#[repr(C)]
pub struct ParserResult { pub ast: Option<Box<Node>>, pub tokens: Vec<Token>, pub diagnostics: Vec<Diagnostic>, pub comments: Vec<Comment>, pub magic_comments: Vec<MagicComment>, pub input: DecodedInput, }
Expand description

Combination of all data that Parser can give you

Fields§

§ast: Option<Box<Node>>

Abstract Syntax Tree that was constructed from you code. Contains None if the code gives no AST nodes

§tokens: Vec<Token>

List of tokens returned by a Lexer and consumed by a Parser. Empty unless ParserOptions::record_tokens is set to true.

§diagnostics: Vec<Diagnostic>

List of all diagnostics (errors and warnings) that have been recorded during lexing and parsing

§comments: Vec<Comment>

List of comments extracted from the source code.

§magic_comments: Vec<MagicComment>

List of magic comments extracted from the source code.

§input: DecodedInput

Input that was used for parsing.

Note: this input is not necessary the same byte array that you passed to Parser::parse. If encoding of the input is not UTF-8 or ASCII-8BIT/BINARY Parser invokes decoder that usually produces a different sequence of bytes.

Pass this data to Loc::source, otherwise you’ll get incorrect source ranges.

Trait Implementations§

source§

impl Debug for ParserResult

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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>,

§

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>,

§

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.