ANTLR3 inject an int into my tree
-
24-09-2019 - |
Question
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 */
;
Solution
Why not use the ChildCount
of your ARRAY
tree node?
arrayDef
: ('[' ']')+
-> ^(ARRAY '['+)
;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow