1#[derive(Debug, Clone)]
4pub enum LingError {
5 Lex(String),
6 Parse(String),
7 Type(String),
8 Borrow(String),
9 Codegen(String),
10}
11
12impl std::fmt::Display for LingError {
13 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14 match self {
15 Self::Lex(s) => write!(f, "Lexical error: {s}"),
16 Self::Parse(s) => write!(f, "Parse error: {s}"),
17 Self::Type(s) => write!(f, "Type error: {s}"),
18 Self::Borrow(s) => write!(f, "Borrow error: {s}"),
19 Self::Codegen(s) => write!(f, "Codegen error: {s}"),
20 }
21 }
22}
23
24impl std::error::Error for LingError {}
25