*** Running test-parse-osh
---
(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:[
    (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:...0x7f759bbdff58
          lhs:(sh_lhs.Name left:...0x7f759bbdff58 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:...0x7f759bbdfe20
          lhs:(sh_lhs.Name left:...0x7f759bbdfe20 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:...0x7f759b89a7a0
                lhs:(sh_lhs.IndexedName
                  left:...0x7f759b89a7a0
                  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:[
    (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:...0x7fe8e28efc18
          lhs:(sh_lhs.Name left:...0x7fe8e28efc18 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 "}">
      )
    )
  ]
)
---
(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:...0x7f206a420f58
          lhs:(sh_lhs.Name left:...0x7f206a420f58 name:CONFIG_HAVE_FOO)
          op:assign_op.Equal
          rhs:(w <Lit_Chars yes>)
        )
      ]
    )
    (command.ShAssignment
      left:<Lit_VarLike "path=">
      pairs:[
        (AssignPair
          left:...0x7f206a420e88
          lhs:(sh_lhs.Name left:...0x7f206a420e88 name:path)
          op:assign_op.Equal
          rhs:(w (SQ "/etc/path with spaces"))
        )
      ]
    )
    (command.ShAssignment
      left:<Lit_VarLike "flags=">
      pairs:[
        (AssignPair
          left:...0x7f206a0db0b8
          lhs:(sh_lhs.Name left:...0x7f206a0db0b8 name:flags)
          op:assign_op.Equal
          rhs:(w (SQ ""))
        )
      ]
    )
    (command.If
      if_kw:<KW_If if>
      arms:[
        (IfArm
          keyword:...0x7f206a0db188
          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:...0x7f206a0db870
                  lhs:(sh_lhs.Name left:...0x7f206a0db870 name:flags)
                  op:assign_op.Equal
                  rhs:(w
                    (DQ (${ VSub_Name flags) <Lit_Chars " --foo="> ($ path))
                  )
                )
              ]
            )
          ]
          then_tok:...0x7f206a0db7a0
        )
      ]
      else_action:[]
      fi_kw:<KW_Fi fi>
    )
    (command.If
      if_kw:<KW_If if>
      arms:[
        (IfArm
          keyword:...0x7f206a0dbc80
          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:...0x7f206a0e31f0
                  lhs:(sh_lhs.Name left:...0x7f206a0e31f0 name:flags)
                  op:assign_op.Equal
                  rhs:(w (DQ (${ VSub_Name flags) <Lit_Chars " --bar">))
                )
              ]
            )
          ]
          then_tok:...0x7f206a0e3120
        )
      ]
      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:...0x7f206a0e39a8
          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:...0x7f206a0ed3f8
        )
      ]
      else_action:[]
      fi_kw:<KW_Fi fi>
    )
    (command.If
      if_kw:<KW_If if>
      arms:[
        (IfArm
          keyword:...0x7f206a0ed8d8
          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:...0x7f206a0edae0
        )
      ]
      else_action:[]
      fi_kw:<KW_Fi fi>
    )
    (C (w <Lit_Chars argv>) (w <Lit_Splice "@flags">))
  ]
)
---
(command.CommandList
  children:[
    (command.ShAssignment
      left:<Lit_VarLike "global_var=">
      pairs:[
        (AssignPair
          left:...0x7f1bbb84f9a8
          lhs:(sh_lhs.Name left:...0x7f1bbb84f9a8 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:...0x7fd927ea4120
          lhs:(sh_lhs.Name left:...0x7fd927ea4120 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)))
  ]
)
OK  test-parse-osh
*** Running test-run-osh
ysh/testdata/array-rewrite-1.sh
---
Traceback (most recent call last):
  File "/home/uke/oil/bin/oils_for_unix.py", line 202, in <module>
    sys.exit(main(sys.argv))
  File "/home/uke/oil/bin/oils_for_unix.py", line 171, in main
    return AppBundleMain(argv)
  File "/home/uke/oil/bin/oils_for_unix.py", line 141, in AppBundleMain
    return shell.Main('osh', arg_r, environ, login_shell, loader, readline)
  File "/home/uke/oil/core/shell.py", line 1253, in Main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/uke/oil/core/main_loop.py", line 336, in Batch
    was_parsed, status = Batch2(cmd_ev, c_parser, errfmt, cmd_flags=cmd_flags)
  File "/home/uke/oil/core/main_loop.py", line 401, in Batch2
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags)
  File "/home/uke/oil/osh/cmd_eval.py", line 2175, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/uke/oil/osh/cmd_eval.py", line 1974, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1861, in _Dispatch
    status = self._DoForEach(node)
  File "/home/uke/oil/osh/cmd_eval.py", line 1261, in _DoForEach
    iter_list = self.word_ev.EvalWordSequence(words)
  File "/home/uke/oil/osh/word_eval.py", line 2623, in EvalWordSequence
    cmd_val = self.EvalWordSequence2(words, False)
  File "/home/uke/oil/osh/word_eval.py", line 2566, in EvalWordSequence2
    self._EvalWordToParts(w, part_vals, EXTGLOB_FILES)
  File "/home/uke/oil/osh/word_eval.py", line 2048, in _EvalWordToParts
    self._EvalWordPart(p, word_part_vals, eval_flags)
  File "/home/uke/oil/osh/word_eval.py", line 1932, in _EvalWordPart
    self._EvalDoubleQuoted(part.parts, part_vals)
  File "/home/uke/oil/osh/word_eval.py", line 1453, in _EvalDoubleQuoted
    self._EvalWordPart(p, part_vals, QUOTED)
  File "/home/uke/oil/osh/word_eval.py", line 1956, in _EvalWordPart
    self._EvalBracedVarSub(part, part_vals, quoted)
  File "/home/uke/oil/osh/word_eval.py", line 1750, in _EvalBracedVarSub
    part_val = _ValueToPartValue(val, quoted or quoted2, part)
  File "/home/uke/oil/osh/word_eval.py", line 235, in _ValueToPartValue
    return part_value.Array(bash_impl.BashArray_GetValues(val), quoted)
NameError: global name 'bash_impl' is not defined
FAIL  test-run-osh