(command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<Id.Lit_LBracket '['>} { (braced_var_sub token: <Id.VSub_Name SPECIALFORMS_IF_SH> suffix_op: (suffix_op.Unary tok:<Id.VTest_Plus '+'> arg_word:{<true>}) ) } {<Id.Lit_RBracket ']'>} ) (command.ControlFlow token:<Id.ControlFlow_Return return>) ] ) (C {<declare>} {<-g>} {<Id.Lit_VarLike 'SPECIALFORMS_IF_SH='> <true>}) (C {<.>} { (braced_var_sub token: <Id.VSub_Name BASH_SOURCE> suffix_op: (suffix_op.Unary tok: <Id.VOp1_Percent '%'> arg_word: {<Id.Lit_Slash '/'> <Id.Lit_Other '*'>} ) ) <'/common.sh'> } ) (C {<.>} { (braced_var_sub token: <Id.VSub_Name BASH_SOURCE> suffix_op: (suffix_op.Unary tok: <Id.VOp1_Percent '%'> arg_word: {<Id.Lit_Slash '/'> <Id.Lit_Other '*'>} ) ) <'/test.sh'> } ) (C {<.>} { (braced_var_sub token: <Id.VSub_Name BASH_SOURCE> suffix_op: (suffix_op.Unary tok: <Id.VOp1_Percent '%'> arg_word: {<Id.Lit_Slash '/'> <Id.Lit_Other '*'>} ) ) <'/specialforms.sh'> } ) (command.ShFunction name: 'evaluator::specialforms::if' body: (BraceGroup children: [ (C {<declare>} {<Id.Lit_VarLike 'env='> (DQ (${ Id.VSub_Number 1))}) (C {<declare>} {<Id.Lit_VarLike 'functionName='> (DQ (${ Id.VSub_Number 2))}) (C {<declare>} {<Id.Lit_VarLike 'args='> (DQ (${ Id.VSub_Number 3))}) (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <length> } {($ Id.VSub_DollarName '$args')} ) terminator: <Id.Op_Semi _> ) (C {<declare>} {<-i>} {<Id.Lit_VarLike 'length='> (DQ (${ Id.VSub_Name RESULT))}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: {($ Id.VSub_DollarName '$length')} right: {<3>} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<stderr>} {(DQ <'usage: (if condition true-branch false-branch)'>)}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [196 209] ) ] ) (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <index> } {($ Id.VSub_DollarName '$args')} {<0>} ) terminator: <Id.Op_Semi _> ) (C {<declare>} {<Id.Lit_VarLike 'condition='> (${ Id.VSub_Name RESULT)}) (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <index> } {($ Id.VSub_DollarName '$args')} {<1>} ) terminator: <Id.Op_Semi _> ) (C {<declare>} {<Id.Lit_VarLike 'trueBranch='> (${ Id.VSub_Name RESULT)}) (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <index> } {($ Id.VSub_DollarName '$args')} {<2>} ) terminator: <Id.Op_Semi _> ) (C {<declare>} {<Id.Lit_VarLike 'falseBranch='> (${ Id.VSub_Name RESULT)}) (command.Sentence child: (C {<evaluator> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <eval>} {($ Id.VSub_DollarName '$env')} {($ Id.VSub_DollarName '$condition')} ) terminator: <Id.Op_Semi _> ) (C {<declare>} {<Id.Lit_VarLike 'conditionResult='> (${ Id.VSub_Name RESULT)}) (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <type> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <instanceOfOrExit> } {($ Id.VSub_DollarName '$conditionResult')} {<Boolean>} ) (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <value>} {($ Id.VSub_DollarName '$conditionResult')} ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ <true>)} right: {(DQ (${ Id.VSub_Name RESULT))} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<evaluator> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <eval>} {($ Id.VSub_DollarName '$env')} {($ Id.VSub_DollarName '$trueBranch')} ) ] spids: [336 355] ) ] else_action: [ (C {<evaluator> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <eval>} {($ Id.VSub_DollarName '$env')} {($ Id.VSub_DollarName '$falseBranch')} ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name RESULT))} spids: [384] ) ] ) ] ) ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Number '$0')} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {($ Id.VSub_DollarName '$BASH_SOURCE')} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [(command.ControlFlow token:<Id.ControlFlow_Return return>)] spids: [402 416] ) ] ) (command.CommandList children: [ (command.Sentence child:(C {<createTestEnv>}) terminator:<Id.Op_Semi _>) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:env) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name RESULT))} spids: [446] ) ] ) ] ) (command.CommandList children: [ (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <new> } ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:command) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name RESULT))} spids: [463] ) ] ) ] ) (C {<appendToList>} {($ Id.VSub_DollarName '$command')} {<Identifier>} {(DQ <if>)}) (command.CommandList children: [ (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <new> } ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:conditional) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name RESULT))} spids: [491] ) ] ) ] ) (C {<appendToList>} {($ Id.VSub_DollarName '$conditional')} {<Identifier>} {(DQ <'='>)} {<Integer>} {<3>} {<Integer>} {<3>} ) (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <append> } {($ Id.VSub_DollarName '$command')} {($ Id.VSub_DollarName '$conditional')} ) (C {<appendToList>} {($ Id.VSub_DollarName '$command')} {<String>} {<yes>} {<String>} {<no>}) (C {<evaluator> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <eval>} {($ Id.VSub_DollarName '$env')} {($ Id.VSub_DollarName '$command')} ) (command.CommandList children: [ (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <debug>} {(DQ (${ Id.VSub_Name RESULT))} ) terminator: <Id.Op_Semi _> ) (C {<assert> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <equals>} {(DQ <'String :: yes'>)} {(DQ (${ Id.VSub_Name RESULT))} {(DQ <'(if (= 3 3) \'yes \'no)'>)} ) ] ) (command.CommandList children: [ (command.Sentence child:(C {<createTestEnv>}) terminator:<Id.Op_Semi _>) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:env) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name RESULT))} spids: [600] ) ] ) ] ) (command.CommandList children: [ (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <new> } ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:command) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name RESULT))} spids: [617] ) ] ) ] ) (C {<appendToList>} {($ Id.VSub_DollarName '$command')} {<Identifier>} {(DQ <if>)}) (command.CommandList children: [ (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <new> } ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:conditional) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name RESULT))} spids: [645] ) ] ) ] ) (C {<appendToList>} {($ Id.VSub_DollarName '$conditional')} {<Identifier>} {(DQ <'='>)} {<Integer>} {<3>} {<Integer>} {<4>} ) (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <append> } {($ Id.VSub_DollarName '$command')} {($ Id.VSub_DollarName '$conditional')} ) (C {<appendToList>} {($ Id.VSub_DollarName '$command')} {<String>} {<yes>} {<String>} {<no>}) (C {<evaluator> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <eval>} {($ Id.VSub_DollarName '$env')} {($ Id.VSub_DollarName '$command')} ) (command.CommandList children: [ (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <debug>} {(DQ (${ Id.VSub_Name RESULT))} ) terminator: <Id.Op_Semi _> ) (C {<assert> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <equals>} {(DQ <'String :: no'>)} {(DQ (${ Id.VSub_Name RESULT))} {(DQ <'(if (= 3 4) \'yes \'no)'>)} ) ] ) (command.CommandList children: [ (command.Sentence child:(C {<createTestEnv>}) terminator:<Id.Op_Semi _>) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:env) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name RESULT))} spids: [754] ) ] ) ] ) (C {<setInEnv>} {($ Id.VSub_DollarName '$env')} {(DQ <v>)} {<Integer>} {<10>}) (command.CommandList children: [ (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <new> } ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:command) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name RESULT))} spids: [783] ) ] ) ] ) (C {<appendToList>} {($ Id.VSub_DollarName '$command')} {<Identifier>} {(DQ <if>)}) (command.CommandList children: [ (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <new> } ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:conditional) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name RESULT))} spids: [811] ) ] ) ] ) (C {<appendToList>} {($ Id.VSub_DollarName '$conditional')} {<Identifier>} {(DQ <'='>)} {<Integer>} {<3>} {<Integer>} {<4>} ) (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <LinkedList> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <append> } {($ Id.VSub_DollarName '$command')} {($ Id.VSub_DollarName '$conditional')} ) (C {<appendToList>} {($ Id.VSub_DollarName '$command')} {<Integer>} {<5>} {<Identifier>} {<v>}) (C {<evaluator> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <eval>} {($ Id.VSub_DollarName '$env')} {($ Id.VSub_DollarName '$command')} ) (command.CommandList children: [ (command.Sentence child: (C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <debug>} {(DQ (${ Id.VSub_Name RESULT))} ) terminator: <Id.Op_Semi _> ) (C {<assert> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <equals>} {(DQ <'Integer :: 10'>)} {(DQ (${ Id.VSub_Name RESULT))} {(DQ <'(if (= 3 4) \'yes \'no)'>)} ) ] ) (C {<assert> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <report>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<Id.Lit_LBracket '['>} { (braced_var_sub token: <Id.VSub_Number 1> suffix_op: (suffix_op.Unary tok:<Id.VTest_Plus '+'> arg_word:{<isset>}) ) } {<Id.Lit_RBracket ']'>} ) (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='> <Id.Lit_Equals '='>} {(DQ <debug>)} {<Id.Lit_RBracket ']'>} ) ] ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<variable> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <printMetadata>})] spids: [914 944] ) ] ) ] )