[antlr-interest] ANTLR tree walker , multiple times return....

Michael Angelo mangelo.mailing at gmail.com
Wed Jun 20 12:34:02 PDT 2012


I've seen a few of you mention '=' and '+=' operators in the grammar, but I
can't find any docs on them.

Can I get a quick rundown of these?

Thanks!


On Tue, Jun 19, 2012 at 11:58 AM, Jim Idle <jimi at temporal-wave.com> wrote:

> = gives the current parameter
> += accumulates a list of them
>
> Should be obvious from there?
>
> Jim
>
> On Jun 19, 2012, at 9:20 PM, Felix.徐 <ygnhzeus at gmail.com> wrote:
>
> > Hi,all .
> >
> > I have a tree walker like this:
> >
> > function:
> >    ^(FUNCTION_TOK fcname=IDENTIFIER param=functionParameters*){
> >        a_param_arrayList.add(param);
> >    }
> > ;
> >
> > functionParameters returns [Object sth]:
> >    ^(PARAM_TOK value=IDENTIFIER){ sth = $value.getText();}
> > ;
> >
> > This is a simple scenario,I just want to add the parameters to an
> > arraylist, but the code above(*a_param_arrayList.add(param)*) will only
> > collects the first parameter and ignores the
> > others.But*functionParameters* actually
> > parases multiple parameters.
> >
> > Does anyone know how to fix this tree walker? Thanks very much!
> >
> > 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