Nicolas Léveillé
62d793b939
Remove warning about parser signature being wrong
2015-12-20 11:51:01 +01:00
Nicolas Léveillé
c95b2987b1
Support variable array length instantiation on MSVC
...
As MSVC doesn't implement C99, variable-length arrays
are not supported. We use _alloca instead.
2015-12-20 11:50:58 +01:00
Sven M. Hallberg
50a73f6ab2
Merge remote-tracking branch 'upstream/master' into fix-wrong_bit_length
2015-12-07 11:05:05 +01:00
Sven M. Hallberg
ca1d8df06c
don't allocate a new arena in h_bind, use the existing one
...
Rationale: If memory allocation fails in the inner parse and we
longjump up the stack, the temporary arena will be missed and leak.
NB: This change means that any allocations done by the continuation
(in the form of new parsers, probably) will persist for the
lifetime of the parse result. Beware of wasting too much memory
this way! The bind continuation should generally keep dynamic
allocations to a minimum.
2015-11-30 14:19:40 +01:00
Sven M. Hallberg
25acd90a48
allow h_sequence(NULL) as parser for the empty sequence
2015-11-01 17:49:53 +01:00
Sven M. Hallberg
d5e79aa4cb
fail an assert on h_sequence(NULL) instead of segfaulting later
2015-10-29 22:03:05 +01:00
Sven M. Hallberg
3765fd64e1
don't pre-allocate all space when parsing an h_length_value
2015-10-29 13:12:16 +01:00
Meredith L. Patterson
969d768205
Don't cache dummy results for primitive parsers.
2015-10-03 17:54:11 +02:00
Sven M. Hallberg
d70e720073
Merge remote-tracking branch 'upstream/master' into fix-wrong_bit_length
2015-09-24 13:52:30 +02:00
Sven M. Hallberg
7319c48e59
fix reshape for h_many
2015-09-16 20:06:24 +02:00
Sven M. Hallberg
57b3495d5e
calculate result bit_length of h_bind and h_left and friends properly
2015-08-31 17:28:01 +02:00
Nicolas Léveillé
0c35525e30
Convert usages of errx to h_platform_errx
...
This BSD call will have to be implemented on windows. Right now
we have a stub that just exits the process.
2015-08-09 22:46:45 +02:00
Sven M. Hallberg
aa2dc7bcf5
put the message into the assert in aa_realloc
2015-03-04 14:54:42 +01:00
Sven M. Hallberg
be80fdedfc
make arena-allocator implementation functions static
2015-03-04 14:52:28 +01:00
Sven M. Hallberg
1ce0ef9b8a
pass a temporary arena allocator to the continuation in h_bind
2015-02-23 14:10:29 +01:00
Sven M. Hallberg
7ba5931095
Merge branch 'master' of git://github.com/UpstandingHackers/hammer into h_bind
2015-01-30 20:48:49 +01:00
Sven M. Hallberg
78266af453
allow h_bind's function argument to return NULL as a shortcut for h_nothing_p()
2015-01-23 22:06:43 +01:00
Sven M. Hallberg
42d51ed479
add monadic bind combinator h_bind
2015-01-23 22:00:59 +01:00
TQ Hirsch
af73181cf4
Fix #118
...
NEWS:
* Switching endianness mid-byte no longer potentially re-reads bytes.
* bit_offset now consistently refers to the number of bits already
read.
* HParsedTokens now have a bit_length field; this is a size_t. This
may be removed for memory reasons.
The bit writer has not yet been updated to match; the result of
switching bit writer endianness in the middle of a byte remains
undefined.
2015-01-04 04:08:01 +01:00
Sven M. Hallberg
41dca83631
add h_permutation
2014-06-18 21:54:52 +02:00
Meredith L. Patterson
eb6c74cf89
h_put_value and h_get_value done.
2014-05-12 09:52:35 +02:00
TQ Hirsch
5679939a2c
Merge pull request #104 from abiggerhammer/master
...
change pointer type to uintptr_t for portability
2014-05-11 14:56:31 -07:00
Meredith L. Patterson
fcd729ef60
change pointer type to uintptr_t for portability
2014-05-11 23:41:54 +02:00
Sven M. Hallberg
5f920b29f8
add h_with_endianness()
2014-05-07 19:24:26 +02:00
Meredith L. Patterson
27f08df1d3
fix infinite loop in isValidCF with indirect
2014-04-20 21:40:09 +02:00
TQ Hirsch
cc4ded8914
Ported to OpenBSD.
2014-04-13 22:30:48 +00:00
TQ Hirsch
849178d60b
Ported to NetBSD (2/2): Add casts for character class detection
...
NetBSD's character class test macros are defined such that they produce
a compiler warning when given a char argument. Adding a cast to the call
fixes this.
2014-04-13 14:36:38 -07:00
Meredith L. Patterson
ef235136d9
Merge branch 'python-bindings' of https://github.com/abiggerhammer/hammer into python-bindings
...
Conflicts:
src/bindings/python/SConscript
src/bindings/python/hammer_tests.py
src/bindings/swig/hammer.i
src/hammer.h
src/parsers/choice.c
src/parsers/sequence.c
2013-11-26 11:35:55 -08:00
Dan Hirsch
9d43244c2e
Working python bindings
2013-11-23 13:33:23 -06:00
Dan Hirsch
de6f6115a8
We declared some functions that were never implemented. Implement them.
2013-11-23 13:33:23 -06:00
Dan Hirsch
69e84bcbb0
Added a void* user_data pointer to HPredicate
2013-11-23 13:01:55 -06:00
Dan Hirsch
e487d5435c
Added a void* user_data pointer to HAction
2013-11-23 12:53:11 -06:00
Joe Rozner
bb02aa18e7
Add warning message
...
Specify warning for internal only headers that are now installed for use
by extensions.
2013-11-21 22:09:25 -08:00
Meredith L. Patterson
b4e28ac021
Fixed a potential segfault; hand-initialized HParsers in h_choice and
...
h_sequence need PB_MIN set.
Conflicts:
src/bindings/python/SConscript
src/bindings/python/hammer_tests.py
2013-11-19 21:58:24 -06:00
Meredith L. Patterson
10c8b0bd22
fixed the segfault! hand-initialized HParser needed PB_MIN set.
2013-11-19 19:00:58 -06:00
Meredith L. Patterson
c369526a4c
Merge branch 'master' of https://github.com/UpstandingHackers/hammer into swig
2013-11-16 05:30:05 +01:00
Peter Johnson
c8fc061ea6
Ditch longs and long longs in favor of stdint.h types, which has cascading
...
effects throughout, including use of inttypes.h/PRI[ud]64 because printf() is
still stuck in a long world, conversion of %lu to %zu for printing values of
type size_t, and changing/renaming the g_check_cmp* family of functions.
2013-11-15 00:12:57 -05:00
Dan Hirsch
8928c04456
Working python bindings
2013-11-07 22:34:27 -05:00
Dan Hirsch
78b7904c5a
We declared some functions that were never implemented. Implement them.
2013-11-01 18:00:50 -04:00
Dan Hirsch
aed1de5ce5
Applied a bugfix from my local branch
2013-06-24 21:46:23 +02:00
Sven M. Hallberg
7b04ab8d9d
pre-allocate h_desugar's result to squelch recursive calls
2013-06-14 12:27:35 +02:00
Meredith L. Patterson
8618f9cb62
remove useless desugar_unimplemented; revert incorrect changes to test_llk()
2013-05-24 20:10:21 -07:00
Dan Hirsch
ec404ca8fe
Refactored all of the desugaring code to no longer depend on memory being initialized to 0. Everything is about 12% faster now.
2013-05-25 03:35:42 +02:00
Dan Hirsch
d71215d494
All tests pass; lots of stuff is no longer const
2013-05-24 15:07:47 +02:00
Dan Hirsch
b9a33f2c98
More testcases work
2013-05-24 12:22:15 +02:00
Dan Hirsch
de38f7bce8
Got more regex tests passing
2013-05-24 02:50:05 +02:00
Dan Hirsch
0600440b7c
Got a lot of regex test cases working
2013-05-23 23:27:07 +02:00
Meredith L. Patterson
f37a13ef41
Fixed the 'unknown HCF_CHOICE' problem with indirect; test_leftrec is not an LL(k) test
2013-05-23 03:38:22 -07:00
Meredith L. Patterson
1c7e9947a4
merging in aegis' JNI bindings
2013-05-23 00:58:27 -07:00
Sven M. Hallberg
1afef6c3d2
reshape for h_attr_bool
2013-05-20 16:59:38 +02:00