yapping/src/token.rs
2024-05-29 15:08:07 +02:00

41 lines
560 B
Rust

#[derive(Clone, PartialEq, Debug)]
pub struct Token {
pub kind: TokenKind,
pub value: TokenValue,
pub index: usize,
pub line: i32,
pub col: i32,
}
#[derive(Clone, PartialEq, Debug)]
pub enum TokenKind {
Error,
Id,
Int,
String,
If,
Else,
Loop,
Break,
Let,
Fn,
Return,
LParen,
RParen,
LBrace,
RBrace,
Colon,
Comma,
Semicolon,
Equal,
MinusLt,
}
#[derive(Clone, PartialEq, Debug)]
pub enum TokenValue {
None,
Id(u64),
Int(i64),
String(String),
}