[antlr-interest] Braces
Alex Pojarsky
divine.raven at gmail.com
Wed Jul 27 15:30:29 PDT 2011
Greetings everyone.
Ive got the following Parser rule in my grammar file:
codeBlock
: SEP_LBRACE {input.mark();} code? SEP_RBRACE
;
And it correctly generates MismatchedTokenException when encounters
EOF instead of SEP_RBRACE. The problem is it gives line 0 and
charPosition -1, which is illegal in the place I'm trying to use it. I
want these things to be set to the position of the last instance of
SEP_LBRACE. I.e. when parser encounters EOF while parsing this
codeBlock rule - it should return Line and charPosition of the nearest
SEP_LBRACE.
Could you please explain how do I do this? I'm still newbie, even
though I've developed a simple grammar for the programming language,
so please, keep things simple as long as it is possible.
Thanks a lot in advance.
More information about the antlr-interest
mailing list