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