[antlr-interest] Building Treenodes from Kleene Closure
shmuel siegel
antlr at shmuelhome.mine.nu
Tue Feb 19 09:37:16 PST 2008
Dejas Ninethousand wrote:
> If I have the grammar:
>
>
> expression_list
> :
> expression (EXPRESSION_LIST_SEPARATOR expression)* -> EXPRESSION_LIST
> ;
>
> Is there anyway to build the AST such that /n
> /EXPRESSION_LIST_SEPARATOR nodes actually appear the number of times
> the separator appears in the input? If so, how would I express that
> on the right hand side of the arrow?
>
>
Am I not undertstanding your question? Will this do?
expression_list
:
e+=expression (EXPRESSION_LIST_SEPARATOR e+=expression)* ->
^(EXPRESSION_LIST $e+)
;
More information about the antlr-interest
mailing list