This commit is contained in:
nub31
2026-02-27 22:20:32 +01:00
parent e512650440
commit 73ecbf8e9b
10 changed files with 163 additions and 90 deletions

View File

@@ -397,6 +397,7 @@ public class Tokenizer
"return" => new TokenKeyword(line, startColumn, column - startColumn, Keyword.Return),
"module" => new TokenKeyword(line, startColumn, column - startColumn, Keyword.Module),
"export" => new TokenKeyword(line, startColumn, column - startColumn, Keyword.Export),
"extern" => new TokenKeyword(line, startColumn, column - startColumn, Keyword.Extern),
"true" => new TokenBoolLiteral(line, startColumn, column - startColumn, true),
"false" => new TokenBoolLiteral(line, startColumn, column - startColumn, false),
_ => new TokenIdent(line, startColumn, column - startColumn, value)
@@ -545,6 +546,7 @@ public enum Keyword
Return,
Module,
Export,
Extern,
}
public class TokenKeyword(int line, int column, int length, Keyword keyword) : Token(line, column, length)
@@ -611,6 +613,7 @@ public static class TokenExtensions
Keyword.Return => "return",
Keyword.Module => "module",
Keyword.Export => "export",
Keyword.Extern => "extern",
_ => throw new ArgumentOutOfRangeException(nameof(symbol), symbol, null)
};
}