Andrew Coppin wrote:
Philippa Cowderoy wrote:
On Wed, 15 Oct 2008, Andrew Coppin wrote:
Philippa Cowderoy wrote:
expressions = do es <- many1 expression
eof
return es
Ah - so "eof" fails if it isn't the end of the input?
eof = notFollowedBy anyChar
(assuming I've got the identifiers right, that's the actual
definition too)
OK, well that'll make it fail alright. Now I just gotta figure out how
to get a sane error message out of it! ;-)
(The example I showed is very simple; real parsers generally aren't.)
Actually, I added this to my real parser, and it actually seems to do
exactly what I want. Give it an invalid expression and it immediately
pinpoints exactly where the problem is, why it's a problem, and what you
should be doing instead. Neat!
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe