[antlr-interest] Where the conflict comes from (java arrayInitializer)?

Yong zhixueyong at hotmail.com
Thu Nov 24 19:26:21 PST 2005


I am reading the java 1.3 grammar (java.g), and can not understand the 
arrayInitializer rule. I have read the embedded comment several times, but still 
do not know where the conflict comes from so that we have to shut it down.

As far as I know, arrayInitializer can only end with RCURLY or COMMA RCURLY, so 
antlr should have no difficulty to predict the exit branch if K >= 2.

The question may have been asked before, but I failed to find it on google.
Thank you very much and have a good holiday!

arrayInitializer
		:	LCURLY
				(	initializer
					(
						// CONFLICT: does a COMMA after an 
initializer start a new
						//           initializer or start the option 
',' at end?
						//           ANTLR generates proper code by 
matching
						//			 the comma as soon as 
possible.
						options {
							warnWhenFollowAmbig = false;
						}
					:
						COMMA! initializer
					)*
					(COMMA!)?
				)?
			RCURLY
		;




More information about the antlr-interest mailing list