Remove default_actions from ParseTable
This commit is contained in:
parent
3ca2e126be
commit
5d9dc71da1
4 changed files with 2 additions and 9 deletions
|
|
@ -36,8 +36,7 @@ namespace tree_sitter {
|
|||
}
|
||||
|
||||
void add_shift_actions(const ParseItemSet &item_set, size_t state_index) {
|
||||
auto x = sym_transitions(item_set, grammar);
|
||||
for (auto transition : x) {
|
||||
for (auto transition : sym_transitions(item_set, grammar)) {
|
||||
rules::Symbol symbol = *transition.first;
|
||||
ParseItemSet item_set = *transition.second;
|
||||
size_t new_state_index = add_parse_state(item_set);
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ namespace tree_sitter {
|
|||
string body = "";
|
||||
for (auto pair : parse_state.actions)
|
||||
body += _case(symbol_id(pair.first), code_for_parse_actions(pair.second, parse_state.expected_inputs()));
|
||||
body += _default(code_for_parse_actions(parse_state.default_actions, parse_state.expected_inputs()));
|
||||
body += _default(parse_error_call(parse_state.expected_inputs()));
|
||||
return
|
||||
string("SET_LEX_STATE(") + to_string(parse_state.lex_state_index) + ");\n" +
|
||||
_switch("LOOKAHEAD_SYM()", body);
|
||||
|
|
|
|||
|
|
@ -69,8 +69,4 @@ namespace tree_sitter {
|
|||
symbol_names.insert(sym_name);
|
||||
states[state_index].actions[sym_name].insert(action);
|
||||
}
|
||||
|
||||
void ParseTable::add_default_action(size_t state_index, ParseAction action) {
|
||||
states[state_index].default_actions.insert(action);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ namespace tree_sitter {
|
|||
public:
|
||||
ParseState();
|
||||
std::unordered_map<std::string, std::unordered_set<ParseAction>> actions;
|
||||
std::unordered_set<ParseAction> default_actions;
|
||||
std::unordered_set<std::string> expected_inputs() const;
|
||||
size_t lex_state_index;
|
||||
};
|
||||
|
|
@ -59,7 +58,6 @@ namespace tree_sitter {
|
|||
public:
|
||||
size_t add_state();
|
||||
void add_action(size_t state_index, std::string symbol_name, ParseAction action);
|
||||
void add_default_action(size_t state_index, ParseAction action);
|
||||
|
||||
std::vector<ParseState> states;
|
||||
std::unordered_set<std::string> symbol_names;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue