[antlr-interest] Scopes and return values
Kay Roepke
kroepke at classdump.org
Thu Nov 30 16:39:23 PST 2006
On 1. Dec 2006, at 1:25 , Kay Roepke wrote:
> Otherwise use a @member directive and a @finally action in rule file:
>
> @members {
> FileData currentData;
> }
> @init {
> currentData = null;
> }
>
> file
> returns [ FileData data ]
> @init {
> currentData = new FileData();
> }
> @finally {
> $data = currentData;
> }
> : fileItem* EOF
> ;
>
> fileItem [ FileData data ]
> : someOtherRule { if (currentData != null) currentData.AddFileItem
> (...); }
> ;
>
Tthe parameter of fileItem is a copy&paste error, of course...
-k
--
Kay Röpke
http://classdump.org/
More information about the antlr-interest
mailing list