mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-19 02:55:50 +00:00
Integrate ParseError to compiler-core::Error
This commit is contained in:
parent
904fc477f1
commit
2b7bf79d29
5 changed files with 67 additions and 32 deletions
22
core/src/error.rs
Normal file
22
core/src/error.rs
Normal 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
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue