Commit graph

87 commits

Author SHA1 Message Date
Steven Dee
2b6b300f91 Custom printers for user token types
I did this in a hurry, but it appears to work locally. I tested it with
a couple boring custom token type printers.
2016-08-12 15:30:30 -04: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
Meredith L. Patterson
969d768205 Don't cache dummy results for primitive parsers. 2015-10-03 17:54:11 +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
42d35fb883 move chunk position into HInputStream and simplify internal chunk API 2015-09-16 23:25:36 +02:00
Sven M. Hallberg
d4f933b2d3 move last_chunk flag into HInputStream 2015-09-04 12:55:37 +02:00
Sven M. Hallberg
28fa93d4cc make overrun flag a bool to match its usage 2015-09-04 12:54:00 +02:00
Sven M. Hallberg
f1d6d0bc5e split h_llk_parse into start/chunk/finish internally 2015-09-03 19:15:57 +02:00
Sven M. Hallberg
2845a9391e add API and backend hooks for iterative (chunked) parsing 2015-09-03 15:03: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
Meredith L. Patterson
759fbe77e5 C++ bindings needed to use system_allocator's free() too 2015-08-02 22:03:30 +02:00
Meredith L. Patterson
1ffd8d9276 Fix undefined behaviour around system_allocator, issue #133. 2015-08-02 21:32:47 +02: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
Meredith L. Patterson
eb6c74cf89 h_put_value and h_get_value done. 2014-05-12 09:52:35 +02:00
Sven M. Hallberg
fbdd2b7613 pull saved position into HParserCacheValue and fix segfault in grow() 2014-03-17 23:46:14 +01:00
Meredith L. Patterson
1d6a6d90ab C++ bindings now work! 2014-01-16 19:49:28 +01: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
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
b0f567c090 Added new build system 2013-07-10 21:32:05 +02:00
Dan Hirsch
ce74cf7939 Refactored regex backend to use a sparse thread list 2013-06-24 21:25:22 +02:00
Sven M. Hallberg
b1e8e29774 add engine forking 2013-06-20 11:05:57 +02:00
Sven M. Hallberg
55c9a3d9c5 add stub GLR backend with h_glr_parse() a copy of h_lr_parse() 2013-06-19 17:20:53 +02:00
Sven M. Hallberg
e7a388d1c7 move djbhash into general availability as h_djbhash 2013-06-06 13:02:29 +02:00
Sven M. Hallberg
636f741d88 add h_hashset_equal (set comparison) 2013-06-05 15:12:48 +02:00
Sven M. Hallberg
976205f9da hook up LALR backend stub 2013-06-04 22:14:06 +02:00
Meredith L. Patterson
02d68f6d18 Merge branch 'master' of https://github.com/thequux/hammer
Conflicts:
	src/backends/llk.c
2013-05-24 20:00:41 -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
Sven M. Hallberg
3047fd223b let h_hashtable_merge's combine function decide what to do on NULL dst values 2013-05-24 22:29:33 +02:00
Meredith L. Patterson
1c7e9947a4 merging in aegis' JNI bindings 2013-05-23 00:58:27 -07:00
Sven M. Hallberg
e4d0b636dd add h_hashtable_merge function 2013-05-22 21:57:46 +02:00
Sven M. Hallberg
623fd6b030 add "reshape" action to HCFChoice 2013-05-14 11:54:43 +02:00
Sven M. Hallberg
1c8764e1da minor cosmetics 2013-05-12 00:20:27 +02:00
Sven M. Hallberg
c64a4e435e Merge remote-tracking branch 'tq/master' into LL such that it compiles
Conflicts:
	src/Makefile
	src/backends/packrat.c
	src/compile.c
	src/hammer.h
	src/internal.h
	src/parsers/action.c
	src/parsers/and.c
	src/parsers/attr_bool.c
	src/parsers/bits.c
	src/parsers/butnot.c
	src/parsers/ch.c
	src/parsers/charset.c
	src/parsers/choice.c
	src/parsers/difference.c
	src/parsers/end.c
	src/parsers/epsilon.c
	src/parsers/ignore.c
	src/parsers/ignoreseq.c
	src/parsers/indirect.c
	src/parsers/int_range.c
	src/parsers/many.c
	src/parsers/not.c
	src/parsers/nothing.c
	src/parsers/optional.c
	src/parsers/sequence.c
	src/parsers/token.c
	src/parsers/unimplemented.c
	src/parsers/whitespace.c
	src/parsers/xor.c
2013-05-11 19:09:22 +02:00
Sven M. Hallberg
b63980f137 add LL(1) driver 2013-05-11 15:14:10 +02:00
Sven M. Hallberg
65ee3593bd compile function can't take a const parser 2013-05-08 18:01:55 +02:00
Sven M. Hallberg
1631e9c08f constify read-only hashtable methods 2013-05-08 17:01:23 +02:00
Sven M. Hallberg
66b0ed7bf1 move h_eq_ptr and h_hash_ptr into datastructures.c / internal.h 2013-05-08 15:54:29 +02:00
Sven M. Hallberg
209bd43f10 add h_hashtable_update and h_hashset_put_all 2013-04-30 17:45:33 +02:00
Sven M. Hallberg
109d60fca3 make hashtable keys const 2013-04-30 17:44:54 +02:00
Dan Hirsch
13088c9d7a Finshed up the regex backend 2013-04-26 20:36:54 -07:00
Sven M. Hallberg
88091b602f wrap all allocs of HParser in helper h_new_parser 2013-04-27 04:17:47 +02:00
Sven M. Hallberg
fd10e83bfe add alias(es) for HHashSet from HHashtable 2013-04-27 00:55:55 +02:00
Meredith L. Patterson
07d35c72ff Most of RVM desugaring done in first draft, for TQ to check. 2013-04-22 18:06:17 -07:00
Sven M. Hallberg
1325ebcdd1 add LL backend stub 2013-04-17 15:10:33 +02:00
Rob Zinkov
4e11c90664 Adding desugar 2013-03-17 13:25:02 -07:00
Dan Hirsch
ffd050e603 Added generic form of desugaring functions 2013-03-16 14:30:15 -07:00
Dan Hirsch
c19d7bb66e Regex VM finished but untested. 2013-03-09 21:42:49 -08:00
Meredith L. Patterson
ab89b0fd4d desugaring done for many and attr_bool 2013-02-20 20:43:16 -05:00
Meredith L. Patterson
156be7a559 Still doesn't build, but desugaring is farther along 2013-02-02 19:31:18 -05:00