Esempio n. 1
0
 def test_fails_to_parse_ll2(self):
     e = self.assertParseFailure(
         combinators.try_(combinators.sequence(
             primitives.any_, primitives.any_,
             primitives.error({"error!"}))),
         "test")
     self.assertEqual({"error!"}, e.expected)
Esempio n. 2
0
 def test_parses(self):
     self.assertParse(combinators.try_(primitives.match(lambda c: c == "h")),
                      "h", "ello", "hello")
Esempio n. 3
0
 def test_fails_to_parse(self):
     e = self.assertParseFailure(
         combinators.try_(primitives.error({"error!"})), "hello")
     self.assertEqual({"error!"}, e.expected)