[antlr-interest] Lexer doesn't agree with me (gives other tokens than I need)

Bill Mayfield antlrinterest at gmail.com
Sat Apr 11 16:31:09 PDT 2009


Hi,

I'm creating a parser for a SQL dialect (sue me :oP) and I'm facing a
problem regarding the lexer generating the wrong kind of token in a certain
context.

Basically I have defined two tokens called LEFT & RIGHT which are needed to
parse SQL joins (left outer join, right outer join, etc...)

LEFT : 'left' ;
RIGHT : 'right' ;

The problem occurs when I'm matching the SQL *functions* LEFT & RIGHT.

LEFT (functionArgs)
RIGHT (functionArgs)

I want the function name to be an IDENTIFIER token but no can do due to the
lexer... It gives me a LEFT or RIGHT token obviously :'o(


What are the general recommendations you experienced ANTLR buffs can give
me?  The parser is generating an AST so I don't really care how it matches
as long as I can keep my AST neat 'n tidy :o/



Thanks!
Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090412/fce27116/attachment.html 


More information about the antlr-interest mailing list