Skip to main content

parse_module

Function parse_module 

Source
pub fn parse_module(
    path: &Path,
    source: &str,
    options: &ParseOptions,
) -> Result<ModuleInfo, SyntaxError>
Expand description

Parses source (the content of path) into a ModuleInfo. The extension of path selects the language.

§Errors

SyntaxError::Unsupported for a file type that is neither a script nor a supported component format.

Syntax errors are not errors of this function: the parser’s recovered program is analysed and the problems are reported in ModuleInfo::parse_diagnostics. When the parser cannot recover at all, the returned info is empty and ModuleInfo::fatal is set.