[antlr-interest] Modifying lexer state from parser
Omry Yadan
omry at yadan.net
Mon Feb 12 07:44:25 PST 2007
Hi,
I want my lexer to start skipping whitespaces after a certain condition
is met in the Parser.
what I am trying to do is to access the lexer and modify it when this
condition is met.
something like this (note the magical $lexer.m_conditionMet which is
just wishful thinking):
class L extends Lexer;
{
boolean m_conditionMet= false;
}
WS
: ( ' '
| '\t'
)
{ if (m_conditionMet) $setType(Token.SKIP); };
class P extends Parser;
foo: bar{$lexer.m_conditionMet = true;}
Is that possible?
Omry.
More information about the antlr-interest
mailing list