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

Jim Idle jimi at temporal-wave.com
Wed Oct 6 08:31:05 PDT 2010


IDN '{' ( modelDefinition* | modelDefinitions ) '}'

And

System.out.println($IDN.text);


> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of serge fukanchik
> Sent: Wednesday, October 06, 2010 5:48 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Token is not generated for IDN blah... and
generated
> for blah... IDN
> 
> 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_simpleDictionaryDefinition2
> 36);
> 
>                     		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
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address



More information about the antlr-interest mailing list