Don't mark error nodes created in the error state as extras

This commit is contained in:
Max Brunsfeld 2017-02-19 21:53:49 -08:00
parent c14a776a3d
commit 5b4e6df3ff
2 changed files with 8 additions and 10 deletions

View file

@ -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)))

View file

@ -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;