[antlr-interest] The NOT (~) Operator

Dan th30dan at gmail.com
Sun Apr 13 09:41:55 PDT 2008


I'm still fairly new to ANTLR but, based on what I've learned, lexer rules
are meant to be pretty dumb, and are not meant to handle alternatives based
on other lexer rules.  For that, it seems to be recommended to use parser

See pages 289-290 of "The Definitive ANTLR Reference" book, if you have
access to it.

Although I haven't yet seen a clear explanation of why this is.

Why is making "INDENTATION" a parser rule not an option for you?


On Sat, Apr 12, 2008 at 1:10 AM, Sven Busse <mail at ghost23.de> wrote:

> Hi,
> i have a problem with a grammar error message, i don't understand.
> I have this grammar (reduced to the relevant bit):
> grammar simpletest;
> : '\r'? '\n';
> fragment
> TAB : '\t';
> Checking the grammar with ANTLRWorks gives me this error:
> simpletest.g:0:0: syntax error: buildnfa: <AST>:6:11: unexpected AST node:
> ?
> The problem seems to relate to the "~NEWLINE", because if i delete it, i
> get no error. Also, if i change the "INDENTATION" to a parser rule
> "indentation", i get no error, but that is not an option for me.
> Can someone explain to me, what the reason behind this error is?
> Thank you
> Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080413/1a2034df/attachment.html 

More information about the antlr-interest mailing list