From 220e081c4945775c4b9459ada984d10651c4fa82 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 28 May 2014 08:13:25 -0700 Subject: [PATCH] Remove unnecessary methods on LexTable --- src/compiler/build_tables/build_lex_table.cc | 8 ++++---- src/compiler/lex_table.cc | 8 -------- src/compiler/lex_table.h | 2 -- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/compiler/build_tables/build_lex_table.cc b/src/compiler/build_tables/build_lex_table.cc index cb8005e3..0c77ade4 100644 --- a/src/compiler/build_tables/build_lex_table.cc +++ b/src/compiler/build_tables/build_lex_table.cc @@ -49,8 +49,8 @@ namespace tree_sitter { if (pair == lex_state_ids.end()) { LexStateId state_id = lex_table.add_state(); lex_state_ids[item_set] = state_id; - add_advance_actions(item_set, state_id); add_accept_token_actions(item_set, state_id); + add_advance_actions(item_set, state_id); add_token_start(item_set, state_id); return state_id; } else { @@ -60,8 +60,8 @@ namespace tree_sitter { void add_error_lex_state() { LexItemSet item_set = build_lex_item_set(parse_table->symbols); - add_advance_actions(item_set, LexTable::ERROR_STATE_ID); add_accept_token_actions(item_set, LexTable::ERROR_STATE_ID); + add_advance_actions(item_set, LexTable::ERROR_STATE_ID); } void add_advance_actions(const LexItemSet &item_set, LexStateId state_id) { @@ -70,7 +70,7 @@ namespace tree_sitter { CharacterSet rule = transition.first; LexItemSet new_item_set = transition.second; LexStateId new_state_id = add_lex_state(new_item_set); - lex_table.add_action(state_id, rule, LexAction::Advance(new_state_id)); + lex_table.state(state_id).actions[rule] = LexAction::Advance(new_state_id); } } @@ -80,7 +80,7 @@ namespace tree_sitter { auto current_action = lex_table.state(state_id).default_action; auto new_action = LexAction::Accept(item.lhs, item.precedence()); if (conflict_manager.resolve_lex_action(current_action, new_action)) - lex_table.add_default_action(state_id, new_action); + lex_table.state(state_id).default_action = new_action; } } } diff --git a/src/compiler/lex_table.cc b/src/compiler/lex_table.cc index 74ded562..1e5e5579 100644 --- a/src/compiler/lex_table.cc +++ b/src/compiler/lex_table.cc @@ -71,13 +71,5 @@ namespace tree_sitter { return states[id]; } - void LexTable::add_action(LexStateId id, CharacterSet match, LexAction action) { - state(id).actions[match] = action; - } - - void LexTable::add_default_action(LexStateId id, LexAction action) { - state(id).default_action = action; - } - const LexStateId LexTable::ERROR_STATE_ID = -1; } diff --git a/src/compiler/lex_table.h b/src/compiler/lex_table.h index 4ef0a36c..0428bca6 100644 --- a/src/compiler/lex_table.h +++ b/src/compiler/lex_table.h @@ -59,8 +59,6 @@ namespace tree_sitter { public: static const LexStateId ERROR_STATE_ID; LexStateId add_state(); - void add_action(LexStateId state_id, rules::CharacterSet rule, LexAction action); - void add_default_action(LexStateId state_id, LexAction action); LexState & state(LexStateId state_id); std::vector states;