Remove depends_on_lookahead field from parse table entries

This simplifies the logic for determining whether a token is reusable
and makes it more conservative. It should fix some incremental parsing
bugs that are being caught by the randomized tests on CI.
This commit is contained in:
Max Brunsfeld 2018-03-28 10:11:05 -07:00
parent 186f70649c
commit e917756ad1
10 changed files with 16 additions and 43 deletions

View file

@ -399,7 +399,7 @@ class CCodeGenerator {
}
void add_parse_table() {
add_parse_action_list_id(ParseTableEntry{ {}, false, false });
add_parse_action_list_id(ParseTableEntry{ {}, false });
size_t state_id = 0;
line("static uint16_t ts_parse_table[STATE_COUNT][SYMBOL_COUNT] = {");
@ -623,10 +623,12 @@ class CCodeGenerator {
indent([&]() {
for (const auto &pair : parse_table_entries) {
size_t index = pair.first;
line("[" + to_string(index) + "] = {.count = " +
to_string(pair.second.actions.size()) + ", .reusable = " +
_boolean(pair.second.reusable) + ", .depends_on_lookahead = " +
_boolean(pair.second.depends_on_lookahead) + "},");
line(
"[" + to_string(index) + "] = {"
".count = " + to_string(pair.second.actions.size()) + ", "
".reusable = " + _boolean(pair.second.reusable) +
"},"
);
for (const ParseAction &action : pair.second.actions) {
add(" ");