*** Running test-parse-osh --- (command.CommandList children:[ (command.ShAssignment left:<Lit_VarLike "global_var="> pairs:[ (AssignPair left:...0x7f639f4fc530 lhs:(sh_lhs.Name left:...0x7f639f4fc530 name:global_var) op:assign_op.Equal rhs:(w <Lit_Chars global>) ) ] ) (command.ShFunction name_tok:<Lit_Chars g> name:g body:(BraceGroup left:<Lit_LBrace "{"> children:[ (C (w <Lit_Chars local>) (w <Lit_VarLike "g_var="> <Lit_Chars f>)) (C (w <Lit_Chars echo>) (w ($ g_var))) (C (w <Lit_Chars echo>) (w ($ f_var))) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name oil_var> name:oil_var)] rhs:(Var global_var) ) (C (w <Lit_Chars echo>) (w ($ oil_var))) ] right:<Lit_RBrace "}"> ) ) (command.ShFunction name_tok:<Lit_Chars f> name:f body:(BraceGroup left:<Lit_LBrace "{"> children:[ (C (w <Lit_Chars local>) (w <Lit_VarLike "f_var="> <Lit_Chars f>)) (C (w <Lit_Chars echo>) (w ($ f_var))) (C (w <Lit_Chars g>)) ] right:<Lit_RBrace "}"> ) ) (C (w <Lit_Chars f>)) ] ) --- (command.CommandList children:[ (C (w <Lit_Chars echo>) (w (SQ "This is a shell script with OSH extensions!")) ) (C (w <Lit_Chars echo>)) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name x> name:x)] rhs:(expr.Binary op:<Arith_Plus "+"> left:(Const Expr_DecInt _) right:(expr.Binary op:<Arith_Star "*"> left:(Const Expr_DecInt _) right:(Const Expr_DecInt _) ) ) ) (C (w <Lit_Chars echo>) (w (DQ <Lit_Chars "x: "> ($ x)))) (command.Mutation keyword:<KW_SetVar setvar> lhs:[<Expr_Name x>] op:<Arith_PlusEqual "+="> rhs:(Const Expr_DecInt _) ) (C (w <Lit_Chars echo>) (w (DQ <Lit_Chars "x: "> ($ x)))) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name mylist> name:mylist)] rhs:(expr.List left:<Op_LBracket "["> elts:[(Const Expr_DecInt _) (Const Expr_DecInt _) (Const Expr_DecInt _)] ctx:expr_context.Store ) ) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name y> name:y)] rhs:(expr.Binary op:<Arith_Star "*"> left:(Subscript left:<Op_LBracket "["> obj:(Var mylist) index:(Const Expr_DecInt _) ) right:(Const Expr_DecInt _) ) ) (C (w <Lit_Chars echo>) (w (DQ <Lit_Chars "y: "> ($ y)))) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name list2> name:list2)] rhs:(expr.Binary op:<Arith_DPlus "++"> left:(Var mylist) right:(expr.List left:<Op_LBracket "["> elts:[(Const Expr_DecInt _) (Const Expr_DecInt _)] ctx:expr_context.Store ) ) ) (C (w <Lit_Chars pp>) (w <Lit_Chars cell>) (w <Lit_Chars list2>)) (command.ShAssignment left:<Lit_VarLike "str1="> pairs:[ (AssignPair left:...0x7f011d26dc18 lhs:(sh_lhs.Name left:...0x7f011d26dc18 name:str1) op:assign_op.Equal rhs:(w (SQ "shell string")) ) ] ) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name str2> name:str2)] rhs:(DQ <Lit_Chars "Oil string">) ) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name str3> name:str3)] rhs:(expr.Binary op:<Arith_DPlus "++"> left:(Var str1) right:(Var str2)) ) (C (w <Lit_Chars echo>) (w (DQ <Lit_Chars "str3 = "> ($ str3)))) ] ) --- (command.CommandList children:[ (C (w <Lit_Chars echo>) (w (SingleQuoted left:<Left_DollarSingleQuote "$'"> sval:"one\ntwo" right:<Right_SingleQuote "'"> ) ) ) (command.VarDecl keyword:<KW_Var var> lhs:[ (NameType left:<Expr_Name a> name:a typ:(TypeExpr tok:<Expr_Name Int> name:Int) ) ] rhs:(expr.Binary op:<Arith_Plus "+"> left:(Const Expr_DecInt _) right:(expr.Binary op:<Arith_Star "*"> left:(Const Expr_DecInt _) right:(Const Expr_DecInt _) ) ) ) (C (w <Lit_Chars echo>) (w <Lit_VarLike "a="> ($ a))) (command.VarDecl keyword:<KW_Var var> lhs:[ (NameType left:<Expr_Name b> name:b typ:(TypeExpr tok:<Expr_Name Float> name:Float) ) ] rhs:(expr.Binary op:<Arith_Slash /> left:(Const Expr_DecInt _) right:(Const Expr_DecInt _) ) ) (C (w <Lit_Chars echo>) (w <Lit_VarLike "b="> ($ b))) (C (w <Lit_Chars echo>) (w <Lit_Chars hi>)) (command.CommandList children:[ (command.Sentence child:(command.Mutation keyword:<KW_SetVar setvar> lhs:[<Expr_Name a>] op:<Arith_Equal "="> rhs:(Var b) ) terminator:<Op_Semi ";"> ) (C (w <Lit_Chars echo>) (w <Lit_Chars hi>)) ] ) (command.Mutation keyword:<KW_SetVar setvar> lhs:[<Expr_Name x>] op:<Arith_Equal "="> rhs:(Const Expr_DecInt _) ) (command.Mutation keyword:<KW_SetVar setvar> lhs:[<Expr_Name d>] op:<Arith_Equal "="> rhs:(Const Expr_DecInt _) ) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name y> name:y)] rhs:(Var a) ) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name z> name:z)] rhs:(Var b) ) (C (w <Lit_Chars echo>) (w <Lit_Chars hi>)) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name mycmd> name:mycmd)] rhs:(expr.Binary op:<Arith_Plus "+"> left:(CommandSub left_token:<Left_DollarParen "$("> child:(C (w <Lit_Chars echo>) (w <Lit_Chars cmd>)) right:<Eof_RParen ")"> ) right:(DQ (CommandSub left_token:<Left_DollarParen "$("> child:(C (w <Lit_Chars echo>) (w <Lit_Chars cmd>)) right:<Eof_RParen ")"> ) ) ) ) (C (w <Lit_Chars echo>) (w <Lit_VarLike "mycmd="> ($ mycmd))) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name mybrace> name:mybrace)] rhs:(expr.Binary op:<Arith_Plus "+"> left:(${ VSub_Name b) right:(DQ (${ VSub_Name b)) ) ) (C (w <Lit_Chars echo>) (w <Lit_VarLike "mybrace="> ($ mybrace))) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name paren> name:paren)] rhs:(expr.Binary op:<Arith_Star "*"> left:(expr.Binary op:<Arith_Plus "+"> left:(Const Expr_DecInt _) right:(Const Expr_DecInt _) ) right:(Const Expr_DecInt _) ) ) (C (w <Lit_Chars echo>) (w <Lit_VarLike "paren="> ($ paren))) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name line_cont> name:line_cont)] rhs:(expr.Binary op:<Arith_Plus "+"> left:(Const Expr_DecInt _) right:(Const Expr_DecInt _) ) ) (C (w <Lit_Chars echo>) (w <Lit_VarLike "line_cont="> ($ line_cont))) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name multiline> name:multiline)] rhs:(expr.Binary op:<Arith_Plus "+"> left:(Const Expr_DecInt _) right:(Const Expr_DecInt _) ) ) (C (w <Lit_Chars echo>) (w <Lit_VarLike "multiline="> ($ multiline))) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name aug> name:aug)] rhs:(Const Expr_DecInt _) ) (command.Mutation keyword:<KW_SetVar setvar> lhs:[<Expr_Name aug>] op:<Arith_PlusEqual "+="> rhs:(Const Expr_DecInt _) ) (C (w <Lit_Chars echo>) (w <Lit_VarLike "aug="> ($ aug))) ] ) --- (command.CommandList children:[ (command.ShFunction name_tok:<Lit_Chars argv> name:argv body:(BraceGroup left:<Lit_LBrace "{"> children:[ (command.Sentence child:(C (w <Lit_Chars spec> <Lit_Slash /> <Lit_Chars bin> <Lit_Slash /> <Lit_Chars argv.py> ) (w (DQ ($ VSub_At))) ) terminator:<Op_Semi ";"> ) ] right:<Lit_RBrace "}"> ) ) (command.ShAssignment left:<Lit_VarLike "CONFIG_HAVE_FOO="> pairs:[ (AssignPair left:...0x7f84d818eae0 lhs:(sh_lhs.Name left:...0x7f84d818eae0 name:CONFIG_HAVE_FOO) op:assign_op.Equal rhs:(w <Lit_Chars yes>) ) ] ) (command.ShAssignment left:<Lit_VarLike "path="> pairs:[ (AssignPair left:...0x7f84d818ea10 lhs:(sh_lhs.Name left:...0x7f84d818ea10 name:path) op:assign_op.Equal rhs:(w (SQ "/etc/path with spaces")) ) ] ) (command.ShAssignment left:<Lit_VarLike "flags="> pairs:[ (AssignPair left:...0x7f84d818ebb0 lhs:(sh_lhs.Name left:...0x7f84d818ebb0 name:flags) op:assign_op.Equal rhs:(w (SQ "")) ) ] ) (command.If if_kw:<KW_If if> arms:[ (IfArm keyword:...0x7f84d818ec80 cond:(List_of_command (command.Sentence child:(C (w <Lit_LBracket "[">) (w <Lit_Chars -n>) (w (DQ (${ VSub_Name CONFIG_HAVE_FOO))) (w <Lit_RBracket "]">) ) terminator:<Op_Semi ";"> ) ) then_kw:<KW_Then then> action:[ (command.ShAssignment left:<Lit_VarLike "flags="> pairs:[ (AssignPair left:...0x7f84d7e383f8 lhs:(sh_lhs.Name left:...0x7f84d7e383f8 name:flags) op:assign_op.Equal rhs:(w (DQ (${ VSub_Name flags) <Lit_Chars " --foo="> ($ path)) ) ) ] ) ] then_tok:...0x7f84d7e38328 ) ] else_action:[] fi_kw:<KW_Fi fi> ) (command.If if_kw:<KW_If if> arms:[ (IfArm keyword:...0x7f84d7e38808 cond:(List_of_command (command.Sentence child:(C (w <Lit_LBracket "[">) (w <Lit_Chars -n>) (w (DQ (${ VSub_Name CONFIG_HAVE_BAR))) (w <Lit_RBracket "]">) ) terminator:<Op_Semi ";"> ) ) then_kw:<KW_Then then> action:[ (command.ShAssignment left:<Lit_VarLike "flags="> pairs:[ (AssignPair left:...0x7f84d7e38ce8 lhs:(sh_lhs.Name left:...0x7f84d7e38ce8 name:flags) op:assign_op.Equal rhs:(w (DQ (${ VSub_Name flags) <Lit_Chars " --bar">)) ) ] ) ] then_tok:...0x7f84d7e38c18 ) ] else_action:[] fi_kw:<KW_Fi fi> ) (C (w <Lit_Chars argv>) (w (${ VSub_Name flags))) (C (w <Lit_Chars set>) (w <Lit_Chars -o>) (w <Lit_Chars errexit>)) (C (w <Lit_Chars shopt>) (w <Lit_Chars -s>) (w <Lit_Chars parse_at>) (w <Lit_Chars simple_word_eval>) ) (command.Mutation keyword:<KW_SetVar setvar> lhs:[<Expr_Name CONFIG_HAVE_FOO>] op:<Arith_Equal "="> rhs:(DQ <Lit_Chars yes>) ) (command.Mutation keyword:<KW_SetVar setvar> lhs:[<Expr_Name path>] op:<Arith_Equal "="> rhs:(DQ <Lit_Chars "/etc/path with spaces">) ) (command.Mutation keyword:<KW_SetVar setvar> lhs:[<Expr_Name flags>] op:<Arith_Equal "="> rhs:(YshArrayLiteral left:<Left_PercentParen "%("> words:[] right:<Right_Initializer ")"> ) ) (command.If if_kw:<KW_If if> arms:[ (IfArm keyword:...0x7f84d7e3a530 cond:(List_of_command (command.Sentence child:(C (w <Lit_Chars test>) (w <Lit_Chars -n>) (w ($ CONFIG_HAVE_FOO)) ) terminator:<Op_Semi ";"> ) ) then_kw:<KW_Then then> action:[ (command.Simple blame_tok:<Lit_Chars append> more_env:[] words:[ (w <Lit_Chars append>) (w <Lit_Chars -->) (w <Lit_Chars --foo> <Lit_Equals "="> ($ path)) ] typed_args:(ArgList left:<Op_LParen "("> pos_args:[(Var flags)] named_args:[] right:<Op_RParen ")"> ) is_last_cmd:F ) ] then_tok:...0x7f84d7e3aef0 ) ] else_action:[] fi_kw:<KW_Fi fi> ) (command.If if_kw:<KW_If if> arms:[ (IfArm keyword:...0x7f84d7e44460 cond:(List_of_command (command.Sentence child:(C (w <Lit_Chars test>) (w <Lit_Chars -n>) (w ($ CONFIG_HAVE_BAR)) ) terminator:<Op_Semi ";"> ) ) then_kw:<KW_Then then> action:[ (command.Simple blame_tok:<Lit_Chars append> more_env:[] words:[ (w <Lit_Chars append>) (w <Lit_Chars -->) (w <Lit_Chars --bar>) ] typed_args:(ArgList left:<Op_LParen "("> pos_args:[(Var flags)] named_args:[] right:<Op_RParen ")"> ) is_last_cmd:F ) ] then_tok:...0x7f84d7e44668 ) ] else_action:[] fi_kw:<KW_Fi fi> ) (C (w <Lit_Chars argv>) (w <Lit_Splice "@flags">)) ] ) --- (command.CommandList children:[ (command.ShFunction name_tok:<Lit_Chars argv> name:argv body:(BraceGroup left:<Lit_LBrace "{"> children:[ (command.Sentence child:(C (w <Lit_Chars spec> <Lit_Slash /> <Lit_Chars bin> <Lit_Slash /> <Lit_Chars argv.py> ) (w (DQ ($ VSub_At))) ) terminator:<Op_Semi ";"> ) ] right:<Lit_RBrace "}"> ) ) (command.ShAssignment left:<Lit_VarLike "regex="> pairs:[ (AssignPair left:...0x7f9aa7464ae0 lhs:(sh_lhs.Name left:...0x7f9aa7464ae0 name:regex) op:assign_op.Equal rhs:(w (word_part.InitializerLiteral left:<Op_LParen "("> pairs:[ (InitializerWord.ArrayWord w:(w <Lit_Chars old1>)) (InitializerWord.ArrayWord w:(w <Lit_Chars old2>)) ] right:<Right_Initializer ")"> ) ) ) ] ) (command.ShAssignment left:<Lit_VarLike "flags="> pairs:[ (AssignPair left:...0x7f9aa74649a8 lhs:(sh_lhs.Name left:...0x7f9aa74649a8 name:flags) op:assign_op.Equal rhs:(w (word_part.InitializerLiteral left:<Op_LParen "("> pairs:[] right:<Right_Initializer ")"> ) ) ) ] ) (command.ForEach keyword:<KW_For for> iter_names:[r] iterable:(for_iter.Words words:[ (w (DQ (BracedVarSub left:<Left_DollarBrace "${"> name_tok:<VSub_Name regex> var_name:regex bracket_op:(bracket_op.WholeArray op_id:Lit_At) right:<Right_DollarBrace "}"> ) ) ) ] ) semi_tok:<Op_Semi ";"> body:(command.DoGroup left:<KW_Do do> children:[ (command.ShAssignment left:<Lit_ArrayLhsOpen "flags["> pairs:[ (AssignPair left:...0x7f9aa710f328 lhs:(sh_lhs.IndexedName left:...0x7f9aa710f328 name:flags index:(w (BracedVarSub left:<Left_DollarBrace "${"> name_tok:<VSub_Name flags> var_name:flags prefix_op:<VSub_Pound "#"> bracket_op:(bracket_op.WholeArray op_id:Lit_At) right:<Right_DollarBrace "}"> ) ) ) op:assign_op.Equal rhs:(w (DQ <Lit_Chars "--regex="> ($ r))) ) ] ) ] right:<KW_Done done> ) ) (C (w <Lit_Chars argv>) (w (DQ (BracedVarSub left:<Left_DollarBrace "${"> name_tok:<VSub_Name flags> var_name:flags bracket_op:(bracket_op.WholeArray op_id:Lit_At) right:<Right_DollarBrace "}"> ) ) ) ) (C (w <Lit_Chars shopt>) (w <Lit_Chars -s>) (w <Lit_Chars simple_word_eval>) (w <Lit_Chars parse_at>) ) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name regex2> name:regex2)] rhs:(YshArrayLiteral left:<Left_PercentParen "%("> words:[(w <Lit_Chars new1>) (w <Lit_Chars new2>)] right:<Right_Initializer ")"> ) ) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name flags2> name:flags2)] rhs:(YshArrayLiteral left:<Left_PercentParen "%("> words:[] right:<Right_Initializer ")"> ) ) (command.ForEach keyword:<KW_For for> iter_names:[r] iterable:(for_iter.Words words:[(w <Lit_Splice "@regex2">)]) semi_tok:<Op_Semi ";"> body:(command.DoGroup left:<KW_Do do> children:[ (command.Simple blame_tok:<Lit_Chars append> more_env:[] words:[(w <Lit_Chars append>) (w (DQ <Lit_Chars "--regex="> ($ r)))] typed_args:(ArgList left:<Op_LParen "("> pos_args:[(Var flags2)] named_args:[] right:<Op_RParen ")"> ) is_last_cmd:F ) ] right:<KW_Done done> ) ) (C (w <Lit_Chars argv>) (w <Lit_Splice "@flags2">)) ] ) --- (command.CommandList children:[ (command.ShFunction name_tok:<Lit_Chars argv> name:argv body:(BraceGroup left:<Lit_LBrace "{"> children:[ (C (w <Lit_Chars python>) (w <Lit_Chars -c>) (w (SQ "import sys;print(sys.argv[1:])")) (w <Lit_Splice "@ARGV">) ) ] right:<Lit_RBrace "}"> ) ) (command.ShFunction name_tok:<Lit_Chars show> name:show body:(BraceGroup left:<Lit_LBrace "{"> children:[ (C (w <Lit_Chars echo>) (w (SQ "====="))) (C (w <Lit_Chars argv>) (w <Lit_Splice "@ARGV">)) (C (w <Lit_Chars echo>)) ] right:<Lit_RBrace "}"> ) ) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name strarray> name:strarray)] rhs:(YshArrayLiteral left:<Left_PercentParen "%("> words:[ (w <Lit_Chars bare>) (w <Lit_Chars words>) (w <Lit_Star "*"> <Lit_Chars .sh>) (word.BracedTree parts:[ (word_part.BracedTuple words:[(w <Lit_Chars a>) (w <Lit_Chars b>)] ) <Lit_Splice "@example"> <Lit_Chars .com> ] ) (w (SQ sq)) (w (DQ <Lit_Chars "dq "> (BracedVarSub left:<Left_DollarBrace "${"> name_tok:<VSub_Name x> var_name:x suffix_op:(suffix_op.Unary op:<VTest_ColonHyphen ":-"> arg_word:(w <Lit_Chars default>) ) right:<Right_DollarBrace "}"> ) ) ) ] right:<Right_Initializer ")"> ) ) (C (w <Lit_Chars show>) (w <Lit_Splice "@strarray">)) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name cmd_sub> name:cmd_sub)] rhs:(CommandSub left_token:<Left_DollarParen "$("> child:(C (w <Lit_Chars echo>) (w <Lit_Chars bare>) (w <Lit_Chars words>) (w <Lit_Star "*"> <Lit_Chars .sh>) (word.BracedTree parts:[ (word_part.BracedTuple words:[(w <Lit_Chars a>) (w <Lit_Chars b>)] ) <Lit_Splice "@example"> <Lit_Chars .com> ] ) (w (SQ sq)) (w (DQ <Lit_Chars "dq "> (BracedVarSub left:<Left_DollarBrace "${"> name_tok:<VSub_Name x> var_name:x suffix_op:(suffix_op.Unary op:<VTest_ColonHyphen ":-"> arg_word:(w <Lit_Chars default>) ) right:<Right_DollarBrace "}"> ) ) ) ) right:<Eof_RParen ")"> ) ) (C (w <Lit_Chars show>) (w ($ cmd_sub))) (C (w <Lit_Chars show>) (w (word_part.ExprSub left:<Left_DollarBracket "$["> child:(expr.Binary op:<Arith_DPlus "++"> left:(expr.Binary op:<Arith_DPlus "++"> left:(SQ "quoted ") right:(SQ "words ") ) right:(DQ <Lit_Chars "dq "> (BracedVarSub left:<Left_DollarBrace "${"> name_tok:<VSub_Name x> var_name:x suffix_op:(suffix_op.Unary op:<VTest_ColonHyphen ":-"> arg_word:(w <Lit_Chars default>) ) right:<Right_DollarBrace "}"> ) ) ) right:<Op_RBracket "]"> ) ) ) ] ) --- (command.CommandList children:[ (C (w <Lit_Chars shopt>) (w <Lit_Chars -s>) (w <Lit_Chars oil-parse-at>) (w <Lit_Chars static-word-eval>) ) (command.ShAssignment left:<Lit_VarLike "myglobal="> pairs:[ (AssignPair left:...0x7f9c2706e7a0 lhs:(sh_lhs.Name left:...0x7f9c2706e7a0 name:myglobal) op:assign_op.Equal rhs:(w <Lit_Chars global>) ) ] ) (command.VarDecl keyword:<KW_Var var> lhs:[(NameType left:<Expr_Name myarray> name:myarray)] rhs:(YshArrayLiteral left:<Left_ColonPipe ":|"> words:[ (w ($ myglobal)) (w (SingleQuoted left:<Left_DollarSingleQuote "$'"> sval:"line\n" right:<Right_SingleQuote "'"> ) ) (w (BracedVarSub left:<Left_DollarBrace "${"> name_tok:<VSub_Name z> var_name:z suffix_op:(suffix_op.Unary op:<VTest_ColonHyphen ":-"> arg_word:(w <Lit_Chars default>) ) right:<Right_DollarBrace "}"> ) ) ] right:<Op_Pipe "|"> ) ) (C (w <Lit_Chars spec> <Lit_Slash /> <Lit_Chars bin> <Lit_Slash /> <Lit_Chars argv.py> ) (w <Lit_Splice "@myarray">) ) (C (w <Lit_Chars echo>) (w <Lit_VarLike "len="> (word_part.ExprSub left:<Left_DollarBracket "$["> child:(expr.FuncCall func:(Var len) args:(ArgList left:<Op_LParen "("> pos_args:[(Var myarray)] named_args:[] right:<Op_RParen ")"> ) ) right:<Op_RBracket "]"> ) ) ) (C (w <Lit_Chars echo>)) (command.Simple blame_tok:<Lit_Chars append> more_env:[] words:[ (w <Lit_Chars append>) (w <Lit_Chars _>) (w (SQ "1 2")) (w (BracedVarSub left:<Left_DollarBrace "${"> name_tok:<VSub_Name myglobal> var_name:myglobal suffix_op:(suffix_op.Unary op:<VTest_ColonHyphen ":-"> arg_word:(w <Lit_Chars default>) ) right:<Right_DollarBrace "}"> ) ) ] typed_args:(ArgList left:<Op_LParen "("> pos_args:[(Var myarray)] named_args:[] right:<Op_RParen ")"> ) is_last_cmd:F ) (C (w <Lit_Chars spec> <Lit_Slash /> <Lit_Chars bin> <Lit_Slash /> <Lit_Chars argv.py> ) (w <Lit_Splice "@myarray">) ) (C (w <Lit_Chars echo>) (w <Lit_VarLike "len="> (word_part.ExprSub left:<Left_DollarBracket "$["> child:(expr.FuncCall func:(Var len) args:(ArgList left:<Op_LParen "("> pos_args:[(Var myarray)] named_args:[] right:<Op_RParen ")"> ) ) right:<Op_RBracket "]"> ) ) ) (C (w <Lit_Chars echo>)) (command.ForEach keyword:<KW_For for> iter_names:[item] iterable:(for_iter.YshExpr e:(Var myarray) blame:<KW_In in>) body:(BraceGroup left:<Lit_LBrace "{"> children:[(C (w <Lit_Chars echo>) (w (DQ <Lit_Chars " "> ($ item))))] right:<Lit_RBrace "}"> ) ) ] ) OK test-parse-osh *** Running test-run-osh ysh/testdata/array-rewrite-1.sh --- ['--regex=old1', '--regex=old2'] append "--regex=$r" (flags2) ^ ysh/testdata/array-rewrite-1.sh:40: 'append' doesn't accept flag -- append "--regex=$r" (flags2) ^ ysh/testdata/array-rewrite-1.sh:40: 'append' doesn't accept flag -- [] ysh/testdata/array-rewrite-2.sh --- ['--foo=/etc/path', 'with', 'spaces'] ['--foo=/etc/path with spaces'] ysh/testdata/sigil-pairs.sh --- ===== ['@ARGV'] ===== ['@ARGV'] ===== ['@ARGV'] ysh/testdata/array-splice-demo.osh --- shopt -s oil-parse-at static-word-eval ^~~~~ ysh/testdata/array-splice-demo.osh:2: 'shopt' got invalid option 'oil-parse-at' ['@myarray'] len=3 ['@myarray'] len=6 global line default _ 1 2 global ysh/testdata/assign.osh skipping ysh/testdata/assign.osh ysh/testdata/hello.osh --- This is a shell script with OSH extensions! x: 7 x: 8 y: 20 pp cell list2 ^~~~ ysh/testdata/hello.osh:26: 'pp' got invalid action 'cell' str3 = shell stringOil string ysh/testdata/no-dynamic-scope.osh skipping ysh/testdata/no-dynamic-scope.osh OK test-run-osh *** Running test-run-ysh --- + Call in expression context: 3 + Inline call that coerces to string: 3 3 + Inline calls can be part of a word: --length=3 33 + Caveat: can't double quote. It would break programs. Should we add an option 'shopt -s parse_dparen'? --length=3 + Just as you can splice @myarray spam eggs ham + You can also splice the result of a function returning a sequence: Notes: - the Dict->reverse() method is from Python. hello world Parts: aaa BB c join(parts): aaaBBc + Another way of doing it, without creating another variable: aaaBBc j => aaa:BB:c When IFS is the default, split(j) => aaa:BB:c When IFS is :, split(j) => aaa BB c + Since there is no word splitting of unquoted $(ls), here is an idiom: bin/ lib/ --- hello 42 --- Hello world! first line second line Some string Some string $myvar Some string Some st Some s 11 DefaultValueIfFooIsMissingOrEmpty --- perhaps it's already here 42 I am just a normal string I am just a normal string and I am just a normal string I am just a normal string_ I am some string \n Hello world! I'm just a string it's true I really do it's true I really do Not a file I'm an abstraction I'm passed hi failure 2025 Here I am! could be anything really date: unrecognized option '--wrong-flag' Try 'date --help' for more information. there was an error number 2025-03-01 2025 OK test-run-ysh ysh/run.sh: 3 tests passed.