Parse the given Python source code using the specified [`Mode`]. This function is the most general function to parse Python code. Based on the [`Mode`] supplied, it can be used to parse a single expression, a full Python program, an interactive expression or a Python program containing IPython escape commands. # Example If we want to parse a simple expression, we can use the [`Mode::Expression`
(source: &str, mode: Mode)
| 210 | /// assert!(parsed.is_ok()); |
| 211 | /// ``` |
| 212 | pub fn parse(source: &str, mode: Mode) -> Result<Parsed<Mod>, ParseError> { |
| 213 | parse_unchecked(source, mode).into_result() |
| 214 | } |
| 215 | |
| 216 | /// Parse the given Python source code using the specified [`Mode`]. |
| 217 | /// |