[antlr-interest] NoViableAlException

Jim Idle jimi at temporal-wave.com
Fri Nov 12 13:10:53 PST 2010


Parsing cache error messages eh?


> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Joachim Schrod
> Sent: Thursday, November 11, 2010 7:01 PM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] NoViableAlException
> 
> Fabian Haupt wrote:
> >
> > I'm getting a NoViableAltException: line 1:55 no viable alternative
> at
> > input '.[CheckIntegrity'
> >
> > with the input of
> > 'The lower level block specifies a right link block of 0.
> > [CheckIntegrity+343^%SYS.DATABASE:%SYS]'
> > starting with the 'test' rule.
> >
> >
> > this is the grammar:
> > ----------------------------
> > grammar integrit;
> >
> > options {
> >    language= Java;
> > }
> >
> >
> > test:'The lower level block specifies a right link block of '+INT+'.'
> > WS debugnote NEWLINE;
> >
> > firstNodePtrWrong: INT+'. We were expecting it to point to ';
> >
> >
> > debugnote:'['+ID+'+'+INT+'^%SYS.DATABASE:%SYS'+']';
> >
> > ID  :   ('a'..'z'|'A'..'Z')+ ;
> > INT :   '0'..'9'+ ;
> > NEWLINE:('\r'? '\n');
> > WS  :   (' '|'\t')+ {skip();} ;
> 
> Without running it --
> You demand a WS in the test rule that will never appear there as you
> skip that token. Don't you mean NEWLINE there?

This is correct, you are asking for WS that will be skipped, but also, hard
coding the specific message is so long will get you in to trouble I think.
You are probably better off with awk for something like this I think.


Jim



More information about the antlr-interest mailing list