Split the ast from the parser, remove compiler dep on parser

This commit is contained in:
Noah 2020-11-02 12:37:19 -06:00
parent 3f88b08aaa
commit e9095a741d
5 changed files with 153 additions and 225 deletions

View file

@ -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: (),