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 TypeMethodDescriptionvoidvoidbooleangetArgs()intgetName()intintgetSubstitutedLine(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.intvoidOperations to be done on this macro before it is committed in macro pool.voidvoidsetFromLine(int fromLine)voidvoidsetOriginalFromLine(int origFromLine)voidsetOriginalToLine(int origToLine)voidsetProgram(MIPSprogram program)voidsetToLine(int toLine)static booleantokenIsMacroParameter(String tokenValue, boolean acceptSpimStyleParameters)Returns whethertokenValueis 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 whethertokenValueis 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.
-