[antlr-interest] Token is not generated for IDN blah... and generated for blah... IDN

serge fukanchik fuxx at mail.ru
Wed Oct 6 05:47:33 PDT 2010


Hi,
my problem is value of the token IDN in the code below:

when the definition is as wollows:
simpleDictionaryDefinition
    : IDN '{' modelDefinition* | modelDefinitions '}'
	{
		System.out.println($IDN);
	}
    ;

antlr generates the following java code:
match(input,10,FOLLOW_10_in_simpleDictionaryDefinition238); 

System.out.println(IDN);

then System.out.println obviously fails to compile.

and when the definition is as follows:
simpleDictionaryDefinition
    : '{' modelDefinition* | modelDefinitions '}' IDN
	{
		System.out.println("2 "+$IDN);
	}
    ;

antl generates the following:
                    IDN1=(Token)match(input,IDN,FOLLOW_IDN_in_simpleDictionaryDefinition236); 

                    		System.out.println(IDN1);

this compiles and works.

My question is - is this by design or a bug? And how can i make it generate token for me?

Thank you in advance!
---
Sergey



More information about the antlr-interest mailing list