astx.flows

astx.flows

Source: packages/astx/src/astx/flows.py

title: Module for controle flow AST.

Classes

IfStmt(StatementType)

title: AST class for `if` statement.
attributes:
  loc:
    type: SourceLocation
  kind:
    type: ASTKind
  condition:
    type: Expr
  then:
    type: Block
  else_:
    type: Optional[Block]

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

IfExpr(Expr)

title: AST class for `if` expression.
attributes:
  loc:
    type: SourceLocation
  kind:
    type: ASTKind
  condition:
    type: Expr
  then:
    type: Block
  else_:
    type: Optional[Block]

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

ForRangeLoopStmt(StatementType)

title: AST class for `For` Range Statement.
attributes:
  kind:
    type: ASTKind
  variable:
    type: InlineVariableDeclaration
  start:
    type: Expr
  end:
    type: Expr
  step:
    type: Expr
  body:
    type: Block

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

ForRangeLoopExpr(Expr)

title: AST class for `For` Range Expression.
attributes:
  kind:
    type: ASTKind
  variable:
    type: InlineVariableDeclaration
  start:
    type: Expr
  end:
    type: Expr
  step:
    type: Expr
  body:
    type: Block

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

ForCountLoopStmt(StatementType)

title: AST class for a simple Count-Controlled `For` Loop statement.
summary: |-

  This is a very basic `for` loop, used by languages like C or C++.
attributes:
  kind:
    type: ASTKind
  initializer:
    type: InlineVariableDeclaration
  condition:
    type: Expr
  update:
    type: Expr
  body:
    type: Block

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

ForCountLoopExpr(Expr)

title: AST class for a simple Count-Controlled `For` Loop expression.
summary: |-

  This is a very basic `for` loop, used by languages like C or C++.
attributes:
  kind:
    type: ASTKind
  initializer:
    type: InlineVariableDeclaration
  condition:
    type: Expr
  update:
    type: Expr
  body:
    type: Block

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

AsyncForRangeLoopStmt(StatementType)

title: AST class for asynchronous `For` Range Statement.
attributes:
  kind:
    type: ASTKind
  variable:
    type: InlineVariableDeclaration
  start:
    type: Optional[Expr]
  end:
    type: Expr
  step:
    type: Optional[Expr]
  body:
    type: Block

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

AsyncForRangeLoopExpr(Expr)

title: AST class for asynchronous `For` Range Expression.
attributes:
  kind:
    type: ASTKind
  variable:
    type: InlineVariableDeclaration
  start:
    type: Optional[Expr]
  end:
    type: Expr
  step:
    type: Optional[Expr]
  body:
    type: Block

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

BreakStmt(StatementType)

title: AST class for break statement.
attributes:
  kind:
    type: ASTKind

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

ContinueStmt(StatementType)

title: AST class for continue statement.
attributes:
  kind:
    type: ASTKind

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

WhileStmt(StatementType)

title: AST class for `while` statement.
attributes:
  kind:
    type: ASTKind
  condition:
    type: Expr
  body:
    type: Block

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

WhileExpr(Expr)

title: AST class for `while` expression.
attributes:
  kind:
    type: ASTKind
  condition:
    type: Expr
  body:
    type: Block

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

CaseStmt(StatementType)

title: AST class for a case in a Switch statement.
attributes:
  kind:
    type: ASTKind
  condition:
    type: Optional[Expr]
  body:
    type: Block
  default:
    type: bool

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

SwitchStmt(StatementType)

title: AST class for Switch statements based on Rust's match syntax.
attributes:
  kind:
    type: ASTKind
  value:
    type: Expr
  cases:
    type: ASTNodes[CaseStmt]

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

GotoStmt(StatementType)

title: AST class for function `Goto` statement.
attributes:
  kind:
    type: ASTKind
  label:
    type: Identifier

Methods

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct

DoWhileStmt(WhileStmt)

title: AST class for `do-while` statement.
attributes:
  condition:
    type: Expr
  body:
    type: Block
  kind:
    type: ASTKind

DoWhileExpr(WhileExpr)

title: AST class for `do-while` expression.
attributes:
  condition:
    type: Expr
  body:
    type: Block
  kind:
    type: ASTKind