[antlr-interest] C TARGET: Strange No Viable Exception

register register72 at gmail.com
Mon Mar 26 13:19:05 PDT 2012


The original version of the file had a trailing newline. Removing it still
gets the same exception. However my grammar pushes every "blank" in the
Hidden Channel like this:


WS  :   ( ' '| '\t'| '\r'| '\n' )+ {$channel=HIDDEN;}

Luca


On Mon, Mar 26, 2012 at 9:58 PM, Jim Idle <jimi at temporal-wave.com> wrote:

> Do you have a trailing newline?
>
> Jim
>
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > bounces at antlr.org] On Behalf Of register
> > Sent: Monday, March 26, 2012 11:10 AM
> > To: antlr-interest at antlr.org
> > Subject: Re: [antlr-interest] C TARGET: Strange No Viable Exception
> >
> > I have just discovered another detail that could be useful to
> > troubleshoot the issue:
> >
> > when I create the lexer stream directly from an input file using
> > "antlr3FileStreamNew" I get no error at all; when I use
> > antlr3StringStreamNew to create the stream from a string in memory I
> > get the No viable exception.
> >
> > Luca
> >
> >
> > On Mon, Mar 26, 2012 at 7:28 PM, register <register72 at gmail.com> wrote:
> >
> > > Hi all,
> > > I have an antlr generated C  lexer that keeps on throwing several
> > "No
> > > Viable Exceptions" just at the end of the file. I have developed the
> > > grammar in AntlrWorks and the Java Lexer doesn't have any trouble at
> > all.
> > > The  ANTLR3_EXCEPTION struct passed to the "
> > >
> > > displayRecognitionError" method does not carry any useful
> > information:
> > >
> > > - expecting, token and expectingSet are all null
> > > - there is a mysmatch between the type and name field: type is 3
> > > (ANTLR3_NO_VIABLE_ALT_EXCEPTION) and name is
> > > "org.antlr.runtime.RecognitionException".
> > >
> > >
> > > However it seems that the grammar is always able to complete a
> > > successful parse of the files. I have made several attempts with
> > > various input and the results I get are always correct. Still this
> > "No
> > > Viable Exceptions" is pretty annoying.
> > > How could I debug this issue?
> > >
> > > Regards,
> > > Luca
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> > email-address
>
> 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