pub fn parse_expression(
source: &str,
) -> Result<Parsed<ModExpression>, ParseError>Expand description
Parses a single Python expression.
This convenience function can be used to parse a single expression without having to specify the Mode or the location.
ยงExample
For example, parsing a single expression denoting the addition of two numbers:
use ruff_python_parser::parse_expression;
let expr = parse_expression("1 + 2");
assert!(expr.is_ok());