Skip to content

Commit

Permalink
Use ParsingError enum for all errors in parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyphack committed Sep 30, 2023
1 parent f472275 commit a06bcb7
Show file tree
Hide file tree
Showing 11 changed files with 794 additions and 364 deletions.
31 changes: 0 additions & 31 deletions parser/src/parser/diagnostics.rs

This file was deleted.

27 changes: 27 additions & 0 deletions parser/src/parser/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use miette::Diagnostic;
use thiserror::Error;

#[derive(Error, Diagnostic, Debug)]
pub enum ParsingError {
#[error(transparent)]
#[diagnostic(code(gen_color::io_error))]
IoError(#[from] std::io::Error),

#[error(
"Invalid syntax"
)]
#[diagnostic(code(
gen_color::colors_and_steps_mismatch
))]
InvalidSyntax {
path: Box<str>,
msg: Box<str>,
line: u32,
#[source_code]
input: String,
#[help]
advice: String,
#[label("span")]
span: (usize, usize),
},
}
1 change: 0 additions & 1 deletion parser/src/parser/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pub mod ast;
pub mod error;
mod diagnostics;
mod expression;
mod operator;
pub mod parser;
Expand Down
Loading

0 comments on commit a06bcb7

Please sign in to comment.