[antlr-interest] RES: Ignore "Mismatched input" and "No viable alternative"

Nilo Roberto C Paim nilopaim at gmail.com
Thu Jun 30 14:08:21 PDT 2011


Bart is right...

I need to discard complete lines and not just some unrecognized tokens. 

And really exists recognized tokens on lines I want to discard, 'cause these
tokens are in invalid places on the line...

I'm thinking in change the text file format, putting a "discard" token on
the beginning of the lines I want to discard (something like a "comment"
line), but these will take a little more time...

Thanks Bart and Robin for answering.

Regards,
Nilo - Brazil

-----Mensagem original-----
De: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] Em nome de Robin
Enviada em: quinta-feira, 30 de junho de 2011 17:46
Para: Bart Kiers
Cc: antlr-interest at antlr.org interest
Assunto: Re: [antlr-interest] Ignore "Mismatched input" and "No viable
alternative"

Good point :-)

On Thu, Jun 30, 2011 at 10:44 PM, Bart Kiers <bkiers at gmail.com> wrote:

> Perhaps, but Nilo is talking about discarding complete lines. Chances are
> that somewhere in these "ignored"-lines, text exists that looks like a
> token
> that _do_ need to be kept. That's why I asked for more info.
>
> Regards,
>
> Bart.
>
>
> On Thu, Jun 30, 2011 at 10:40 PM, Robin <diabeteman at gmail.com> wrote:
>
> > You could use the filter=true grammar option to discard tokens that
don't
> > match anything
> >
> >
> > On Thu, Jun 30, 2011 at 10:36 PM, Bart Kiers <bkiers at gmail.com> wrote:
> >
> >> Can you give an example of your input, and explain what line you want
to
> >> ignore?
> >>
> >> Regards,
> >>
> >> Bart.
> >>
> >>
> >> On Thu, Jun 30, 2011 at 10:33 PM, Nilo Roberto C Paim <
> nilopaim at gmail.com
> >> >wrote:
> >>
> >> > Hi all,
> >> >
> >> > I'm trying to parse a text file created by an application. There are
> >> lines
> >> > in this text file that I know perfectly their contents and format,
and
> >> > these
> >> > lines are correctly parsed.
> >> >
> >> > Otherwise, there are lines that can be recognized by any syntax I can
> >> think
> >> > about.
> >> >
> >> > When I parse the file with my syntax, I'm getting several occurrences
> of
> >> > "Mismatched input" and "No viable alternative" on the lines that I
> can't
> >> > recognize.
> >> >
> >> > What I want is simply throw away these invalid lines, as if them
would
> >> be
> >> > absent from the text file. For my purposes, these lines are
> >> "invisibles".
> >> >
> >> > How can I do that, ignoring the lexer/parser errors?
> >> >
> >> > TIA
> >> >
> >> > Nilo - Brasil
> >> >
> >> >
> >> > 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
> >>
> >
> >
>
> 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