ANTLR did not report an error for this syntactically wrong statement.. I am puzzled.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sun_set
Posted On:   Friday, February 8, 2002 03:54 AM

			
ruleA : "keywordA" (ruleB | ruleC)*;
ruleB : "keywordB" IDENT;
ruleC : "keywordC" IDENT;
IDENT : ( 'A'..'Z' | 'a'..'z' ) ( 'A'..'Z' | 'a'..'z' | '0'..'9' )*



Given this statement,



keywordA keywordB myIdentitier rubbish_now




how come ANTLR did not report an error? rubbish_now obviously does not follow any subrule in ruleA.

Re: ANTLR did not report an error for this syntactically wrong statement.. I am puzzled.

Posted By:   Monty_Zukowski  
Posted On:   Monday, February 11, 2002 07:00 AM

It's because ruleA isn't expecting anything after the subrule. Try


ruleA : ""keywordA"" (ruleB | ruleC)* EOF;


And you will see an error message.
About | Sitemap | Contact