|
miSim | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--misim.asm.Expr | +--misim.asm.Context
The context class provides information on the labels and parameters in the current scope of the assembler.
Constructor Summary | |
Context()
Construct a root context ready for assembly |
|
Context(Context parent)
Construct a child context for a given parent |
Method Summary | |
void |
addLabel(Token aToken,
int labelType)
Add a label to this context |
void |
addLabel(Token aToken,
int labelType,
int value)
Add a label to this context |
int |
defaultRadix()
Return the current default radix |
int |
evaluate(TokenIterator tokens,
boolean evalBool)
Evaluate the numeric expression in a file, beginning at the given token position. |
Label |
getLabel(Token aToken)
Return the given label in the smallest possible scope |
Context |
getParent()
Return the parent context for this context |
int |
getProgramCounter()
Return the current program counter |
int |
getValue(Token aToken)
Return the value of the given label in the smallest possible scope |
boolean |
labelExists(java.lang.String text)
Test to see if a given label has been defined. |
Context |
rootContext()
Return the root context for this context |
void |
setLocal(Token aToken)
|
void |
setProgramCounter(int value)
Set the current program counter to a valid value |
void |
setRadix(int newRadix)
Set the current default radix |
void |
setValue(Token aToken,
int value)
Set the value of the given label in the smallest possible scope |
void |
undefineVariables()
Undefine variables in preparation for the second assembly pass, as their value is not global |
Methods inherited from class misim.asm.Expr |
evaluate, evaluate, evaluateOperation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Context()
public Context(Context parent)
parent
- The parent contextMethod Detail |
public Context rootContext()
public Context getParent()
public int getProgramCounter()
public void setProgramCounter(int value)
value
- The new value for the program counterpublic int defaultRadix()
public void setRadix(int newRadix)
newRadix
- the new current default radixpublic int evaluate(TokenIterator tokens, boolean evalBool) throws EditorException
tokens
- The TokenIterator for the line being assembledcontext
- The local context for this lineevalBool
- True if the expression should evaluate as booleanAssemblerException
- if the expression contains an error.public int getValue(Token aToken) throws EditorException
aToken
- The token that referred to this labelEditorException
- If the label does not existpublic void setValue(Token aToken, int value) throws EditorException
aToken
- The token that referred to this labelvalue
- The new value for this labelEditorException
- If the label does not existpublic Label getLabel(Token aToken) throws EditorException
aToken
- The token that referred to this labelEditorException
- If the label does not existpublic void setLocal(Token aToken)
public void addLabel(Token aToken, int labelType, int value) throws EditorException
aToken
- The token that referred to this labellabelType
- The label typevalue
- The value of the labelEditorException
- if the label already existspublic void addLabel(Token aToken, int labelType) throws EditorException
aToken
- The token that referred to this labellabelType
- The label typeEditorException
- if the label already existspublic boolean labelExists(java.lang.String text)
public void undefineVariables()
|
miSim | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |