[antlr-interest] Use of $text within parser rule changes return type of the rule?

Chuck chuck_1234567 at yahoo.com
Wed Apr 16 11:49:20 PDT 2008


The following parser rule 

  rule1 returns [String rStr] : ID ;

generates a rule with the following return type:

 public final String rule1() throws
RecognitionException {

But if I add an action that uses the predefined rule
attribute "$text" such as the following line:

  rule1 returns [String rStr] : ID
{System.out.println($text);} ;

it changes the return type of the rule to the
following:

 public final TgramParser.rule1_return rule1() throws
RecognitionException {
 
Is this behavior a bug or are there some restrictions
on using using prefined rule attributes 
in conjunction with return types?

thanks

Chuck



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


More information about the antlr-interest mailing list