Package mars.assembler
Class Macro
java.lang.Object
mars.assembler.Macro
Stores information of a macro definition.
- Author:
- M.H.Sekhavat <sekhavat17@gmail.com>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
boolean
getArgs()
int
getName()
int
int
getSubstitutedLine(int line, TokenList args, long counter, ErrorList errors)
Substitutes macro arguments in a line of source code inside macro definition to be parsed after macro expansion.int
void
Operations to be done on this macro before it is committed in macro pool.void
void
setFromLine(int fromLine)
void
void
setOriginalFromLine(int origFromLine)
void
setOriginalToLine(int origToLine)
void
setProgram(MIPSprogram program)
void
setToLine(int toLine)
static boolean
tokenIsMacroParameter(String tokenValue, boolean acceptSpimStyleParameters)
Returns whethertokenValue
is a macro parameter or not
-
Constructor Details
-
Macro
public Macro()
-
-
Method Details
-
getName
-
setName
-
getProgram
-
setProgram
-
getFromLine
public int getFromLine() -
getOriginalFromLine
public int getOriginalFromLine() -
setFromLine
public void setFromLine(int fromLine) -
setOriginalFromLine
public void setOriginalFromLine(int origFromLine) -
getToLine
public int getToLine() -
getOriginalToLine
public int getOriginalToLine() -
setToLine
public void setToLine(int toLine) -
setOriginalToLine
public void setOriginalToLine(int origToLine) -
getArgs
-
setArgs
-
equals
-
addArg
-
getSubstitutedLine
Substitutes macro arguments in a line of source code inside macro definition to be parsed after macro expansion.
Also appends "_M#" to all labels defined inside macro body where # is value ofcounter
- Parameters:
line
- source line number in macro definition to be substitutedargs
-counter
- unique macro expansion iderrors
-- Returns:
line
-th line of source code, with substituted arguments
-
tokenIsMacroParameter
Returns whethertokenValue
is a macro parameter or not- Parameters:
tokenValue
-acceptSpimStyleParameters
- accepts SPIM-style parameters which begin with '$' if true- Returns:
-
addLabel
-
readyForCommit
public void readyForCommit()Operations to be done on this macro before it is committed in macro pool.
-