[antlr-interest] rule returns

Alexander Gängel alexander at gaengel.de
Wed Apr 9 16:27:36 PDT 2008


I am wonder in if it is possible to define a rule return with the name 
of an predefined rule attribute.

so I tested it an it is possible. And don't get an Warning. I don't 
think this behavior is intended.

here my test Grammar:

    rule    :
            subrule+ {System.out.println($subrule.text);} EOF
        ;

    subrule returns[String text] :Identifier;

    Identifier
        :   ('a'..'z'|'A'..'Z'|) ;

for the Input test I get the Output null

it I remove the return statement from subrule the input test generates 
the Output test

Alexander



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080410/1133df52/attachment.html 


More information about the antlr-interest mailing list