[antlr-interest] Controlling Lexer from Parser

Gokulakannan Somasundaram gokul007 at gmail.com
Thu Dec 3 02:07:43 PST 2009

   I have seen some relevant articles in the FAQ. But i want to know,
whether the following approach will always work for me.

I am trying to parse a SQL grammar, in which the SQL Keywords are sometime
allowed as table names / column names.
a)  Say when i am expecting a table_name /column name from parser, i set a
global variable called x.
b) i check this x to set the token type of that particular token.

This will succeed only if the parser completes executing the parsing actions
before trying to make tokens out of the inputstream. Is it always the case
with ANTLR? I see no reason why this should not work, but i want to make
sure. (The Lexer and  Parser are in different grammar files)

Thanks in Advance,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091203/df4070a8/attachment.html 

More information about the antlr-interest mailing list