.	var x = $(echo hi)

	var x = ${x}

	var x = "quoted ${x}"

.	var x = y + 2 * 3;
	var x = r'one\ntwo\n';
	var x = $'one\ntwo\n';
	var x = "one\\ntwo\\n";
	var x = [1,2,3];
	var x = [4+5, 6+7*8]

	var x = []

	var x = [x for x in y]

.	var x = %(a b);
	var x = %('c' $'string\n');
	var x = %($(echo command) $(echo sub));
-----
'= x }'
     ^
-----
-----
'= x;}'
    ^
-----
-----
'= x; }'
    ^
-----
-----
'echo $x;}'
         ^
-----
-----
'echo $x; }'
         ^
-----
-----
'= x\n'
    ^
-----
-----
'echo $x\n'
         ^
-----
--- $(echo hi)

(command.VarDecl
  keyword:<KW_Var var>
  lhs:[(NameType left:<Expr_Name x> name:x)]
  rhs:(CommandSub
    left_token:<Left_DollarParen "$(">
    child:(C (w <Lit_Chars echo>) (w <Lit_Chars hi>))
    right:<Eof_RParen ")">
  )
)

--- ${x}

(command.VarDecl
  keyword:<KW_Var var>
  lhs:[(NameType left:<Expr_Name x> name:x)]
  rhs:(${ VSub_Name x)
)

--- "quoted ${x}"

(command.VarDecl
  keyword:<KW_Var var>
  lhs:[(NameType left:<Expr_Name x> name:x)]
  rhs:(DQ <Lit_Chars "quoted "> (${ VSub_Name x))
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(expr.Binary
      op:<Arith_Plus "+">
      left:(Var y)
      right:(expr.Binary
        op:<Arith_Star "*">
        left:(Const Expr_DecInt _)
        right:(Const Expr_DecInt _)
      )
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(SingleQuoted
      left:<Left_RSingleQuote "r'">
      sval:"one\\ntwo\\n"
      right:<Right_SingleQuote "'">
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(SingleQuoted
      left:<Left_DollarSingleQuote "$'">
      sval:"one\ntwo\n"
      right:<Right_SingleQuote "'">
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(DQ
      <Lit_Chars one>
      (word_part.EscapedLiteral token:<Lit_EscapedChar "\\\\"> ch:"\\")
      <Lit_Chars ntwo>
      (word_part.EscapedLiteral token:<Lit_EscapedChar "\\\\"> ch:"\\")
      <Lit_Chars n>
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(expr.List
      left:<Op_LBracket "[">
      elts:[(Const Expr_DecInt _) (Const Expr_DecInt _) (Const Expr_DecInt _)]
      ctx:expr_context.Store
    )
  )
  terminator:<Op_Semi ";">
)


(command.VarDecl
  keyword:<KW_Var var>
  lhs:[(NameType left:<Expr_Name x> name:x)]
  rhs:(expr.List
    left:<Op_LBracket "[">
    elts:[
      (expr.Binary
        op:<Arith_Plus "+">
        left:(Const Expr_DecInt _)
        right:(Const Expr_DecInt _)
      )
      (expr.Binary
        op:<Arith_Plus "+">
        left:(Const Expr_DecInt _)
        right:(expr.Binary
          op:<Arith_Star "*">
          left:(Const Expr_DecInt _)
          right:(Const Expr_DecInt _)
        )
      )
    ]
    ctx:expr_context.Store
  )
)


(command.VarDecl
  keyword:<KW_Var var>
  lhs:[(NameType left:<Expr_Name x> name:x)]
  rhs:(expr.List left:<Op_LBracket "["> elts:[] ctx:expr_context.Store)
)


(command.VarDecl
  keyword:<KW_Var var>
  lhs:[(NameType left:<Expr_Name x> name:x)]
  rhs:(expr.ListComp
    left:<Op_LBracket "[">
    elt:(Var x)
    generators:[
      (Comprehension lhs:[(NameType left:<Expr_Name x> name:x)] iter:(Var y))
    ]
  )
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(ShArrayLiteral
      left:<Left_PercentParen "%(">
      words:[(w <Lit_Chars a>) (w <Lit_Chars b>)]
      right:<Right_ShArrayLiteral ")">
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(ShArrayLiteral
      left:<Left_PercentParen "%(">
      words:[
        (w (SQ c))
        (w
          (SingleQuoted
            left:<Left_DollarSingleQuote "$'">
            sval:"string\n"
            right:<Right_SingleQuote "'">
          )
        )
      ]
      right:<Right_ShArrayLiteral ")">
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(c	var x = %(a b) * %($c ${d});
	var x = %(
    a
    b
    c
    );
.	var x = $(echo hi);
	var x = $(echo $(echo hi));
	var x = $(echo
hi)
    
	var x = $(echo $((1+2)));
	var x = $(for i in 1 2 3; do echo $i; done);
	var x = %(a b)
ommand.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(ShArrayLiteral
      left:<Left_PercentParen "%(">
      words:[
        (w
          (CommandSub
            left_token:<Left_DollarParen "$(">
            child:(C (w <Lit_Chars echo>) (w <Lit_Chars command>))
            right:<Eof_RParen ")">
          )
        )
        (w
          (CommandSub
            left_token:<Left_DollarParen "$(">
            child:(C (w <Lit_Chars echo>) (w <Lit_Chars sub>))
            right:<Eof_RParen ")">
          )
        )
      ]
      right:<Right_ShArrayLiteral ")">
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(expr.Binary
      op:<Arith_Star "*">
      left:(ShArrayLiteral
        left:<Left_PercentParen "%(">
        words:[(w <Lit_Chars a>) (w <Lit_Chars b>)]
        right:<Right_ShArrayLiteral ")">
      )
      right:(ShArrayLiteral
        left:<Left_PercentParen "%(">
        words:[(w ($ c)) (w (${ VSub_Name d))]
        right:<Right_ShArrayLiteral ")">
      )
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(ShArrayLiteral
      left:<Left_PercentParen "%(">
      words:[(w <Lit_Chars a>) (w <Lit_Chars b>) (w <Lit_Chars c>)]
      right:<Right_ShArrayLiteral ")">
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(CommandSub
      left_token:<Left_DollarParen "$(">
      child:(C (w <Lit_Chars echo>) (w <Lit_Chars hi>))
      right:<Eof_RParen ")">
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(CommandSub
      left_token:<Left_DollarParen "$(">
      child:(C
        (w <Lit_Chars echo>)
        (w
          (CommandSub
            left_token:<Left_DollarParen "$(">
            child:(C (w <Lit_Chars echo>) (w <Lit_Chars hi>))
            right:<Eof_RParen ")">
          )
        )
      )
      right:<Eof_RParen ")">
    )
  )
  terminator:<Op_Semi ";">
)


(command.VarDecl
  keyword:<KW_Var var>
  lhs:[(NameType left:<Expr_Name x> name:x)]
  rhs:(CommandSub
    left_token:<Left_DollarParen "$(">
    child:(command.CommandList
      children:[(C (w <Lit_Chars echo>)) (C (w <Lit_Chars hi>))]
    )
    right:<Eof_RParen ")">
  )
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(CommandSub
      left_token:<Left_DollarParen "$(">
      child:(C
        (w <Lit_Chars echo>)
        (w
          (word_part.ArithSub
            left:<Left_DollarDParen "$((">
            anode:(arith_expr.Binary
              op:<Arith_Plus "+">
              left:(w <Lit_Digits 1>)
              right:(w <Lit_Digits 2>)
            )
            right:<Right_DollarDParen ")">
          )
        )
      )
      right:<Eof_RParen ")">
    )
  )
  terminator:<Op_Semi ";">
)


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(CommandSub
      left_token:<Left_DollarParen "$(">
      child:(command.ForEach
        keyword:<KW_For for>
        iter_names:[i]
        iterable:(for_iter.Words
          words:[(w <Lit_Chars 1>) (w <Lit_Chars 2>) (w <Lit_Chars 3>)]
        )
        semi_tok:<Op_Semi ";">
        body:(command.DoGroup
          left:<KW_Do do>
          children:[
            (command.Sentence
              child:(C (w <Lit_Chars echo>) (w ($ i)))
              terminator:<Op_Semi ";">
            )
          ]
          right:<KW_Done done>
        )
      )
      right:<Eof_RParen ")">
    )
  )
  terminator:<Op_Semi ";">
)


(command.VarDecl
  keyword:<KW_Var var>
  lhs:[(NameType left:<Expr_Name x> name:x)]
  rhs:(ShArrayLiteral
    left:<Left_PercentParen "%(">
    words:[(.
----------------------------------------------------------------------
Ran 5 tests in 0.042s

OK
w <Lit_Chars a>) (w <Lit_Chars b>)]
    right:<Right_ShArrayLiteral ")">
  )
)