Expression

Struct Expression 

Source
pub struct Expression<'source> {
    pub first_token: Option<Token<'source>>,
    pub last_token: Option<Token<'source>>,
    pub diagnostics: Diagnostics<'source>,
    pub contents: [Node<'source>],
}
Expand description

This type should not contain an incomplete expression so long as there are no error diagnostics.

Fields§

§first_token: Option<Token<'source>>§last_token: Option<Token<'source>>§diagnostics: Diagnostics<'source>§contents: [Node<'source>]

Implementations§

Source§

impl<'source> Expression<'source>

Source

pub fn build<G>( first_token: Option<Token<'source>>, last_token: Option<Token<'source>>, diagnostics: Diagnostics<'source>, contents: G, ) -> Box<Self>
where G: IntoIterator<Item = Node<'source>>, <G as IntoIterator>::IntoIter: ExactSizeIterator,

Creates an instance of Box<Expression>.

Source

pub fn build_from_slice( first_token: Option<Token<'source>>, last_token: Option<Token<'source>>, diagnostics: Diagnostics<'source>, contents: &[Node<'source>], ) -> Box<Self>
where Node<'source>: Copy,

Creates an instance of Box<Expression>.

Source

pub fn destructure( this: Box<Self>, ) -> (Option<Token<'source>>, Option<Token<'source>>, Diagnostics<'source>, ExpressionIter<'source>)

Destructures an instance of Box<Expression>, returning the tail slice as an iterator.

Source§

impl<'source> Expression<'source>

Source

pub fn new(lexer: &mut Peekable<Lexer<'source>>) -> Option<Box<Self>>

Parse an expression until an unexpected token is upcoming (via peek).

Trait Implementations§

Source§

impl<'source> Debug for Expression<'source>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'source> PartialEq for Expression<'source>

Source§

fn eq(&self, other: &Expression<'source>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'source> Eq for Expression<'source>

Source§

impl<'source> StructuralPartialEq for Expression<'source>

Auto Trait Implementations§

§

impl<'source> Freeze for Expression<'source>

§

impl<'source> RefUnwindSafe for Expression<'source>

§

impl<'source> Send for Expression<'source>

§

impl<'source> !Sized for Expression<'source>

§

impl<'source> Sync for Expression<'source>

§

impl<'source> Unpin for Expression<'source>

§

impl<'source> UnwindSafe for Expression<'source>

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