On Wed, 2008-09-17 at 17:06 -0700, Terence Parr wrote: > On Sep 17, 2008, at 5:05 PM, Jim Idle wrote: > > > On Wed, 2008-09-17 at 17:02 -0700, Terence Parr wrote: > >> > >> On Sep 17, 2008, at 3:50 PM, Sam Harwell wrote: > >> > >> > In the past, I noted that one of the ANTLR compile errors was > >> > checking a visual ambiguity and not a syntactic ambiguity. In order > >> > to work around the error, I have placed a label (“right=”) on one > >> of > >> > the references in the following rule. However, I still get: > >> > > >> > error 132: reference $assign_expression is ambiguous; rule > >> > assign_expression is enclosing rule and referenced in the > >> production > >> > (assuming enclosing rule) > >> > > >> > assign_expression > >> > : ( ternary_expression > >> > -> ternary_expression > >> > ) > >> > ( assignment_operator > >> > right=assign_expression > >> > -> ^(assignment_operator $assign_expression > >> > $right) > >> > )? > >> > ; > >> > >> Because it is ambiguous, I elected to give an error message. Yep, we > >> do need a way to reference the entire outer rule's tree. should it > >> be $ > >> $? > > > > As in: $$assignment_operator, or just $$ ? > > Just $$. I guess I was thinking about ## shorthand from version 2 > antlr. $this and $self make me nervous because they are normally > associate with objects and might refer to the current grammar/parser > not the rule.
Works for me! > > T
_______________________________________________ antlr-dev mailing list [email protected] http://www.antlr.org:8080/mailman/listinfo/antlr-dev
