jparse
Class CompileContext

java.lang.Object
  extended byjparse.CompileContext

public final class CompileContext
extends Object

Information about the compilation context so that individual AST nodes can set up needed values

Author:
Jerry James

Field Summary
private  LinkedList breakTarget
          The current targets for break statements; i.e., the closest enclosing for, while, do-while, or switch statements.
private  LinkedList continueTarget
          The current targets for continue statements; i.e., the closest enclosing for, while, or do-while statements.
 boolean isField
          Whether the current construct is a field (top-level construct in a class), or not.
 ModifierAST mods
          The current modifiers
 boolean negative
          The current sign of a number being read, true for negative or false for positive.
 StatementAST nextStmt
          The next statement in sequence after the current one
 TypeAST type
          The current variable or array base type
 
Constructor Summary
CompileContext()
           
 
Method Summary
 StatementAST breakTarget()
          Get the current break target
 StatementAST continueTarget()
          Get the current continue target
 void popBreak()
          Pop a break target off of the stack
 void popContinue()
          Pop a continue (and break) target off of the stack
 void pushBreak(JavaAST target)
          Push a new break target onto the stack
 void pushContinue(JavaAST target)
          Push a new continue (and break) target onto the stack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isField

public boolean isField
Whether the current construct is a field (top-level construct in a class), or not. This is used to distinguish local variables from static and instance variables.


nextStmt

public StatementAST nextStmt
The next statement in sequence after the current one


mods

public ModifierAST mods
The current modifiers


type

public TypeAST type
The current variable or array base type


negative

public boolean negative
The current sign of a number being read, true for negative or false for positive. This is necessary to avoid a NumberFormatException when reading in the most negative number.


breakTarget

private final LinkedList breakTarget
The current targets for break statements; i.e., the closest enclosing for, while, do-while, or switch statements.


continueTarget

private final LinkedList continueTarget
The current targets for continue statements; i.e., the closest enclosing for, while, or do-while statements.

Constructor Detail

CompileContext

public CompileContext()
Method Detail

pushBreak

public void pushBreak(JavaAST target)
Push a new break target onto the stack

Parameters:
target - the new break target

popBreak

public void popBreak()
Pop a break target off of the stack


breakTarget

public StatementAST breakTarget()
Get the current break target

Returns:
the current break target

pushContinue

public void pushContinue(JavaAST target)
Push a new continue (and break) target onto the stack

Parameters:
target - the new continue target

popContinue

public void popContinue()
Pop a continue (and break) target off of the stack


continueTarget

public StatementAST continueTarget()
Get the current continue target

Returns:
the current continue target