welly_parser::welly

Type Alias Stmt

source
pub type Stmt = Stmt;

Aliased Type§

enum Stmt {
    Expr(Option<Box<Expr>>),
    Assign(Option<Box<Expr>>, AssignOp, Option<Box<Expr>>),
    If(Option<Box<Expr>>, Brace, Option<Brace>),
    While(Option<Box<Expr>>, Brace, Option<Brace>),
    For(Option<Box<Expr>>, Brace, Option<Brace>),
    Switch(Option<Box<Expr>>, Vec<Case>, Option<Brace>),
    Verb(Verb, Option<Box<Expr>>),
}

Variants§

§

Expr(Option<Box<Expr>>)

E.g. print("Hello");.

§

Assign(Option<Box<Expr>>, AssignOp, Option<Box<Expr>>)

E.g. x += 1;.

§

If(Option<Box<Expr>>, Brace, Option<Brace>)

E.g. if ... {...} else {...}.

Allow the condition Expr to be None, though it’s an error.

§

While(Option<Box<Expr>>, Brace, Option<Brace>)

E.g. while ... {...} else {...}.

Allow the condition Expr to be None, though it’s an error.

§

For(Option<Box<Expr>>, Brace, Option<Brace>)

E.g. for ... in ... {...} else {...}.

Allow an arbitrary Expr, or a missing one, though anything but ... in ... is an error.

§

Switch(Option<Box<Expr>>, Vec<Case>, Option<Brace>)

E.g. switch ... case ... {...} case ... {...} else {...}.

Allow the discriminant Expr to be None, though it’s an error.

§

Verb(Verb, Option<Box<Expr>>)

E.g. return ...; or continue;.

Allow the Expr to be present or missing, though for some Verbs one of those cases is an error.