From ee8dd8b3f3486b0c18ada7e4e933dce06d189661 Mon Sep 17 00:00:00 2001 From: Erez Shinan Date: Wed, 26 Jul 2017 10:17:27 +0300 Subject: [PATCH] Added a test suggested by James McLaughlin --- tests/test_parser.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_parser.py b/tests/test_parser.py index 55c010e..348993a 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -379,6 +379,20 @@ def _make_parser_test(LEXER, PARSER): x = g.parse('Hello HelloWorld') self.assertSequenceEqual(x.children, ['HelloWorld']) + def test_token_collision2(self): + # NOTE: This test reveals a bug in token reconstruction in Scanless Earley + # I probably need to re-write grammar transformation + + g = _Lark(""" + !start: "starts" + + %import common.LCASE_LETTER + """) + + x = g.parse("starts") + self.assertSequenceEqual(x.children, ['starts']) + + # def test_string_priority(self): # g = _Lark("""start: (A | /a?bb/)+ # A: "a" """)