fn generic_verb<'a>(
    statement: &'a Statement,
    target: &str,
    simple_factory: &dyn Fn(usize, usize) -> Simple,
) -> Instruction {
    let conds = conditions(statement);
    if let Noun::Identifier(id) = statement.subject {
        if let Some(Target::Noun(Noun::Identifier(source))) = statement.action_target {
            let simple = simple_factory(id, source); 
            merge(simple, conds)
        }
        else if let Some(Target::Noun(Noun::Empty)) = statement.action_target {
            let simple = simple_factory(id, 0); 
            merge(simple, conds)
        }
        else if let Some(Target::Noun(Noun::Level)) = statement.action_target {
            let simple = simple_factory(id, 1); 
            merge(simple, conds)
        }
        else {
            Instruction::NoOp
        }
    }
    else {
        throw_error(
            ErrorType::InstructionValidationError, 
            format!("Cannot make {:?} {} any noun", statement.subject, target),
            None
        );
        Instruction::NoOp
    }
}
/// Returns a generic NOUN VERB NOUN instruction.
/// 
/// Negation via NOT returns a no-op.
Returns a generic NOUN VERB NOUN instruction.
Negation via NOT returns a no-op.
Returns a generic NOUN VERB NOUN instruction . Negation via NOT returns a no - op .
fn generic_verb<'a>(
    statement: &'a Statement,
    target: &str,
    simple_factory: &dyn Fn(usize, usize) -> Simple,
) -> Instruction {
    let conds = conditions(statement);
    if let Noun::Identifier(id) = statement.subject {
        if let Some(Target::Noun(Noun::Identifier(source))) = statement.action_target {
            let simple = simple_factory(id, source); 
            merge(simple, conds)
        }
        else if let Some(Target::Noun(Noun::Empty)) = statement.action_target {
            let simple = simple_factory(id, 0); 
            merge(simple, conds)
        }
        else if let Some(Target::Noun(Noun::Level)) = statement.action_target {
            let simple = simple_factory(id, 1); 
            merge(simple, conds)
        }
        else {
            Instruction::NoOp
        }
    }
    else {
        throw_error(
            ErrorType::InstructionValidationError, 
            format!("Cannot make {:?} {} any noun", statement.subject, target),
            None
        );
        Instruction::NoOp
    }
}
fn generic_verb < ' a > ( statement : & ' a Statement , target : & str , simple_factory : & dyn Fn ( usize , usize ) -> Simple , ) -> Instruction { let conds = conditions ( statement ) ; if let Noun :: Identifier ( id ) = statement . subject { if let Some ( Target :: Noun ( Noun :: Identifier ( source ) ) ) = statement . action_target { let simple = simple_factory ( id , source ) ; merge ( simple , conds ) } else if let Some ( Target :: Noun ( Noun :: Empty ) ) = statement . action_target { let simple = simple_factory ( id , 0 ) ; merge ( simple , conds ) } else if let Some ( Target :: Noun ( Noun :: Level ) ) = statement . action_target { let simple = simple_factory ( id , 1 ) ; merge ( simple , conds ) } else { Instruction :: NoOp } } else { throw_error ( ErrorType :: InstructionValidationError , format ! ( " " statement subject target ) , None ) ; Instruction :: NoOp } }
Returns a generic NOUN VERB NOUN instruction.
Returns a generic NOUN VERB NOUN instruction .
statement
&'a Statement
target
&str
simple_factory
&dyn Fn(usize, usize) -> Simple
statement
&'a Statement
target
&str
simple_factory
&dyn Fn(usize, usize) -> Simple