From ac9d260734a676965c1809e3f56569c388d6d1de Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 31 Aug 2017 12:50:10 -0700 Subject: [PATCH] Clean up parser fields --- src/runtime/parser.c | 6 +++--- src/runtime/parser.h | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/runtime/parser.c b/src/runtime/parser.c index a989989d..3f1765f1 100644 --- a/src/runtime/parser.c +++ b/src/runtime/parser.c @@ -424,7 +424,7 @@ static Tree *parser__get_lookahead(Parser *self, StackVersion version, TSStateId reason = "is_error"; } else if (result->fragile_left || result->fragile_right) { reason = "is_fragile"; - } else if (self->is_split && result->child_count) { + } else if (self->in_ambiguity && result->child_count) { reason = "in_ambiguity"; } @@ -630,7 +630,7 @@ static StackPopResult parser__reduce(Parser *self, StackVersion version, TSStateId state = ts_stack_top_state(self->stack, slice.version); TSStateId next_state = ts_language_next_state(self->language, state, symbol); - if (fragile || self->is_split || pop.slices.size > 1 || initial_version_count > 1) { + if (fragile || self->in_ambiguity || pop.slices.size > 1 || initial_version_count > 1) { parent->fragile_left = true; parent->fragile_right = true; parent->parse_state = TS_TREE_STATE_NONE; @@ -1332,7 +1332,7 @@ Tree *parser_parse(Parser *self, TSInput input, Tree *old_tree, bool halt_on_err break; } - self->is_split = (version > 1); + self->in_ambiguity = version > 1; } while (version != 0); LOG("done"); diff --git a/src/runtime/parser.h b/src/runtime/parser.h index 202a910e..533cdf3a 100644 --- a/src/runtime/parser.h +++ b/src/runtime/parser.h @@ -23,15 +23,14 @@ typedef struct { const TSLanguage *language; ReduceActionSet reduce_actions; Tree *finished_tree; - bool is_split; - bool print_debugging_graphs; Tree scratch_tree; TokenCache token_cache; ReusableNode reusable_node; TreePath tree_path1; TreePath tree_path2; void *external_scanner_payload; - Tree *last_external_token; + bool in_ambiguity; + bool print_debugging_graphs; } Parser; bool parser_init(Parser *);