diff --git a/source/tlang/compiler/lexer/core/tokens.d b/source/tlang/compiler/lexer/core/tokens.d index 84df4f53..63cf3f51 100644 --- a/source/tlang/compiler/lexer/core/tokens.d +++ b/source/tlang/compiler/lexer/core/tokens.d @@ -6,8 +6,7 @@ module tlang.compiler.lexer.core.tokens; import std.string : cmp, format; import std.conv : to; import tlang.compiler.reporting : Coords; - -// TODO: Below could have linof?!?!?! +import tlang.compiler.reporting : LineInfo; /** * Defines a `Token` that a lexer @@ -120,9 +119,13 @@ public final class Token return Coords(this.line, this.column); } - // TODO: Switch to this - import tlang.compiler.reporting :LineInfo; - public LineInfo deriveLineInfo() + /** + * Returns the line information + * of this particular token + * + * Returns: the `LineInfo` + */ + public LineInfo getLineInfo() { return LineInfo(getOrigin(), getCoords()); } diff --git a/source/tlang/compiler/reporting.d b/source/tlang/compiler/reporting.d index 167a59e4..5a87ef5c 100644 --- a/source/tlang/compiler/reporting.d +++ b/source/tlang/compiler/reporting.d @@ -157,13 +157,11 @@ public string report(string message, LineInfo linfo, ulong cursor = 0) public string report(Token offendingToken, string message) { - string line = offendingToken.getOrigin(); - // FIXME: Double check the boundries here ulong pointerPos = offendingToken.getCoords().getColumn() < message.length ? offendingToken.getCoords().getColumn() : 0; assert(pointerPos < message.length); - return report(message, offendingToken.deriveLineInfo(), pointerPos); + return report(message, offendingToken.getLineInfo(), pointerPos); } version(unittest)