Commit graph

823 commits

Author SHA1 Message Date
Sven M. Hallberg
d28f182c4f clear arena exception handler when exiting llk_parse_chunk_ 2015-12-04 13:28:26 +01:00
Sven M. Hallberg
9602caf64f test out-of-memory handling with a mock allocator 2015-12-02 14:10:12 +01:00
Sven M. Hallberg
7b13a82851 add __m variants to some check macros 2015-12-02 13:28:24 +01:00
Sven M. Hallberg
db4fd66eaf try it with a smaller alloc 2015-12-01 18:12:21 +01:00
Sven M. Hallberg
e89d9f9134 delete results properly in parser test macros 2015-12-01 17:51:45 +01:00
Sven M. Hallberg
22b5611cdf add oom handling to iterative LR engine 2015-12-01 17:10:47 +01:00
Sven M. Hallberg
384a7b9390 reset arena jmp_bufs at end of h_llk_parse_chunk 2015-12-01 17:07:04 +01:00
Sven M. Hallberg
3ce4f61cf9 add test for out-of-memory handling 2015-12-01 16:56:08 +01:00
Sven M. Hallberg
2309bd6da9 out-of-memory support for iterative LL(k) 2015-12-01 16:48:01 +01:00
Sven M. Hallberg
d5f3e13309 out-of-memory handling in LL(k), LR, and GLR backends 2015-11-30 18:07:33 +01:00
Sven M. Hallberg
5996477a5e out-of-memory handling in packrat backend 2015-11-30 18:01:23 +01:00
Sven M. Hallberg
3fc56a0dc3 add h_alloc() which calls errx() on failure and use it for all basic allocation
Rationale: "Basic allocation" refers to things outside of parsing proper,
mostly initialization. If such allocations fail, the system is globally
emory-starved from which it will likely not recover by returning failure.
In this case, terminating the process is in fact the most robust strategy as
it may mean the difference between a permanent hang and a temporary crash.
2015-11-30 16:37:00 +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
5b3cb46c96 avoid GCC warning about potential longjmp clobbers 2015-11-14 23:26:04 +01:00
Sven M. Hallberg
6aa7db833e Merge remote-tracking branch 'upstream/master' into fix-alloc-failures 2015-11-14 23:24:06 +01:00
Sven M. Hallberg
9e37fbe513 fix LIBPATH order for building test_suite 2015-11-14 18:44:53 +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
e8b1962005 out of memory handling and leak fixes in regex backend 2015-10-30 21:26:08 +01:00
Sven M. Hallberg
9ef70f2f2d never return if h_arena_malloc fails, call errx() or longjmp() 2015-10-30 21:23:45 +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
Sven M. Hallberg
d2ade1f5b4 call h_arena_free when resizing in h_carray_append 2015-10-29 13:11:32 +01:00
Meredith L. Patterson
99ca500d2b Don't try to recall() primitive results 2015-10-04 15:32:32 +02:00
Meredith L. Patterson
4fed9327a4 now both clang and gcc have coverage without any dumb hacks 2015-10-04 02:53:54 +02:00
Meredith L. Patterson
755b771ee2 more thorough comments 2015-10-03 22:26:40 +02:00
Meredith L. Patterson
969d768205 Don't cache dummy results for primitive parsers. 2015-10-03 17:54:11 +02:00
Meredith L. Patterson
578ac05154 add platform.h to distribution headers 2015-10-03 14:32:54 +02:00
Meredith L. Patterson
fea3a69d4b Merge pull request #149 from pesco/fix-charset_bits
Allocate 256 bits, not 256 bytes, for a charset
2015-09-26 17:45:41 +02:00
Sven M. Hallberg
f3011f8263 allocate 256 bits, not 256 bytes, for a charset 2015-09-25 16:48:32 +02:00
Sven M. Hallberg
c770fbab1b add regression test for charset over-allocation 2015-09-25 16:47:07 +02:00
Sven M. Hallberg
df179eba43 fix conflict resolution with charset productions 2015-09-25 01:28:52 +02:00
Sven M. Hallberg
520884739c cosmetic changes 2015-09-24 16:33:13 +02:00
Sven M. Hallberg
65dbcf56fc make sure LALR doesn't confuse terminal symbols in the enhanced grammar 2015-09-24 16:29:56 +02:00
Sven M. Hallberg
09db791089 Merge branch 'fix-lalr_bugs' into iterative 2015-09-17 16:40:13 +02:00
Sven M. Hallberg
9edef88bbc fix a formatting error in h_pprint_stringmap 2015-09-17 16:39:22 +02:00
Sven M. Hallberg
a4179fca02 note why token position is not set correctly by LL(k) right now 2015-09-17 00:33:14 +02:00
Sven M. Hallberg
6094deda96 report correct token position from LR backends 2015-09-17 00:19:22 +02:00
Sven M. Hallberg
caf00006f3 add iterative API to LALR backend 2015-09-16 23:43:30 +02:00
Sven M. Hallberg
ff55937e00 split out h_pprint_lr_info for debugging purposes 2015-09-16 23:42:18 +02:00
Sven M. Hallberg
42d35fb883 move chunk position into HInputStream and simplify internal chunk API 2015-09-16 23:25:36 +02:00
Sven M. Hallberg
e385e0e5de Merge branch 'fix-lalr_bugs' into iterative 2015-09-16 22:21:53 +02:00
Sven M. Hallberg
cdd1289936 fix printing of "negative" byte values 2015-09-16 22:17:31 +02:00
Sven M. Hallberg
7319c48e59 fix reshape for h_many 2015-09-16 20:06:24 +02:00
Sven M. Hallberg
db95cda229 add regression test for wrong nesting of h_many/h_sequence results with CFG backends 2015-09-16 20:06:06 +02:00
Sven M. Hallberg
3eb2a2023d add a comment regarding another CHARSET case 2015-09-16 18:51:16 +02:00
Sven M. Hallberg
422f88c4aa handle charset left-hand-side in LALR compile 2015-09-16 18:43:52 +02:00
Sven M. Hallberg
31c460780f add regression test for unhandled charset left-hand-side case in LALR compile 2015-09-16 18:23:32 +02:00
Sven M. Hallberg
5b4550ab0f make MARK a constant that points to itself 2015-09-08 16:19:45 +02:00
Sven M. Hallberg
fb5122ec88 fix result bit_length for LR backends 2015-09-07 15:37:26 +02:00
Sven M. Hallberg
4f455aa97e fix result bit_length for LL(k) 2015-09-07 15:33:50 +02:00