blob: 34022cfd6743a023af82f2702780af45f8362bf8 [file] [log] [blame]
/*******************************************************************************
* 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 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 ListRuleBody extends GymnastASTNode {
private SimpleExpr _listExpr;
private GymnastTokenNode _lparen;
private SimpleExpr _separator;
private SimpleExpr _listExpr2;
private GymnastTokenNode _rparen;
private ListMark _listMark;
public SimpleExpr getListExpr() {
return _listExpr;
}
public GymnastTokenNode getLparen() {
return _lparen;
}
public SimpleExpr getSeparator() {
return _separator;
}
public SimpleExpr getListExpr2() {
return _listExpr2;
}
public GymnastTokenNode getRparen() {
return _rparen;
}
public ListMark getListMark() {
return _listMark;
}
/**
* @return the number of children of this ASTNode
*/
public int getChildCount() {
int count = 0;
if (_listExpr != null) count++;
if (_lparen != null) count++;
if (_separator != null) count++;
if (_listExpr2 != null) count++;
if (_rparen != null) count++;
if (_listMark != null) count++;
return count;
}
/**
* @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) {
int count = -1;
if ((_listExpr != null) && (++count == index)) return _listExpr;
if ((_lparen != null) && (++count == index)) return _lparen;
if ((_separator != null) && (++count == index)) return _separator;
if ((_listExpr2 != null) && (++count == index)) return _listExpr2;
if ((_rparen != null) && (++count == index)) return _rparen;
if ((_listMark != null) && (++count == index)) return _listMark;
throw new IndexOutOfBoundsException();
}
/**
* Construct a new ListRuleBody.
*/
public ListRuleBody(
SimpleExpr listExpr,
Token lparen,
SimpleExpr separator,
SimpleExpr listExpr2,
Token rparen,
ListMark listMark
) {
super();
if (listExpr != null) {
_listExpr = listExpr;
if (_listExpr._parent != null) throw new RuntimeException();
_listExpr._parent = this;
}
if (lparen != null) {
_lparen = new GymnastTokenNode(lparen);
if (_lparen._parent != null) throw new RuntimeException();
_lparen._parent = this;
}
if (separator != null) {
_separator = separator;
if (_separator._parent != null) throw new RuntimeException();
_separator._parent = this;
}
if (listExpr2 != null) {
_listExpr2 = listExpr2;
if (_listExpr2._parent != null) throw new RuntimeException();
_listExpr2._parent = this;
}
if (rparen != null) {
_rparen = new GymnastTokenNode(rparen);
if (_rparen._parent != null) throw new RuntimeException();
_rparen._parent = this;
}
if (listMark != null) {
_listMark = listMark;
if (_listMark._parent != null) throw new RuntimeException();
_listMark._parent = this;
}
}
/**
* 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);
}
}