Do not consider any symbols to be 'in-progress' in out-of-context states

This commit is contained in:
Max Brunsfeld 2016-03-02 20:47:20 -08:00
parent 76d072545d
commit b68f7212c8
2 changed files with 8 additions and 5 deletions

View file

@ -143,7 +143,7 @@ class ParseTableBuilder {
ParseStateId state_id = parse_table.add_state();
for (const auto &entry : item_set.entries) {
const ParseItem &item = entry.first;
if (item.step_index > 0 && item.lhs() != rules::START())
if (item.step_index > 0 && item.lhs() != rules::START() && !allow_any_conflict)
parse_table.states[state_id].in_progress_symbols.insert(item.lhs());
}

View file

@ -269,14 +269,17 @@ class CCodeGenerator {
}
void add_in_progress_symbol_table() {
line("static unsigned short ts_in_progress_symbol_table[] = {");
add_in_progress_symbol_list_id({});
line("static unsigned short ts_in_progress_symbol_table[STATE_COUNT] = {");
indent([&]() {
size_t state_id = 0;
for (const ParseState &state : parse_table.states) {
line("[" + to_string(state_id) + "] = ");
add(to_string(add_in_progress_symbol_list_id(state.in_progress_symbols)));
add(",");
if (!state.in_progress_symbols.empty()) {
line("[" + to_string(state_id) + "] = ");
add(to_string(add_in_progress_symbol_list_id(state.in_progress_symbols)));
add(",");
}
state_id++;
}
});