MCPcopy Create free account
hub / github.com/LaBatata101/sith-language-server / try_into_expression

Method try_into_expression

crates/sith_python_parser/src/lib.rs:319–328  ·  view source on GitHub ↗

Attempts to convert the [`Parsed `] into a [`Parsed `]. This method checks if the `syntax` field of the output is a [`Mod::Expression`]. If it is, the method returns [`Some(Parsed )`] with the contained expression. Otherwise, it returns [`None`]. [`Some(Parsed )`]: Some

(self)

Source from the content-addressed store, hash-verified

317 ///
318 /// [`Some(Parsed<ModExpression>)`]: Some
319 pub fn try_into_expression(self) -> Option<Parsed<ModExpression>> {
320 match self.syntax {
321 Mod::Module(_) => None,
322 Mod::Expression(expression) => Some(Parsed {
323 syntax: expression,
324 tokens: self.tokens,
325 errors: self.errors,
326 }),
327 }
328 }
329}
330
331impl Parsed<ModModule> {

Callers 2

parse_expressionFunction · 0.80
parse_expression_rangeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected