Skip to content

Commit

Permalink
Added tests for bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
erezsh committed Jun 30, 2024
1 parent 7fec983 commit 7547758
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,19 @@ def test_resolve_ambiguity_with_shared_node2(self):
tree = l.parse("")
self.assertEqual(tree, Tree('start', [Tree('x', [])]))


def test_consistent_derivation_order1(self):
# Should return the same result for any hash-seed
parser = Lark('''
start: a a
a: "." | b
b: "."
''', lexer=LEXER)

tree = parser.parse('..')
n = Tree('a', [Tree('b', [])])
assert tree == Tree('start', [n, n])

_NAME = "TestFullEarley" + LEXER.capitalize()
_TestFullEarley.__name__ = _NAME
globals()[_NAME] = _TestFullEarley
Expand Down

0 comments on commit 7547758

Please sign in to comment.