示例#1
0
 def __init__(self,
              grammar,
              start_symbol=START_SYMBOL,
              expansion_switch=1,
              log=False):
     self.tainted_start_symbol = ostr(start_symbol,
                                      origin=[1] * len(start_symbol))
     self.expansion_switch = expansion_switch
     self.log = log
     self.grammar = grammar
     self.c_grammar = canonical(grammar)
     self.init_tainted_grammar()
示例#2
0
 def __init__(self, runner, grammar, start_symbol=START_SYMBOL, log=False):
     super().__init__(runner, log=log)
     self.grammar = grammar
     self.start_symbol = start_symbol
     self.parser = PEGParser(canonical(grammar), start_symbol)