I like Parsec. I use it for everything. But it does have one irritating problem.

Consider the following parser:

 expressions = many1 expression

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", as if everything parsed successfully. But actually it has ignored half the input! o_O

Does anybody know how to fix this irratiting quirk? I can see why it happens, but not how to fix it.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to