Package mars.assembler
Class SourceLine
java.lang.Object
mars.assembler.SourceLine
Handy class to represent, for a given line of source code, the code itself,
the program containing it, and its line number within that program.
This is used to separately keep track of the original file/position of
a given line of code. When .include is used, it will migrate to a different
line and possibly different program but the migration should not be visible
to the user.
-
Constructor Summary
ConstructorsConstructorDescriptionSourceLine(String source, MIPSprogram mipsProgram, int lineNumber)
SourceLine constructor -
Method Summary
Modifier and TypeMethodDescriptionRetrieve name of file containing source statementint
Retrieve line number of source statementRetrieve MIPSprogram object containing source statementRetrieve source statement itself
-
Constructor Details
-
SourceLine
SourceLine constructor- Parameters:
source
- The source code itselfmipsProgram
- The program (object representing source file) containing that linelineNumber
- The line number within that program where source appears.
-
-
Method Details
-
getSource
Retrieve source statement itself- Returns:
- Source statement as String
-
getFilename
Retrieve name of file containing source statement- Returns:
- File name as String
-
getLineNumber
public int getLineNumber()Retrieve line number of source statement- Returns:
- Line number of source statement
-
getMIPSprogram
Retrieve MIPSprogram object containing source statement- Returns:
- program as MIPSprogram object
-