Allow multiple parse actions in parse table
This commit is contained in:
parent
25f8ecd85f
commit
755894b44d
7 changed files with 46265 additions and 46256 deletions
|
|
@ -182,7 +182,7 @@ class CCodeGenerator {
|
|||
line("#pragma GCC diagnostic ignored \"-Wmissing-field-initializers\"");
|
||||
line();
|
||||
line(
|
||||
"static const TSParseAction "
|
||||
"static const TSParseAction *"
|
||||
"ts_parse_actions[STATE_COUNT][SYMBOL_COUNT] = {");
|
||||
|
||||
indent([&]() {
|
||||
|
|
@ -191,8 +191,9 @@ class CCodeGenerator {
|
|||
indent([&]() {
|
||||
for (const auto &pair : state.actions) {
|
||||
line("[" + symbol_id(pair.first) + "] = ");
|
||||
add("ACTIONS(");
|
||||
add_parse_action(pair.second);
|
||||
add(",");
|
||||
add("),");
|
||||
}
|
||||
});
|
||||
line("},");
|
||||
|
|
|
|||
|
|
@ -27,9 +27,14 @@
|
|||
* Private
|
||||
*/
|
||||
|
||||
static const TSParseAction ERROR_ACTION = {
|
||||
.type = TSParseActionTypeError
|
||||
};
|
||||
|
||||
static TSParseAction get_action(const TSLanguage *language, TSStateId state,
|
||||
TSSymbol sym) {
|
||||
return (language->parse_table + (state * language->symbol_count))[sym];
|
||||
const TSParseAction *actions = (language->parse_table + (state * language->symbol_count))[sym];
|
||||
return actions ? actions[0] : ERROR_ACTION;
|
||||
}
|
||||
|
||||
static TSLength break_down_left_stack(TSParser *parser, TSInputEdit edit) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue