welly_parser::welly

Type Alias Stmt

source
pub type Stmt = Stmt;

Aliased Type§

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

Variants§

§

Expr(Option<Box<Expr>>)

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

§

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

E.g. x += 1;.

§

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

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

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

§

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

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

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

§

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

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

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

§

Switch(Location, Option<Box<Expr>>, Vec<Case>, Option<Else>)

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

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

§

Verb(Loc<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.