[antlr-interest] illegal option output and ! operator

Gavin Lambert antlr at mirality.co.nz
Fri Dec 18 10:15:51 PST 2009


At 03:45 19/12/2009, Rick Schumeyer wrote:
>The following rule generates an "illegal option output" error 
>when I attempt to generate code in antrlworks 1.3.1.
>
>EQUOTE    :    '\\'! '"';
>
>I see that others have had the same problem, but I couldn't find 
>the solution.
>
>Is the ! operator supposed to work in a non-AST grammar?

No, and not in the lexer.  Instead of using !, you need to 
explicitly set the text of the token via { $text = "xxx"; } or { 
setText("xxx"); } or something similar, depending on your target 
language.  See the examples and the wiki.



More information about the antlr-interest mailing list