[antlr-interest] Possible bug in (not) setting TokenStartIndex and TokenStopIndex during AST rewrites

Sam Harwell sharwell at pixelminegames.com
Wed Aug 6 11:34:36 PDT 2008


If you take the following rule:

postfix_expression
	:	(	IDENTIFIER
			-> ^(IDENTIFIER)
		)
		(	'.' IDENTIFIER
			-> ^(AST_DIRECT_MEMBER $postfix_expression
IDENTIFIER)
		)*
	;


And run it on the following input:

a.b.c

You get the following AST:

AST_DIRECT_MEMBER /* has Token Start/Stop Info set */
- AST_DIRECT_MEMBER /* DOES NOT have Token Start/Stop Info set! */
-- a /* has Token Start/Stop Info set */
-- b /* has Token Start/Stop Info set */
- c /* has Token Start/Stop Info set */




More information about the antlr-interest mailing list