...('\n---', '${array[0]}') { (word_part.BracedVarSub token: bracket_op: (bracket_op.ArrayIndex expr:(arith_expr.ArithWord w:{(Lit_Digits 0)})) ) }('\n---', '${array[5+5]}') { (word_part.BracedVarSub token: bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.ArithWord w:{(Lit_Digits 5)}) right: (arith_expr.ArithWord w:{(Lit_Digits 5)}) ) ) ) }('\n---', '${array[@]}') {(word_part.BracedVarSub token: bracket_op:(bracket_op.WholeArray op_id:Lit_At))}('\n---', '${array[*]}') {(word_part.BracedVarSub token: bracket_op:(bracket_op.WholeArray op_id:Arith_Star))}('\n---', '${#}') {(${ VSub_Pound '#')}('\n---', '${!}') {(${ VSub_Bang '!')}('\n---', '${?}') {(${ VSub_QMark '?')}('\n---', '${var}') {(${ VSub_Name var)}('\n---', '${15}') {(${ VSub_Number 15)}('\n---', '${#var}') {(word_part.BracedVarSub token: prefix_op:VSub_Pound)}('\n---', '${!ref}') {(word_part.BracedVarSub token: prefix_op:VSub_Bang)}('\n---', '${##}') {(word_part.BracedVarSub token: prefix_op:VSub_Pound)}('\n---', '${array[0]}') { (word_part.BracedVarSub token: bracket_op: (bracket_op.ArrayIndex expr:(arith_expr.ArithWord w:{(Lit_Digits 0)})) ) }('\n---', '${array[@]}') {(word_part.BracedVarSub token: bracket_op:(bracket_op.WholeArray op_id:Lit_At))}('\n---', '${#array[0]}') { (word_part.BracedVarSub token: prefix_op: VSub_Pound bracket_op: (bracket_op.ArrayIndex expr:(arith_expr.ArithWord w:{(Lit_Digits 0)})) ) }('\n---', '${!array[0]}') { (word_part.BracedVarSub token: prefix_op: VSub_Bang bracket_op: (bracket_op.ArrayIndex expr:(arith_expr.ArithWord w:{(Lit_Digits 0)})) ) }('\n---', '${var#prefix}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Unary op_id:VOp1_Pound arg_word:{(prefix)}) ) }('\n---', '${!var#prefix}') { (word_part.BracedVarSub token: prefix_op: VSub_Bang suffix_op: (suffix_op.Unary op_id:VOp1_Pound arg_word:{(prefix)}) ) }('\n---', '${#var#prefix}') Got expected ParseError: ('\n---', '${##2}') Got expected ParseError: ('\n---', '${undef:-') Got expected ParseError: ('\n---', '${undef:-$') Got expected ParseError: ('\n---', '${undef:-$F') Got expected ParseError: ('\n---', '${x@') Got expected ParseError: ('\n---', '${x@Q') Got expected ParseError: ('\n---', '${x%') Got expected ParseError: ('\n---', '${x/') Got expected ParseError: ('\n---', '${x/a/') Got expected ParseError: ('\n---', '${x/a/b') Got expected ParseError: ('\n---', '${x:') Got expected ParseError: ('\n---', '$func().') Got expected ParseError: ('\n---', '${#@}') {(word_part.BracedVarSub token: prefix_op:VSub_Pound)}('\n---', '${#11}') {(word_part.BracedVarSub token: prefix_op:VSub_Pound)}('\n---', '${#str}') {(word_part.BracedVarSub token: prefix_op:VSub_Pound)}('\n---', '${#array[0]}') { (word_part.BracedVarSub token: prefix_op: VSub_Pound bracket_op: (bracket_op.ArrayIndex expr:(arith_expr.ArithWord w:{(Lit_Digits 0)})) ) }('\n---', '${#array["key"]}') { (word_part.BracedVarSub token: prefix_op: VSub_Pound bracket_op: (bracket_op.ArrayIndex expr:(arith_expr.ArithWord w:{(DQ (key))})) ) }--MULTI ('\n---', '@words') {(word_part.Splice name:)}('\n---', '.@words') {(.) (Lit_Splice '@words')}('\n---', '.@words.') {(.) (Lit_Splice '@words') (.)}('\n---', '@words[') Got expected ParseError: ('\n---', '@words.') Got expected ParseError: ('\n---', '@func()') {(word_part.FuncCall name: arguments:[(expr.Str s:TODO)])}('\n---', '$(echo @func())') { (word_part.CommandSub left_token: command_list: (command.CommandList children: [ (C {(echo)} {(word_part.FuncCall name: arguments:[(expr.Str s:TODO)])}) ] ) ) }('\n---', '$(($(echo @func())))') { (word_part.ArithSub anode: (arith_expr.ArithWord w: { (word_part.CommandSub left_token: command_list: (command.CommandList children: [ (C {(echo)} {(word_part.FuncCall name: arguments:[(expr.Str s:TODO)])} ) ] ) ) } ) ) }('\n---', '@func().') Got expected ParseError: {(Lit_VarLike 'a=') (word_part.ArrayLiteral words:[{(1)} {(2)} {(3)}])}a=(1 2 3) 0 (line_span line_id:0 col:0 length:2) {(foo)}foo 0 (line_span line_id:0 col:0 length:3) {(word_part.EscapedLiteral token:)}\$ 0 (line_span line_id:0 col:0 length:2) {(SQ )}'' 0 (line_span line_id:0 col:0 length:1) {(SQ )}'sq' 0 (line_span line_id:0 col:0 length:1) {(DQ )}"" 0 (line_span line_id:0 col:0 length:1) {(DQ (dq))}"dq" 0 (line_span line_id:0 col:0 length:1) { (word_part.CommandSub left_token: command_list: (command.CommandList children:[(C {(echo)} {(command)} {(sub)})]) ) }$(echo command sub) 0 (line_span line_id:0 col:0 length:2) { (word_part.ArithSub anode: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.ArithWord w:{(Lit_Digits 1)}) right: (arith_expr.ArithWord w:{(Lit_Digits 2)}) ) ) }$(( 1 + 2 )) 0 (line_span line_id:0 col:0 length:3) {(Lit_TildeLike '~user')}~user 0 (line_span line_id:0 col:0 length:5) {(word_part.BracedVarSub token: suffix_op:(suffix_op.Unary op_id:VOp1_Pound arg_word:{}))}${var#} 0 (line_span line_id:0 col:0 length:2) ('\n---', '${var/pat/replace}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.PatSub pat:{(pat)} replace:{(replace)} replace_mode:Undefined_Tok) ) }('\n---', '${var//pat/replace}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.PatSub pat:{(pat)} replace:{(replace)} replace_mode:Lit_Slash) ) }('\n---', '${var/%pat/replace}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.PatSub pat:{(pat)} replace:{(replace)} replace_mode:Lit_Percent) ) }('\n---', '${var/#pat/replace}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Pat..Sub pat:{(pat)} replace:{(replace)} replace_mode:Lit_Pound) ) }('\n---', '${var/pat}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.PatSub pat:{(pat)} replace_mode:Undefined_Tok) ) }('\n---', '${var//pat}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.PatSub pat:{(pat)} replace_mode:Lit_Slash) ) }('\n---', '${var/pat//}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.PatSub pat:{(pat)} replace:{(Lit_Slash /)} replace_mode:Undefined_Tok) ) }('\n---', '${var/pat///}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.PatSub pat: {(pat)} replace: {(Lit_Slash /) (Lit_Slash /)} replace_mode: Undefined_Tok ) ) }('\n---', '${var/pat/"//"}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.PatSub pat:{(pat)} replace:{(DQ (//))} replace_mode:Undefined_Tok) ) }('\n---', '${var////\\\\/}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.PatSub pat: {(Lit_Slash /)} replace: {(word_part.EscapedLiteral token:) (Lit_Slash /)} replace_mode: Lit_Slash ) ) }--- ls "foo" () {(ls)}{(DQ (foo))}(word.Token token:)--- $(( 1 + 2 )) () { (word_part.ArithSub anode: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.ArithWord w:{(Lit_Digits 1)}) right: (arith_expr.ArithWord w:{(Lit_Digits 2)}) ) ) }(word.Token token:)--- $(echo $(( 1 )) ) () { (word_part.CommandSub left_token: command_list: (command.CommandList children: [(C {(echo)} {(word_part.ArithSub anode:(arith_expr.ArithWord w:{(Lit_Digits 1)}))})] ) ) }(word.Token token:)--- echo ${#array[@]} b () {(echo)}{ (word_part.BracedVarSub token: prefix_op: VSub_Pound bracket_op: (bracket_op.WholeArray op_id:Lit_At) ) }{(b)}(word.Token token:)--- echo $(( ${#array[@]} )) () {(echo)}{ (word_part.ArithSub anode: (arith_expr.ArithWord w: { (word_part.BracedVarSub token: prefix_op: VSub_Pound bracket_op: (bracket_op.WholeArray op_id:Lit_At) ) } ) ) }(word.Token token:)--- echo ${@%suffix} () {(echo)}{ (word_part.BracedVarSub token: suffix_op: (suffix_op.Unary op_id:VOp1_Percent arg_word:{(suffix)}) ) }(word.Token token:)--- ${@} () {(${ VSub_At '@')}(word.Token token:)--- echo ${var,,} () {(echo)}{(word_part.BracedVarSub token: suffix_op:(suffix_op.Unary op_id:VOp1_DComma arg_word:{}))}(word.Token token:)--- echo ${var,,?} () {(echo)}{ (word_part.BracedVarSub token: suffix_op: (suffix_op.Unary op_id:VOp1_DComma arg_word:{('?')}) ) }(word.Token token:)--- ${\ foo} () {(${ VSub_Name foo)}(word.Token token:)--- ${foo\ } () {(${ VSub_Name foo)}(word.Token token:)--- ${foo#\ yo} () { (word_part.BracedVarSub token: suffix_op: (suffix_op.Unary op_id:VOp1_Pound arg_word:{(yo)}) ) }(word.Token token:)--- "${foo#\ yo}" () { (DQ (word_part.BracedVarSub token: suffix_op: (suffix_op.Unary op_id:VOp1_Pound arg_word:{(yo)}) ) ) }(word.Token token:)--- 1 + 2 () {(Lit_Digits 1)}(word.Token token:){(Lit_Digits 2)}(word.Token token:)--- a + b () {(Lit_ArithVarLike a)}(word.Token token:){(Lit_ArithVarLike b)}(word.Token token:)--- $a * $b () {($ VSub_DollarName '$a')}(word.Token token:){($ VSub_DollarName '$b')}(word.Token token:)--- ${a} * ${b} () {(${ VSub_Name a)}(word.Token token:){(${ VSub_Name b)}(word.Token token:)--- $(ec....ho 1) * $(echo 2) () { (word_part.CommandSub left_token: command_list: (command.CommandList children:[(C {(echo)} {(1)})]) ) }(word.Token token:){ (word_part.CommandSub left_token: command_list: (command.CommandList children:[(C {(echo)} {(2)})]) ) }(word.Token token:)--- `echo 1` + 2 () { (word_part.CommandSub left_token: command_list: (command.CommandList children:[(C {(echo)} {(1)})]) ) }(word.Token token:){(Lit_Digits 2)}(word.Token token:)--- $((1 + 2)) * $((3 + 4)) () { (word_part.ArithSub anode: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.ArithWord w:{(Lit_Digits 1)}) right: (arith_expr.ArithWord w:{(Lit_Digits 2)}) ) ) }(word.Token token:){ (word_part.ArithSub anode: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.ArithWord w:{(Lit_Digits 3)}) right: (arith_expr.ArithWord w:{(Lit_Digits 4)}) ) ) }(word.Token token:)--- 'single quoted' () {(SQ <'single quoted'>)}(word.Token token:)--- "${a}" + "${b}" () {(DQ (${ VSub_Name a))}(word.Token token:){(DQ (${ VSub_Name b))}(word.Token token:)--- $# + $$ () {($ VSub_Pound '$#')}(word.Token token:){($ VSub_Dollar '$$')}(word.Token token:)--- $(( x[0] < 5 )) () { (word_part.ArithSub anode: (arith_expr.Binary op_id: Arith_Less left: (arith_expr.Binary op_id: Arith_LBracket left: (arith_expr.VarRef token:) right: (arith_expr.ArithWord w:{(Lit_Digits 0)}) ) right: (arith_expr.ArithWord w:{(Lit_Digits 5)}) ) ) }(word.Token token:)--- $(( ++i )) () {(word_part.ArithSub anode:(arith_expr.UnaryAssign op_id:Arith_DPlus child:(lhs_expr.LhsName name:i)))}(word.Token token:)--- $(( i++ )) () { (word_part.ArithSub anode: (arith_expr.UnaryAssign op_id:Node_PostDPlus child:(lhs_expr.LhsName name:i)) ) }(word.Token token:)--- $(( x -= 1)) () { (word_part.ArithSub anode: (arith_expr.BinaryAssign op_id: Arith_MinusEqual left: (lhs_expr.LhsName name:x) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) }(word.Token token:)--- $(( x |= 1)) () { (word_part.ArithSub anode: (arith_expr.BinaryAssign op_id: Arith_PipeEqual left: (lhs_expr.LhsName name:x) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) }(word.Token token:)--- $(( x[0] = 1 )) () { (word_part.ArithSub anode: (arith_expr.BinaryAssign op_id: Arith_Equal left: (lhs_expr.LhsIndexedName name:x index:(arith_expr.ArithWord w:{(Lit_Digits 0)})) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) }(word.Token token:)--- $(( 1 | 0 )) () { (word_part.ArithSub anode: (arith_expr.Binary op_id: Arith_Pipe left: (arith_expr.ArithWord w:{(Lit_Digits 1)}) right: (arith_expr.ArithWord w:{(Lit_Digits 0)}) ) ) }(word.Token token:)--- $((0x$size)) () { (word_part.ArithSub anode: (arith_expr.ArithWord w:{(Lit_Digits 0) (Lit_ArithVarLike x) ($ VSub_DollarName '$size')}) ) }(word.Token token:)('\n---', '$(( (1+2) ))') { (word_part.ArithSub anode: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.ArithWord w:{(Lit_Digits 1)}) right: (arith_expr.ArithWord w:{(Lit_Digits 2)}) ) ) }('\n---', '$(( (1+2) ))') { (word_part.ArithSub anode: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.ArithWord w:{(Lit_Digits 1)}) right: (arith_expr.ArithWord w:{(Lit_Digits 2)}) ) ) }('\n---', '${foo:0}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Slice beg...... ---------------------------------------------------------------------- Ran 20 tests in 0.022s OK in:(arith_expr.ArithWord w:{(Lit_Digits 0)})) ) }('\n---', '${foo:0:1}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Slice begin: (arith_expr.ArithWord w:{(Lit_Digits 0)}) length: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) }('\n---', '${foo:1+2:2+3}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Slice begin: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.ArithWord w:{(Lit_Digits 1)}) right: (arith_expr.ArithWord w:{(Lit_Digits 2)}) ) length: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.ArithWord w:{(Lit_Digits 2)}) right: (arith_expr.ArithWord w:{(Lit_Digits 3)}) ) ) ) }('\n---', '${foo::1}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Slice length:(arith_expr.ArithWord w:{(Lit_Digits 1)})) ) }('\n---', '${var:-default]}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Unary op_id:VTest_ColonHyphen arg_word:{('default]')}) ) }('\n---', '~/git/oilshell/oil') {(Lit_TildeLike '~') (/git/oilshell/oil)}('\n---', '~andy/git/oilshell/oil') {(Lit_TildeLike '~andy') (/git/oilshell/oil)}('\n---', '~andy_c/git/oilshell/oil') {(Lit_TildeLike '~andy_c') (/git/oilshell/oil)}('\n---', '~andy.c/git/oilshell/oil') {(Lit_TildeLike '~andy.c') (/git/oilshell/oil)}('\n---', '~andy-c/git/oilshell/oil') {(Lit_TildeLike '~andy-c') (/git/oilshell/oil)}('\n---', '~andy-c:git/oilshell/oil') {(Lit_TildeLike '~andy-c') (Lit_Other ':') (git/oilshell/oil)}('\n---', '${var#}') {(word_part.BracedVarSub token: suffix_op:(suffix_op.Unary op_id:VOp1_Pound arg_word:{}))}('\n---', '${var#prefix}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Unary op_id:VOp1_Pound arg_word:{(prefix)}) ) }('\n---', '${var##}') {(word_part.BracedVarSub token: suffix_op:(suffix_op.Unary op_id:VOp1_DPound arg_word:{}))}('\n---', '${var##prefix}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Unary op_id:VOp1_DPound arg_word:{(prefix)}) ) }('\n---', '${var%suffix}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Unary op_id:VOp1_Percent arg_word:{(suffix)}) ) }('\n---', '${var%%suffix}') { (word_part.BracedVarSub token: suffix_op: (suffix_op.Unary op_id:VOp1_DPercent arg_word:{(suffix)}) ) }('\n---', '${name}') {(${ VSub_Name name)}('\n---', '${name[0]}') { (word_part.BracedVarSub token: bracket_op: (bracket_op.ArrayIndex expr:(arith_expr.ArithWord w:{(Lit_Digits 0)})) ) }('\n---', '${array[@]}') {(word_part.BracedVarSub token: bracket_op:(bracket_op.WholeArray op_id:Lit_At))}