[Haskell-cafe] Examples for the problem
rendel at informatik.uni-marburg.de
Wed Mar 2 14:59:51 CET 2011
Robert Clausecker wrote:
> Each instruction has up to three operands, looking like this:
> @+4 (Jump for bytes forward)
> "foo" (the string foo"
> etc. A string literal may contain anything but a newline, (there are
> no escape codes or similar). But when I add a check for a newline,
> the parser just fails and the next one is tried. This is undesired, as
> I want to return an error like "unexpected newline" instead. How is
> this handled in other parsers?
I would expect that the other parsers are tried, but fail, because they
do not accept an initial quotation mark. You get two errors messages then:
1. Unexpected newline after quotation mark
2. Unexpected quotation mark
These two error messages reflect the two ways to solve the problem:
Either delete the first quotation mark, or add a second one.
PS. Please use "Reply" to answer posts, so that they can be put into the
More information about the Haskell-Cafe