Package mars.assembler.token
Class SourceLine
java.lang.Object
mars.assembler.token.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
(SourceLocation location, String content, List<Token> tokens) Create a newSourceLine
with the given information.SourceLine
(SourceLocation location, String content, List<Token> tokens, SourceLine originalLine) Create a new macro expansionSourceLine
with the given information. -
Method Summary
Modifier and TypeMethodDescriptionGet the raw source code of the line.Get the location of this line in the source code.Get the line in the macro definition or included file that this line was created from, if applicable.Get the list of tokens that the line contains.void
setContent
(String content) void
setLocation
(SourceLocation location) void
setOriginalLine
(SourceLine originalLine)
-
Constructor Details
-
SourceLine
Create a newSourceLine
with the given information.- Parameters:
location
- The location of the line in the source code.content
- The raw source code of the line.tokens
- The list of tokens that the line contains.
-
SourceLine
public SourceLine(SourceLocation location, String content, List<Token> tokens, SourceLine originalLine) Create a new macro expansionSourceLine
with the given information.- Parameters:
location
- The location of the line in the source code.content
- The raw source code of the line.tokens
- The list of tokens that the line contains.originalLine
- The line in the macro definition or included file that this line was created from.
-
-
Method Details
-
getLocation
Get the location of this line in the source code.- Returns:
- The line location.
-
setLocation
-
getContent
Get the raw source code of the line.- Returns:
- The line content.
-
setContent
-
getTokens
Get the list of tokens that the line contains.- Returns:
- The token list.
-
getOriginalLine
Get the line in the macro definition or included file that this line was created from, if applicable.- Returns:
- The original line if this line is part of a macro expansion or included file,
or
null
otherwise.
-
setOriginalLine
-