[antlr-interest] Greedy matching to end of line

Pop Qvarnström pop.qvarnstrom at gmail.com
Fri Jan 28 06:02:45 PST 2011


Same apology goes here, attached is cap of my run of NOCHandle in the
interpreter, grammar cut and pasted from your original mail. The interpreter
has quirks though, have you tried running it in the debugger instead? And
what versions of antlr/antlrworks are you running?

Cheers,
Pop

2011/1/28 Robert J. Hansen <rjh at sixdemonbag.org>

> (I apologize in advance for the embedded images.  I understand a lot of
> people on the 'net want only pure ASCII text, but it seems easiest if I give
> screen caps.)
>
>
>
> > I cannot reproduce this using your supplied grammar: as long as the
> required NEWLINE is in place, your example works just fine. If, however, I
> do not provide a newline in the input, I'm hit by a NoViableAltException.
>
> Strange.  In my own tests it works out quite differently.
>
> First, yes, you're correct: a newline needs to be at the end of each and
> every line.  This is part of the original corpus's spec.  In the attached
> screenshots, the interpreter input has a newline at the end, although it's
> not visible.  First, a bad parse, showing how it bombs out on the words
> token:
>
>
>
> Second, a good parse, showing how changing NOCHandle to anything else
> allows it to parse:
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NOCHandle.png
Type: image/png
Size: 12656 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20110128/a9b232a5/attachment.png 


More information about the antlr-interest mailing list