mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-15 17:15:24 +00:00
parser::Mode from compile::Mode
This commit is contained in:
parent
122382cb53
commit
8d39d5362b
2 changed files with 12 additions and 6 deletions
|
@ -31,12 +31,7 @@ pub fn compile(
|
|||
source_path: String,
|
||||
opts: compile::CompileOpts,
|
||||
) -> Result<CodeObject, CompileError> {
|
||||
let parser_mode = match mode {
|
||||
compile::Mode::Exec => parser::Mode::Module,
|
||||
compile::Mode::Eval => parser::Mode::Expression,
|
||||
compile::Mode::Single | compile::Mode::BlockExpr => parser::Mode::Interactive,
|
||||
};
|
||||
let mut ast = match parser::parse(source, parser_mode, &source_path) {
|
||||
let mut ast = match parser::parse(source, mode.into(), &source_path) {
|
||||
Ok(x) => x,
|
||||
Err(e) => return Err(error_from_parse(e, source)),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue