示例#1
0
文件: prim.py 项目: bmhacker/pyparsec
 def processor(state):
     state = self(state)
     if isParseError(state):
         return state
     newstate = other(state)
     if isParseError(newstate):
         return newstate
     return setParseSuccessTree(newstate, filter(lambda x: x is not None,
                                                 [parseSuccessTree(state), parseSuccessTree(newstate)]))  # filter out 'skipped' input
示例#2
0
 def processor(state):
     state = self(state)
     if isParseError(state):
         return state
     newstate = other(state)
     if isParseError(newstate):
         return newstate
     return setParseSuccessTree(
         newstate,
         filter(lambda x: x is not None,
                [parseSuccessTree(state),
                 parseSuccessTree(newstate)
                 ]))  # filter out 'skipped' input
示例#3
0
 def processor(state):
     tree = []
     for pr in parsers:
         state = pr(state)
         if isParseError(state):
             return state
         tree.append(parseSuccessTree(state))
     return setParseSuccessTree(state, tree)
示例#4
0
 def processor(state):
     tree = []
     for pr in parsers:
         state = pr(state)
         if isParseError(state):
             return state
         tree.append(parseSuccessTree(state))
     return setParseSuccessTree(state, tree)
示例#5
0
 def processor(state):
     tree = []
     while True:
         newstate = parser(state)
         if isParseError(newstate):
             break
         tree.append(parseSuccessTree(newstate))
         state = newstate
     return setParseSuccessTree(state, tree) if not inputConsumed(newstate, state) else newstate
示例#6
0
 def processor(state):
     tree = []
     while True:
         newstate = parser(state)
         if isParseError(newstate):
             break
         tree.append(parseSuccessTree(newstate))
         state = newstate
     return setParseSuccessTree(
         state, tree) if not inputConsumed(newstate, state) else newstate
示例#7
0
 def processor(state):
     newstate = self(state)
     if isParseError(newstate):
         return newstate
     tree = parseSuccessTree(newstate)
     return f(tree)(newstate)
示例#8
0
文件: prim.py 项目: bmhacker/pyparsec
 def processor(state):
     newstate = self(state)
     if isParseError(newstate):
         return newstate
     tree = parseSuccessTree(newstate)
     return f(tree)(newstate)