from modgrammar import *
from functools import *
#grammar_whitespace_mode = 'optional'
class NonZeroDigit(Grammar):
grammar = reduce(lambda a,b:a|b, list(map(L,list("123456789"))))
class Digit(Grammar):
grammar = reduce(lambda a,b:a|b, list(map(L,list("0123456789"))))
class PositiveInteger(Grammar):
grammar = L("0") | (NonZeroDigit, ZERO_OR_MORE(Digit))
class Integer(Grammar):
grammar = (OPTIONAL("-"), PositiveInteger)
class IntegerList(Grammar):
grammar = LIST_OF(Integer, sep=";")
p = IntegerList.parser()