[antlr-interest] Find X :-)
Sameh W. Zaky
sameh.wz at gmail.com
Tue May 18 07:35:36 PDT 2010
Dear All,
I have in my grammar:
fragment UNIT_NAME :;
ID : ('a'..'z'|'_')*
{
if ( myLookUpMethod( *X* ) ) $type=UNIT_NAME;
}
;
===============================
Instead of *X*, I wanna refer to the text that is in red.. For example, the
token "w_aw_s" is ID. I want to take the text of this token "w_aw_s" and
look it up in a certain array and if it is in this array then I set its type
to UNIT_NAME.
P.S.: I tried to replace *X* with *$text* but I receive the error:
[16:15:56] symbol : method myLookUpMethod(java.lang.String)
[16:15:56] location: class SimpleTestLexer
[16:15:56] if(myLookUpMethod(getText())) _type=UNIT_NAME;
[16:15:56] ^
[16:15:56] 1 error
Find X :-)
Many Thanks !
--
Sameh W. Zaky
More information about the antlr-interest
mailing list