mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Format main.rs
This commit is contained in:
1 parent
eb16f16566
commit
b34784e9ef
1 file changed
+12
-4
+12
-4
@@ -10,8 +10,8 @@ extern crate rustyline;
|
||||
use clap::{App, Arg};
|
||||
use rustpython_parser::error::ParseError;
|
||||
use rustpython_vm::{
|
||||
compile, error::CompileError, error::CompileErrorType, frame::Scope, import, obj::objstr, print_exception,
|
||||
pyobject::PyResult, util, VirtualMachine,
|
||||
compile, error::CompileError, error::CompileErrorType, frame::Scope, import, obj::objstr,
|
||||
print_exception, pyobject::PyResult, util, VirtualMachine,
|
||||
};
|
||||
use rustyline::{error::ReadlineError, Editor};
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -115,7 +115,12 @@ fn shell_exec(vm: &VirtualMachine, source: &str, scope: Scope) -> Result<(), Com
|
||||
Ok(())
|
||||
}
|
||||
// Don't inject syntax errors for line continuation
|
||||
Err(err @ CompileError{ error: CompileErrorType::Parse(ParseError::EOF(_)), .. }) => Err(err),
|
||||
Err(
|
||||
err @ CompileError {
|
||||
error: CompileErrorType::Parse(ParseError::EOF(_)),
|
||||
..
|
||||
},
|
||||
) => Err(err),
|
||||
Err(err) => {
|
||||
let exc = vm.new_syntax_error(&err);
|
||||
print_exception(vm, &exc);
|
||||
@@ -188,7 +193,10 @@ fn run_shell(vm: &VirtualMachine) -> PyResult {
|
||||
}
|
||||
|
||||
match shell_exec(vm, &input, vars.clone()) {
|
||||
Err(CompileError { error: CompileErrorType::Parse(ParseError::EOF(_)), .. }) => {
|
||||
Err(CompileError {
|
||||
error: CompileErrorType::Parse(ParseError::EOF(_)),
|
||||
..
|
||||
}) => {
|
||||
continuing = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user