[][src]Enum piske::ast::ast::Expression

pub enum Expression {
    Literal(Node<Literal>),
    Identifier(Node<Identifier>),
    Infix {
        op: InfixOp,
        left: Box<Node<Expression>>,
        right: Box<Node<Expression>>,
    },
    Prefix {
        op: PrefixOp,
        right: Box<Node<Expression>>,
    },
    Postfix {
        op: PostfixOp,
        left: Box<Node<Expression>>,
    },
    Block(Node<Block>),
    FnCall {
        name: Node<Identifier>,
        args: Vec<Node<Expression>>,
    },
    IfElse {
        cond: Box<Node<Expression>>,
        if_block: Node<Block>,
        else_block: Option<Node<Block>>,
    },
    Loop {
        variant: Option<Node<Identifier>>,
        set: Node<Set>,
        body: Node<Block>,
    },
}

Valid expressions in the piske programming language.

Variants

Literal(Node<Literal>)

A sole literal

Identifier(Node<Identifier>)

An identifier

Infix

An infix operation, of form

Fields of Infix

op: InfixOp

The specific type of infix operation (e.g. add, subtract)

left: Box<Node<Expression>>

The left operand

right: Box<Node<Expression>>

The right operand

Prefix

A prefix operation, of form

Fields of Prefix

op: PrefixOp

The specific type of prefix operation (e.g. negation)

right: Box<Node<Expression>>

The operand

Postfix

A postfix operation, of form

Fields of Postfix

op: PostfixOp

The specific type of postfix operation

left: Box<Node<Expression>>

The operand

Block(Node<Block>)

A block of statements is treated as an expression (and can have a return value)

FnCall

A function call

Fields of FnCall

name: Node<Identifier>

Function name.

args: Vec<Node<Expression>>

List of arguments passed into the function.

IfElse

If / else expression

Fields of IfElse

cond: Box<Node<Expression>>

conditional

if_block: Node<Block>

if-block (executed if cond is true)

else_block: Option<Node<Block>>

else-block (executed if cond is false); optional

Loop

Loop expression

Fields of Loop

variant: Option<Node<Identifier>>

name of loop-varying symbol

set: Node<Set>

set of elements to loop over

body: Node<Block>

loop body

Trait Implementations

impl PartialEq<Expression> for Expression[src]

impl Clone for Expression[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Expression[src]

impl Display for Expression[src]

impl Annotated for Expression

type Annotation = Annotation

The annotation type.

Auto Trait Implementations

impl !Send for Expression

impl !Sync for Expression

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.