org.omegahat.Environment.Parser.Parse
Class StatementList

java.lang.Object
  |
  +--antlr.BaseAST
        |
        +--antlr.CommonAST
              |
              +--org.omegahat.Environment.Parser.Parse.BasicExpression
                    |
                    +--org.omegahat.Environment.Parser.Parse.List
                          |
                          +--org.omegahat.Environment.Parser.Parse.StatementList
All Implemented Interfaces:
antlr.collections.AST, java.lang.Cloneable, Evaluable, ExpressionInt, OmegaTokenTypes, java.lang.Runnable, java.io.Serializable, Subsettable, TreeNodeInt
Direct Known Subclasses:
TryCatch

public class StatementList
extends List

This class is used to gather an ordered collection of expressions into a unit such as the body of a loop, etc. It is designed to evaluate the elements sequentially and also to take care of attaching a temporary database for local declarations and assignments within this block.

See Also:
Serialized Form

Field Summary
protected  Database db
           
protected  int DepthForLocalVariables
           
protected  boolean handleLocalFrame
           
 
Fields inherited from class org.omegahat.Environment.Parser.Parse.List
elements, separator
 
Fields inherited from class org.omegahat.Environment.Parser.Parse.BasicExpression
children, comments, isActive, parent, POST, PRE
 
Fields inherited from class antlr.BaseAST
down, right
 
Fields inherited from interface org.omegahat.Environment.Parser.AntlrParser.OmegaTokenTypes
ABSTRACT, ARG_LIST, ARRAY_DECLARATOR, ARRAY_INIT, ASSIGN, BAND, BAND_ASSIGN, BLOCK, BNOT, BOR, BOR_ASSIGN, BREAK, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, CHAR_LITERAL, CLASS_DEF, COLON, COMMA, CONTINUE, CTOR_DEF, DEC, DIV, DIV_ASSIGN, DOT, DOTS, EAGER, ELEMENT_OP, EOF, EQUAL, ESC, EXPONENT, EXPONENT_OP, EXPR, EXTENDS_CLAUSE, FINAL, FLOAT_SUFFIX, FUNCTION, GE, GT, HEX_DIGIT, IDENT, IMPLEMENTS_CLAUSE, IMPORT, INC, INDEX_OP, INSTANCE_INIT, INSTANCEOF, INTERFACE_DEF, LABELED_STAT, LAND, LAZY, LBRACK, LCURLY, LE, LITERAL_abstract, LITERAL_boolean, LITERAL_break, LITERAL_byte, LITERAL_case, LITERAL_catch, LITERAL_char, LITERAL_class, LITERAL_const, LITERAL_continue, LITERAL_default, LITERAL_do, LITERAL_double, LITERAL_eager, LITERAL_else, LITERAL_extends, LITERAL_false, LITERAL_final, LITERAL_finally, LITERAL_float, LITERAL_for, LITERAL_function, LITERAL_global, LITERAL_if, LITERAL_implements, LITERAL_import, LITERAL_in, LITERAL_instanceof, LITERAL_int, LITERAL_interface, LITERAL_lazy, LITERAL_long, LITERAL_method, LITERAL_native, LITERAL_new, LITERAL_null, LITERAL_private, LITERAL_protected, LITERAL_public, LITERAL_return, LITERAL_short, LITERAL_static, LITERAL_super, LITERAL_switch, LITERAL_synchronized, LITERAL_this, LITERAL_threadsafe, LITERAL_throw, LITERAL_throws, LITERAL_transient, LITERAL_true, LITERAL_try, LITERAL_void, LITERAL_while, LNOT, LOR, LPAREN, LT, METHOD, METHOD_CALL, METHOD_DEF, MINUS, MINUS_ASSIGN, MISSING_ARG, ML_COMMENT, MOD, MOD_ASSIGN, MODIFIERS, NOT_EQUAL, NULL_TREE_LOOKAHEAD, NUM_FLOAT, NUM_INT, NUM_LONG, OBJBLOCK, PACKAGE_DEF, PARAMETER_DEF, PARAMETERS, PLUS, PLUS_ASSIGN, POST_DEC, POST_INC, QUESTION, RBRACK, RCURLY, RETURN, RPAREN, SEMI, SEQUENCE_OP, SL, SL_ASSIGN, SL_COMMENT, SLIST, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STATIC_INIT, STRING_LITERAL, SYNCHRONIZED, THROW, TRANSIENT, TYPE, TYPECAST, UNARY_MINUS, UNARY_PLUS, VARIABLE_DEF, VOCAB, WS
 
