[antlr-interest] Stupid problem (Antlr 2.7.6)

Jose Ventura jose.ventura.roda at gmail.com
Mon Jan 29 01:01:29 PST 2007


Thank's Xue.

I'm still thinking why in another parser i have:

relationalExpression
    : e1:sumExpression (o:op e2:sumExpression)*

{ *if* (#e2==*null*) // a=10 or 2 --> entra '2'

....
And run. I don't know why.

Thank's again.



2007/1/26, Xue Yong Zhi <zhixueyong at hotmail.com>:
>
> Jose Ventura wrote:
> > With this very simple antlr parser I have problems generating java
> program
> >
> >  class pru extends Parser;
> >  copy: la:"COPY"    {System.out.println (#la.getText());};
> >
> > Antlr generate
> >
> >  try { // for error handling
> >    la = LT(1);
> >    match(LITERAL_COPY);
> >    System.out.println (#la.getText());
> >  }
> >
> > Wy don't translate the #?
> >
> > Is a stupid question, sure. But I don't see it.
> >
> > Any help? Thank's.
> >
>
> You do not need one. Just use
> copy: la:"COPY"    {System.out.println (la.getText());};
>
> --
> Xue Yong Zhi
> http://seclib.blogspot.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070129/f50a9d38/attachment.html 


More information about the antlr-interest mailing list