|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--antlr.BaseAST
|
+--antlr.CommonAST
|
+--org.omegahat.Environment.Parser.Parse.BasicExpression
|
+--org.omegahat.Environment.Parser.Parse.List
|
+--org.omegahat.Environment.Parser.Parse.SwitchCase
This class represents one or more case statements within
a switch construct. It collects the expressions (or
values) between the between the case keyword and the colon
of declaration and stores them as elements of a List.
When are two or more \JKeyword{case} elements stored together?
When only the last has a non-trivial action statement.
In other words, when a case statement has no code and trivially
``falls-through'' to the next \JKeyword{statement},
it is logically
grouped with that next \JKeyword{case} element and so on
until we arrive at one that has a non-empty action statement list.
This object stores these related expressions
and the statement list of the final one that is to be evaluated
if the value of the expression controlling the
\JKeyword{switch} matches any of the expression values in this
\OmegaClass{List}.
| Field Summary | |
protected java.lang.Object |
body
|
static java.lang.Integer |
DEFAULT_CASE
|
protected boolean |
DefaultCase
|
| 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 |
| Constructor Summary | |
SwitchCase()
|
|
SwitchCase(java.lang.Object lab)
|
|
| Method Summary | |
void |
addElement(java.lang.Object o)
|
java.lang.String |
asString()
|
java.lang.Object |
body()
|
java.lang.Object |
body(java.lang.Object o)
|
java.lang.Object |
evalBody(Evaluator evaluator)
|
antlr.collections.AST |
getFirstChild()
|
boolean |
isDefault()
|
boolean |
isDefault(boolean val)
|
java.lang.String |
separator()
|
java.lang.String |
toString()
|
| Methods inherited from class org.omegahat.Environment.Parser.Parse.List |
addElements, addElements, addElements, addResult, asString, asString, clear, clone, contains, copyElements, elementAt, elements, elementToString, eval, 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, parent, replaceChild |
| Methods inherited from interface org.omegahat.Environment.Language.Evaluable |
eval, eval |
| Field Detail |
public static java.lang.Integer DEFAULT_CASE
protected java.lang.Object body
protected boolean DefaultCase
| Constructor Detail |
public SwitchCase(java.lang.Object lab)
public SwitchCase()
| Method Detail |
public java.lang.Object body()
public java.lang.Object body(java.lang.Object o)
public boolean isDefault()
public boolean isDefault(boolean val)
public java.lang.Object evalBody(Evaluator evaluator)
throws java.lang.Throwable
public void addElement(java.lang.Object o)
addElement in class Listpublic java.lang.String toString()
toString in class Listpublic java.lang.String asString()
asString in class Listpublic java.lang.String separator()
separator in class Listpublic antlr.collections.AST getFirstChild()
getFirstChild in class List
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||