Example #1
0
 def test_fails_to_parse_non_ll1(self):
     e = self.assertSimpleParseFailure(
         combinators.option(
             combinators.sequence(primitives.match(lambda c: c == "h"),
                                  primitives.match(lambda c: c == "e"))),
         "hzllo")
     self.assertEqual("z", e.value)
     self.assertEqual(list("llo"), list(e.it))
     self.assertEqual(set(), e.expected)
Example #2
0
 def test_parses_none(self):
     self.assertParse(combinators.option(primitives.error(set())), None,
                      "hello", "hello")
Example #3
0
 def test_parses(self):
     self.assertParse(combinators.option(primitives.any_), "h", "ello",
                      "hello")