1 package antlr.collections.impl; 2 3 import antlr.collections.AST; 4 5 /** ASTArray is a class that allows ANTLR to 6 * generate code that can create and initialize an array 7 * in one expression, like: 8 * (new ASTArray(3)).add(x).add(y).add(z) 9 */ 10 11 public class ASTArray { 12 public int size = 0; 13 public AST[] array; 14 15 16 public ASTArray(int capacity) { 17 array = new AST[capacity]; 18 } 19 public ASTArray add(AST node) { 20 array[size++] = node; 21 /* if ( node!=null ) { 22 array[size++] = node; 23 } 24 */ 25 return this; 26 } 27 } 28