|
- from unittest import TestCase, main
-
- from lark import Lark, Tree
-
- class TestLexer(TestCase):
- def setUp(self):
- pass
-
- def test_basic(self):
- p = Lark("""
- start: "a" "b" "c" "d"
- %ignore " "
- """)
-
- res = list(p.lex("abc cba dd"))
- assert res == list('abccbadd')
-
- res = list(p.lex("abc cba dd", dont_ignore=True))
- assert res == list('abc cba dd')
-
-
- if __name__ == '__main__':
- main()
|