[Haskell-cafe] How to use notFollowedBy function in Parsec
Daniel Fischer
daniel.is.fischer at web.de
Tue Nov 22 09:16:55 EST 2005
Am Dienstag, 22. November 2005 14:51 schrieben Sie:
> Am Montag, 21. November 2005 03:27 schrieb Sara Kenedy:
>
> May I suggest
>
> endBy anyToken semi ? -- optionally replace semi by "char ';'", if you
^^^^^^^^
Oops, I confused endBy and manyTill !! Also below.
And since maybe there isn't any semicolon, I'd say
manyTill anyToken (semi {- try semi, perhaps -} <|> eof)
> don't want to skip whitespace
>
> I think this is what you want --- stop at the first semicolon.
>
> If you want to ignore just a final semicolon, you might use
>
> endBy anyToken (optional semi >> eof),
>
> if you want to stop at the last semicolon, whatever comes thereafter, you
> have a problem, you'd need long lookahead.
>
Cheers again,
Daniel
More information about the Haskell-Cafe
mailing list