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

@ -52,6 +52,28 @@
} \
} while(0)
#define g_check_regular(lang) do { \
if (!lang->isValidRegular(lang->env)) { \
g_test_message("Language is not regular"); \
g_test_fail(); \
} \
} while(0)
#define g_check_contextfree(lang) do { \
if (!lang->isValidCF(lang->env)) { \
g_test_message("Language is not context-free"); \
g_test_fail(); \
} \
} while(0)
#define g_check_compilable(lang, backend, params) do { \
if (!h_compile(lang, backend, params)) { \
g_test_message("Language is not %s(%s)", #backend, params); \
g_test_fail(); \
} \
} while(0)
// TODO: replace uses of this with g_check_parse_failed
#define g_check_failed(res) do { \
const HParseResult *result = (res); \
@ -77,14 +99,14 @@
} else { \
char* cres = h_write_result_unamb(res->ast); \
g_check_string(cres, ==, result); \
g_free(cres); \
system_allocator.free(&system_allocator, cres); \
HArenaStats stats; \
h_allocator_stats(res->arena, &stats); \
g_test_message("Parse used %zd bytes, wasted %zd bytes. " \
"Inefficiency: %5f%%", \
stats.used, stats.wasted, \
stats.wasted * 100. / (stats.used+stats.wasted)); \
h_delete_arena(res->arena); \
h_delete_arena(res->arena); \
} \
} while(0)
@ -149,4 +171,5 @@
#define g_check_cmpdouble(n1, op, n2) g_check_inttype("%g", double, n1, op, n2)
#endif // #ifndef HAMMER_TEST_SUITE__H