.	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]

-----
'= x }'
     ^
-----
-----
'= x;}'
    ^
-----
-----
'= x; }'
    ^
-----
-----
'echo $x;}'
         ^
-----
-----
'echo $x; }'
         ^
-----
-----
'= x\n'
    ^
-----
-----
'echo $x\n'
         ^
-----
--- $(echo hi)

(command.VarDecl
  keyword: <Id.KW_Var var>
  lhs: [(NameType left:<Id.Expr_Name x> name:x)]
  rhs: 
    (CommandSub
      left_token: <Id.Left_DollarParen "$(">
      child: 
        (command.Simple
          blame_tok: <Id.Lit_Chars echo>
          more_env: []
          words: [{<Id.Lit_Chars echo>} {<Id.Lit_Chars hi>}]
          is_last_cmd: F
        )
      right: <Id.Eof_RParen ")">
    )
)
--- ${x}

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

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

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

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

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

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

(command.Sentence
  child: 
    (command.VarDecl
      keyword: <Id.KW_Var var>
      lhs: [(NameType left:<Id.Expr_Name x> name:x)]
      rhs: 
        (expr.List
          left: <Id.Op_LBracket "[">
          elts: [
            (expr.Const c:<Id.Expr_DecInt 1> val:(value.Int i:1))
            (expr.Const c:<Id.Expr_DecInt 2> val:(value.Int i:2))
            (expr.Const c:<Id.Expr_DecInt 3> val:(value.Int i:3))
          ]
          ctx: expr_context.Store
        )
    )
  terminator: <Id.Op_Semi ";">
)

(command.VarDecl
  keyword: <Id.KW_Var var>
  lhs: [(NameType left:<Id.Expr_Name x> name:x)]
  rhs: 
    (expr.List
      left: <Id.Op_LBracket "[">
      elts: [
        (expr.Binary
          op: <Id.Arith_Plus "+">
          left: (expr.Const c:<Id.Expr_DecInt 4> val:(value.Int i:4))
          right: (expr.Const c:<Id.Expr_DecInt 5> val:(value.Int i:5))
        )
        (expr.Binary
          op: <Id.Arith_Plus "+">
          left: (expr.Const c:<Id.Expr_DecInt 6> val:(value.Int i:6))
          right: 
            (expr.Binary
              op: <Id.Arith_Star "*">
              left: (expr.Const c:<Id.Expr_DecInt 7> val:(value.Int i:7))
              right: (expr.Const c:<Id.Expr_DecInt 8> val:(value.Int i:8))
            )
        )
      ]
      ctx: expr_context.Store
    )
)

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

(command.VarDecl
  keyword: <Id.KW_Var var>
  .	var x = %(a b);
	var x = %('c' $'string\n');
	var x = %($(echo command) $(echo sub));
	var x = %(a b) * %($c ${d});
	var x = %(
    a
    b
    c
    );
.	var x = $(echo hi);
	var x = $(echo $(echo hi));
lhs: [(NameType left:<Id.Expr_Name x> name:x)]
  rhs: 
    (expr.ListComp
      left: <Id.Op_LBracket "[">
      elt: (expr.Var left:<Id.Expr_Name x> name:x)
      generators: [
        (Comprehension
          lhs: [(NameType left:<Id.Expr_Name x> name:x)]
          iter: (expr.Var left:<Id.Expr_Name y> name:y)
        )
      ]
    )
)

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

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

(command.Sentence
  child: 
    (command.VarDecl
      keyword: <Id.KW_Var var>
      lhs: [(NameType left:<Id.Expr_Name x> name:x)]
      rhs: 
        (ShArrayLiteral
          left: <Id.Left_PercentParen "%(">
          words: [
            {
              (CommandSub
                left_token: <Id.Left_DollarParen "$(">
                child: 
                  (command.Simple
                    blame_tok: <Id.Lit_Chars echo>
                    more_env: []
                    words: [{<Id.Lit_Chars echo>} {<Id.Lit_Chars command>}]
                    is_last_cmd: F
                  )
                right: <Id.Eof_RParen ")">
              )
            }
            {
              (CommandSub
                left_token: <Id.Left_DollarParen "$(">
                child: 
                  (command.Simple
                    blame_tok: <Id.Lit_Chars echo>
                    more_env: []
                    words: [{<Id.Lit_Chars echo>} {<Id.Lit_Chars sub>}]
                    is_last_cmd: F
                  )
                right: <Id.Eof_RParen ")">
              )
            }
          ]
          right: <Id.Right_ShArrayLiteral ")">
        )
    )
  terminator: <Id.Op_Semi ";">
)

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

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

(command.Sentence
  child: 
    (command.VarDecl
      keyword: <Id.KW_Var var>
      lhs: [(NameType left:<Id.Expr_Name x> name:x)]
      rhs: 
        (CommandSub
          left_token: <Id.Left_DollarParen "$(">
          child: 
            (command.Simple
              blame_tok: <Id.Lit_Chars echo>
              more_env: []
              words: [{<Id.Lit_Chars echo>} {<Id.Lit_Chars hi>}]
              is_last_cmd: F
            )
          right: <Id.Eof_RParen ")">
        )
    )
  terminator: <Id.Op_Semi ";">
)

(co	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)
mmand.Sentence
  child: 
    (command.VarDecl
      keyword: <Id.KW_Var var>
      lhs: [(NameType left:<Id.Expr_Name x> name:x)]
      rhs: 
        (CommandSub
          left_token: <Id.Left_DollarParen "$(">
          child: 
            (command.Simple
              blame_tok: <Id.Lit_Chars echo>
              more_env: []
              words: [
                {<Id.Lit_Chars echo>}
                {
                  (CommandSub
                    left_token: <Id.Left_DollarParen "$(">
                    child: 
                      (command.Simple
                        blame_tok: <Id.Lit_Chars echo>
                        more_env: []
                        words: [{<Id.Lit_Chars echo>} {<Id.Lit_Chars hi>}]
                        is_last_cmd: F
                      )
                    right: <Id.Eof_RParen ")">
                  )
                }
              ]
              is_last_cmd: F
            )
          right: <Id.Eof_RParen ")">
        )
    )
  terminator: <Id.Op_Semi ";">
)

(command.VarDecl
  keyword: <Id.KW_Var var>
  lhs: [(NameType left:<Id.Expr_Name x> name:x)]
  rhs: 
    (CommandSub
      left_token: <Id.Left_DollarParen "$(">
      child: 
        (command.CommandList
          children: [
            (command.Simple
              blame_tok: <Id.Lit_Chars echo>
              more_env: []
              words: [{<Id.Lit_Chars echo>}]
              is_last_cmd: F
            )
            (command.Simple
              blame_tok: <Id.Lit_Chars hi>
              more_env: []
              words: [{<Id.Lit_Chars hi>}]
              is_last_cmd: F
            )
          ]
        )
      right: <Id.Eof_RParen ")">
    )
)

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

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

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

OK
it_Chars a>} {<Id.Lit_Chars b>}]
      right: <Id.Right_ShArrayLiteral ")">
    )
)