[Haskell-cafe] An irritating Parsec problem

Philippa Cowderoy flippa at flippac.org
Wed Oct 15 15:29:12 EDT 2008

On Wed, 15 Oct 2008, Andrew Coppin wrote:

> Suppose this is the top-level parser for my language. Now suppose the user
> supplies an expression with a syntax error half way through it. What I *want*
> to happen is for an error to be raised. What *actually* happens is that Parsec
> just ignores all input after that point. So if "+" is not a valid token, but
> the user writes
>  x = 1; y = 2; z = 3 + z; w = 4;
> then what my program receives back is "x = 1; y = 2; z = 3"

That'll teach me not to scan-read when I'm tired!

expressions = do es <- many1 expression
                 return es

flippa at flippac.org

Society does not owe people jobs.
Society owes it to itself to find people jobs.

More information about the Haskell-Cafe mailing list