Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9cfadb45918311944cd4d139ef980f4c03ce8dd0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*******************************************************************************
 * Copyright (c) 2004, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.gymnast.generator.core.ast;

import java.util.ArrayList;

import org.eclipse.gymnast.runtime.core.ast.ASTNode;

import antlr.Token;


/**
 *
 * @generated by Gymnast from gymnast.ast on Aug 15, 2004 2:28:15 PM
 */
public class Grammar extends GymnastASTNode {

	private ArrayList _children = new ArrayList();
	
	/**
	 * @return the number of children of this ASTNode
	 */
	public int getChildCount() {
		return _children.size();
	}

	/**
	 * @param index the index of a child ASTNode to get
	 * @return the child ASTNode at the given index
	 * @throws IndexOutOfBoundsException when the index is out of bounds
	 */
	public ASTNode getChild(int index) {
		return (ASTNode)_children.get(index);
	}

	/**
	 * Add a child to this list.
	 */
	public void addChild(GymnastASTNode child) {
		if (child == null) return;
		if (child._parent != null) throw new RuntimeException();
		_children.add(child);
		child._parent = this;
	}

	/**
	 * Wrap the provided Token in a GymnastTokenNode
	 * and add it as a child of this node.
	 * 
	 * @param token the Token to be added as a child of this node
	 */
	public void addChild(Token token) {
		addChild(new GymnastTokenNode(token));
	}

	/**
	 * Construct a new Grammar.
	 */
	public Grammar() {
		super();
	}

	/**
	 * This method overrides the superclass <code>acceptImpl</code> providing
	 * the same implementation.  Here <code>this</code> refers to this specific node
	 * class, so the <code>beginVisit</code> and <code>endVisit</code> methods
	 * specific to this type in the visitor will be invoked.
	 */
	public void acceptImpl(GymnastASTNodeVisitor visitor) {
		boolean visitChildren = visitor.beginVisit(this);
		if (visitChildren) visitChildren(visitor);
		visitor.endVisit(this);
	}

}

Back to the top