ASTArray.java
上传用户:afrynkmhm
上传日期:2007-01-06
资源大小:1262k
文件大小:1k
源码类别:

编译器/解释器

开发平台:

Others

  1. package antlr.collections.impl;
  2. /* ANTLR Translator Generator
  3.  * Project led by Terence Parr at http://www.jGuru.com
  4.  * Software rights: http://www.antlr.org/RIGHTS.html
  5.  *
  6.  * $Id: //depot/code/org.antlr/release/antlr-2.7.0/antlr/collections/impl/ASTArray.java#1 $
  7.  */
  8. import antlr.collections.AST;
  9. /** ASTArray is a class that allows ANTLR to
  10.   * generate code that can create and initialize an array
  11.   * in one expression, like:
  12.   *    (new ASTArray(3)).add(x).add(y).add(z)
  13.   */
  14. public class ASTArray {
  15. public int size = 0;
  16. public AST[] array;
  17. public ASTArray(int capacity) {
  18. array = new AST[capacity];
  19. }
  20. public ASTArray add(AST node) {
  21. array[size++] = node;
  22. return this;
  23. }
  24. }