[antlr-interest] pass state from parser to lexer

Bart Kiers bkiers at gmail.com
Mon Jul 2 12:15:05 PDT 2012


On Mon, Jul 2, 2012 at 9:02 PM, Scobie Smith (Insight Global) <
v-scobis at microsoft.com> wrote:

> Is there a way to pass state information from the parser to the lexer? I
> am continually facing situations where the lexer should tokenize
> differently based on the parser rule. I have seen this question about ANTLR
> discussed on the web, but so far I haven't seen any solutions.
>
>
ANTLR's lexer operates independently from the parser, so the "easy" answer
would be: you can't.
However, there are several ways to make the lexer (a bit) context
sensitive. Could you explain what problem you're actually trying to solve
here?

Regards,

Bart.


More information about the antlr-interest mailing list