weird. wait. does $stop work for tree grammars? you might try input.LT(-1) or
-2.
T
On Feb 5, 2010, at 11:36 AM, Chris DiGiano wrote:
> I've read and reread the documentation on the $stop attributes of
> rules, but I can't for the life of me figure out how to use it to get
> the last matched node. Here's what I want to do:
>
> impliedQualifiedName returns [Tree idNode]
> @after {
> $idNode = $stop; // I also tried $impliedQualifiedName.stop
> }
> : Identifier
> | ^( BYFIELD qn=impliedQualifiedName Identifier )
> ;
>
> But I get the error "attribute is not a token, parameter, or return
> value: stop".
>
> Instead I have to do:
>
> impliedQualifiedName returns [Tree idNode]
> : Identifier { $idNode = $Identifier; }
> | ^( BYFIELD qn=impliedQualifiedName Identifier )
> { $idNode = $Identifier; }
> ;
>
> What am I doing wrong?
>
> Chris
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.