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

Function parse_module

crates/sith_python_parser/src/lib.rs:108–113  ·  view source on GitHub ↗

Parse a full Python module usually consisting of multiple lines. This is a convenience function that can be used to parse a full Python program without having to specify the [`Mode`] or the location. It is probably what you want to use most of the time. # Example For example, parsing a simple function definition and a call to that function: ``` use sith_python_parser::parse_module; let source

(source: &str)

Source from the content-addressed store, hash-verified

106/// assert!(module.is_valid());
107/// ```
108pub fn parse_module(source: &str) -> Parsed<ModModule> {
109 Parser::new(source, Mode::Module)
110 .parse()
111 .try_into_module()
112 .unwrap()
113}
114
115/// Parses a single Python expression.
116///

Callers 7

index_contentMethod · 0.85
build_symbol_tableMethod · 0.85
parse_suiteFunction · 0.85
test_unicode_aliasesFunction · 0.85
benchmark_parserFunction · 0.85
get_module_documentationFunction · 0.85

Calls 2

try_into_moduleMethod · 0.80
parseMethod · 0.45

Tested by 1

test_unicode_aliasesFunction · 0.68