diff --git a/src/compiler/build_tables/build_lex_table.cc b/src/compiler/build_tables/build_lex_table.cc index 79a05522..1dca5e91 100644 --- a/src/compiler/build_tables/build_lex_table.cc +++ b/src/compiler/build_tables/build_lex_table.cc @@ -159,13 +159,9 @@ class LexTableBuilder { void mark_fragile_tokens() { for (LexState &state : lex_table.states) if (state.default_action.type == LexActionTypeAccept) - if (has_fragile_token(state.default_action.symbol)) + if (conflict_manager.fragile_tokens.count(state.default_action.symbol)) state.default_action.type = LexActionTypeAcceptFragile; } - - bool has_fragile_token(const Symbol &symbol) { - return conflict_manager.fragile_tokens.find(symbol) != conflict_manager.fragile_tokens.end(); - } }; LexTable build_lex_table(ParseTable *table, const LexicalGrammar &grammar) { diff --git a/src/compiler/build_tables/build_parse_table.cc b/src/compiler/build_tables/build_parse_table.cc index 82db5721..292ff63c 100644 --- a/src/compiler/build_tables/build_parse_table.cc +++ b/src/compiler/build_tables/build_parse_table.cc @@ -282,7 +282,7 @@ class ParseTableBuilder { if (item.step_index > 0) { set first_set = get_first_set(next_symbol); - if (first_set.find(lookahead) != first_set.end()) { + if (first_set.count(lookahead)) { involved_symbols.insert(item.lhs()); core_shift_items.insert(item); } diff --git a/src/compiler/build_tables/lex_item_transitions.cc b/src/compiler/build_tables/lex_item_transitions.cc index 46961d5c..9b7500e7 100644 --- a/src/compiler/build_tables/lex_item_transitions.cc +++ b/src/compiler/build_tables/lex_item_transitions.cc @@ -75,7 +75,7 @@ class LexItemTransitions : public rules::RuleFn { map activate_precedence( map metadata) { - if (metadata.find(rules::PRECEDENCE) != metadata.end()) + if (metadata.count(rules::PRECEDENCE)) metadata.insert({ rules::IS_ACTIVE, 1 }); return metadata; } diff --git a/src/compiler/generate_code/c_code.cc b/src/compiler/generate_code/c_code.cc index 5b10b01a..292fe82a 100644 --- a/src/compiler/generate_code/c_code.cc +++ b/src/compiler/generate_code/c_code.cc @@ -172,7 +172,7 @@ class CCodeGenerator { add(", "); - if (syntax_grammar.ubiquitous_tokens.find(symbol) != syntax_grammar.ubiquitous_tokens.end()) + if (syntax_grammar.ubiquitous_tokens.count(symbol)) add(".extra = true"); else add(".extra = false");