[antlr-interest] newbie problem with mismatched token in antr v3

Norbert Kiesel nkiesel at tbdnetworks.com
Tue Oct 16 23:18:49 PDT 2007


On Wed, 2007-10-17 at 00:20 -0400, Austin Hastings wrote:
> Norbert,
> 
> There's a solitary apostrophe in your ITFNAME rule that probably doesn't 
> belong.  Also, you're defining ITFNAME as something with spaces in the 
> middle. Is that what you intended?

Yeah, that ' is bogus: I trimmed down the grammar a bit more to get a
shorter posting and forgot to make sure it still had the same result.
Sorry for that.  However, the problem prevails.  Regarding the 'space in
ITFNAME': don't blame me, blame Cisco. I'm trying to parse some IOS
config snipplets, and IOS accepts both "ip interface Ethernet 0/3" and
"ip interface Ethernet0/3" and treats it as identical.

I trimmed the grammar down even more (it's of course useless in that
form), and I still get the same error:

grammar itf;
itf	  	: 'interface' ' ' itfname EOF ;
itfname		:  ITFNAME ;
ITFNAME		: ( 'a'..'z' )+ ' ' ( '0' | '9' )+ ;

BTW: the problem goes away if I drop any of the characters that make up
'interface' from the 'a'..'z' in ITFNAME.

Best,
  Norbert



More information about the antlr-interest mailing list