[antlr-interest] Bug when creating variable for parser (ANTLR 2.7.2)?

defordusa defordusa at yahoo.com
Wed Jun 11 05:56:23 PDT 2003


Is it a bug or by design that no variable "f1" is created in the 
parser?
I have had to create an instance member "fpInstVar" in order to 
properly
grab the contents of fp.

If I try to use "f1" I get a variable not defined error.

I am using ANTLER 2.7.2

========== grammar snippet ==========

{
   ...
   ...
   Token fpInstVar = null;    //  <== Creation of fpInstVar
   ...
   ...
}

...
...
...


fpname  :
            f1:fp      //  <=== Creation of f1 (f1 NEVER CREATED)
            (
              {
                fpInstVar= LT(1); // Contains contents of fp.
              }
              f2:TX
              (
                f3:TX
                (
                  f4:TX
                  (
                    {
                      System.out.println( f1.getText() ); // <= ERROR!
                      System.out.println( 
fpInstVar.getText() );
                      System.out.println( f2.getText() );
                      System.out.println( f3.getText() );
                      System.out.println( f4.getText() );
                    }
                  )

...
...
...


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list