/// /// Cases in Files /// ===== CASE: FILE test/parse-errors/01-bad-func.sh ===== foo (,) ^ test/parse-errors/01-bad-func.sh:15: Syntax error in expression (near Id.Arith_Comma) ===== CASE: FILE test/parse-errors/02-bad-func.sh ===== foo() ^ test/parse-errors/02-bad-func.sh:3: Unexpected word while parsing compound command (Id.Eof_Real) ===== CASE: FILE test/parse-errors/05-unterminated-single.sh ===== A B echo 'C ^ test/parse-errors/05-unterminated-single.sh:5: Unexpected EOF in single-quoted string that began here ===== CASE: FILE test/parse-errors/06-unterminated-double-long.sh ===== A B echo 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 " ^ test/parse-errors/06-unterminated-double-long.sh:9: Unexpected EOF reading double-quoted string that began here ===== CASE: FILE test/parse-errors/06-unterminated-double.sh ===== A B echo "0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 ^ test/parse-errors/06-unterminated-double.sh:6: Unexpected EOF reading double-quoted string that began here ===== CASE: FILE test/parse-errors/07-unterminated-here-doc-2.sh ===== cat << "$@" ^ test/parse-errors/07-unterminated-here-doc-2.sh:2: Invalid here doc delimiter ===== CASE: FILE test/parse-errors/07-unterminated-here-doc.sh ===== cat <out ===== (command.ControlFlow keyword: (Token id: Id.ControlFlow_Break length: 5 col: 0 line: (SourceLine line_num:1 content:"break >out" src:(source.CFlag)) ) ) ===== CASE: -n -c break >out ===== break >out ^~~~~ [ -c flag ]:1: Control flow shouldn't have redirects ===== CASE: -n -c [ ( x ] ===== [ ( x ] ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_RBracket) OK test-cmd-parse *** Running test-command-sub ===== CASE: -n -c echo line 2 echo $( echo ===== echo $( echo ^ [ -c flag ]:3: Invalid word while parsing command list ===== CASE: -n -c echo line 2 echo ` echo ===== echo ` echo ^ [ -c flag ]:3: Unexpected EOF while looking for closing backtick ===== CASE: -n -c echo line 2 echo ` echo \` ===== echo ` echo \` ^ [ -c flag ]:3: Unexpected EOF while looking for closing backtick ===== CASE: -n -c echo line 2 echo ` echo \`unclosed ` ===== echo ` echo \`unclosed ` ^ [ backticks in [ -c flag ] ]:3: Unexpected EOF while looking for closing backtick ===== CASE: -n -c echo `for x in` ===== echo `for x in` ^ [ backticks in [ -c flag ] ]:1: Invalid word in for loop OK test-command-sub *** Running test-dparen ===== CASE: -n -c (()) ===== (command.DParen left: (Token id:Id.Op_DLeftParen length:2 col:0 line:(SourceLine line_num:1 content:"(())" src:(source.CFlag))) child: ...0x3ffffffc right: (Token id:Id.Op_DRightParen length:1 col:3 line:...0x1332) ) ===== CASE: -n -c (( )) ===== (command.DParen left: (Token id:Id.Op_DLeftParen length:2 col:0 line:(SourceLine line_num:1 content:"(( ))" src:(source.CFlag))) child: ...0x3ffffffc right: (Token id:Id.Op_DRightParen length:1 col:4 line:...0x1332) ) ===== CASE: -n -c (( ) ===== (( ) ^ [ -c flag ]:1: Expected second ) to end arith statement ===== CASE: -n -c (( )x ===== (( )x ^ [ -c flag ]:1: Expected second ) to end arith statement ===== CASE: -n -c $(echo $(( 1 + 2 ))) ===== (command.Simple blame_tok: (Token id: Id.Left_DollarParen length: 2 col: 0 line: (SourceLine line_num:1 content:"$(echo $(( 1 + 2 )))" src:(source.CFlag)) ) more_env: [] words: [ (CompoundWord parts: [ (CommandSub left_token: ...0x1326 child: (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:2 line:...0x132e) more_env: [] words: [ (CompoundWord parts:[...0x131a]) (CompoundWord parts: [ (word_part.ArithSub left: (Token id:Id.Left_DollarDParen length:3 col:7 line:...0x132e) anode: (arith_expr.Binary op: (Token id:Id.Arith_Plus length:1 col:13 line:...0x132e) left: (CompoundWord parts: [(Token id:Id.Lit_Digits length:1 col:11 line:...0x132e)] ) right: (CompoundWord parts: [(Token id:Id.Lit_Digits length:1 col:15 line:...0x132e)] ) ) right: (Token id:Id.Right_DollarDParen length:1 col:18 line:...0x132e) ) ] ) ] is_last_cmd: F ) right: (Token id:Id.Eof_RParen length:1 col:19 line:...0x132e) ) ] ) ] is_last_cmd: F ) ===== CASE: -n -c $( (())) ===== (command.Simple blame_tok: (Token id:Id.Left_DollarParen length:2 col:0 line:(SourceLine line_num:1 content:"$( (()))" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts: [ (CommandSub left_token: ...0x1326 child: (command.DParen left: (Token id:Id.Op_DLeftParen length:2 col:3 line:...0x132e) child: ...0x3ffffffc right: (Token id:Id.Op_DRightParen length:1 col:6 line:...0x132e) ) right: (Token id:Id.Eof_RParen length:1 col:7 line:...0x132e) ) ] ) ] is_last_cmd: F ) ===== CASE: -n -c (( 1 + 2 / ===== (( 1 + 2 / ^ [ -c flag ]:1: Unexpected end of input ===== CASE: -n -c (( 1 + 2 )/ ===== (( 1 + 2 )/ ^ [ -c flag ]:1: Expected second ) to end arith statement ===== CASE: -n -c (( 1 ===== (( 1 ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Eof_Real != Id.Arith_RParen) ===== CASE: -n -c (( ===== (( ^ [ -c flag ]:1: Unexpected end of input OK test-dparen *** Running test-eval_parse_error ===== CASE: -c x="echo )" eval $x ===== echo ) ^ [ eval word at line 3 of [ -c flag ] ]:1 eval $x ^~~~ [ -c flag ]:3: Invalid word while parsing command line (Id.Op_RParen) OK test-eval_parse_error *** Running test-extra-newlines ===== CASE: -n -c for do done ===== for ^ [ -c flag ]:2: Expected loop variable (a constant word) ===== CASE: -n -c case in esac ===== case ^ [ -c flag ]:2: Expected a word to match against ===== CASE: -n -c while do done ===== do ^~ [ -c flag ]:3: Expected a condition ===== CASE: -n -c if then fi ===== then ^~~~ [ -c flag ]:3: Expected a condition ===== CASE: -n -c if true then elif then fi ===== then ^~~~ [ -c flag ]:5: Expected a condition ===== CASE: -n -c case | in esac ===== case | ^ [ -c flag ]:2: Expected a word to match against ===== CASE: -n -c case ; in esac ===== case ; ^ [ -c flag ]:2: Expected a word to match against ===== CASE: -n -c if true then fi ===== (command.If if_kw: (Token id:Id.KW_If length:2 col:2 line:(SourceLine line_num:2 content:" if\n" src:(source.CFlag))) arms: [ (IfArm keyword: ...0x131e cond: (condition.Shell commands: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" true\n" src:...0x3ffffffc) ) more_env: [] words: [(CompoundWord parts:[...0x12fe])] is_last_cmd: F ) ] ) then_kw: (Token id: Id.KW_Then length: 4 col: 2 line: (SourceLine line_num:4 content:" then\n" src:...0x3ffffffc) ) action: [] then_tok: ...0x12ce ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 2 line: (SourceLine line_num:5 content:" fi\n" src:...0x3ffffffc) ) ) ===== CASE: -n -c while false do done ===== (command.WhileUntil keyword: (Token id:Id.KW_While length:5 col:2 line:(SourceLine line_num:2 content:" while\n" src:(source.CFlag))) cond: (condition.Shell commands: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 5 col: 2 line: (SourceLine line_num:3 content:" false\n" src:...0x3ffffffc) ) more_env: [] words: [(CompoundWord parts:[...0x12fa])] is_last_cmd: F ) ] ) body: (command.DoGroup left: (Token id: Id.KW_Do length: 2 col: 2 line: (SourceLine line_num:4 content:" do\n" src:...0x3ffffffc) ) children: [] right: (Token id: Id.KW_Done length: 4 col: 2 line: (SourceLine line_num:5 content:" done\n" src:...0x3ffffffc) ) ) ) ===== CASE: -n -c while true; false do done ===== (command.WhileUntil keyword: (Token id:Id.KW_While length:5 col:2 line:(SourceLine line_num:2 content:" while\n" src:(source.CFlag))) cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" true;\n" src:...0x3ffffffc) ) more_env: [] words: [(CompoundWord parts:[...0x12fe])] is_last_cmd: F ) terminator: (Token id:Id.Op_Semi length:1 col:6 line:...0x1306) ) (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 5 col: 2 line: (SourceLine line_num:4 content:" false\n" src:...0x3ffffffc) ) more_env: [] words: [(CompoundWord parts:[...0x12c6])] is_last_cmd: F ) ] ) body: (command.DoGroup left: (Token id: Id.KW_Do length: 2 col: 2 line: (SourceLine line_num:5 content:" do\n" src:...0x3ffffffc) ) children: [] right: (Token id: Id.KW_Done length: 4 col: 2 line: (SourceLine line_num:6 content:" done\n" src:...0x3ffffffc) ) ) ) ===== CASE: -n -c if true then fi ===== (command.If if_kw: (Token id:Id.KW_If length:2 col:2 line:(SourceLine line_num:2 content:" if true\n" src:(source.CFlag))) arms: [ (IfArm keyword: ...0x1316 cond: (condition.Shell commands: [ (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:5 line:...0x131e) more_env: [] words: [(CompoundWord parts:[...0x1302])] is_last_cmd: F ) ] ) then_kw: (Token id: Id.KW_Then length: 4 col: 2 line: (SourceLine line_num:3 content:" then\n" src:...0x3ffffffc) ) action: [] then_tok: ...0x12ce ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 2 line: (SourceLine line_num:4 content:" fi\n" src:...0x3ffffffc) ) ) ===== CASE: -n -c while true; false do done ===== (command.WhileUntil keyword: (Token id:Id.KW_While length:5 col:2 line:(SourceLine line_num:2 content:" while true;\n" src:(source.CFlag))) cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:8 line:...0x1326) more_env: [] words: [(CompoundWord parts:[...0x130e])] is_last_cmd: F ) terminator: (Token id:Id.Op_Semi length:1 col:12 line:...0x1326) ) (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 5 col: 8 line: (SourceLine line_num:3 content:" false\n" src:...0x3ffffffc) ) more_env: [] words: [(CompoundWord parts:[...0x12d2])] is_last_cmd: F ) ] ) body: (command.DoGroup left: (Token id: Id.KW_Do length: 2 col: 2 line: (SourceLine line_num:4 content:" do\n" src:...0x3ffffffc) ) children: [] right: (Token id: Id.KW_Done length: 4 col: 2 line: (SourceLine line_num:5 content:" done\n" src:...0x3ffffffc) ) ) ) OK test-extra-newlines *** Running test-here-doc ===== CASE: -n -c cat < >> ) ===== echo $( echo > >> ) ^~ [ -c flag ]:1: Invalid token after redirect operator OK test-redirect *** Running test-regex-nix ===== CASE: -n -c if [[ ! (" ${params[*]} " =~ " -shared " || " ${params[*]} " =~ " -static " ) ]]; then echo hi fi ===== (command.If if_kw: (Token id: Id.KW_If length: 2 col: 0 line: (SourceLine line_num: 2 content: "if [[ ! (\" ${params[*]} \" =~ \" -shared \" || \" ${params[*]} \" =~ \" -static \" ) ]]; then\n" src: (source.CFlag) ) ) arms: [ (IfArm keyword: ...0x1326 cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: (Token id:Id.KW_DLeftBracket length:2 col:3 line:...0x132a) expr: (bool_expr.LogicalNot child: (bool_expr.LogicalOr left: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 9 line: ...0x132a ) parts: [ (Token id: Id.Lit_Chars length: 1 col: 10 line: ...0x132a ) (BracedVarSub left: (Token id: Id.Left_DollarBrace length: 2 col: 11 line: ...0x132a ) token: (Token id: Id.VSub_Name length: 6 col: 13 line: ...0x132a ) var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: (Token id: Id.Right_DollarBrace length: 1 col: 22 line: ...0x132a ) ) (Token id: Id.Lit_Chars length: 1 col: 23 line: ...0x132a ) ] right: (Token id: Id.Right_DoubleQuote length: 1 col: 24 line: ...0x132a ) ) ] ) right: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 29 line: ...0x132a ) parts: [(Token id:Id.Lit_Chars length:9 col:30 line:...0x132a)] right: (Token id: Id.Right_DoubleQuote length: 1 col: 39 line: ...0x132a ) ) ] ) ) right: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 44 line: ...0x132a ) parts: [ (Token id: Id.Lit_Chars length: 1 col: 45 line: ...0x132a ) (BracedVarSub left: (Token id: Id.Left_DollarBrace length: 2 col: 46 line: ...0x132a ) token: (Token id: Id.VSub_Name length: 6 col: 48 line: ...0x132a ) var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: (Token id: Id.Right_DollarBrace length: 1 col: 57 line: ...0x132a ) ) (Token id: Id.Lit_Chars length: 1 col: 58 line: ...0x132a ) ] right: (Token id: Id.Right_DoubleQuote length: 1 col: 59 line: ...0x132a ) ) ] ) right: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 64 line: ...0x132a ) parts: [(Token id:Id.Lit_Chars length:9 col:65 line:...0x132a)] right: (Token id: Id.Right_DoubleQuote length: 1 col: 74 line: ...0x132a ) ) ] ) ) ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:78 line:...0x132a) ) terminator: (Token id:Id.Op_Semi length:1 col:80 line:...0x132a) ) ] ) then_kw: (Token id:Id.KW_Then length:4 col:82 line:...0x132a) action: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" echo hi\n" src:...0x3ffffffc) ) more_env: [] words: [ (CompoundWord parts:[...0x11da]) (CompoundWord parts:[(Token id:Id.Lit_Chars length:2 col:7 line:...0x11e2)]) ] is_last_cmd: F ) ] then_tok: ...0x11fa ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 0 line: (SourceLine line_num:4 content:"fi\n" src:...0x3ffffffc) ) ) ===== CASE: -n -c if [[ (foo =~ (x) ) ]]; then echo hi fi ===== (command.If if_kw: (Token id: Id.KW_If length: 2 col: 0 line: (SourceLine line_num:2 content:"if [[ (foo =~ (x) ) ]]; then\n" src:(source.CFlag)) ) arms: [ (IfArm keyword: ...0x1322 cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: (Token id:Id.KW_DLeftBracket length:2 col:3 line:...0x1326) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [(Token id:Id.Lit_Chars length:3 col:7 line:...0x1326)] ) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:14 line:...0x1326) child: (CompoundWord parts: [(Token id:Id.Lit_Chars length:1 col:15 line:...0x1326)] ) right: (Token id: Id.Right_BashRegexGroup length: 1 col: 16 line: ...0x1326 ) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:20 line:...0x1326) ) terminator: (Token id:Id.Op_Semi length:1 col:22 line:...0x1326) ) ] ) then_kw: (Token id:Id.KW_Then length:4 col:24 line:...0x1326) action: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" echo hi\n" src:...0x3ffffffc) ) more_env: [] words: [ (CompoundWord parts:[...0x1272]) (CompoundWord parts:[(Token id:Id.Lit_Chars length:2 col:7 line:...0x127a)]) ] is_last_cmd: F ) ] then_tok: ...0x1292 ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 0 line: (SourceLine line_num:4 content:"fi\n" src:...0x3ffffffc) ) ) ===== CASE: -n -c if [[ (foo =~ x) ]]; then echo hi fi ===== (command.If if_kw: (Token id: Id.KW_If length: 2 col: 0 line: (SourceLine line_num:2 content:"if [[ (foo =~ x) ]]; then\n" src:(source.CFlag)) ) arms: [ (IfArm keyword: ...0x1322 cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: (Token id:Id.KW_DLeftBracket length:2 col:3 line:...0x1326) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [(Token id:Id.Lit_Chars length:3 col:7 line:...0x1326)] ) right: (CompoundWord parts: [(Token id:Id.Lit_Chars length:1 col:14 line:...0x1326)] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:17 line:...0x1326) ) terminator: (Token id:Id.Op_Semi length:1 col:19 line:...0x1326) ) ] ) then_kw: (Token id:Id.KW_Then length:4 col:21 line:...0x1326) action: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" echo hi\n" src:...0x3ffffffc) ) more_env: [] words: [ (CompoundWord parts:[...0x128a]) (CompoundWord parts:[(Token id:Id.Lit_Chars length:2 col:7 line:...0x1292)]) ] is_last_cmd: F ) ] then_tok: ...0x12aa ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 0 line: (SourceLine line_num:4 content:"fi\n" src:...0x3ffffffc) ) ) ===== CASE: -n -c if [[ ! (" ${params[*]} " =~ " -shared " || " ${params[*]} " =~ " -static ") ]]; then echo hi fi ===== (command.If if_kw: (Token id: Id.KW_If length: 2 col: 0 line: (SourceLine line_num: 2 content: "if [[ ! (\" ${params[*]} \" =~ \" -shared \" || \" ${params[*]} \" =~ \" -static \") ]]; then\n" src: (source.CFlag) ) ) arms: [ (IfArm keyword: ...0x1326 cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: (Token id:Id.KW_DLeftBracket length:2 col:3 line:...0x132a) expr: (bool_expr.LogicalNot child: (bool_expr.LogicalOr left: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 9 line: ...0x132a ) parts: [ (Token id: Id.Lit_Chars length: 1 col: 10 line: ...0x132a ) (BracedVarSub left: (Token id: Id.Left_DollarBrace length: 2 col: 11 line: ...0x132a ) token: (Token id: Id.VSub_Name length: 6 col: 13 line: ...0x132a ) var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: (Token id: Id.Right_DollarBrace length: 1 col: 22 line: ...0x132a ) ) (Token id: Id.Lit_Chars length: 1 col: 23 line: ...0x132a ) ] right: (Token id: Id.Right_DoubleQuote length: 1 col: 24 line: ...0x132a ) ) ] ) right: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 29 line: ...0x132a ) parts: [(Token id:Id.Lit_Chars length:9 col:30 line:...0x132a)] right: (Token id: Id.Right_DoubleQuote length: 1 col: 39 line: ...0x132a ) ) ] ) ) right: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 44 line: ...0x132a ) parts: [ (Token id: Id.Lit_Chars length: 1 col: 45 line: ...0x132a ) (BracedVarSub left: (Token id: Id.Left_DollarBrace length: 2 col: 46 line: ...0x132a ) token: (Token id: Id.VSub_Name length: 6 col: 48 line: ...0x132a ) var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: (Token id: Id.Right_DollarBrace length: 1 col: 57 line: ...0x132a ) ) (Token id: Id.Lit_Chars length: 1 col: 58 line: ...0x132a ) ] right: (Token id: Id.Right_DoubleQuote length: 1 col: 59 line: ...0x132a ) ) ] ) right: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 64 line: ...0x132a ) parts: [(Token id:Id.Lit_Chars length:9 col:65 line:...0x132a)] right: (Token id: Id.Right_DoubleQuote length: 1 col: 74 line: ...0x132a ) ) ] ) ) ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:77 line:...0x132a) ) terminator: (Token id:Id.Op_Semi length:1 col:79 line:...0x132a) ) ] ) then_kw: (Token id:Id.KW_Then length:4 col:81 line:...0x132a) action: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" echo hi\n" src:...0x3ffffffc) ) more_env: [] words: [ (CompoundWord parts:[...0x11da]) (CompoundWord parts:[(Token id:Id.Lit_Chars length:2 col:7 line:...0x11e2)]) ] is_last_cmd: F ) ] then_tok: ...0x11fa ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 0 line: (SourceLine line_num:4 content:"fi\n" src:...0x3ffffffc) ) ) OK test-regex-nix *** Running test-regex-pipe ===== CASE: -n -c [[ a =~ b|c ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ b|c ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x132e)]) right: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:1 col:8 line:...0x132e) (Token id:Id.Lit_Other length:1 col:9 line:...0x132e) (Token id:Id.Lit_Chars length:1 col:10 line:...0x132e) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:12 line:...0x132e) ) OK test-regex-pipe *** Running test-regex-right-paren ===== CASE: -n -c [[ a =~ b ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ b ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x132e)]) right: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:8 line:...0x132e)]) ) right: (Token id:Id.Lit_DRightBracket length:2 col:10 line:...0x132e) ) ===== CASE: -n -c [[ a =~ (b) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ (b) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x132e)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:8 line:...0x132e) child: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:9 line:...0x132e)]) right: (Token id:Id.Right_BashRegexGroup length:1 col:10 line:...0x132e) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:12 line:...0x132e) ) ===== CASE: -n -c [[ (a =~ b) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ (a =~ b) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:4 line:...0x132e)]) right: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:9 line:...0x132e)]) ) right: (Token id:Id.Lit_DRightBracket length:2 col:12 line:...0x132e) ) ===== CASE: -n -c [[ (a =~ (b)) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ (a =~ (b)) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:4 line:...0x132e)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:9 line:...0x132e) child: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:10 line:...0x132e)]) right: (Token id:Id.Right_BashRegexGroup length:1 col:11 line:...0x132e) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:14 line:...0x132e) ) ===== CASE: -n -c [[ (a =~ ( ===== [[ (a =~ ( ^ [ -c flag ]:1: Expected word after ( opening bash regex group ===== CASE: -n -c [[ (a =~ (b ===== [[ (a =~ (b ^ [ -c flag ]:1: Expected ) to close bash regex group OK test-regex-right-paren *** Running test-regex-space ===== CASE: -n -c [[ a =~ ( ) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ ( ) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x132e)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:8 line:...0x132e) child: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:9 line:...0x132e)]) right: (Token id:Id.Right_BashRegexGroup length:1 col:10 line:...0x132e) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:12 line:...0x132e) ) ===== CASE: -n -c [[ a =~ (b c) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ (b c) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x132e)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:8 line:...0x132e) child: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:1 col:9 line:...0x132e) (Token id:Id.Lit_Chars length:1 col:10 line:...0x132e) (Token id:Id.Lit_Chars length:1 col:11 line:...0x132e) ] ) right: (Token id:Id.Right_BashRegexGroup length:1 col:12 line:...0x132e) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:14 line:...0x132e) ) ===== CASE: -n -c [[ a =~ (a b)(c d) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ (a b)(c d) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x132e)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:8 line:...0x132e) child: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:1 col:9 line:...0x132e) (Token id:Id.Lit_Chars length:1 col:10 line:...0x132e) (Token id:Id.Lit_Chars length:1 col:11 line:...0x132e) ] ) right: (Token id:Id.Right_BashRegexGroup length:1 col:12 line:...0x132e) ) (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:13 line:...0x132e) child: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:1 col:14 line:...0x132e) (Token id:Id.Lit_Chars length:1 col:15 line:...0x132e) (Token id:Id.Lit_Chars length:1 col:16 line:...0x132e) ] ) right: (Token id:Id.Right_BashRegexGroup length:1 col:17 line:...0x132e) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:19 line:...0x132e) ) bash=0 ===== CASE: -n -c [[ a =~ (b c) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ (b\n" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x132a)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:8 line:...0x132a) child: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:1 col:9 line:...0x132a) (Token id:Id.Lit_Chars length:1 col:10 line:...0x132a) (Token id: Id.Lit_Chars length: 1 col: 0 line: (SourceLine line_num:2 content:"c) ]]" src:...0x3ffffffc) ) ] ) right: (Token id:Id.Right_BashRegexGroup length:1 col:1 line:...0x12de) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:3 line:...0x12de) ) OK test-regex-space *** Running test-shell_for ===== CASE: -n -c for x in & ===== for x in & ^ [ -c flag ]:1: Invalid word in for loop ===== CASE: -n -c for (( i=0; i<10; i++ )) ls ===== for (( i=0; i<10; i++ )) ls ^~ [ -c flag ]:1: Invalid word after for expression ===== CASE: -n -c for ( i=0; i<10; i++ ) ===== for ( i=0; i<10; i++ ) ^ [ -c flag ]:1: Expected loop variable (a constant word) ===== CASE: -n -c for $x in 1 2 3; do echo $i; done ===== for $x in 1 2 3; do echo $i; done ^~ [ -c flag ]:1: Expected loop variable (a constant word) ===== CASE: -n -c for x.y in 1 2 3; do echo $i; done ===== for x.y in 1 2 3; do echo $i; done ^~~ [ -c flag ]:1: Invalid loop variable name 'x.y' ===== CASE: -n -c for x in 1 2 3; & ===== for x in 1 2 3; & ^ [ -c flag ]:1: Expected word type Id.KW_Do, got Id.Op_Amp ===== CASE: -n -c for foo BAD ===== for foo BAD ^ [ -c flag ]:1: Expected loop variable (a constant word) ===== CASE: -n -c for var in x; do echo $var; done ===== (command.ForEach keyword: (Token id: Id.KW_For length: 3 col: 0 line: (SourceLine line_num:1 content:"for var in x; do echo $var; done" src:(source.CFlag)) ) iter_names: [var] iterable: (for_iter.Words words: [(CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:11 line:...0x1336)])] ) semi_tok: (Token id:Id.Op_Semi length:1 col:12 line:...0x1336) body: (command.DoGroup left: (Token id:Id.KW_Do length:2 col:14 line:...0x1336) children: [ (command.Sentence child: (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:17 line:...0x1336) more_env: [] words: [ (CompoundWord parts:[...0x12d2]) (CompoundWord parts: [ (SimpleVarSub tok: (Token id:Id.VSub_DollarName length:4 col:22 line:...0x1336) ) ] ) ] is_last_cmd: F ) terminator: (Token id:Id.Op_Semi length:1 col:26 line:...0x1336) ) ] right: (Token id:Id.KW_Done length:4 col:28 line:...0x1336) ) ) OK test-shell_for *** Running test-simple-command ===== CASE: -n -c PYTHONPATH=. FOO=(1 2) python ===== PYTHONPATH=. FOO=(1 2) python ^~~~ [ -c flag ]:1: Environment bindings can't contain array literals ===== CASE: -n -c PYTHONPATH+=1 python ===== PYTHONPATH+=1 python ^~~~~~~~~~~~ [ -c flag ]:1: Expected = in environment binding, got += ===== CASE: -n -c =var ===== =var ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c =f(x) ===== =f(x) ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c =var ===== =var ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c =f(x) ===== =f(x) ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it OK test-simple-command *** Running test-slice ===== CASE: -n -c ${foo:42} ===== (command.Simple blame_tok: (Token id:Id.Left_DollarBrace length:2 col:0 line:(SourceLine line_num:1 content:"${foo:42}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts: [ (BracedVarSub left: ...0x1326 token: (Token id:Id.VSub_Name length:3 col:2 line:...0x132e) var_name: foo suffix_op: (suffix_op.Slice begin: (CompoundWord parts:[(Token id:Id.Lit_Digits length:2 col:6 line:...0x132e)]) ) right: (Token id:Id.Arith_RBrace length:1 col:8 line:...0x132e) ) ] ) ] is_last_cmd: F ) ===== CASE: -n -c ${foo:42+1} ===== (command.Simple blame_tok: (Token id: Id.Left_DollarBrace length: 2 col: 0 line: (SourceLine line_num:1 content:"${foo:42+1}" src:(source.CFlag)) ) more_env: [] words: [ (CompoundWord parts: [ (BracedVarSub left: ...0x1326 token: (Token id:Id.VSub_Name length:3 col:2 line:...0x132e) var_name: foo suffix_op: (suffix_op.Slice begin: (arith_expr.Binary op: (Token id:Id.Arith_Plus length:1 col:8 line:...0x132e) left: (CompoundWord parts:[(Token id:Id.Lit_Digits length:2 col:6 line:...0x132e)]) right: (CompoundWord parts: [(Token id:Id.Lit_Digits length:1 col:9 line:...0x132e)] ) ) ) right: (Token id:Id.Arith_RBrace length:1 col:10 line:...0x132e) ) ] ) ] is_last_cmd: F ) ===== CASE: -n -c echo ${a:1;} ===== echo ${a:1;} ^ [ -c flag ]:1: Expected : or } in slice ===== CASE: -n -c echo ${a:1:2;} ===== echo ${a:1:2;} ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RBrace) OK test-slice *** Running test-test-builtin ===== CASE: -c [ x -a y f ] ===== [ x -a y f ] ^ [ -c flag ]:1: (test) Unexpected trailing word 'f' ===== CASE: -c test x -a y f ===== test x -a y f ^ [ -c flag ]:1: (test) Unexpected trailing word 'f' ===== CASE: -c [ x ===== [ x ^ [ -c flag ]:1: missing closing ] ===== CASE: -c [ x x ] ===== [ x x ] ^ [ -c flag ]:1: (test) Expected unary operator, got 'x' (2 args) ===== CASE: -c [ x x "a b" ] ===== [ x x "a b" ] ^ [ -c flag ]:1: (test) Expected binary operator, got 'x' (3 args) ===== CASE: -c [ -t xxx ] ===== [ -t xxx ] ^~~ [ -c flag ]:1: (test) Invalid file descriptor 'xxx' ===== CASE: -c [ \( x -a -y -a z ] ===== [??? no location ???] (test) Expected ), got EOF OK test-test-builtin *** Running test-word-parse ===== CASE: -n -c echo ${ ===== echo ${ ^ [ -c flag ]:1: Unexpected token in ${} ===== CASE: -n -c echo ${a[@Z ===== echo ${a[@Z ^ [ -c flag ]:1: Expected ] to close subscript ===== CASE: -n -c echo ${x.} ===== echo ${x.} ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c echo ${!x.} ===== echo ${!x.} ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c echo ${#a. ===== echo ${#a. ^ [ -c flag ]:1: Expected } after length expression ===== CASE: -n -c for (( i = 0; i < 10; i++ ; ===== for (( i = 0; i < 10; i++ ; ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RParen) ===== CASE: -n -c for (( i = 0; i < 10; i++ / ===== for (( i = 0; i < 10; i++ / ^ [ -c flag ]:1: Unexpected end of input ===== CASE: -n -c echo @(extglob|foo ===== echo @(extglob|foo ^~ [ -c flag ]:1: Unexpected EOF reading extended glob that began here ===== CASE: -n -c ${undef:- ===== ${undef:- ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${undef:-$ ===== ${undef:-$ ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${undef:-$F ===== ${undef:-$F ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${x@ ===== ${x@ ^ [ -c flag ]:1: Unexpected token in ${} (VOp3) ===== CASE: -n -c ${x@Q ===== ${x@Q ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${x% ===== ${x% ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${x/ ===== ${x/ ^ [ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real ===== CASE: -n -c ${x/a/ ===== ${x/a/ ^ [ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real ===== CASE: -n -c ${x/a/b ===== ${x/a/b ^ [ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real ===== CASE: -n -c ${x: ===== ${x: ^ [ -c flag ]:1: Unexpected end of input OK test-word-parse test/parse-errors.sh: 36 tests passed.