. 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); --- $(echo hi) (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) right: ) ) --- ${x} (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (${ Id.VSub_Name x) ) --- "quoted ${x}" (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (DQ <'quoted '> (${ Id.VSub_Name x)) ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (expr.Binary op: left: (expr.Var name:) right: (expr.Binary op: left: (expr.Const c:) right: (expr.Const c:) ) ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (SingleQuoted left: tokens: [<'one\\ntwo\\n'>] right: ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (SingleQuoted left: tokens: [ ] right: ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (DQ (word_part.EscapedLiteral token: ch:'\\') (word_part.EscapedLiteral token: ch:'\\') ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (expr.List elts: [ (expr.Const c:) (expr.Const c:) (expr.Const c:) ] ctx: expr_context.Store ) ) terminator: ) (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (expr.List elts: [ (expr.Binary op: left: (expr.Const c:) right: (expr.Const c:) ) (expr.Binary op: left: (expr.Const c:) right: (expr.Binary op: left: (expr.Const c:) right: (expr.Const c:) ) ) ] ctx: expr_context.Store ) ) (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (expr.List elts:[] ctx:expr_context.Store) ) (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (expr.ListComp elt: (expr.Var name:) generators: [ (Comprehension lhs: [(NameType name:)] iter: (expr.Var name:) ) ] ) ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (ShArrayLiteral left: words: [{} {}] 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)); right: ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (ShArrayLiteral left: words: [ {(SQ )} { (SingleQuoted left: tokens: [ ] right: ) } ] right: ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (ShArrayLiteral left: words: [ { (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) right: ) } { (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) right: ) } ] right: ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (expr.Binary op: left: (ShArrayLiteral left: words: [{} {}] right: ) right: (ShArrayLiteral left: words: [{($ Id.VSub_DollarName c)} {(${ Id.VSub_Name d)}] right: ) ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (ShArrayLiteral left: words: [{} {} {}] right: ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) right: ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [ {} { (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] 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) . ---------------------------------------------------------------------- Ran 5 tests in 0.046s OK do_fork: T ) right: ) } ] redirects: [] do_fork: T ) right: ) ) terminator: ) (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (CommandSub left_token: child: (command.CommandList children: [ (command.Simple blame_tok: more_env: [] words: [{}] redirects: [] do_fork: T ) (command.Simple blame_tok: more_env: [] words: [{}] redirects: [] do_fork: T ) ] ) right: ) ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [ {} { (word_part.ArithSub left: anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {} right: {} ) right: ) } ] redirects: [] do_fork: T ) right: ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (CommandSub left_token: child: (command.ForEach keyword: iter_names: [i] iterable: (for_iter.Words words:[{<1>} {<2>} {<3>}]) semi_tok: body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ Id.VSub_DollarName i)}] redirects: [] do_fork: T ) terminator: ) ] right: ) redirects: [] ) right: ) ) terminator: ) (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (ShArrayLiteral left: words: [{} {}] right: ) )