diff --git a/lark/load_grammar.py b/lark/load_grammar.py index 6da2df0..8f924c5 100644 --- a/lark/load_grammar.py +++ b/lark/load_grammar.py @@ -235,6 +235,7 @@ class SimplifyRule_Visitor(Visitor): tree.children = [self.visit(ST('expansion', [option if i==j else other for j, other in enumerate(tree.children)])) for option in set(child.children)] + self._flatten(tree) break def alias(self, tree): diff --git a/tests/test_parser.py b/tests/test_parser.py index c4d7147..a029abe 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -148,6 +148,9 @@ class TestParsers(unittest.TestCase): self.assertEqual( r.children, [""] ) + def test_alias(self): + Lark("""start: ["a"] "b" ["c"] "e" ["f"] ["g"] ["h"] "x" -> d """) + def _make_full_earley_test(LEXER):