net.scheinerman.phoenix.interpreter
Class SwitchInterpreter
java.lang.Object
net.scheinerman.phoenix.interpreter.Interpreter
net.scheinerman.phoenix.interpreter.SwitchInterpreter
public class SwitchInterpreter
- extends Interpreter
Fields inherited from class net.scheinerman.phoenix.interpreter.Interpreter |
_break, _continue, _return, breakValue, code, fat, file, keywordList, line, line_diff, printValues, retType, retTypeSet, retValue, run_code, stop, vat |
Constructor Summary |
SwitchInterpreter(java.lang.String file,
java.lang.String code,
int line,
Variable switchVariable,
java.util.LinkedList<java.util.HashMap<java.lang.String,Variable>> vat,
java.util.LinkedList<java.util.HashMap<java.lang.String,Function>> fat)
|
Method Summary |
protected void |
dealWithBreak(int value)
Deals with a break statement with a given integer value. |
void |
doRun()
Does simple interpretation of the given code for this Interpreter class. |
Methods inherited from class net.scheinerman.phoenix.interpreter.Interpreter |
dealWithContinue, dealWithError, dealWithReturn, delete, getBlock, getFunction, getFunctionArguments, getFunctionFromDefinition, getReturnValue, getVariable, getWhitespace, initNewTables, isValidIdentifier, makeDefaultVariable, makeFunction, makeVariable, makeVariable, parsePhrase, putFunction, removeComments, removeWhitespace, retValueMatches, run |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fallThrough
private boolean fallThrough
switchVariable
private Variable switchVariable
SwitchInterpreter
public SwitchInterpreter(java.lang.String file,
java.lang.String code,
int line,
Variable switchVariable,
java.util.LinkedList<java.util.HashMap<java.lang.String,Variable>> vat,
java.util.LinkedList<java.util.HashMap<java.lang.String,Function>> fat)
doRun
public final void doRun()
- Description copied from class:
Interpreter
- Does simple interpretation of the given code for this
Interpreter
class. For most
subclasses,this method should not be overridden. However, there are some instances where it might
prove useful to override this method (for example, the SwitchInterpreter
class overrides
this method).
- Overrides:
doRun
in class Interpreter
- See Also:
SwitchInterpreter}
dealWithBreak
protected void dealWithBreak(int value)
- Description copied from class:
Interpreter
- Deals with a
break
statement with a given integer value. This method is meant to be
overridden in subclasses if subclasses deal with breaks differently. For example, this class just
passes the break up to the Interpreter
of greater scope. However, subclasses of
LoopInterpreter
subtract one from the break value and pass it up if it is greater than zero.
- Overrides:
dealWithBreak
in class Interpreter
- Parameters:
value
- - The number of breaks that should be executed.