01: package antlr.collections.impl;
02:
03: /* ANTLR Translator Generator
04: * Project led by Terence Parr at http://www.cs.usfca.edu
05: * Software rights: http://www.antlr.org/license.html
06: */
07:
08: import antlr.collections.AST;
09:
10: /** ASTArray is a class that allows ANTLR to
11: * generate code that can create and initialize an array
12: * in one expression, like:
13: * (new ASTArray(3)).add(x).add(y).add(z)
14: */
15: public class ASTArray {
16: public int size = 0;
17: public AST[] array;
18:
19: public ASTArray(int capacity) {
20: array = new AST[capacity];
21: }
22:
23: public ASTArray add(AST node) {
24: array[size++] = node;
25: return this;
26: }
27: }
|