....(CompoundWord parts:[ (Token id:Lit_Chars length:2 col:0 line:(SourceLine line_num:1 content:"hi'\n" src:(source.MainFile path:hi)) ) (SingleQuoted left:(Token id:Left_SingleQuote length:1 col:2 line:...0x7f1f906ac730) sval:"\nsingle quoted" right:(Token id:Right_SingleQuote length:1 col:13 line:(SourceLine line_num:2 content:"single quoted'\"double\n" src:...0x7f1f90642170 ) ) ) (DoubleQuoted left:(Token id:Left_DoubleQuote length:1 col:14 line:...0x7f1f906ac788) parts:[ (Token id:Lit_Chars length:7 col:15 line:...0x7f1f906ac788) (Token id:Lit_Chars length:7 col:0 line:(SourceLine line_num:3 content:"quoted\n" src:...0x7f1f90642170) ) ] right:(Token id:Right_DoubleQuote length:1 col:0 line:(SourceLine line_num:4 content:"\"there\n" src:...0x7f1f90642170) ) ) (Token id:Lit_Chars length:5 col:1 line:...0x7f1f906ac890) ] ) s = '\'\nsingle quoted\'"double\nquoted\n"' s = "'\nsingle quoted'" s = 'hi' (CompoundWord parts:[ (Token id:Lit_VarLike length:4 col:4 line:(SourceLine line_num:1 content:"ls; foo=42" src:(source.MainFile path:"") ) ) (Token id:Lit_Chars length:2 col:8 line:...0x7f1f906ac7e0) ] ) (CompoundWord parts:[ (Token id:Lit_VarLike length:5 col:4 line:(SourceLine line_num:1 content:"ls; foo+=X" src:(source.MainFile path:"") ) ) (Token id:Lit_Chars length:1 col:9 line:...0x7f1f906ace68) ] ) --- ${array[0]} (w (BracedVarSub left: name_tok: var_name:array bracket_op:(bracket_op.ArrayIndex expr:(w )) right: ) ) --- ${array[5+5]} (w (BracedVarSub left: name_tok: var_name:array bracket_op:(bracket_op.ArrayIndex expr:(arith_expr.Binary op: left:(w ) right:(w ) ) ) right: ) ) --- ${array[@]} (w (BracedVarSub left: name_tok: var_name:array bracket_op:(bracket_op.WholeArray op_id:Lit_At) right: ) ) --- ${array[*]} (w (BracedVarSub left: name_tok: var_name:array bracket_op:(bracket_op.WholeArray op_id:Arith_Star) right: ) ) --- ${#} (w (${ VSub_Pound "#")) --- ${!} (w (${ VSub_Bang "!")) --- ${?} (w (${ VSub_QMark "?")) --- ${var} (w (${ VSub_Name var)) --- ${15} (w (${ VSub_Number 15)) --- ${#var} (w (BracedVarSub left: name_tok: var_name:var prefix_op: right: ) ) --- ${!ref} (w (BracedVarSub left: name_tok: var_name:ref prefix_op: right: ) ) --- ${##} (w (BracedVarSub left: name_tok: var_name:"#" prefix_op: right: ) ) --- ${array[0]} (w (BracedVarSub left: name_tok: var_name:array bracket_op:(bracket_op.ArrayIndex expr:(w )) right: ) ) --- ${array[@]} (w (BracedVarSub left: name_tok: var_name:array bracket_op:(bracket_op.WholeArray op_id:Lit_At) right: ) ) --- ${#array[0]} (w (BracedVarSub left: name_tok: var_name:array prefix_op: bracket_op:(bracket_op.ArrayIndex expr:(w..... )) right: ) ) --- ${!array[0]} (w (BracedVarSub left: name_tok: var_name:array prefix_op: bracket_op:(bracket_op.ArrayIndex expr:(w )) right: ) ) --- ${var#prefix} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) --- ${!var#prefix} (w (BracedVarSub left: name_tok: var_name:var prefix_op: suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) ('\n---', '${#var#prefix}') Got expected ParseError: ('\n---', '${##2}') Got expected ParseError: --MULTI ('\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: --- ${#@} (w (BracedVarSub left: name_tok: var_name:"@" prefix_op: right: ) ) --- ${#11} (w (BracedVarSub left: name_tok: var_name:11 prefix_op: right: ) ) --- ${#str} (w (BracedVarSub left: name_tok: var_name:str prefix_op: right: ) ) --- ${#array[0]} (w (BracedVarSub left: name_tok: var_name:array prefix_op: bracket_op:(bracket_op.ArrayIndex expr:(w )) right: ) ) --- ${#array["key"]} (w (BracedVarSub left: name_tok: var_name:array prefix_op: bracket_op:(bracket_op.ArrayIndex expr:(w (DQ ))) right: ) ) --- @words (w (word_part.Splice blame_tok: var_name:words)) --- .@words (w ) --- .@words. (w ) ('\n---', '@words[') Got expected ParseError: ('\n---', '@words.') Got expected ParseError: (w words:[(w ) (w ) (w )] right: ) ) a=(1 2 3) (Token id:Lit_VarLike length:2 col:0 line:(SourceLine line_num:1 content:"a=(1 2 3)" src:(source.MainFile path:word_parse_test.py) ) ) (w ) foo (Token id:Lit_Chars length:3 col:0 line:(SourceLine line_num:1 content:foo src:(source.MainFile path:word_parse_test.py) ) ) (w (word_part.EscapedLiteral token: ch:"$")) \$ (Token id:Lit_EscapedChar length:2 col:0 line:(SourceLine line_num:1 content:"\\$" src:(source.MainFile path:word_parse_test.py) ) ) (w (SQ "")) '' (Token id:Left_SingleQuote length:1 col:0 line:(SourceLine line_num:1 content:"''" src:(source.MainFile path:word_parse_test.py) ) ) (w (SQ sq)) 'sq' (Token id:Left_SingleQuote length:1 col:0 line:(SourceLine line_num:1 content:"'sq'" src:(source.MainFile path:word_parse_test.py) ) ) (w (DQ)) "" (Token id:Left_DoubleQuote length:1 col:0 line:(SourceLine line_num:1 content:"\"\"" src:(source.MainFile path:word_parse_test.py) ) ) (w (DQ ).) "dq" (Token id:Left_DoubleQuote length:1 col:0 line:(SourceLine line_num:1 content:"\"dq\"" src:(source.MainFile path:word_parse_test.py) ) ) (w (CommandSub left_token: child:(C (w ) (w ) (w )) right: ) ) $(echo command sub) (Token id:Left_DollarParen length:2 col:0 line:(SourceLine line_num:1 content:"$(echo command sub)" src:(source.MainFile path:word_parse_test.py) ) ) (w (word_part.ArithSub left: anode:(arith_expr.Binary op: left:(w ) right:(w ) ) right: ) ) $(( 1 + 2 )) (Token id:Left_DollarDParen length:3 col:0 line:(SourceLine line_num:1 content:"$(( 1 + 2 ))" src:(source.MainFile path:word_parse_test.py) ) ) (w ) ~user (Token id:Lit_Tilde length:1 col:0 line:(SourceLine line_num:1 content:"~user" src:(source.MainFile path:word_parse_test.py) ) ) (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w)) right: ) ) ${var#} (Token id:Left_DollarBrace length:2 col:0 line:(SourceLine line_num:1 content:"${var#}" src:(source.MainFile path:word_parse_test.py) ) ) --- ${var/pat/replace} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.PatSub pat:(w ) replace:(w ) replace_mode:Undefined_Tok slash_tok: ) right: ) ) --- ${var//pat/replace} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.PatSub pat:(w ) replace:(w ) replace_mode:Lit_Slash slash_tok: ) right: ) ) --- ${var/%pat/replace} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.PatSub pat:(w ) replace:(w ) replace_mode:Lit_Percent slash_tok: ) right: ) ) --- ${var/#pat/replace} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.PatSub pat:(w ) replace:(w ) replace_mode:Lit_Pound slash_tok: ) right: ) ) --- ${var/pat} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.PatSub pat:(w ) replace:(rhs_word.Empty) replace_mode:Undefined_Tok slash_tok: ) right: ) ) --- ${var//pat} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.PatSub pat:(w ) replace:(rhs_word.Empty) replace_mode:Lit_Slash slash_tok: ) right: ) ) --- ${var/pat//} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.PatSub pat:(w ) replace:(w ) replace_mode:Undefined_Tok slash_tok: ) right: ) ) --- ${var/pat///} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.PatSub pat:(w ) replace:(w ) replace_mode:Undefined_Tok slash_tok: ) right:<..Right_DollarBrace "}"> ) ) --- ${var/pat/"//"} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.PatSub pat:(w ) replace:(w (DQ )) replace_mode:Undefined_Tok slash_tok: ) right: ) ) --- ${var////\\/} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.PatSub pat:(w ) replace:(w (word_part.EscapedLiteral token: ch:"\\") ) replace_mode:Lit_Slash slash_tok: ) right: ) ) --- ls "foo" () (w ) (w (DQ )) --- $(( 1 + 2 )) () (w (word_part.ArithSub left: anode:(arith_expr.Binary op: left:(w ) right:(w ) ) right: ) ) --- $(echo $(( 1 )) ) () (w (CommandSub left_token: child:(C (w ) (w (word_part.ArithSub left: anode:(w ) right: ) ) ) right: ) ) --- echo ${#array[@]} b () (w ) (w (BracedVarSub left: name_tok: var_name:array prefix_op: bracket_op:(bracket_op.WholeArray op_id:Lit_At) right: ) ) (w ) --- echo $(( ${#array[@]} )) () (w ) (w (word_part.ArithSub left: anode:(w (BracedVarSub left: name_tok: var_name:array prefix_op: bracket_op:(bracket_op.WholeArray op_id:Lit_At) right: ) ) right: ) ) --- echo ${@%suffix} () (w ) (w (BracedVarSub left: name_tok: var_name:"@" suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) --- ${@} () (w (${ VSub_At "@")) --- echo ${var,,} () (w ) (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w)) right: ) ) --- echo ${var,,?} () (w ) (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) --- ${\ foo} () (w (${ VSub_Name foo)) --- ${foo\ } () (w (${ VSub_Name foo)) --- ${foo#\ yo} () (w (BracedVarSub left: name_tok: var_name:foo suffix_op:(suffix_op.Unary op: arg_word:(w )) right: ) ) --- "${foo#\ yo}" () (w (DQ (BracedVarSub left: name_tok: var_name:foo suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) ) --- 1 + 2 () (w ) (w ) --- a + b () (w ) (w ) --- $a * $b () (w ($ a)) (w ($ b)) --- ${a} * ${b} () (w (${ VSub_Name a)) (w (${ VSub_Name b)) --- $(echo 1) * ...$(echo 2) () (w (CommandSub left_token: child:(C (w ) (w )) right: ) ) (w (CommandSub left_token: child:(C (w ) (w )) right: ) ) --- `echo 1` + 2 () (w (CommandSub left_token: child:(C (w ) (w )) right: ) ) (w ) --- $((1 + 2)) * $((3 + 4)) () (w (word_part.ArithSub left: anode:(arith_expr.Binary op: left:(w ) right:(w ) ) right: ) ) (w (word_part.ArithSub left: anode:(arith_expr.Binary op: left:(w ) right:(w ) ) right: ) ) --- 'single quoted' () (w (SQ "single quoted")) --- "${a}" + "${b}" () (w (DQ (${ VSub_Name a))) (w (DQ (${ VSub_Name b))) --- $# + $$ () (w ($ VSub_Pound)) (w ($ VSub_Dollar)) --- $(( x[0] < 5 )) () (w (word_part.ArithSub left: anode:(arith_expr.Binary op: left:(arith_expr.Binary op: left: right:(w ) ) right:(w ) ) right: ) ) --- $(( ++i )) () (w (word_part.ArithSub left: anode:(arith_expr.UnaryAssign op_id:Arith_DPlus child:) right: ) ) --- $(( i++ )) () (w (word_part.ArithSub left: anode:(arith_expr.UnaryAssign op_id:Node_PostDPlus child: ) right: ) ) --- $(( x -= 1)) () (w (word_part.ArithSub left: anode:(arith_expr.BinaryAssign op_id:Arith_MinusEqual left: right:(w ) ) right: ) ) --- $(( x |= 1)) () (w (word_part.ArithSub left: anode:(arith_expr.BinaryAssign op_id:Arith_PipeEqual left: right:(w ) ) right: ) ) --- $(( x[0] = 1 )) () (w (word_part.ArithSub left: anode:(arith_expr.BinaryAssign op_id:Arith_Equal left:(arith_expr.Binary op: left: right:(w ) ) right:(w ) ) right: ) ) --- $(( 1 | 0 )) () (w (word_part.ArithSub left: anode:(arith_expr.Binary op: left:(w ) right:(w ) ) right: ) ) --- $((0x$size)) () (w (word_part.ArithSub left: anode:(w ($ size)) right: ) ) --- $(( (1+2) )) (w (word_part.ArithSub left: anode:(arith_expr.Binary op: left:(w ) right:(w ) ) right: ) ) --- $(( (1+2) )) (w (word_part.ArithSub left: anode:(arith_expr.Binary op: left:(w ) right:(w ) ) right: ) ) --- ${foo:0} (w (BracedVarSub left: name_tok: var_name:foo suffix_op:(suffix_op.S......lice begin:(w )) right: ) ) --- ${foo:0:1} (w (BracedVarSub left: name_tok: var_name:foo suffix_op:(suffix_op.Slice begin:(w ) length:(w ) ) right: ) ) --- ${foo:1+2:2+3} (w (BracedVarSub left: name_tok: var_name:foo suffix_op:(suffix_op.Slice begin:(arith_expr.Binary op: left:(w ) right:(w ) ) length:(arith_expr.Binary op: left:(w ) right:(w ) ) ) right: ) ) --- ${foo::1} (w (BracedVarSub left: name_tok: var_name:foo suffix_op:(suffix_op.Slice begin:(arith_expr.EmptyZero) length:(w ) ) right: ) ) --- ${var:-default]} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) --- ~/git/oilshell/oil (w ) --- ~andy/git/oilshell/oil (w ) --- ~andy_c/git/oilshell/oil (w ) --- ~andy.c/git/oilshell/oil (w ) --- ~andy-c/git/oilshell/oil (w ) --- ~andy-c:git/oilshell/oil (w ) --- ${var#} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w)) right: ) ) --- ${var#prefix} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) --- ${var##} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w)) right: ) ) --- ${var##prefix} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) --- ${var%suffix} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) --- ${var%%suffix} (w (BracedVarSub left: name_tok: var_name:var suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) --- ${name} (w (${ VSub_Name name)) --- ${name[0]} (w (BracedVarSub left: name_tok: var_name:name bracket_op:(bracket_op.ArrayIndex expr:(w )) right: ) ) --- ${array[@]} (w (BracedVarSub left: name_tok: var_name:array bracket_op:(bracket_op.WholeArray op_id:Lit_At) right: ) )