let's just use ((void *)-1) as another invalid pointer result
This commit is contained in:
parent
90b6f30fa1
commit
8995097a1d
3 changed files with 5 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue