[antlr-interest] The NOT (~) Operator

Sven Busse mail at ghost23.de
Sat Apr 12 01:10:47 PDT 2008


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;

INDENTATION
	:	TAB* ~NEWLINE;

NEWLINE
	:	'\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



More information about the antlr-interest mailing list