. 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)); --- $(echo hi) (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (command_sub left_token: child:(C {} {})) ) --- ${x} (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (${ Id.VSub_Name x) ) --- "quoted ${x}" (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (DQ <'quoted '> (${ Id.VSub_Name x)) ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (expr.Binary op: left: (Var y) right: (expr.Binary op: left: (Const Id.Expr_DecInt 2) right: (Const Id.Expr_DecInt 3) ) ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (single_quoted left: tokens:[<'one\\ntwo\\n'>] multiline:F) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (single_quoted left: tokens: [ ] multiline: F ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (DQ (word_part.EscapedLiteral token:) (word_part.EscapedLiteral token:) ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (expr.List elts: [(Const Id.Expr_DecInt 1) (Const Id.Expr_DecInt 2) (Const Id.Expr_DecInt 3)] ctx: expr_context.Store ) ) terminator: ) (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (expr.List elts: [ (expr.Binary op: left: (Const Id.Expr_DecInt 4) right: (Const Id.Expr_DecInt 5) ) (expr.Binary op: left: (Const Id.Expr_DecInt 6) right: (expr.Binary op: left: (Const Id.Expr_DecInt 7) right: (Const Id.Expr_DecInt 8) ) ) ] ctx: expr_context.Store ) ) (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (expr.List ctx:expr_context.Store) ) (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (expr.ListComp elt: (Var x) generators: [(comprehension lhs:[(name_type name:)] iter:(Var y))] ) ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (sh_array_literal left: words:[{} {}]) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (sh_array_literal left: words: [ {(SQ )} { (single_quoted left: tokens: [ ] multiline: F ) } ] ) ) terminator: ) (command.Senten 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) . ---------------------------------------------------------------------- Ran 5 tests in 0.018s OK ce child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (sh_array_literal left: words: [ {(command_sub left_token: child:(C {} {}))} {(command_sub left_token: child:(C {} {}))} ] ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (expr.Binary op: left: (sh_array_literal left: words:[{} {}]) right: (sh_array_literal left: words: [{($ Id.VSub_DollarName '$c')} {(${ Id.VSub_Name d)}] ) ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (sh_array_literal left: words:[{} {} {}]) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (command_sub left_token: child:(C {} {})) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (command_sub left_token: child: (C {} {(command_sub left_token: child:(C {} {}))}) ) ) terminator: ) (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (command_sub left_token: child: (command.CommandList children:[(C {}) (C {})]) ) ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (command_sub left_token: child: (C {} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {} right: {} ) ) } ) ) ) terminator: ) (command.Sentence child: (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (command_sub left_token: child: (command.ForEach iter_name: i iter_words: [{<1>} {<2>} {<3>}] do_arg_iter: F body: (command.DoGroup children: [ (command.Sentence child: (C {} {($ Id.VSub_DollarName '$i')}) terminator: ) ] ) ) ) ) terminator: ) (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (sh_array_literal left: words:[{} {}]) )