Base initial commit

Still WIP, working on object system still, which in Rust, makes me want
to kill myself

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2024-09-20 16:04:30 -07:00
parent ccf6c9e939
commit 16f3dc960c
11 changed files with 4079 additions and 0 deletions

67
src/token.rs Normal file
View File

@@ -0,0 +1,67 @@
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum TokenKind {
// Keywords
Return,
If,
Else,
True,
False,
Nil,
// Expressions
Name,
Number,
String,
// Binary operators
Plus,
Minus,
Star,
Slash,
// Unary operators (not already covered)
Bang,
// Boolean operators
And,
Or,
// Comparison
BangEq,
EqEq,
Greater,
GreaterEq,
Less,
LessEq,
// Braces, parens, etc
LParen,
RParen,
LBrace,
RBrace,
LBracket,
RBracket,
// Assignment
Eq,
// Dot, comma
Dot,
Comma,
Arrow,
Colon,
// Line end
Eol,
// File end
Eof,
}
#[derive(Debug, Clone)]
pub struct Token {
pub line: usize,
//pub index: usize,
pub text: String,
pub kind: TokenKind,
}