#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Span {
pub line: usize,
pub column: usize,
}
impl Span {
pub fn new(line: usize, column: usize) -> Self {
Self { line, column }
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum Token {
Atom(String),
Variable(String),
Anonymous,
Integer(i32),
Neck,
Query,
Comma,
Semicolon,
Dot,
Pipe,
Cut,
LParen,
RParen,
LBracket,
RBracket,
Plus,
Minus,
Star,
Slash,
Mod,
Is,
Unify,
NotUnify,
Identical,
NotIdentical,
Lt,
Gt,
Le,
Ge,
ArithEq,
ArithNe,
Eof,
}
impl Token {
pub fn can_start_term(&self) -> bool {
matches!(
self,
Token::Atom(_)
| Token::Variable(_)
| Token::Anonymous
| Token::Integer(_)
| Token::LParen
| Token::LBracket
| Token::Minus
)
}
}