mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-12 07:35:16 +00:00
parser::Mode from compile::Mode
This commit is contained in:
parent
40690b9761
commit
bfe4795b6c
1 changed files with 11 additions and 0 deletions
|
@ -17,6 +17,17 @@ impl Mode {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<rustpython_compiler_core::Mode> for Mode {
|
||||
fn from(mode: rustpython_compiler_core::Mode) -> Self {
|
||||
use rustpython_compiler_core::Mode as CompileMode;
|
||||
match mode {
|
||||
CompileMode::Exec => Self::Module,
|
||||
CompileMode::Eval => Self::Expression,
|
||||
CompileMode::Single | CompileMode::BlockExpr => Self::Interactive,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for Mode {
|
||||
type Err = ModeParseError;
|
||||
fn from_str(s: &str) -> Result<Self, ModeParseError> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue