mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-31 00:44:19 +00:00
Split the ast from the parser, remove compiler dep on parser
This commit is contained in:
parent
3f88b08aaa
commit
e9095a741d
5 changed files with 153 additions and 225 deletions
11
src/mode.rs
11
src/mode.rs
|
@ -1,5 +1,3 @@
|
|||
use rustpython_parser::parser;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum Mode {
|
||||
Exec,
|
||||
|
@ -19,15 +17,6 @@ impl std::str::FromStr for Mode {
|
|||
}
|
||||
}
|
||||
|
||||
impl Mode {
|
||||
pub fn to_parser_mode(self) -> parser::Mode {
|
||||
match self {
|
||||
Mode::Exec | Mode::Single => parser::Mode::Program,
|
||||
Mode::Eval => parser::Mode::Statement,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ModeParseError {
|
||||
_priv: (),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue