Skip to main content

ControlFlowGenerator

Trait ControlFlowGenerator 

Source
pub trait ControlFlowGenerator {
    // Required methods
    fn generate_if_then_else(
        &mut self,
        condition: &Expr,
        then_block: &[Stmt],
        else_block: Option<&[Stmt]>,
    ) -> Result<()>;
    fn generate_while_loop(
        &mut self,
        condition: &Expr,
        body: &[Stmt],
    ) -> Result<()>;
    fn generate_for_loop(
        &mut self,
        variable: &str,
        start: &Expr,
        end: &Expr,
        step: Option<&Expr>,
        body: &[Stmt],
        direction: ForDirection,
    ) -> Result<()>;
    fn generate_repeat_loop(
        &mut self,
        body: &[Stmt],
        condition: &Expr,
    ) -> Result<()>;
}
Expand description

Control flow generation trait

Required Methods§

Source

fn generate_if_then_else( &mut self, condition: &Expr, then_block: &[Stmt], else_block: Option<&[Stmt]>, ) -> Result<()>

Generate if-then-else structure

Source

fn generate_while_loop(&mut self, condition: &Expr, body: &[Stmt]) -> Result<()>

Generate while loop

Source

fn generate_for_loop( &mut self, variable: &str, start: &Expr, end: &Expr, step: Option<&Expr>, body: &[Stmt], direction: ForDirection, ) -> Result<()>

Generate for loop

Source

fn generate_repeat_loop( &mut self, body: &[Stmt], condition: &Expr, ) -> Result<()>

Generate repeat-until loop

Implementors§