This commit is contained in:
nub31
2025-07-06 23:13:15 +02:00
parent 7ee76f43cb
commit a2ac312ba5
5 changed files with 78 additions and 82 deletions

View File

@@ -1,6 +0,0 @@
namespace NubLang.Syntax.Tokenization;
public class IdentifierToken(SourceSpan span, string value) : Token(span)
{
public string Value { get; } = value;
}

View File

@@ -1,15 +0,0 @@
namespace NubLang.Syntax.Tokenization;
public class LiteralToken(SourceSpan span, LiteralKind kind, string value) : Token(span)
{
public LiteralKind Kind { get; } = kind;
public string Value { get; } = value;
}
public enum LiteralKind
{
Integer,
Float,
String,
Bool
}

View File

@@ -1,12 +0,0 @@
namespace NubLang.Syntax.Tokenization;
public class ModifierToken(SourceSpan span, Modifier modifier) : Token(span)
{
public Modifier Modifier { get; } = modifier;
}
public enum Modifier
{
Extern,
Export
}

View File

@@ -1,49 +0,0 @@
namespace NubLang.Syntax.Tokenization;
public class SymbolToken(SourceSpan span, Symbol symbol) : Token(span)
{
public Symbol Symbol { get; } = symbol;
}
public enum Symbol
{
Func,
Return,
If,
Else,
While,
Break,
Continue,
Colon,
OpenParen,
CloseParen,
OpenBrace,
CloseBrace,
OpenBracket,
CloseBracket,
Comma,
Period,
Assign,
Bang,
Equal,
NotEqual,
LessThan,
LessThanOrEqual,
GreaterThan,
GreaterThanOrEqual,
Plus,
Minus,
Star,
ForwardSlash,
Struct,
Caret,
Ampersand,
DoubleColon,
Namespace,
Let,
Alloc,
Calls,
Trait,
Impl,
For
}

View File

@@ -4,3 +4,81 @@ public abstract class Token(SourceSpan span)
{
public SourceSpan Span { get; } = span;
}
public class IdentifierToken(SourceSpan span, string value) : Token(span)
{
public string Value { get; } = value;
}
public class LiteralToken(SourceSpan span, LiteralKind kind, string value) : Token(span)
{
public LiteralKind Kind { get; } = kind;
public string Value { get; } = value;
}
public enum LiteralKind
{
Integer,
Float,
String,
Bool
}
public class ModifierToken(SourceSpan span, Modifier modifier) : Token(span)
{
public Modifier Modifier { get; } = modifier;
}
public enum Modifier
{
Extern,
Export
}
public class SymbolToken(SourceSpan span, Symbol symbol) : Token(span)
{
public Symbol Symbol { get; } = symbol;
}
public enum Symbol
{
Func,
Return,
If,
Else,
While,
Break,
Continue,
Colon,
OpenParen,
CloseParen,
OpenBrace,
CloseBrace,
OpenBracket,
CloseBracket,
Comma,
Period,
Assign,
Bang,
Equal,
NotEqual,
LessThan,
LessThanOrEqual,
GreaterThan,
GreaterThanOrEqual,
Plus,
Minus,
Star,
ForwardSlash,
Struct,
Caret,
Ampersand,
DoubleColon,
Namespace,
Let,
Alloc,
Calls,
Trait,
Impl,
For
}