Skip to content

Commit

Permalink
Small fix: Use OrderedSet
Browse files Browse the repository at this point in the history
  • Loading branch information
erezsh committed Jun 18, 2024
1 parent 1cf48c5 commit 1e9bf46
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lark/parsers/earley.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def parse(self, lexer, start):
# If the parse was successful, the start
# symbol should have been completed in the last step of the Earley cycle, and will be in
# this column. Find the item for the start_symbol, which is the root of the SPPF tree.
solutions = list({n.node for n in columns[-1] if n.is_complete and n.node is not None and n.s == start_symbol and n.start == 0})
solutions = list(OrderedSet([n.node for n in columns[-1] if n.is_complete and n.node is not None and n.s == start_symbol and n.start == 0]))
if not solutions:
expected_terminals = [t.expect.name for t in to_scan]
raise UnexpectedEOF(expected_terminals, state=frozenset(i.s for i in to_scan))
Expand Down

0 comments on commit 1e9bf46

Please sign in to comment.