def runTest(self): parser = pypeg2.Parser() with self.assertRaises(SyntaxError): r = parser.parse(", world", pypeg2.K("hallo")) pypeg2.Keyword.table[pypeg2.K("hallo")]
def runTest(self): parser = pypeg2.Parser() r = parser.parse("hallo, world", pypeg2.K("hallo")) self.assertEqual(r, (", world", None)) pypeg2.Keyword.table[pypeg2.K("hallo")]
class EnumTest(pypeg2.Symbol): grammar = pypeg2.Enum( pypeg2.K("int"), pypeg2.K("long") )
class ComposeKeyword(object): grammar = pypeg2.K("hallo")
class Type(peg.Keyword): grammar = (peg.Enum(peg.K("int"), peg.K("long")))