Skip to main content

ParseResult

Struct ParseResult 

Source
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: String

The original source text, owned.

§program: Program

The 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: bool

true when the error list was capped and further errors were dropped.

§source_map: SourceMap

Pre-computed line index for span-to-line/column resolution.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.