vig/src/tokens.zig

74 lines
933 B
Zig
Raw Normal View History

pub const TokenType = enum {
// basic tokens
LeftParen,
RightParen,
LeftBrace,
RightBrace,
LeftSquare,
RightSquare,
Dot,
Equal,
Semicolon,
Comma,
Colon,
Ampersand,
Pipe,
QuestionMark,
DollarSign,
// math operators
Plus,
Minus,
Star,
Slash,
Modulo,
// one-two char tokens
DotEqual,
LeftDoubleChevron, // AKA "<<"
PlusPlus,
PlusEqual,
MinusEqual,
LessThan,
LessEqual,
GreaterThan,
GreaterEqual,
Bang,
BangEqual,
// complex types
Integer,
Float,
String,
Identifier,
// keywords
Break,
Const,
Continue,
Defer,
Else,
Enum,
Fn,
For,
Go,
Goto,
If,
Import,
In,
Interface,
Match,
Module,
Mut,
Or,
Return,
Struct,
Type,
};
pub const Token = struct {
ttype: TokenType,
lexeme: []u8,
};