def fn(parserState): if parserState["isError"] == True: return parserState nextState = testState = parserState.copy() results = [] done = False while (not done): testState = parser.parserStateTransformerFn(testState) if not testState["isError"]: results.append(testState["result"]) nextState = testState else: done = True return updateParserResult(nextState, tuple(results))
def fn(parserState): if parserState["isError"] == True: return parserState results = [] nextState = parserState.copy() for p in parsers: nextState = p.parserStateTransformerFn(nextState) if nextState["isError"] == True: break results.append(nextState["result"]) return updateParserResult(nextState, tuple(results))
def fn1(parserState): results = [] nextState = parserState.copy() while (True): thingWeWantState = valueParser.parserStateTransformerFn( nextState) if thingWeWantState["isError"]: break results.append(thingWeWantState["result"]) nextState = thingWeWantState separatorState = separatorParser.parserStateTransformerFn( nextState) if separatorState["isError"]: break nextState = separatorState return updateParserResult(nextState, results)
def fn(parserState): if parserState["isError"] == True: return parserState nextState = testState = parserState.copy() results = [] done = False while (not done): testState = parser.parserStateTransformerFn(testState) if not testState["isError"]: results.append(testState["result"]) nextState = testState else: done = True if len(results) < 1: return updateParserError( nextState, "many1: Unable to match any input using parser at index %i" % (parserState["index"])) return updateParserResult(nextState, tuple(results))
def fn1(parserState): results = [] nextState = parserState.copy() while (True): thingWeWantState = valueParser.parserStateTransformerFn( nextState) if thingWeWantState["isError"]: break results.append(thingWeWantState["result"]) nextState = thingWeWantState separatorState = separatorParser.parserStateTransformerFn( nextState) if separatorState["isError"]: break nextState = separatorState if len(results) < 1: return updateParserError( nextState, "sepBy1: Unable to match any input using parser at index %i" % (parserState["index"])) return updateParserResult(nextState, tuple(results))