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