[antlr-interest] return result of a rule reference directly

Martin Probst mail at martin-probst.com
Fri Jun 2 09:58:17 PDT 2006


> I was wondering is it possible to return the result of a rule
> reference directly (without instantiating a variable).

The problem is with the generated code, which has code paths that  
don't go through the assignment. However, you can reduce bloat by  
initializing it (I presume you mean initializing, no?) in the  
declaration, e.g.

yellow_rule
returns [String name = ""]
:
  ....

Regards,
Martin


More information about the antlr-interest mailing list