Constructor Summary
StatementList()
           
StatementList(antlr.collections.AST els, boolean down)
           
StatementList(java.lang.Object el)
           
 
Method Summary
 boolean close(Evaluator evaluator)
           
 boolean definesLocalVariables(Evaluator evaluator)
           
 java.lang.Object eval(Evaluator evaluator)
          Evaluate this object by evaluating each of its elements, where possible.
 List getComments()
          Get the formal comments from the collection of statements.
 List getComments(boolean onlyFormals)
          Get all or just the formal comments from the list of expressions.
 antlr.collections.AST getFirstChild()
           
 boolean handleLocalFrame()
           
 boolean handleLocalFrame(boolean val)
           
 java.lang.String separator()
           
 java.lang.String toString()
           
 
Methods inherited from class org.omegahat.Environment.Parser.Parse.List
addElement, addElements, addElements, addElements, addResult, asString, asString, asString, clear, clone, contains, copyElements, elementAt, elements, elementToString, eval, evalElement, evalElement, evalResult, getReferencedVariables, lastElement, parent, separator, setElementAt, size, size, subset, subset, subset, toArray, toString
 
Methods inherited from class org.omegahat.Environment.Parser.Parse.BasicExpression
addChild, addComment, apply, apply, apply, children, children, comment, comment, depth, error, eval, evalInit, evaluationFrame, evaluator, getReferencedVariables, getReferencedVariables, isActive, isActive, parent, postComment, postComment, preComment, preComment, render, replaceChild, resolve, run, setParent, setParent, setParent, setParent, showComments, showComments, substitute, substitute
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, initialize, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
addChild, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getNextSibling, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.omegahat.Environment.Parser.Parse.ExpressionInt
error, resolve, substitute
 
Methods inherited from interface org.omegahat.Environment.Parser.Parse.TreeNodeInt
addChild, children, depth, parent, replaceChild
 
Methods inherited from interface org.omegahat.Environment.Language.Evaluable
eval
 

Field Detail

handleLocalFrame

protected boolean handleLocalFrame

db

protected Database db

DepthForLocalVariables

protected int DepthForLocalVariables
Constructor Detail

StatementList

public StatementList()

StatementList

public StatementList(java.lang.Object el)

StatementList

public StatementList(antlr.collections.AST els,
                     boolean down)
Method Detail

eval

public java.lang.Object eval(Evaluator evaluator)
                      throws java.lang.Throwable
Description copied from class: List
Evaluate this object by evaluating each of its elements, where possible.
Overrides:
eval in class List

close

public boolean close(Evaluator evaluator)

definesLocalVariables

public boolean definesLocalVariables(Evaluator evaluator)

handleLocalFrame

public boolean handleLocalFrame()

handleLocalFrame

public boolean handleLocalFrame(boolean val)

getComments

public List getComments(boolean onlyFormals)
Get all or just the formal comments from the list of expressions.

Note that because of the way comments are linked, adjacent comments will appear as a single entry and will be printed as multiple comments. This is true of all comment types, irrespective of whether we want formals or not and is inescapable given the current framework for comments. Of course, that can easily be changed.

Parameters:
onlyFormals - indicates whether to restrict the retrieved comments to the javadoc-style comments or all comments.

getComments

public List getComments()
Get the formal comments from the collection of statements. This is not a deep get.
See Also:
getComments(boolean)

separator

public java.lang.String separator()
Overrides:
separator in class List

toString

public java.lang.String toString()
Overrides:
toString in class List

getFirstChild

public antlr.collections.AST getFirstChild()
Overrides:
getFirstChild in class List