Remove extra EOF actions in lexer
This commit is contained in:
parent
32e94081fa
commit
129d2b9314
7 changed files with 1045 additions and 1153 deletions
|
|
@ -88,11 +88,12 @@ namespace tree_sitter {
|
|||
|
||||
LexItemSet lex_item_set_for_parse_state(const ParseState &state) {
|
||||
LexItemSet result;
|
||||
for (auto &symbol : state.expected_inputs())
|
||||
if (lex_grammar.has_definition(symbol)) {
|
||||
for (auto &symbol : state.expected_inputs()) {
|
||||
if (lex_grammar.has_definition(symbol))
|
||||
result.insert(LexItem(symbol, after_separators(lex_grammar.rule(symbol))));
|
||||
}
|
||||
result.insert(LexItem(rules::END_OF_INPUT(), after_separators(CharacterSet({ 0 }).copy())));
|
||||
if (symbol == rules::END_OF_INPUT())
|
||||
result.insert(LexItem(symbol, after_separators(CharacterSet({ 0 }).copy())));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace tree_sitter {
|
|||
|
||||
set<Symbol> ParseState::expected_inputs() const {
|
||||
set<Symbol> result;
|
||||
for (auto pair : actions)
|
||||
for (auto &pair : actions)
|
||||
result.insert(pair.first);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue