diff --git a/lark/parsers/earley.py b/lark/parsers/earley.py index 34c290c6..7033eeb8 100644 --- a/lark/parsers/earley.py +++ b/lark/parsers/earley.py @@ -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))