[][src]Enum rustpython_parser::ast::StatementType

pub enum StatementType {
    Break,
    Continue,
    Return {
        value: Option<Expression>,
    },
    Import {
        names: Vec<ImportSymbol>,
    },
    ImportFrom {
        level: usize,
        module: Option<String>,
        names: Vec<ImportSymbol>,
    },
    Pass,
    Assert {
        test: Expression,
        msg: Option<Expression>,
    },
    Delete {
        targets: Vec<Expression>,
    },
    Assign {
        targets: Vec<Expression>,
        value: Expression,
    },
    AugAssign {
        target: Box<Expression>,
        op: Operator,
        value: Box<Expression>,
    },
    AnnAssign {
        target: Box<Expression>,
        annotation: Box<Expression>,
        value: Option<Expression>,
    },
    Expression {
        expression: Expression,
    },
    Global {
        names: Vec<String>,
    },
    Nonlocal {
        names: Vec<String>,
    },
    If {
        test: Expression,
        body: Suite,
        orelse: Option<Suite>,
    },
    While {
        test: Expression,
        body: Suite,
        orelse: Option<Suite>,
    },
    With {
        is_async: bool,
        items: Vec<WithItem>,
        body: Suite,
    },
    For {
        is_async: bool,
        target: Box<Expression>,
        iter: Box<Expression>,
        body: Suite,
        orelse: Option<Suite>,
    },
    Raise {
        exception: Option<Expression>,
        cause: Option<Expression>,
    },
    Try {
        body: Suite,
        handlers: Vec<ExceptHandler>,
        orelse: Option<Suite>,
        finalbody: Option<Suite>,
    },
    ClassDef {
        name: String,
        body: Suite,
        bases: Vec<Expression>,
        keywords: Vec<Keyword>,
        decorator_list: Vec<Expression>,
    },
    FunctionDef {
        is_async: bool,
        name: String,
        args: Box<Parameters>,
        body: Suite,
        decorator_list: Vec<Expression>,
        returns: Option<Expression>,
    },
}

Abstract syntax tree nodes for python statements.

Variants

Break

A break statement.

Continue

A continue statement.

Return

A return statement. This is used to return from a function.

Fields of Return

value: Option<Expression>
Import

An import statement.

Fields of Import

names: Vec<ImportSymbol>
ImportFrom

An import from statement.

Fields of ImportFrom

level: usizemodule: Option<String>names: Vec<ImportSymbol>
Pass

A pass statement.

Assert

An assert statement.

Fields of Assert

test: Expressionmsg: Option<Expression>
Delete

A del statement, to delete some variables.

Fields of Delete

targets: Vec<Expression>
Assign

Variable assignment. Note that we can assign to multiple targets.

Fields of Assign

targets: Vec<Expression>value: Expression
AugAssign

Augmented assignment.

Fields of AugAssign

target: Box<Expression>op: Operatorvalue: Box<Expression>
AnnAssign

A type annotated assignment.

Fields of AnnAssign

target: Box<Expression>annotation: Box<Expression>value: Option<Expression>
Expression

An expression used as a statement.

Fields of Expression

expression: Expression
Global

The global statement, to declare names as global variables.

Fields of Global

names: Vec<String>
Nonlocal

A nonlocal statement, to declare names a non-local variables.

Fields of Nonlocal

names: Vec<String>
If

An if statement.

Fields of If

test: Expressionbody: Suiteorelse: Option<Suite>
While

A while statement.

Fields of While

test: Expressionbody: Suiteorelse: Option<Suite>
With

The with statement.

Fields of With

is_async: boolitems: Vec<WithItem>body: Suite
For

A for statement. Contains the body of the loop, and the else clause.

Fields of For

is_async: booltarget: Box<Expression>iter: Box<Expression>body: Suiteorelse: Option<Suite>
Raise

A raise statement.

Fields of Raise

exception: Option<Expression>cause: Option<Expression>
Try

A try statement.

Fields of Try

body: Suitehandlers: Vec<ExceptHandler>orelse: Option<Suite>finalbody: Option<Suite>
ClassDef

A class definition.

Fields of ClassDef

name: Stringbody: Suitebases: Vec<Expression>keywords: Vec<Keyword>decorator_list: Vec<Expression>
FunctionDef

A function definition. Contains the name of the function, it's body some decorators and formal parameters to the function.

Fields of FunctionDef

is_async: boolname: Stringargs: Box<Parameters>body: Suitedecorator_list: Vec<Expression>returns: Option<Expression>

Trait Implementations

impl Debug for StatementType[src]

impl PartialEq<StatementType> for StatementType[src]

impl StructuralPartialEq for StatementType[src]

Auto Trait Implementations

impl RefUnwindSafe for StatementType

impl Send for StatementType

impl Sync for StatementType

impl Unpin for StatementType

impl UnwindSafe for StatementType

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.