[antlr-interest] Newbie: problem with semantic differentiation in the lexer

Ulrich Frank Ulrich.Frank at dlr.de
Tue Feb 14 06:48:00 PST 2006


Hello,

I have the following problem. In the lexer I define the following rules

protected CHAR : ('a'..'z') ;
protected DIGIT : ('0'..'9') ;
IDENT : (CHAR | DIGIT)+ ;

In the parser I have a rule like

query : "from" IDENT "select" IDENT ;

Because I want to develop a query editor I want to extend it with an 
auto completion mechanism. This means at the position of IDENT after 
'from' I want to choose between all existing objects coming from an 
repository and at the position of IDENT after 'select' I want to show 
all available attributes corresponding to the object selected after 'from'.
To do this, I have to distinguish between both of these IDENTs. So how 
can I do this???? Any proposals? Please help.


More information about the antlr-interest mailing list