Include out-of-context states starting with non-terminals
This commit is contained in:
parent
e7abfdd373
commit
76d072545d
4 changed files with 54 additions and 25 deletions
|
|
@ -225,10 +225,12 @@ class CCodeGenerator {
|
|||
indent([&]() {
|
||||
for (const auto &entry : parse_table.symbols) {
|
||||
const rules::Symbol &symbol = entry.first;
|
||||
ParseStateId state = parse_table.out_of_context_state_indices.find(symbol)->second;
|
||||
if (symbol.is_token && !symbol.is_built_in()) {
|
||||
line("[" + symbol_id(symbol) + "] = " + to_string(state) + ",");
|
||||
}
|
||||
if (symbol.is_built_in())
|
||||
continue;
|
||||
auto iter = parse_table.out_of_context_state_indices.find(symbol);
|
||||
string state = (iter != parse_table.out_of_context_state_indices.end()) ?
|
||||
to_string(iter->second) : "ts_parse_state_error";
|
||||
line("[" + symbol_id(symbol) + "] = " + state + ",");
|
||||
}
|
||||
});
|
||||
line("};");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue