Hello all, I think I should probably apologize in advance for this question because (a) it's probably really obvious and (b) I know it's been asked before but as a newbie I've had trouble understanding the previous posts or finding the solution in the book.
In my parser grammar: expr_list : (expr (',' expr)* )? -> ^(EXPR_LIST expr*) ; In my tree grammar: expr_list returns [List<Double> values] : ^(EXPR_LIST expr*) { $values = new ArrayList<Double>(); int n = $EXPR_LIST.getChildCount(); for (int i = 0; i < n; i++) { $values.add($expr.value); } } ; Yuck !! I can see I'm doing ANTLR's work here insstead of letting it work for me - but I haven't been able to see how to collect the values of 0 or more expressions. I understand that I can't use list label syntax here because I don't have output=AST for the tree grammar. I can see by looking at the generated walker code that there is a loop iterating through the expr values, after which my ugly code does the same thing ! I'd be pathetically grateful if someone could point me in the right direction here :-) Michael List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---