[antlr-interest] Multiplexing question - no lexer token to switch, context necessary

Maximilian Störzer stoerzer at fmi.uni-passau.de
Tue Sep 7 05:15:40 PDT 2004


Hi everybody!

I am stuck with a multiplexing problem. I understand that in general it is
no good idea to switch the lexer from the parser.

However I have the problem that I would need a different lexer dependent on
the context. There is *no* token (like e.g. "/**" for JavaDoc) to allow
switching the lexer from within the lexer. Only the parser knows about this
necessary context.

The problem is that - depending on context - foo*bar should be parsed as
IDENT STAR IDENT or as WILDCARD_IDENT, but, again, there is no single token
to indicate this state change, only the context (i.e. the current parser
rule the parser sits in).

I am not sure if this is still context-free, is this even possible with
ANTLR?
If yes, could anyone please give me a hint how to handle this?

Thanks for any suggestions!

Best regards,
	Max





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list