Fix parser loops in parse_any and parse_consecutive
This commit is contained in:
parent
3e325e4abd
commit
a436f23601
@ -50,7 +50,8 @@ parse_result_t parse_list(tokenlist_entry_t *current, node_id_t id,
|
||||
}
|
||||
|
||||
parse_result_t parse_any(tokenlist_entry_t *current, parser_t parsers[]) {
|
||||
for (parser_t parser = *parsers; parser; parser = *parsers++) {
|
||||
parser_t parser;
|
||||
while ((parser = *parsers++)) {
|
||||
parse_result_t result = parser(current);
|
||||
if (result.err == nullptr)
|
||||
return result;
|
||||
@ -106,7 +107,8 @@ parse_result_t parse_consecutive(tokenlist_entry_t *current, node_id_t id,
|
||||
|
||||
all->id = id;
|
||||
|
||||
for (parser_t parser = *parsers; parser && current; parser = *parsers++) {
|
||||
parser_t parser;
|
||||
while ((parser = *parsers++) && current) {
|
||||
result = parser(current);
|
||||
if (result.err) {
|
||||
ast_node_free(all);
|
||||
|
Loading…
x
Reference in New Issue
Block a user