[antlr-interest] ANTLR3 has an equivalent of LA(1)?

Liviu U liviu.u at gmail.com
Tue Feb 10 01:03:05 PST 2009


Hi all,

I am new to ANTLR. I have an old grammar to start from. I use antlr3
with CSharp2 target.
The condition does not compile:

 */
NUM_INT
	:	('0'..'9')+ // everything starts with a digit sequence
		(	(	{(LA(2)!='.')&&(LA(2)!=')')}?				// force k=2; avoid ".."
//PSPSPS example ARRAY (.1..99.) OF char; // after .. thinks it's a NUM_REAL
				'.' {state.type = NUM_REAL;}	// dot means we are float
				('0'..'9')+ (EXPONENT)?
			)?
		|	EXPONENT {state.type = NUM_REAL;}	// 'E' means we are float
		)
	;

But,  the function: LA(2)  is not defined? Is there an equivalent?

Thank you


More information about the antlr-interest mailing list