jparse.stmt
Class IfElseAST

java.lang.Object
  extended byantlr.BaseAST
      extended byantlr.CommonAST
          extended byantlr.CommonASTWithHiddenTokens
              extended byjparse.JavaAST
                  extended byjparse.stmt.StatementAST
                      extended byjparse.stmt.IfElseAST
All Implemented Interfaces:
antlr.collections.AST, HasExceptions, Serializable

public final class IfElseAST
extends StatementAST

An AST node that represents an if-else statement

Author:
Jerry James
See Also:
Serialized Form

Field Summary
private  ExpressionAST condition
          The conditional
private  StatementAST elseStmt
          The "else" statement
private  StatementAST thenStmt
          The "then" statement
 
Fields inherited from class jparse.stmt.StatementAST
control, exceptions, next, nonlocal
 
Fields inherited from class jparse.JavaAST
context, currSymTable, noTypes, symTable, topLevel, typeAST
 
Fields inherited from class antlr.CommonASTWithHiddenTokens
hiddenAfter, hiddenBefore
 
Fields inherited from class antlr.CommonAST
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
IfElseAST(antlr.Token token)
          Create a new if-else statement AST
 
Method Summary
protected  StatementAST[] computeControl()
          Compute the list of points to which control might flow after this statement
protected  Type[] computeExceptions()
          Compute the checked exception types that might be thrown by this statement
 ExpressionAST getCondition()
          Get the condition of the if statement
 StatementAST getElse()
          Get the else part of the if statement
 StatementAST getThen()
          Get the then part of the if statement
 VarList getVarList()
          Get the list of variables read, written, and declared by this statement
 void parseComplete()
          Compute any derived attributes that must be evaluated after the initial parse.
 
Methods inherited from class jparse.stmt.StatementAST
getExceptionTypes, nextControlPoints
 
Methods inherited from class jparse.JavaAST
print, printHiddenAfter, printHiddenBefore
 
Methods inherited from class antlr.CommonASTWithHiddenTokens
getHiddenAfter, getHiddenBefore, initialize
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getColumn, getFirstChild, getLine, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toString, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

condition

private ExpressionAST condition
The conditional


thenStmt

private StatementAST thenStmt
The "then" statement


elseStmt

private StatementAST elseStmt
The "else" statement

Constructor Detail

IfElseAST

public IfElseAST(antlr.Token token)
Create a new if-else statement AST

Parameters:
token - the token represented by this AST node
Method Detail

parseComplete

public void parseComplete()
Description copied from class: JavaAST
Compute any derived attributes that must be evaluated after the initial parse. The default action is to just tell your children that the parse is complete.

Overrides:
parseComplete in class StatementAST

computeExceptions

protected Type[] computeExceptions()
Description copied from class: StatementAST
Compute the checked exception types that might be thrown by this statement

Specified by:
computeExceptions in class StatementAST
Returns:
an array of types representing the exceptions that this statement might throw

computeControl

protected StatementAST[] computeControl()
Description copied from class: StatementAST
Compute the list of points to which control might flow after this statement

Specified by:
computeControl in class StatementAST
Returns:
a list of statements to which control might pass from this one

getVarList

public VarList getVarList()
Description copied from class: StatementAST
Get the list of variables read, written, and declared by this statement

Specified by:
getVarList in class StatementAST
Returns:
the list of variables read, written, and declared by this statement

getCondition

public ExpressionAST getCondition()
Get the condition of the if statement

Returns:
the condition

getThen

public StatementAST getThen()
Get the then part of the if statement

Returns:
the then part

getElse

public StatementAST getElse()
Get the else part of the if statement

Returns:
the else part