From 608b5ce02b5a58671e33852cbf414c0037f18066 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 12 May 2014 08:53:28 -0700 Subject: [PATCH] Cleanup - extract method in parse table builder --- src/compiler/build_tables/build_parse_table.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/build_tables/build_parse_table.cc b/src/compiler/build_tables/build_parse_table.cc index fb12be9b..ecf5ef6d 100644 --- a/src/compiler/build_tables/build_parse_table.cc +++ b/src/compiler/build_tables/build_parse_table.cc @@ -35,6 +35,7 @@ namespace tree_sitter { ParseStateId state_id = parse_table.add_state(); parse_state_ids[item_set] = state_id; add_shift_actions(item_set, state_id); + add_ubiquitous_token_actions(item_set, state_id); add_reduce_actions(item_set, state_id); return state_id; } else { @@ -56,7 +57,9 @@ namespace tree_sitter { parse_table.add_action(state_id, symbol, ParseAction::Shift(new_state_id, precedence_values)); } } - + } + + void add_ubiquitous_token_actions(const ParseItemSet &item_set, ParseStateId state_id) { for (const Symbol &symbol : grammar.options.ubiquitous_tokens) { auto &actions = parse_table.states[state_id].actions; if (actions.find(symbol) == actions.end())