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

Felix.徐 ygnhzeus at gmail.com
Tue Jun 19 06:20:00 PDT 2012


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!


More information about the antlr-interest mailing list