-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86d942b
commit f210f7c
Showing
3 changed files
with
12 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
//SPDX-FileCopyrightText: 2024 Ryuichi Ueda [email protected] | ||
//SPDX-License-Identifier: BSD-3-Clause | ||
|
||
use super::exec::ExecError; | ||
|
||
#[derive(Debug)] | ||
pub enum ParseError { | ||
UnexpectedSymbol(String), | ||
UnexpectedEof, | ||
Interrupted, | ||
} | ||
|
||
impl From<ParseError> for ExecError { | ||
fn from(e: ParseError) -> ExecError { | ||
impl From<ParseError> for String { | ||
fn from(e: ParseError) -> String { | ||
match e { | ||
ParseError::UnexpectedSymbol(s) => ExecError::Other(s), | ||
ParseError::UnexpectedEof => ExecError::Other("eof".to_string()), | ||
ParseError::Interrupted => ExecError::Other("Interrupted".to_string()), | ||
ParseError::UnexpectedSymbol(s) => format!("Unexpected token: {}", s), | ||
ParseError::UnexpectedEof => "syntax error: unexpected end of file".to_string(), | ||
ParseError::Interrupted => "interrupted".to_string(), | ||
} | ||
} | ||
} |