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

Method parse

crates/ruff_python_parser/src/parser/mod.rs:156–165  ·  view source on GitHub ↗

Consumes the [`Parser`] and returns the parsed [`Parsed`].

(mut self)

Source from the content-addressed store, hash-verified

154
155 /// Consumes the [`Parser`] and returns the parsed [`Parsed`].
156 pub(crate) fn parse(mut self) -> Parsed<Mod> {
157 let syntax = self.maybe_grow_stack(|parser| match parser.options.mode {
158 Mode::Expression | Mode::ParenthesizedExpression => {
159 Mod::Expression(parser.parse_single_expression())
160 }
161 Mode::Module | Mode::Ipython => Mod::Module(parser.parse_module()),
162 });
163
164 self.finish(syntax)
165 }
166
167 /// Parses a single expression.
168 ///

Callers 8

parse_moduleFunction · 0.45
parse_expressionFunction · 0.45
parse_expression_rangeFunction · 0.45
parse_uncheckedFunction · 0.45
parse_unchecked_sourceFunction · 0.45
parse_cells_uncheckedFunction · 0.45
number_valuesFunction · 0.45

Calls 6

ExpressionClass · 0.85
maybe_grow_stackMethod · 0.80
parse_moduleMethod · 0.80
ModuleClass · 0.50
finishMethod · 0.45

Tested by 1

number_valuesFunction · 0.36