Skip to content

Commit

Permalink
Tokens
Browse files Browse the repository at this point in the history
- Added derivation to `LineInfo`
  • Loading branch information
deavmi committed Apr 2, 2024
1 parent e74fdd3 commit e87385c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source/tlang/compiler/lexer/core/tokens.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import std.string : cmp, format;
import std.conv : to;
import tlang.compiler.reporting : Coords;

// TODO: Below could have linof?!?!?!

/**
* Defines a `Token` that a lexer
* would be able to produce
Expand Down Expand Up @@ -117,4 +119,11 @@ public final class Token
{
return Coords(this.line, this.column);
}

// TODO: Switch to this
import tlang.compiler.reporting :LineInfo;
public LineInfo deriveLineInfo()
{
return LineInfo(getOrigin(), getCoords());
}
}

0 comments on commit e87385c

Please sign in to comment.