pub struct GeneratedParseOutput<R, P> {
pub result: R,
pub parser: P,
}Expand description
Result from a generated parser entry point that retains the parser.
Keeps the generated parser available after the entry rule runs so callers
can inspect diagnostics or recover the parser-owned token stream. Generated
modules alias this type as <Grammar>ParserParseOutput<R, L, H> with their
parser type substituted for P and H defaulting to
crate::NoSemanticHooks. Self::into_parsed_file and
Self::validate are available for those generated parser types, which
wire in their module’s parsed and validated surfaces.
Fields§
§result: RValue returned by the caller-selected entry rule.
parser: PThe generated parser after the entry rule has run.
Implementations§
Source§impl<P: __GeneratedParserIntoParsedFile> GeneratedParseOutput<NodeId, P>
impl<P: __GeneratedParserIntoParsedFile> GeneratedParseOutput<NodeId, P>
Sourcepub fn into_parsed_file(self) -> ParsedFile
pub fn into_parsed_file(self) -> ParsedFile
Converts the completed parse into its owned crate::ParsedFile.
This consumes the retained parser, so inspect diagnostics such as
Parser::number_of_syntax_errors() first. Unlike validate(), this
preserves recovered parses, matching the generated parse entry point.
Source§impl<P: __GeneratedParserValidate> GeneratedParseOutput<NodeId, P>
impl<P: __GeneratedParserValidate> GeneratedParseOutput<NodeId, P>
Sourcepub fn validate(self) -> Result<P::Validated, ValidationError>
pub fn validate(self) -> Result<P::Validated, ValidationError>
Validates a completed parse and changes its generated context surface.
Validation rejects lexer diagnostics, parser recovery, recovered error nodes, and missing generated required children before constructing the validated-tree type boundary.
§Errors
Returns a ValidationError when the parse recorded lexer or parser
syntax errors or the completed tree fails structural validation.