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

Jim Idle jimi at temporal-wave.com
Tue Jun 19 08:58:44 PDT 2012


= 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


More information about the antlr-interest mailing list