[antlr-interest] NoViableAlException

Fabian Haupt fabian at fabianhaupt.de
Fri Nov 12 15:41:39 PST 2010


yep ;) I want a nicer view of the dbase structure (and errors)


On 11/12/2010 10:10 PM, Jim Idle wrote:
> 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
>
>
> 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