views:

23

answers:

1

Is it possible to do what I'm attempting here? Or, perhaps I'm approaching it wrong?

arrayDef
  : { int c = 0; }
    ('['']' {c++;})+
  -> ARRAY /* somehow inject c here */
  ;
A: 

Why not use the ChildCount of your ARRAY tree node?

arrayDef
    :   ('[' ']')+
        -> ^(ARRAY '['+)
    ;
280Z28
That worked nicely, thanks!
Sam Washburn