This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

23 rindas
466 B

  1. from unittest import TestCase, main
  2. from lark import Lark, Tree
  3. class TestLexer(TestCase):
  4. def setUp(self):
  5. pass
  6. def test_basic(self):
  7. p = Lark("""
  8. start: "a" "b" "c" "d"
  9. %ignore " "
  10. """)
  11. res = list(p.lex("abc cba dd"))
  12. assert res == list('abccbadd')
  13. res = list(p.lex("abc cba dd", dont_ignore=True))
  14. assert res == list('abc cba dd')
  15. if __name__ == '__main__':
  16. main()