mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
chore: impl some error conversions
This commit is contained in:
parent
8a793c7d59
commit
ed0f8e1d57
2 changed files with 18 additions and 0 deletions
|
@ -609,6 +609,12 @@ impl ParserRunnerError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<ParserRunnerError> for LexError {
|
||||
fn from(err: ParserRunnerError) -> Self {
|
||||
Self::new(err.core)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ParserRunnerErrors(Vec<ParserRunnerError>);
|
||||
|
||||
|
@ -618,6 +624,12 @@ impl_stream!(ParserRunnerErrors, ParserRunnerError);
|
|||
|
||||
impl MultiErrorDisplay<ParserRunnerError> for ParserRunnerErrors {}
|
||||
|
||||
impl From<ParserRunnerErrors> for LexErrors {
|
||||
fn from(errs: ParserRunnerErrors) -> Self {
|
||||
Self(errs.0.into_iter().map(LexError::from).collect())
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ParserRunnerErrors {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.fmt_all(f)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue