Enum Expr

Source
pub enum Expr<'input> {
Show 23 variants None(None), Bool(Bool<'input>), Num(Num<'input>), Ident(Ident<'input>), Atom(Atom<'input>), Str(Str<'input>), Binary(Binary<'input>), Call(Call<'input>), Unary(Unary<'input>), Assign(Assign<'input>), If(If<'input>), InlineFun(InlineFun<'input>), Fun(Fun<'input>), Block(Block<'input>), ListLit(ListLit<'input>), MapLit(MapLit<'input>), Struct(Struct<'input>), Var(Var<'input>), While(While<'input>), Break(Break<'input>), Continue(Continue<'input>), Return(Return<'input>), Range(Range<'input>),
}
Expand description

An xlang expression.

Variants§

§

None(None)

§

Bool(Bool<'input>)

§

Num(Num<'input>)

§

Ident(Ident<'input>)

§

Atom(Atom<'input>)

§

Str(Str<'input>)

§

Binary(Binary<'input>)

§

Call(Call<'input>)

§

Unary(Unary<'input>)

§

Assign(Assign<'input>)

§

If(If<'input>)

§

InlineFun(InlineFun<'input>)

§

Fun(Fun<'input>)

§

Block(Block<'input>)

§

ListLit(ListLit<'input>)

§

MapLit(MapLit<'input>)

§

Struct(Struct<'input>)

§

Var(Var<'input>)

§

While(While<'input>)

§

Break(Break<'input>)

§

Continue(Continue<'input>)

§

Return(Return<'input>)

§

Range(Range<'input>)

Implementations§

Source§

impl<'input> Expr<'input>

Source

pub fn none(loc: Loc) -> Self

Creates a new none expression.

Source

pub fn bool(loc: Loc, value: &'input str) -> Self

Creates a new boolean expression.

Source

pub fn dec(loc: Loc, value: &'input str) -> Self

Creates a new decimal integer expression.

Source

pub fn hex(loc: Loc, value: &'input str) -> Self

Creates a new hexadecimal integer expression.

Source

pub fn bin(loc: Loc, value: &'input str) -> Self

Creates a new binary integer expression.

Source

pub fn oct(loc: Loc, value: &'input str) -> Self

Creates a new octal integer expression.

Source

pub fn float(loc: Loc, value: &'input str) -> Self

Creates a new floating point number expression.

Source

pub fn ident(loc: Loc, value: &'input str) -> Self

Creates a new identifier expression.

Source

pub fn atom(loc: Loc, value: &'input str) -> Self

Creates a new atom expression.

Source

pub fn str(loc: Loc, value: &'input str) -> Self

Creates a new string expression.

Source

pub fn binary(loc: Loc, left: Self, op: BinaryOp, right: Self) -> Self

Creates a new binary operation.

Source

pub fn call(loc: Loc, fun: Self, args: Vec<Self>) -> Self

Creates a new function call operation.

Source

pub fn unary(loc: Loc, op: UnaryOp, subject: Self) -> Self

Creates a new function call operation.

Source

pub fn assign(loc: Loc, left: Self, op: AssignOp, right: Self) -> Self

Creates a new assignment operation.

Source

pub fn range_exclusive( loc: Loc, left: Option<Self>, right: Option<Self>, ) -> Self

Creates an exclusive range.

Source

pub fn range_inclusive(loc: Loc, left: Option<Self>, right: Self) -> Self

Creates an inclusive range.

Trait Implementations§

Source§

impl<'input> Clone for Expr<'input>

Source§

fn clone(&self) -> Expr<'input>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'input> Debug for Expr<'input>

Source§

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

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

impl<'input> Locate for Expr<'input>

Source§

fn loc(&self) -> Loc

Returns the location of this expression.
Source§

impl<'input> PartialEq for Expr<'input>

Source§

fn eq(&self, other: &Expr<'input>) -> 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<'input> StructuralPartialEq for Expr<'input>

Auto Trait Implementations§

§

impl<'input> Freeze for Expr<'input>

§

impl<'input> RefUnwindSafe for Expr<'input>

§

impl<'input> Send for Expr<'input>

§

impl<'input> Sync for Expr<'input>

§

impl<'input> Unpin for Expr<'input>

§

impl<'input> UnwindSafe for Expr<'input>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.