MCPcopy Create free account
hub / github.com/astral-sh/ruff / parse

Function parse

crates/ruff_python_parser/src/lib.rs:281–283  ·  view source on GitHub ↗

Parse the given Python source code using the specified [`ParseOptions`]. This function is the most general function to parse Python code. Based on the [`Mode`] supplied via the [`ParseOptions`], 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, w

(source: &str, options: ParseOptions)

Source from the content-addressed store, hash-verified

279/// assert!(parsed.is_ok());
280/// ```
281pub fn parse(source: &str, options: ParseOptions) -> Result<Parsed<Mod>, ParseError> {
282 parse_unchecked(source, options).into_result()
283}
284
285/// Parse the given Python source code using the specified [`ParseOptions`].
286///

Callers 15

parse_fill_and_alignFunction · 0.50
parseMethod · 0.50
from_strMethod · 0.50
from_raw_strMethod · 0.50
from_strMethod · 0.50
parseMethod · 0.50
trace_visitationFunction · 0.50
benchmark_formatterFunction · 0.50
mainFunction · 0.50
format_module_sourceFunction · 0.50
quick_testFunction · 0.50

Calls 2

parse_uncheckedFunction · 0.85
into_resultMethod · 0.80