This commit is contained in:
nub31
2025-10-31 14:42:58 +01:00
parent 031b118a24
commit 7c7624b1bc
17 changed files with 453 additions and 605 deletions

View File

@@ -16,15 +16,11 @@ public record IntLiteralToken(SourceSpan Span, string Value, int Base) : Token(S
{
private string GetNumericValue()
{
// Strip base prefixes: 0b, 0o, 0x
return Base switch
{
2 when Value.StartsWith("0b", StringComparison.OrdinalIgnoreCase)
=> Value.Substring(2),
8 when Value.StartsWith("0o", StringComparison.OrdinalIgnoreCase)
=> Value.Substring(2),
16 when Value.StartsWith("0x", StringComparison.OrdinalIgnoreCase)
=> Value.Substring(2),
2 when Value.StartsWith("0b", StringComparison.OrdinalIgnoreCase) => Value[2..],
8 when Value.StartsWith("0o", StringComparison.OrdinalIgnoreCase) => Value[2..],
16 when Value.StartsWith("0x", StringComparison.OrdinalIgnoreCase) => Value[2..],
_ => Value
};
}
@@ -95,7 +91,6 @@ public enum Symbol
Func,
Struct,
Enum,
Import,
Module,
// Modifier
@@ -159,7 +154,6 @@ public record SymbolToken(SourceSpan Span, Symbol Symbol) : Token(Span)
Symbol.Extern => "extern",
Symbol.Module => "module",
Symbol.Export => "export",
Symbol.Import => "import",
Symbol.Defer => "defer",
Symbol.Enum => "enum",
Symbol.Equal => "==",