[antlr-interest] Find X :-)

Sameh W. Zaky sameh.wz at gmail.com
Tue May 18 08:10:30 PDT 2010


OK, Sorry for that!

Just after I have sent this message I realized that the problem is that
ANTLR cannot find my method myLookUpMethod..
I have defined it in @members{} part of the grammar file.. But ANTLR still
cannot find it.. Any idea?

On Tue, May 18, 2010 at 4:35 PM, Sameh W. Zaky <sameh.wz at gmail.com> wrote:

> 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
>



-- 
Sameh W. Zaky


More information about the antlr-interest mailing list