pub struct ParseResult {
pub file: File,
pub diagnostics: Vec<ParseDiagnostic>,
pub status: ParseStatus,
pub terminal_error: Option<Error>,
pub syntax_facts: SyntaxFacts,
}Expand description
The result of parsing a script, including any recovery diagnostics and syntax facts collected along the way.
Fields§
§file: FileParsed syntax tree for the file.
diagnostics: Vec<ParseDiagnostic>Recovery diagnostics emitted while producing the AST.
status: ParseStatusHigh-level parse status.
terminal_error: Option<Error>Terminal parse error, when recovery could not continue.
syntax_facts: SyntaxFactsAdditional syntax facts collected during parsing.
Implementations§
Source§impl ParseResult
impl ParseResult
Sourcepub fn is_ok(&self) -> bool
pub fn is_ok(&self) -> bool
Returns true when the parse completed without recovery diagnostics.
Sourcepub fn is_err(&self) -> bool
pub fn is_err(&self) -> bool
Returns true when the parse produced recovery diagnostics or a terminal error.
Sourcepub fn strict_error(&self) -> Error
pub fn strict_error(&self) -> Error
Convert this result into a strict parse error.
If recovery diagnostics exist but no terminal error was recorded, the first recovery
diagnostic is converted into an Error.
Sourcepub fn unwrap(self) -> Self
pub fn unwrap(self) -> Self
Return the parse result when it is clean, otherwise panic with the strict error.
Sourcepub fn expect(self, message: &str) -> Self
pub fn expect(self, message: &str) -> Self
Return the parse result when it is clean, otherwise panic with message.
Sourcepub fn unwrap_err(self) -> Error
pub fn unwrap_err(self) -> Error
Return the strict parse error when the result is not clean, otherwise panic.
Sourcepub fn expect_err(self, message: &str) -> Error
pub fn expect_err(self, message: &str) -> Error
Return the strict parse error when the result is not clean, otherwise panic with
message.
Trait Implementations§
Source§impl Clone for ParseResult
impl Clone for ParseResult
Source§fn clone(&self) -> ParseResult
fn clone(&self) -> ParseResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more