Integrate ParseError to compiler-core::Error

This commit is contained in:
Jeong YunWon 2022-08-22 09:07:15 +09:00
parent 904fc477f1
commit 2b7bf79d29
5 changed files with 67 additions and 32 deletions

22
core/src/error.rs Normal file
View file

@ -0,0 +1,22 @@
use crate::Location;
#[derive(Debug, PartialEq, Eq)]
pub struct Error<T> {
pub error: T,
pub location: Location,
pub source_path: String,
}
impl<T> std::ops::Deref for Error<T> {
type Target = T;
fn deref(&self) -> &Self::Target {
&self.error
}
}
impl<T> Error<T> {
pub fn error(self) -> T {
self.error
}
}

View file

@ -2,9 +2,11 @@
#![doc(html_root_url = "https://docs.rs/rustpython-compiler-core/")]
mod bytecode;
mod error;
mod location;
mod mode;
pub use bytecode::*;
pub use error::Error;
pub use location::Location;
pub use mode::Mode;