[antlr-interest] tree rewrite ambiguous enclosing rule/referenced in production

Tim Williams williamstw at gmail.com
Wed Aug 12 18:45:43 PDT 2009


For the scopedClause rule below, I'm getting this error(132):
"$scopedClause is ambiguous; rule scopedClause is enclosing rule and
referenced in the production (assuming enclosing rule)"

I've had a similar rule working before.  I also tried Jim's suggestion
of just rewriting it inline and changing the .type of the Token to OR
but got a "cannot write to read-only attribute problem".  Hopefully,
below is enough for someone to gather what I'm attempting to achieve?
Thanks,
--tim

scopedClause:	
	LPAREN (scopedClause->scopedClause) ((OR_TOKEN s2=scopedClause) ->
^(OR $scopedClause $s2))+ RPAREN
    | LPAREN (scopedClause->scopedClause) ((AND_TOKEN s2=scopedClause)
-> ^(AND $scopedClause $s2))+ RPAREN
    | LPAREN (scopedClause->scopedClause) ((NOT_TOKEN s2=scopedClause)
-> ^(NOT $scopedClause $s2))+ RPAREN
	| searchClause
		-> searchClause
	;


More information about the antlr-interest mailing list