Remove quickerror in favor of thiserror

This commit is contained in:
2025-12-09 11:32:14 -07:00
parent 23c2ba4134
commit c531f673a5
13 changed files with 97 additions and 136 deletions

View File

@@ -4,11 +4,10 @@ version = "0.1.0"
edition = "2024"
[dependencies]
quick-error = { workspace = true }
tokenizer = { path = "../tokenizer" }
helpers = { path = "../helpers" }
lsp-types = { workspace = true }
thiserror = "2"
thiserror = { workspace = true }
[dev-dependencies]

View File

@@ -1,7 +1,6 @@
pub mod sys_call;
#[cfg(test)]
mod test;
pub mod sys_call;
pub mod tree_node;
use crate::sys_call::{Math, System};
@@ -28,8 +27,8 @@ macro_rules! boxed {
#[derive(Error, Debug)]
pub enum Error {
#[error("Tokenizer Error: {0}")]
TokenizerError(#[from] tokenizer::Error),
#[error(transparent)]
Tokenizer(#[from] tokenizer::Error),
#[error("Unexpected token: {1}")]
UnexpectedToken(Span, Token),
@@ -52,7 +51,7 @@ impl From<Error> for lsp_types::Diagnostic {
use Error::*;
use lsp_types::*;
match value {
TokenizerError(e) => e.into(),
Tokenizer(e) => e.into(),
UnexpectedToken(span, _)
| DuplicateIdentifier(span, _)
| InvalidSyntax(span, _)
@@ -216,7 +215,7 @@ impl<'a> Parser<'a> {
match self.tokenizer.peek() {
Ok(None) => break,
Err(e) => {
self.errors.push(Error::TokenizerError(e));
self.errors.push(Error::Tokenizer(e));
break;
}
_ => {}

View File

@@ -1,8 +1,6 @@
use std::ops::Deref;
use crate::sys_call;
use super::sys_call::SysCall;
use crate::sys_call;
use std::ops::Deref;
use tokenizer::token::Number;
#[derive(Debug, Eq, PartialEq, Clone)]