From a8b421ebb6671fbb5676bcd851b2a368caed6c8d Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Fri, 9 Jan 2026 09:29:43 -0500 Subject: [PATCH] Issue 17 to resolve build errors with cFS integration --- CMakeLists.txt | 20 ++++++++++++++++ src/allocator.c | 4 ++-- src/backends/packrat.c | 18 +++++++------- src/benchmark.c | 6 ++--- src/cfgrammar.c | 36 ++++++++++++++-------------- src/glue.c | 54 +++++++++++++++++++++--------------------- src/hammer.h | 4 ++-- src/internal.h | 46 +++++++++++++++++------------------ src/test_suite.h | 2 +- 9 files changed, 105 insertions(+), 85 deletions(-) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..8209998a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,20 @@ +project(HAMMER_PARSE C) + +file(GLOB_RECURSE APP_SRC_FILES + "src/*.c" +) + +# Create the app module +add_cfe_app(hammer_parse ${APP_SRC_FILES}) + +# The API to this library (which may be invoked/referenced from other apps) +# is stored in fsw/public_inc. Using "target_include_directories" is the +# preferred method of indicating this (vs. directory-scope "include_directories"). +target_include_directories(hammer_parse PUBLIC + src/backends + src/parsers + src) + + + + diff --git a/src/allocator.c b/src/allocator.c index 7c0862aa..110ada7b 100644 --- a/src/allocator.c +++ b/src/allocator.c @@ -284,12 +284,12 @@ void *h_arena_realloc(HArena *arena, void *ptr, size_t n) { // much data from the old block as there could have been. for (link = arena->head; link; link = link->next) { - if (ptr >= (void *)link->rest && ptr <= (void *)link->rest + link->used) + if (ptr >= (void *)link->rest && ptr <= (void *)((char *)link->rest + link->used)) break; /* found it */ } assert(link != NULL); - ncopy = (void *)link->rest + link->used - ptr; + ncopy = ((char *)link->rest + link->used) - (char *)ptr; if (n < ncopy) ncopy = n; diff --git a/src/backends/packrat.c b/src/backends/packrat.c index 137d0751..d7c7fcfe 100644 --- a/src/backends/packrat.c +++ b/src/backends/packrat.c @@ -19,7 +19,7 @@ static uint32_t cache_key_hash(const void *key); static HParserCacheValue *cached_result(HParseState *state, HParseResult *result) { HParserCacheValue *ret = a_new(HParserCacheValue, 1); ret->value_type = PC_RIGHT; - ret->right = result; + ret->cache_value_union.right = result; ret->input_stream = state->input_stream; return ret; } @@ -28,7 +28,7 @@ static HParserCacheValue *cached_result(HParseState *state, HParseResult *result static HParserCacheValue *cached_lr(HParseState *state, HLeftRec *lr) { HParserCacheValue *ret = a_new(HParserCacheValue, 1); ret->value_type = PC_LEFT; - ret->left = lr; + ret->cache_value_union.left = lr; ret->input_stream = state->input_stream; return ret; } @@ -94,7 +94,7 @@ HParserCacheValue *recall(HParserCacheKey *k, HParseState *state, HHashValue key h_hashtable_put_precomp(state->cache, k, cached, keyhash); } else { cached->value_type = PC_RIGHT; - cached->right = tmp_res; + cached->cache_value_union.right = tmp_res; cached->input_stream = state->input_stream; } } @@ -145,7 +145,7 @@ HParseResult *grow(HParserCacheKey *k, HParseState *state, HRecursionHead *head) HParserCacheValue *old_cached = h_hashtable_get(state->cache, k); if (!old_cached || PC_LEFT == old_cached->value_type) h_platform_errx(1, "impossible match"); - HParseResult *old_res = old_cached->right; + HParseResult *old_res = old_cached->cache_value_union.right; // rewind the input state->input_stream = k->input_pos; @@ -164,7 +164,7 @@ HParseResult *grow(HParserCacheKey *k, HParseState *state, HRecursionHead *head) HParserCacheValue *cached = h_hashtable_get(state->cache, k); if (cached && PC_RIGHT == cached->value_type) { state->input_stream = cached->input_stream; - return cached->right; + return cached->cache_value_union.right; } else { h_platform_errx(1, "impossible match"); } @@ -254,10 +254,10 @@ HParseResult *h_do_parse(const HParser *parser, HParseState *state) { /* it exists! */ state->input_stream = m->input_stream; if (PC_LEFT == m->value_type) { - setupLR(parser, state, m->left); - return m->left->seed; + setupLR(parser, state, m->cache_value_union.left); + return m->cache_value_union.left->seed; } else { - return m->right; + return m->cache_value_union.right; } } } @@ -390,7 +390,7 @@ bool h_packrat_parse_chunk(HSuspendedParser *s, HInputStream *input) { h_platform_errx(1, "input length would overflow"); newlen = cat->length + input->length; cat->input = h_realloc(mm__, (void *)cat->input, newlen); - memcpy((void *)cat->input + cat->length, input->input, input->length); + memcpy((void *)((char *)cat->input + cat->length), input->input, input->length); cat->length = newlen; cat->last_chunk = input->last_chunk; diff --git a/src/benchmark.c b/src/benchmark.c index 95494e50..b520dfb3 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -102,7 +102,7 @@ HBenchmarkResults *h_benchmark__m(HAllocator *mm__, HParser *parser, HParserTest } time_diff = h_platform_stopwatch_ns(&stopwatch); } while (time_diff < 100000000); - ret->results[backend].cases[cur_case].parse_time = (time_diff / count); + ret->results[backend].cases[cur_case].swig_union_2.parse_time = (time_diff / count); ret->results[backend].cases[cur_case].length = tc->length; cur_case++; } @@ -123,8 +123,8 @@ void h_benchmark_report(FILE *stream, HBenchmarkResults *result) { continue; } fprintf(stream, "Case %zd: %zd ns/parse, %zd ns/byte\n", j, - result->results[i].cases[j].parse_time, - result->results[i].cases[j].parse_time / result->results[i].cases[j].length); + result->results[i].cases[j].swig_union_2.parse_time, + result->results[i].cases[j].swig_union_2.parse_time / result->results[i].cases[j].length); } } } diff --git a/src/cfgrammar.c b/src/cfgrammar.c index 4c507a29..bf52bcb1 100644 --- a/src/cfgrammar.c +++ b/src/cfgrammar.c @@ -82,12 +82,12 @@ HCFGrammar *h_cfgrammar_(HAllocator *mm__, HCFChoice *desugared) { // desugared is a terminal. wrap it in a singleton HCF_CHOICE. HCFChoice *nt = h_new(HCFChoice, 1); nt->type = HCF_CHOICE; - nt->seq = h_new(HCFSequence *, 2); - nt->seq[0] = h_new(HCFSequence, 1); - nt->seq[0]->items = h_new(HCFChoice *, 2); - nt->seq[0]->items[0] = desugared; - nt->seq[0]->items[1] = NULL; - nt->seq[1] = NULL; + nt->hcfchoice_union.seq = h_new(HCFSequence *, 2); + nt->hcfchoice_union.seq[0] = h_new(HCFSequence, 1); + nt->hcfchoice_union.seq[0]->items = h_new(HCFChoice *, 2); + nt->hcfchoice_union.seq[0]->items[0] = desugared; + nt->hcfchoice_union.seq[0]->items[1] = NULL; + nt->hcfchoice_union.seq[1] = NULL; nt->pred = NULL; nt->action = NULL; nt->reshape = h_act_first; @@ -131,7 +131,7 @@ static void collect_nts(HCFGrammar *grammar, HCFChoice *symbol) { // each element s of symbol->seq (HCFSequence) represents the RHS of // a production. call self on all symbols (HCFChoice) in s. - for (s = symbol->seq; *s != NULL; s++) { + for (s = symbol->hcfchoice_union.seq; *s != NULL; s++) { for (x = (*s)->items; *x != NULL; x++) { collect_nts(grammar, *x); } @@ -197,7 +197,7 @@ static void collect_geneps(HCFGrammar *g) { // this NT derives epsilon if any one of its productions does. HCFSequence **p; - for (p = symbol->seq; *p != NULL; p++) { + for (p = symbol->hcfchoice_union.seq; *p != NULL; p++) { if (h_derives_epsilon_seq(g, (*p)->items)) { h_hashset_put(g->geneps, symbol); break; @@ -229,7 +229,7 @@ static void remove_productions_with(HCFGrammar *g, const HCFChoice *x) { assert(symbol->type == HCF_CHOICE); HCFSequence **p, **q; - for (p = symbol->seq; *p != NULL;) { + for (p = symbol->hcfchoice_union.seq; *p != NULL;) { if (mentions_symbol((*p)->items, x)) { // remove production p for (q = p; *(q + 1) != NULL; q++) @@ -260,7 +260,7 @@ static void eliminate_dead_rules(HCFGrammar *g) { assert(symbol->type == HCF_CHOICE); // this NT is dead if it has no productions - if (*symbol->seq == NULL) + if (*symbol->hcfchoice_union.seq == NULL) found = true; } } @@ -472,12 +472,12 @@ static const HStringMap *h_first_work(size_t k, HCFGrammar *g, HHashTable **pws, switch (x->type) { case HCF_CHAR: - h_stringmap_put_char(ret, x->chr, INSET); + h_stringmap_put_char(ret, x->hcfchoice_union.chr, INSET); break; case HCF_CHARSET: c = 0; do { - if (charset_isset(x->charset, c)) { + if (charset_isset(x->hcfchoice_union.charset, c)) { h_stringmap_put_char(ret, c, INSET); } } while (c++ < 255); @@ -494,7 +494,7 @@ static const HStringMap *h_first_work(size_t k, HCFGrammar *g, HHashTable **pws, h_hashtable_put(ws, pkx, ret); // return the union of the first sets of all productions - for (p = x->seq; *p; ++p) { + for (p = x->hcfchoice_union.seq; *p; ++p) { const HStringMap *first_rhs = h_first_seq_work(k, g, pws, (*p)->items); assert(ws == *pws); // call above did not change the workset pointer taint |= first_rhs->taint; @@ -723,7 +723,7 @@ static const HStringMap *h_follow_work(size_t k, HCFGrammar *g, HHashTable **pws // iterate over the productions for A HCFSequence **p; - for (p = a->seq; *p; p++) { + for (p = a->hcfchoice_union.seq; *p; p++) { HCFChoice **s = (*p)->items; // production's right-hand side for (; *s; s++) { @@ -918,7 +918,7 @@ static HCFChoice **pprint_string(FILE *f, HCFChoice **x) { if ((*x)->type != HCF_CHAR) { break; } - h_pprint_char(f, (*x)->chr); + h_pprint_char(f, (*x)->hcfchoice_union.chr); } fputc('"', f); return x; @@ -928,14 +928,14 @@ void h_pprint_symbol(FILE *f, const HCFGrammar *g, const HCFChoice *x) { switch (x->type) { case HCF_CHAR: fputc('"', f); - h_pprint_char(f, x->chr); + h_pprint_char(f, x->hcfchoice_union.chr); fputc('"', f); break; case HCF_END: fputc('$', f); break; case HCF_CHARSET: - pprint_charset(f, x->charset); + pprint_charset(f, x->hcfchoice_union.charset); break; default: fputs(nonterminal_name(g, x), f); @@ -985,7 +985,7 @@ static void pprint_ntrules(FILE *f, const HCFGrammar *g, const HCFChoice *nt, in fputc(' ', f); assert(nt->type == HCF_CHOICE); - HCFSequence **p = nt->seq; + HCFSequence **p = nt->hcfchoice_union.seq; if (*p == NULL) { fputs(" -x\n", f); // empty choice, e.g. h_nothing_p() return; diff --git a/src/glue.c b/src/glue.c index 438a5fd6..c3d2c363 100644 --- a/src/glue.c +++ b/src/glue.c @@ -16,37 +16,37 @@ HParsedToken *h_act_index(int i, const HParseResult *p, void *user_data) { if (!tok || tok->token_type != TT_SEQUENCE) return NULL; - const HCountedArray *seq = tok->seq; + const HCountedArray *seq = tok->swig_union.seq; size_t n = seq->used; if (i < 0 || (size_t)i >= n) return NULL; else - return tok->seq->elements[i]; + return tok->swig_union.seq->elements[i]; } HParsedToken *h_act_first(const HParseResult *p, void *user_data) { assert(p->ast); assert(p->ast->token_type == TT_SEQUENCE); - assert(p->ast->seq->used > 0); + assert(p->ast->swig_union.seq->used > 0); - return p->ast->seq->elements[0]; + return p->ast->swig_union.seq->elements[0]; } HParsedToken *h_act_second(const HParseResult *p, void *user_data) { assert(p->ast); assert(p->ast->token_type == TT_SEQUENCE); - assert(p->ast->seq->used > 0); + assert(p->ast->swig_union.seq->used > 0); - return p->ast->seq->elements[1]; + return p->ast->swig_union.seq->elements[1]; } HParsedToken *h_act_last(const HParseResult *p, void *user_data) { assert(p->ast); assert(p->ast->token_type == TT_SEQUENCE); - assert(p->ast->seq->used > 0); + assert(p->ast->swig_union.seq->used > 0); - return p->ast->seq->elements[p->ast->seq->used - 1]; + return p->ast->swig_union.seq->elements[p->ast->swig_union.seq->used - 1]; } static void act_flatten_(HCountedArray *seq, const HParsedToken *tok) { @@ -54,8 +54,8 @@ static void act_flatten_(HCountedArray *seq, const HParsedToken *tok) { return; } else if (tok->token_type == TT_SEQUENCE) { size_t i; - for (i = 0; i < tok->seq->used; i++) - act_flatten_(seq, tok->seq->elements[i]); + for (i = 0; i < tok->swig_union.seq->used; i++) + act_flatten_(seq, tok->swig_union.seq->elements[i]); } else { h_carray_append(seq, (HParsedToken *)tok); } @@ -63,7 +63,7 @@ static void act_flatten_(HCountedArray *seq, const HParsedToken *tok) { HParsedToken *h_act_flatten(const HParseResult *p, void *user_data) { HParsedToken *res = h_make_seq(p->arena); - act_flatten_(res->seq, p->ast); + act_flatten_(res->swig_union.seq, p->ast); return res; } @@ -79,50 +79,50 @@ HParsedToken *h_make_(HArena *arena, HTokenType type) { HParsedToken *h_make(HArena *arena, HTokenType type, void *value) { assert(type >= TT_USER); HParsedToken *ret = h_make_(arena, type); - ret->user = value; + ret->swig_union.user = value; return ret; } HParsedToken *h_make_seq(HArena *arena) { HParsedToken *ret = h_make_(arena, TT_SEQUENCE); - ret->seq = h_carray_new(arena); + ret->swig_union.seq = h_carray_new(arena); return ret; } HParsedToken *h_make_seqn(HArena *arena, size_t n) { HParsedToken *ret = h_make_(arena, TT_SEQUENCE); - ret->seq = h_carray_new_sized(arena, n); + ret->swig_union.seq = h_carray_new_sized(arena, n); return ret; } HParsedToken *h_make_bytes(HArena *arena, const uint8_t *array, size_t len) { HParsedToken *ret = h_make_(arena, TT_BYTES); - ret->bytes.len = len; - ret->bytes.token = array; + ret->swig_union.bytes.len = len; + ret->swig_union.bytes.token = array; return ret; } HParsedToken *h_make_sint(HArena *arena, int64_t val) { HParsedToken *ret = h_make_(arena, TT_SINT); - ret->sint = val; + ret->swig_union.sint = val; return ret; } HParsedToken *h_make_uint(HArena *arena, uint64_t val) { HParsedToken *ret = h_make_(arena, TT_UINT); - ret->uint = val; + ret->swig_union.uint = val; return ret; } HParsedToken *h_make_double(HArena *arena, double val) { HParsedToken *ret = h_make_(arena, TT_DOUBLE); - ret->dbl = val; + ret->swig_union.dbl = val; return ret; } HParsedToken *h_make_float(HArena *arena, float val) { HParsedToken *ret = h_make_(arena, TT_FLOAT); - ret->flt = val; + ret->swig_union.flt = val; return ret; } @@ -135,19 +135,19 @@ HParsedToken *h_carray_index(const HCountedArray *a, size_t i) { size_t h_seq_len(const HParsedToken *p) { assert(p != NULL); assert(p->token_type == TT_SEQUENCE); - return p->seq->used; + return p->swig_union.seq->used; } HParsedToken **h_seq_elements(const HParsedToken *p) { assert(p != NULL); assert(p->token_type == TT_SEQUENCE); - return p->seq->elements; + return p->swig_union.seq->elements; } HParsedToken *h_seq_index(const HParsedToken *p, size_t i) { assert(p != NULL); assert(p->token_type == TT_SEQUENCE); - return h_carray_index(p->seq, i); + return h_carray_index(p->swig_union.seq, i); } HParsedToken *h_seq_index_path(const HParsedToken *p, size_t i, ...) { @@ -174,7 +174,7 @@ void h_seq_snoc(HParsedToken *xs, const HParsedToken *x) { assert(xs != NULL); assert(xs->token_type == TT_SEQUENCE); - h_carray_append(xs->seq, (HParsedToken *)x); + h_carray_append(xs->swig_union.seq, (HParsedToken *)x); } void h_seq_append(HParsedToken *xs, const HParsedToken *ys) { @@ -183,8 +183,8 @@ void h_seq_append(HParsedToken *xs, const HParsedToken *ys) { assert(ys != NULL); assert(ys->token_type == TT_SEQUENCE); - for (size_t i = 0; i < ys->seq->used; i++) - h_carray_append(xs->seq, ys->seq->elements[i]); + for (size_t i = 0; i < ys->swig_union.seq->used; i++) + h_carray_append(xs->swig_union.seq, ys->swig_union.seq->elements[i]); } // Flatten nested sequences. Always returns a sequence. @@ -196,7 +196,7 @@ const HParsedToken *h_seq_flatten(HArena *arena, const HParsedToken *p) { switch (p->token_type) { case TT_SEQUENCE: // Flatten and append all. - for (size_t i = 0; i < p->seq->used; i++) { + for (size_t i = 0; i < p->swig_union.seq->used; i++) { h_seq_append(ret, h_seq_flatten(arena, h_seq_index(p, i))); } break; diff --git a/src/hammer.h b/src/hammer.h index 62e7d7dc..5afadf22 100644 --- a/src/hammer.h +++ b/src/hammer.h @@ -146,7 +146,7 @@ typedef struct HParsedToken_ { float flt; HCountedArray *seq; /**< a sequence of HParsedToken's */ void *user; - }; + }swig_union; #else HTokenData token_data; #endif @@ -290,7 +290,7 @@ typedef struct HCaseResult_ { const char *actual_results; /**< on failure, filled in with the results of h_write_result_unamb */ size_t parse_time; /**< on success, filled in with time for a single parse, in nsec */ - }; + }swig_union_2; #else HResultTiming timestamp; #endif diff --git a/src/internal.h b/src/internal.h index 3afc4161..18c11120 100644 --- a/src/internal.h +++ b/src/internal.h @@ -230,7 +230,7 @@ struct HSuspendedParser_ { uint8_t endianness; }; -typedef struct HParserBackendVTable_ { +typedef struct { int (*compile)(HAllocator *mm__, HParser *parser, const void *params); HParseResult *(*parse)(HAllocator *mm__, const HParser *parser, HInputStream *stream); void (*free)(HParser *parser); @@ -268,7 +268,7 @@ typedef struct HParserBackendVTable_ { /* extract params from the input string */ int (*extract_params)(HParserBackendWithParams *be_with_params, backend_with_params_t *be_with_params_t); -} HParserBackendVTable; +} HParserBackendVTable_; /* The (location, parser) tuple used to key the cache. */ @@ -321,7 +321,7 @@ typedef struct HParserCacheValue_t { union { HLeftRec *left; HParseResult *right; - }; + }cache_value_union; HInputStream input_stream; } HParserCacheValue; @@ -454,7 +454,7 @@ void *h_symbol_get(HParseState *state, const char *key); void *h_symbol_free(HParseState *state, const char *key); typedef struct HCFSequence_ HCFSequence; -typedef struct HCFStack_ HCFStack; +// typedef struct HCFStack_ HCFStack; struct HCFChoice_ { enum HCFChoiceType { HCF_END, HCF_CHOICE, HCF_CHARSET, HCF_CHAR } type; @@ -462,7 +462,7 @@ struct HCFChoice_ { HCharset charset; HCFSequence **seq; uint8_t chr; - }; + }hcfchoice_union; HAction reshape; // take CFG parse tree to HParsedToken of expected form. // to execute before action and pred are applied. HAction action; @@ -514,20 +514,20 @@ static inline void h_cfstack_add_to_seq(HAllocator *mm__, HCFStack *stk__, HCFCh static inline void h_cfstack_add_to_seq(HAllocator *mm__, HCFStack *stk__, HCFChoice *item) { HCFChoice *cur_top = stk__->stack[stk__->count - 1]; assert(cur_top->type == HCF_CHOICE); - assert(cur_top->seq[0] != NULL); // There must be at least one sequence... + assert(cur_top->hcfchoice_union.seq[0] != NULL); // There must be at least one sequence... stk__->last_completed = item; for (int i = 0;; i++) { - if (cur_top->seq[i + 1] == NULL) { - assert(cur_top->seq[i]->items != NULL); + if (cur_top->hcfchoice_union.seq[i + 1] == NULL) { + assert(cur_top->hcfchoice_union.seq[i]->items != NULL); for (int j = 0;; j++) { - if (cur_top->seq[i]->items[j] == NULL) { - cur_top->seq[i]->items = - mm__->realloc(mm__, cur_top->seq[i]->items, sizeof(HCFChoice *) * (j + 2)); - if (!cur_top->seq[i]->items) { + if (cur_top->hcfchoice_union.seq[i]->items[j] == NULL) { + cur_top->hcfchoice_union.seq[i]->items = + mm__->realloc(mm__, cur_top->hcfchoice_union.seq[i]->items, sizeof(HCFChoice *) * (j + 2)); + if (!cur_top->hcfchoice_union.seq[i]->items) { stk__->error = 1; } - cur_top->seq[i]->items[j] = item; - cur_top->seq[i]->items[j + 1] = NULL; + cur_top->hcfchoice_union.seq[i]->items[j] = item; + cur_top->hcfchoice_union.seq[i]->items[j + 1] = NULL; assert(!stk__->error); return; } @@ -555,14 +555,14 @@ static inline HCFChoice *h_cfstack_new_choice_raw(HAllocator *mm__, HCFStack *st static inline void h_cfstack_add_charset(HAllocator *mm__, HCFStack *stk__, HCharset charset) { HCFChoice *ni = h_cfstack_new_choice_raw(mm__, stk__); ni->type = HCF_CHARSET; - ni->charset = charset; + ni->hcfchoice_union.charset = charset; stk__->last_completed = ni; } static inline void h_cfstack_add_char(HAllocator *mm__, HCFStack *stk__, uint8_t chr) { HCFChoice *ni = h_cfstack_new_choice_raw(mm__, stk__); ni->type = HCF_CHAR; - ni->chr = chr; + ni->hcfchoice_union.chr = chr; stk__->last_completed = ni; } @@ -575,8 +575,8 @@ static inline void h_cfstack_add_end(HAllocator *mm__, HCFStack *stk__) { static inline void h_cfstack_begin_choice(HAllocator *mm__, HCFStack *stk__) { HCFChoice *choice = h_cfstack_new_choice_raw(mm__, stk__); choice->type = HCF_CHOICE; - choice->seq = h_new(HCFSequence *, 1); - choice->seq[0] = NULL; + choice->hcfchoice_union.seq = h_new(HCFSequence *, 1); + choice->hcfchoice_union.seq[0] = NULL; if (stk__->count + 1 > stk__->cap) { assert(stk__->cap > 0); @@ -593,14 +593,14 @@ static inline void h_cfstack_begin_choice(HAllocator *mm__, HCFStack *stk__) { static inline void h_cfstack_begin_seq(HAllocator *mm__, HCFStack *stk__) { HCFChoice *top = stk__->stack[stk__->count - 1]; for (int i = 0;; i++) { - if (top->seq[i] == NULL) { - top->seq = mm__->realloc(mm__, top->seq, sizeof(HCFSequence *) * (i + 2)); - if (!top->seq) { + if (top->hcfchoice_union.seq[i] == NULL) { + top->hcfchoice_union.seq = mm__->realloc(mm__, top->hcfchoice_union.seq, sizeof(HCFSequence *) * (i + 2)); + if (!top->hcfchoice_union.seq) { stk__->error = 1; return; } - HCFSequence *seq = top->seq[i] = h_new(HCFSequence, 1); - top->seq[i + 1] = NULL; + HCFSequence *seq = top->hcfchoice_union.seq[i] = h_new(HCFSequence, 1); + top->hcfchoice_union.seq[i + 1] = NULL; seq->items = h_new(HCFChoice *, 1); seq->items[0] = NULL; return; diff --git a/src/test_suite.h b/src/test_suite.h index 1fcf22b6..6b6e6352 100644 --- a/src/test_suite.h +++ b/src/test_suite.h @@ -2,6 +2,6 @@ #ifndef HAMMER_TEST_SUITE__H_FWD #define HAMMER_TEST_SUITE__H_FWD -#include "tests/test_suite.h" +//#include "tests/test_suite.h" #endif