replace thiserror with quick_error

This commit is contained in:
2024-11-26 21:47:38 -07:00
parent 51109ee4bb
commit 2372f0c61a
7 changed files with 132 additions and 183 deletions

View File

@@ -1,4 +1,5 @@
#![feature(error_generic_member_access)]
#[macro_use]
extern crate quick_error;
mod compiler;
mod parser;
@@ -21,16 +22,26 @@ macro_rules! boxed {
};
}
#[derive(Debug, thiserror::Error)]
enum StationlangError {
#[error(transparent)]
TokenizerError(#[from] TokenizerError),
#[error(transparent)]
ParserError(#[from] parser::ParseError),
#[error(transparent)]
CompileError(#[from] compiler::CompileError),
#[error(transparent)]
IoError(#[from] std::io::Error),
quick_error! {
#[derive(Debug)]
enum StationlangError {
TokenizerError(err: TokenizerError) {
from()
display("Tokenizer error: {}", err)
}
ParserError(err: parser::ParseError) {
from()
display("Parser error: {}", err)
}
CompileError(err: compiler::CompileError) {
from()
display("Compile error: {}", err)
}
IoError(err: std::io::Error) {
from()
display("IO error: {}", err)
}
}
}
#[derive(Parser, Debug)]