modifiers

This commit is contained in:
nub31
2025-05-16 20:46:38 +02:00
parent 2a4401bab6
commit 57ccd0a38a
4 changed files with 64 additions and 64 deletions

View File

@@ -5,8 +5,6 @@ public class Lexer
private static readonly Dictionary<string, Symbol> Keywords = new()
{
["func"] = Symbol.Func,
["global"] = Symbol.Global,
["extern"] = Symbol.Extern,
["import"] = Symbol.Import,
["if"] = Symbol.If,
["else"] = Symbol.Else,
@@ -17,6 +15,12 @@ public class Lexer
["new"] = Symbol.New,
["struct"] = Symbol.Struct,
};
private static readonly Dictionary<string, Modifier> Modifers = new()
{
["global"] = Modifier.Global,
["extern"] = Modifier.Extern,
};
private static readonly Dictionary<char[], Symbol> Chians = new()
{
@@ -84,6 +88,11 @@ public class Lexer
return new SymbolToken(keywordSymbol);
}
if (Modifers.TryGetValue(buffer, out var modifer))
{
return new ModifierToken(modifer);
}
if (buffer is "true" or "false")
{
return new LiteralToken(NubPrimitiveType.Bool, buffer);