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
This commit is contained in:
Sven M. Hallberg 2013-05-11 19:04:59 +02:00
commit c64a4e435e
46 changed files with 1289 additions and 263 deletions

View file

@ -2,15 +2,16 @@
#define HAMMER_PARSE_INTERNAL__H
#include "../hammer.h"
#include "../internal.h"
#include "../backends/regex.h"
#define a_new_(arena, typ, count) ((typ*)h_arena_malloc((arena), sizeof(typ)*(count)))
#define a_new(typ, count) a_new_(state->arena, typ, count)
// we can create a_new0 if necessary. It would allocate some memory and immediately zero it out.
static inline HParseResult* make_result(HParseState *state, HParsedToken *tok) {
HParseResult *ret = a_new(HParseResult, 1);
static inline HParseResult* make_result(HArena *arena, HParsedToken *tok) {
HParseResult *ret = h_arena_malloc(arena, sizeof(HParseResult));
ret->ast = tok;
ret->arena = state->arena;
ret->arena = arena;
return ret;
}
@ -23,9 +24,6 @@ static inline size_t token_length(HParseResult *pr) {
}
}
static inline bool h_true(void *env) { return true; }
static inline bool h_false(void *env) { return false; }
/* Epsilon rules happen during desugaring. This handles them. */
static inline HCFChoice* desugar_epsilon(HAllocator *mm__, void *env) {
static HCFChoice *res_seq_l[] = {NULL};