[][src]Enum yotc::parser::statement::Statement

pub enum Statement {
    CompoundStatement {
        statements: Vec<Statement>,
    },
    IfStatement {
        condition: Box<Expression>,
        main_statement: Box<Statement>,
        else_statement: Option<Box<Statement>>,
    },
    ReturnStatement {
        value: Box<Expression>,
    },
    VariableDeclarationStatement {
        name: String,
        value: Option<Box<Expression>>,
    },
    ExpressionStatement {
        expression: Box<Expression>,
    },
    NoOpStatement,
}

A yot statement.

Variants

CompoundStatement

Multiple statements enclosed in braces.

Grammar

  • "{" + Statement... + "}"

Fields of CompoundStatement

statements: Vec<Statement>
IfStatement

An if/else statement.

Grammar

  • "?" + "[" + Expression + "]" + Statement
  • "?" + "[" + Expression + "]" + Statement + ":" + Statement

Fields of IfStatement

condition: Box<Expression>main_statement: Box<Statement>else_statement: Option<Box<Statement>>
ReturnStatement

A return statement.

Grammar

  • "->" + Expression + ";"

Fields of ReturnStatement

value: Box<Expression>
VariableDeclarationStatement

A variable declaration with an optional value.

Grammar

  • "@" + Identifier + ";"
  • "@" + Identifier + "=" + Expression + ";"

Fields of VariableDeclarationStatement

name: Stringvalue: Option<Box<Expression>>
ExpressionStatement

An expression ending with a semicolon.

Grammar

  • Expression + ";"

Fields of ExpressionStatement

expression: Box<Expression>
NoOpStatement

A no-op ending (just a semicolon).

Grammar

  • ;

Trait Implementations

impl Debug for Statement[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.