able-script/src/error.rs
Erin 47400ee2ce Starting work on parser improvements
- Parser should parse single expressions
2021-04-26 10:44:42 +02:00

21 lines
382 B
Rust

use std::ops::Range;
#[derive(Debug, Clone)]
pub struct Error {
pub kind: ErrorKind,
pub position: Range<usize>,
}
#[derive(Debug, Clone)]
pub enum ErrorKind {
SyntaxError(String),
EndOfTokenStream,
}
impl Error {
pub fn panic(&self, span: &str) {
println!("{:?} occured at {:?}", self.kind, self.position);
println!(" {}", &span);
}
}