parsec, return remaining input?

Hi, Is there a way to return the remaining input, so that parsec can be used to parse one piece at a time. So something like: chunk = many (noneOf ",:") parse chunk "abc,123:xyz" Would return ("abc", ",123:last") or similar? thanks, Rob

On Saturday 16 April 2011 01:44:32, Rob Nikander wrote:
Hi,
Is there a way to return the remaining input, so that parsec can be used to parse one piece at a time. So something like:
chunk = many (noneOf ",:")
chunk = do first <- many (noneOf ",:") rest <- getInput -- maybe `setInput ""' here return (first, rest)
parse chunk "abc,123:xyz"
But that looks like you're going to iterate, so maybe sepBy (many $ noneOf ",:") (oneOf ",:") should be looked at.
Would return ("abc", ",123:last") or similar?
thanks, Rob
participants (2)
-
Daniel Fischer
-
Rob Nikander