Added Token class for future use in lexer

This commit is contained in:
Tristan B. Velloza Kildaire 2021-03-03 11:05:57 +02:00
parent 1c2684814f
commit 2ceaa0c8b0
1 changed files with 22 additions and 0 deletions

View File

@ -4,6 +4,28 @@ import std.container.slist;
import gogga;
import std.conv : to;
/* TODO: Add Token type (which matches column and position too) */
public final class Token
{
/* The token */
private string token;
/* Line number information */
private ulong line, column;
this(string token, ulong line, ulong column)
{
this.token = token;
this.line = line;
this.column = column;
}
override string toString()
{
return token~" at ("~to!(string)(line)~", "~to!(string)(column)~")";
}
}
public final class Lexer
{
/* The source to be lexed */