pub struct ParseResult {
pub source: String,
pub program: Program,
pub comments: Vec<Comment>,
pub errors: Vec<ParseError>,
pub errors_truncated: bool,
pub source_map: SourceMap,
}Expand description
Lifetime-free result of parsing a PHP source string.
This is the primary return type of parse and parse_versioned. The
AST is fully owned (Box<str>, Box<[T]>) so it can be stored in a
HashMap, sent across threads, or cached alongside other data without
fighting the borrow checker.
Use parse_arena or ParserContext when you need the arena-allocated
form for maximum throughput in tight loops or LSP re-parse scenarios.
Fields§
§source: StringThe original source text, owned.
program: ProgramThe parsed AST, fully owned with no lifetime parameters.
comments: Vec<Comment>All comments found in the source, in source order. Doc-block comments
attached to a declaration are stored in the declaration node’s
doc_comment field, not here.
errors: Vec<ParseError>Parse errors and diagnostics. Empty on a successful parse.
errors_truncated: booltrue when the error list was capped and further errors were dropped.
source_map: SourceMapPre-computed line index for span-to-line/column resolution.