This commit is contained in:
nub31
2025-05-04 16:02:48 +02:00
parent 248f95fa6e
commit 5f2d1ff3f9
25 changed files with 264 additions and 539 deletions

View File

@@ -86,7 +86,7 @@ public class Lexer
if (buffer is "true" or "false")
{
return new LiteralToken(new PrimitiveType(PrimitiveTypeKind.Bool), buffer);
return new LiteralToken(NubType.Bool, buffer);
}
return new IdentifierToken(buffer);
@@ -103,7 +103,7 @@ public class Lexer
current = Peek();
}
return new LiteralToken(new PrimitiveType(PrimitiveTypeKind.Int64), buffer);
return new LiteralToken(NubType.Int64, buffer);
}
// TODO: Revisit this
@@ -148,7 +148,7 @@ public class Lexer
buffer += current.Value;
}
return new LiteralToken(new StringType(), buffer);
return new LiteralToken(NubType.String, buffer);
}
if (char.IsWhiteSpace(current.Value))

View File

@@ -1,7 +1,7 @@
namespace Nub.Lang.Frontend.Lexing;
public class LiteralToken(Type type, string value) : Token
public class LiteralToken(NubType type, string value) : Token
{
public Type Type { get; } = type;
public NubType Type { get; } = type;
public string Value { get; } = value;
}