Have a context level variable and update it through the action part in SEP_LBRACE.
Gokul. On Thu, Jul 28, 2011 at 6:30 AM, Alex Pojarsky <[email protected]>wrote: > 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. > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
