modifiers
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user