slovo/compiler/src/token.rs
2026-05-22 08:38:43 +02:00

32 lines
514 B
Rust

#[derive(Debug, Clone, PartialEq)]
pub enum TokenKind {
LParen,
RParen,
Arrow,
Ident(String),
Int(i64),
I64(i64),
U32(u32),
U64(u64),
Float(f64),
String(String),
}
#[derive(Debug, Clone, PartialEq)]
pub struct Token {
pub kind: TokenKind,
pub span: Span,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Span {
pub start: usize,
pub end: usize,
}
impl Span {
pub fn new(start: usize, end: usize) -> Self {
Self { start, end }
}
}