1 package antlr.collections.impl;2 3 /* ANTLR Translator Generator4 * Project led by Terence Parr at http://www.jGuru.com5 * Software rights: http://www.antlr.org/RIGHTS.html6 *7 * $Id: //depot/code/org.antlr/main/main/antlr/collections/impl/ASTArray.java#4 $8 */9 10 import antlr.collections.AST;11 12 /** ASTArray is a class that allows ANTLR to13 * generate code that can create and initialize an array14 * in one expression, like:15 * (new ASTArray(3)).add(x).add(y).add(z)16 */17 public class ASTArray {18 public int size = 0;19 public AST[] array;20 21 22 public ASTArray(int capacity) {23 array = new AST[capacity];24 }25 26 public ASTArray add(AST node) {27 array[size++] = node;28 return this;29 }30 }31