From 5b4e6df3ff59e183bd0022bbaad3684e587491d5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Sun, 19 Feb 2017 21:53:49 -0800 Subject: [PATCH] Don't mark error nodes created in the error state as extras --- spec/fixtures/error_corpus/c_errors.txt | 12 +++++------- src/runtime/language.c | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/spec/fixtures/error_corpus/c_errors.txt b/spec/fixtures/error_corpus/c_errors.txt index 4dfb0894..b00eb5d3 100644 --- a/spec/fixtures/error_corpus/c_errors.txt +++ b/spec/fixtures/error_corpus/c_errors.txt @@ -23,20 +23,18 @@ int c; --- (translation_unit - (preproc_ifdef - (identifier) - (ERROR (identifier) (identifier) (comment))) + (preproc_ifdef (identifier) + (ERROR (identifier) (identifier)) + (comment)) (declaration (identifier) (identifier)) - (preproc_ifdef - (identifier) + (preproc_ifdef (identifier) (ERROR (storage_class_specifier) (string_literal))) (declaration (identifier) (identifier)) - (preproc_ifdef - (identifier) + (preproc_ifdef (identifier) (ERROR)) (declaration (identifier) (identifier))) diff --git a/src/runtime/language.c b/src/runtime/language.c index 7f1bdefa..05361a81 100644 --- a/src/runtime/language.c +++ b/src/runtime/language.c @@ -2,8 +2,8 @@ #include "runtime/tree.h" #include "runtime/error_costs.h" -static const TSParseAction ERROR_SHIFT_EXTRA = { - .type = TSParseActionTypeShift, .extra = true, +static const TSParseAction SHIFT_ERROR = { + .type = TSParseActionTypeShift, .params = {.to_state = ERROR_STATE} }; void ts_language_table_entry(const TSLanguage *self, TSStateId state, @@ -14,7 +14,7 @@ void ts_language_table_entry(const TSLanguage *self, TSStateId state, result->action_count = 1; result->is_reusable = false; result->depends_on_lookahead = false; - result->actions = &ERROR_SHIFT_EXTRA; + result->actions = &SHIFT_ERROR; return; } action_index = 0;