diff --git a/src/backends/llk.c b/src/backends/llk.c index 95289975ef9f539c2e2a5a6d030fa53f5cb68c1b..b09599854dd4ba853e67e830b04c760d1653f59e 100644 --- a/src/backends/llk.c +++ b/src/backends/llk.c @@ -276,8 +276,7 @@ typedef struct { // execute on their corresponding result. // also on the stack below the mark, we store the previously accumulated // value for the surrounding production. -static int dummy; -static void *MARK = &dummy; // stack frame delimiter +static void *MARK = (void *)-1; // stack frame delimiter static HLLkState *llk_parse_start_(HAllocator* mm__, const HParser* parser) { @@ -329,7 +328,7 @@ static HCountedArray *llk_parse_chunk_(HLLkState *s, const HParser* parser, const HCFSequence *p = h_llk_lookup(table, x, stream); if(p == NULL) goto no_parse; - if(p == H_NEED_INPUT) + if(p == NEED_INPUT) goto need_input; // an infinite loop case that shouldn't happen diff --git a/src/cfgrammar.c b/src/cfgrammar.c index 117009a57cc3033c62a08d7caef274df5f582276..a7601e11151146aa6f688cb8e049375f9846922f 100644 --- a/src/cfgrammar.c +++ b/src/cfgrammar.c @@ -349,7 +349,7 @@ void *h_stringmap_get(const HStringMap *m, const uint8_t *str, size_t n, bool en return m->epsilon_branch; } -// A NULL result means no parse. H_NEED_INPUT means lookahead is too short. +// A NULL result means no parse. NEED_INPUT means lookahead is too short. void *h_stringmap_get_lookahead(const HStringMap *m, HInputStream lookahead) { while(m) { @@ -368,7 +368,7 @@ void *h_stringmap_get_lookahead(const HStringMap *m, HInputStream lookahead) // XXX assumption of byte-wise grammar and input return m->end_branch; } else { - return H_NEED_INPUT; + return NEED_INPUT; } } diff --git a/src/cfgrammar.h b/src/cfgrammar.h index 2294d445175b3d622fa4a4e59d0b38deda017b7f..1e18442df21ad34201dbd29384288446c2f2cb47 100644 --- a/src/cfgrammar.h +++ b/src/cfgrammar.h @@ -57,7 +57,7 @@ static inline HStringMap *h_stringmap_get_char(const HStringMap *m, const uint8_ { return h_hashtable_get(m->char_branches, (void *)char_key(c)); } // dummy return value used by h_stringmap_get_lookahead when out of input -#define H_NEED_INPUT ((void *)&h_stringmap_get_lookahead) +#define NEED_INPUT ((void *)-1) /* Convert 'parser' into CFG representation by desugaring and compiling the set