[antlr-interest] newbi question : operator + any

Gabriel Miro gsmiro at gmail.com
Tue Feb 7 09:30:10 PST 2012


The problem is that ANYTHING also matches '>'. What Gokul is suggesting
will make ANYTHING match all characters that are not '>' and COMPARE match
'>' only. Give us more info and we might be able to give further help.

Miró

On Tue, Feb 7, 2012 at 3:02 PM, Gokulakannan Somasundaram <
gokul007 at gmail.com> wrote:

> ANTLR is appropriate. Keep that constant. OK i should have tried before
> posting. This helps, but i don't know, whether this would suffice your
> requirement.
>
>
> COMPARE : '>';
>
> ANYTHING : (~('>'))*;
>
> testExpression : COMPARE ANYTHING;
>
> Or please explain me, what are you trying to do.
>
> Gokul.
>
> On Tue, Feb 7, 2012 at 3:44 PM, Marco Laponder <marco.laponder at kewill.com
> >wrote:
>
> >  This still gives me the same error, any other ideas ? Of is antlr just
> > not appropriate for this ?****
> >
> > ** **
> >
> > Kind regards,****
> >
> > Marco****
> >
> > ** **
> >  ------------------------------
> >
> > *Van:* Gokulakannan Somasundaram [mailto:gokul007 at gmail.com]
> > *Verzonden:* maandag 6 februari 2012 16:56
> > *Aan:* Marco Laponder
> > *CC:* antlr-interest at antlr.org
> > *Onderwerp:* Re: [antlr-interest] newbi question : operator + any****
> >
> > ** **
> >
> > COMPARE : '>';
> >
> > ANYTHING : (~'>')(.)*;
> >
> > testExpression : COMPARE ANYTHING; ****
> >
> > ** **
> >
> > ** **
> >
> > Try this.****
> >
> > ** **
> >
> > Gokul.****
> >
> > On Mon, Feb 6, 2012 at 8:30 PM, Marco Laponder <
> marco.laponder at kewill.com>
> > wrote:****
> >
> > Hi All,
> >
> >
> >
> > I am trying to setup a very simple grammar, ik should be able to handle
> >
> >
> >
> > "> thiscouldbeanything"
> >
> >
> >
> > So I tried:
> >
> >
> >
> > COMPARE : '>';
> >
> > ANYTHING : (.)+;
> >
> > testExpression : COMPARE ANYTHING;
> >
> >
> >
> > but when generating java resources it gave me the error:
> >
> >
> >
> > "The following alternatives can never be matched: 1"
> >
> >
> >
> > The problems seems to be the ANYTHING, so how should I define a grammar
> > to be able to handle this ?
> >
> >
> >
> > Kind regards,
> >
> > Marco
> >
> >
> > 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