pub struct ParseResult { /* private fields */ }Expand description
Owns a parsed document, its backing text, and non-fatal warnings.
A successful parse can contain recovered content. Check Self::source_recovery
when the application requires complete input, and Self::warnings for all diagnostics.
Implementations§
Source§impl ParseResult
impl ParseResult
Sourcepub fn source(&self) -> &str
pub fn source(&self) -> &str
Borrow the preprocessed source the AST was parsed from.
Note: this is the text as seen by the grammar, after include resolution and other preprocessor transforms — not the original caller input.
Sourcepub fn source_location(&self, location: &Location) -> SourceLocation
pub fn source_location(&self, location: &Location) -> SourceLocation
Resolve a location from this result’s AST to its original source file and position.
Includes use the file resolved during preprocessing, even when selection or indentation changed the parsed text. A span crossing files is anchored in the file containing its start. Unknown include chains have no file.
Sourcepub fn source_recovery(&self) -> Option<&Warning>
pub fn source_recovery(&self) -> Option<&Warning>
The first warning for recovered source content or structure, when present.
This includes omitted content, ignored substitutions, and unmatched block
boundaries, but excludes presentation warnings. It remains available after
Self::take_warnings.
Sourcepub fn take_warnings(&mut self) -> Vec<Warning>
pub fn take_warnings(&mut self) -> Vec<Warning>
Take the warnings, leaving Self::warnings empty.
The document and Self::source_recovery remain available.