===== CASE: FOO=1 break ===== FOO=1 break ^~~~ [ -c flag ]:1: Control flow shouldn't have environment bindings ===== CASE: break 1 2 ===== break 1 2 ^ [ -c flag ]:1: Unexpected argument to 'break' ===== CASE: for x in & ===== for x in & ^ [ -c flag ]:1: Invalid word in for loop ===== CASE: for (( i=0; i<10; i++ )) ls ===== for (( i=0; i<10; i++ )) ls ^~ [ -c flag ]:1: Invalid word after for expression ===== CASE: for $x in 1 2 3; do echo $i; done ===== for $x in 1 2 3; do echo $i; done ^~ [ -c flag ]:1: Loop variable name should be a constant ===== CASE: 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 ===== CASE: 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: for foo BAD ===== for foo BAD ^~~ [ -c flag ]:1: Unexpected word after for loop variable ===== CASE: x"y"() { echo hi; } ===== x"y"() { echo hi; } ^ [ -c flag ]:1: Invalid function name ===== CASE: function x"y" { echo hi; } ===== function x"y" { echo hi; } ^ [ -c flag ]:1: Invalid KSH-style function name ===== CASE: } ===== } ^ [ -c flag ]:1: Unexpected right brace ===== CASE: case foo in *) echo ===== case foo in *) echo ^ [ -c flag ]:1: Expected ;; or esac ===== CASE: ls foo| ===== ls foo| ^ [ -c flag ]:1: Unexpected EOF while parsing command ===== CASE: ls foo&& ===== ls foo&& ^ [ -c flag ]:1: Unexpected EOF while parsing command ===== CASE: foo() ===== foo() ^ [ -c flag ]:1: Unexpected word while parsing compound command ===== CASE: [ ( x ] ===== [ ( x ] ^ [ -c flag ]:1: Expected ) in function definition ===== CASE: break >out ===== (command.ControlFlow token:) ===== CASE: break >out ===== break >out ^~~~~ [ -c flag ]:1: Control flow shouldn't have redirects ===== CASE: PYTHONPATH=. FOO=(1 2) python ===== PYTHONPATH=. FOO=(1 2) python ^~~~ [ -c flag ]:1: Environment bindings can't contain array literals ===== CASE: PYTHONPATH+=1 python ===== PYTHONPATH+=1 python ^~~~~~~~~~~~ [ -c flag ]:1: Expected = in environment binding, got += ===== CASE: echo line 2 echo $( echo ===== echo $( echo ^ [ -c flag ]:3: Unexpected EOF while parsing command ===== CASE: echo line 2 echo ` echo ===== echo ` echo ^ [ -c flag ]:3: Unexpected EOF while looking for closing backtick ===== CASE: echo line 2 echo ` echo \` ===== echo ` echo \` ^ [ -c flag ]:3: Unexpected EOF while looking for closing backtick ===== CASE: echo line 2 echo ` echo \`unclosed ` ===== echo `unclosed ^ [ backticks at ... ]:1: Unexpected EOF while looking for closing backtick ===== CASE: echo < << ===== echo < << ^~ [ -c flag ]:1: Invalid token after redirect operator ===== CASE: echo $( echo > >> ) ===== echo $( echo > >> ) ^~ [ -c flag ]:1: Invalid token after redirect operator ===== CASE: cat < right: {} ) cond: (arith_expr.Binary op_id:Id.Arith_Less left: right:{}) update: (arith_expr.UnaryAssign op_id:Id.Node_PostDPlus child:) body: (command.DoGroup children: [ (command.Sentence child: (C {} {($ Id.VSub_DollarName '$x')}) terminator: ) ] ) ) ===== CASE: for ((; x<5; x++)); do echo $x; done ===== (command.ForExpr cond: (arith_expr.Binary op_id:Id.Arith_Less left: right:{}) update: (arith_expr.UnaryAssign op_id:Id.Node_PostDPlus child:) body: (command.DoGroup children: [ (command.Sentence child: (C {} {($ Id.VSub_DollarName '$x')}) terminator: ) ] ) ) ===== CASE: for ((; ; x++)); do echo $x; done ===== (command.ForExpr update: (arith_expr.UnaryAssign op_id:Id.Node_PostDPlus child:) body: (command.DoGroup children: [ (command.Sentence child: (C {} {($ Id.VSub_DollarName '$x')}) terminator: ) ] ) ) ===== CASE: for ((; ;)); do echo $x; done ===== (command.ForExpr body: (command.DoGroup children: [ (command.Sentence child: (C {} {($ Id.VSub_DollarName '$x')}) terminator: ) ] ) ) ===== CASE: for ((x=0; x<5; x++ b)); do echo $x; done ===== for ((x=0; x<5; x++ b)); do echo $x; done ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) ===== CASE: for ((x=0 b; x<5; x++)); do echo $x; done ===== for ((x=0 b; x<5; x++)); do echo $x; done ^ [ -c flag ]:1: Expected ; here ===== CASE: for ((x=0; x<5 b; x++)); do echo $x; done ===== for ((x=0; x<5 b; x++)); do echo $x; done ^ [ -c flag ]:1: Expected ; here ===== CASE: ${a:1+2 b} ===== ${a:1+2 b} ^ [ -c flag ]:1: Expected : or } in slice ===== CASE: ${a:1+2:3+4 b} ===== ${a:1+2:3+4 b} ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RBrace) ===== CASE: ${a[1+2 b]} ===== ${a[1+2 b]} ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RBracket) ===== CASE: $(( 1 + + )) ===== $(( 1 + + )) ^ [ -c flag ]:1: Token can't be used in prefix position ===== CASE: $(( 1 2 )) ===== $(( 1 2 )) ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) ===== CASE: $(( - ; )) ===== $(( - ; )) ^ [ -c flag ]:1: Token can't be used in prefix position ===== CASE: $(( ` )) ===== $(( ` )) ^ [ -c flag ]:1: Unexpected EOF while looking for closing backtick ===== CASE: $(( $ )) ===== $(( $ )) ^ [ -c flag ]:1: Unexpected token while parsing arithmetic: '$' ===== CASE: $(( ${var} = fd )) ===== $(( ${var} = fd )) ^ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: $(( x+1 = 42 )) ===== $(( x+1 = 42 )) ^ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: $(( (x+42)++ )) ===== $(( (x+42)++ )) ^~ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: $(( ++(x+42) )) ===== $(( ++(x+42) )) ^~ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: $(( 1 = foo )) ===== $(( 1 = foo )) ^ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: $(( 1++ )) ===== $(( 1++ )) ^~ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: $(( ++1 )) ===== $(( ++1 )) ^~ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: [[ a b ]] ===== [[ a b ]] ^ [ -c flag ]:1: Expected ]] ===== CASE: [[ a "a"$(echo hi)"b" ]] ===== [[ a "a"$(echo hi)"b" ]] ^ [ -c flag ]:1: Expected ]] ===== CASE: [[ a == ]] ===== [[ a == ]] ^ [ -c flag ]:1: Expected ]] ===== CASE: [[ ( 1 == 2 - ]] ===== [[ ( 1 == 2 - ]] ^ [ -c flag ]:1: Expected ), got (compound_word parts:[(Token id:Id.Lit_Chars span_id:10 val:-)]) ===== CASE: [[ == ]] ===== [[ == ]] ^~ [ -c flag ]:1: Unexpected token in boolean expression (Id.BoolBinary_GlobDEqual) ===== CASE: [[ ) ]] ===== [[ ) ]] ^ [ -c flag ]:1: Unexpected token in boolean expression (Id.Op_RParen) ===== CASE: [[ ( ]] ===== [[ ( ]] ^~ [ -c flag ]:1: Unexpected token in boolean expression (Id.Lit_DRightBracket) ===== CASE: [[ ;;; ]] ===== [[ ;;; ]] ^~ [ -c flag ]:1: Unexpected token in boolean expression (Id.Op_DSemi) ===== CASE: [[ ===== [[ ^ [ -c flag ]:1: Unexpected token in boolean expression (Id.Eof_Real) ===== CASE: [ x -a y f ] ===== [ x -a y f ] ^ [ -c flag ]:1: (test) Unexpected trailing word 'f' ===== CASE: test x -a y f ===== test x -a y f ^ [ -c flag ]:1: (test) Unexpected trailing word 'f' ===== CASE: [ x ===== [ x ^ [ -c flag ]:1: missing closing ] ===== CASE: [ x x ] ===== [ x x ] ^ [ -c flag ]:1: (test) Expected unary operator, got 'x' (2 args) ===== CASE: [ x x "a b" ] ===== [ x x "a b" ] ^ [ -c flag ]:1: (test) Expected binary operator, got 'x' (3 args) ===== CASE: [ -t xxx ] ===== [ -t xxx ] ^~~ [ -c flag ]:1: (test) Invalid file descriptor 'xxx' ===== CASE: [ \( x -a -y -a z ] ===== [??? no location ???] (test) Expected ), got EOF ===== CASE: printf % ===== % ^ (source.ArgvWord word_spid:2):1: Expected a printf format character ===== CASE: printf [%Z] ===== [%Z] ^ (source.ArgvWord word_spid:2):1: Invalid printf format character ===== CASE: printf -v "-invalid-" %s foo ===== -invalid- ^ (source.ArgvWord word_spid:-1):1: Unexpected end of input printf -v "-invalid-" %s foo ^~~~~~ [ -c flag ]:1: 'printf' got invalid place expression ===== CASE: shift 1 2 ===== shift 1 2 ^~~~~ [ -c flag ]:1: 'shift' got too many arguments ===== CASE: shift zzz ===== shift zzz ^~~~~ [ -c flag ]:1: 'shift' Invalid shift argument 'zzz' ===== CASE: pushd x y ===== pushd x y ^~~~~ [ -c flag ]:1: 'pushd' got too many arguments ===== CASE: pwd -x ===== pwd -x ^~ [ -c flag ]:1: 'pwd' doesn't accept flag -x ===== CASE: pp x foo a-x ===== pp x foo a-x ^ [ -c flag ]:1: 'pp' got invalid action 'x' ===== CASE: wait zzz ===== wait zzz ^~~ [ -c flag ]:1: 'wait' expected PID or jobspec, got 'zzz' ===== CASE: wait %jobspec-not-supported ===== wait %jobspec-not-supported ^ [ -c flag ]:1: 'wait' doesn't support bash-style jobspecs (got '%jobspec-not-supported') ===== CASE: unset invalid-var-name ===== unset invalid-var-name ^~~~~ [ -c flag ]:1: fatal: Invalid place to modify ===== CASE: getopts hc: invalid-var-name ===== getopts hc: invalid-var-name ^~~~~~~~~~~~~~~~ [ -c flag ]:1: 'getopts' got invalid variable name 'invalid-var-name' ===== CASE: read -x ===== read -x ^~ [ -c flag ]:1: 'read' doesn't accept flag -x ===== CASE: builtin read -x ===== builtin read -x ^~ [ -c flag ]:1: 'read' doesn't accept flag -x ===== CASE: read -n ===== read -n ^~ [ -c flag ]:1: 'read' expected argument to '-n' ===== CASE: read -n x ===== read -n x ^ [ -c flag ]:1: 'read' expected integer after -n, got 'x' ===== CASE: set -o errexit +o oops ===== set -o errexit +o oops ^~~ [ -c flag ]:1: 'set' got invalid option 'oops' set -o errexit +o oops ^~~ [ -c flag ]:1: fatal: Exiting with status 2 (command in PID 11760) osh usage error: got invalid argument 'x' to '-ast-format', expected one of: text|abbrev-text|html|abbrev-html|oheap|none oil: got invalid option 'oops' ===== CASE: echo {1..3..-1} ===== echo {1..3..-1} ^~~~~~~~ [ -c flag ]:1: Invalid step -1 for ascending integer range ===== CASE: echo {1..3..0} ===== echo {1..3..0} ^~~~~~~ [ -c flag ]:1: Step can't be 0 ===== CASE: echo {3..1..1} ===== echo {3..1..1} ^~~~~~~ [ -c flag ]:1: Invalid step 1 for descending integer range ===== CASE: echo {3..1..0} ===== echo {3..1..0} ^~~~~~~ [ -c flag ]:1: Step can't be 0 ===== CASE: echo {a..Z} ===== echo {a..Z} ^~~~ [ -c flag ]:1: Mismatched cases in character range ===== CASE: echo {a..z..0} ===== echo {a..z..0} ^~~~~~~ [ -c flag ]:1: Step can't be 0 ===== CASE: echo {a..z..-1} ===== echo {a..z..-1} ^~~~~~~~ [ -c flag ]:1: Invalid step -1 for ascending character range ===== CASE: echo {z..a..1} ===== echo {z..a..1} ^~~~~~~ [ -c flag ]:1: Invalid step 1 for descending character range ===== CASE: var x = 1 + ===== var x = 1 + ^ [ -c flag ]:1: Syntax error in expression (near Id.Eof_Real) ===== CASE: var x = * ===== var x = * ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Star) ===== CASE: var x = @($(cat <out { echo hi } ===== >out { echo hi } ^ [ -c flag ]:1: Unexpected block ===== CASE: a=1 b=2 { echo hi } ===== a=1 b=2 { echo hi } ^~ [ -c flag ]:1: name=val isn't allowed when shopt 'parse_equals' is on. Hint: add 'env' before it, or spaces around = ===== CASE: break { echo hi } ===== break { echo hi } ^ [ -c flag ]:1: Unexpected block ===== CASE: cd / { echo hi } cd / ===== cd / { echo hi } cd / ^~ [ -c flag ]:1: Unexpected word while parsing command line ===== CASE: if test -f foo{ echo hi } ===== if test -f foo{ echo hi } ^~~ [ -c flag ]:1: Word has unbalanced { }. Maybe add a space or quote it like \{ ===== CASE: var x = /[a-zA-Z]/ ===== var x = /[a-zA-Z]/ ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Minus) ===== CASE: var x = /[a-z0-9]/ ===== var x = /[a-z0-9]/ ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Minus) ===== CASE: var x = /[a-zz]/ ===== var x = /[a-zz]/ ^~ [ -c flag ]:1: Range start/end shouldn't have more than one character ===== CASE: var x = /['ab'-'z']/ ===== var x = /['ab'-'z']/ ^ [ -c flag ]:1: Range start/end shouldn't have more than one character ===== CASE: var x = /[$a-${z}]/ ===== var x = /[$a-${z}]/ ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Minus) ===== CASE: var x = /[abc]/ ===== var x = /[abc]/ ^~~ [ -c flag ]:1: 'abc' isn't a character class ===== CASE: var x = /[% _]/ ===== var x = /[% _]/ ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Percent) ===== CASE: proc f[] { echo hi } ===== proc f[] { echo hi } ^~ [ -c flag ]:1: Invalid proc name 'f[' ===== CASE: proc : { echo hi } ===== proc : { echo hi } ^ [ -c flag ]:1: Invalid proc name ':' ===== CASE: proc foo::bar { echo hi } ===== proc foo::bar { echo hi } ^~ [ -c flag ]:1: Syntax error in expression (near Id.Expr_DColon) ===== CASE: = 5 mod 3 ===== = 5 mod 3 ^~~ [ -c flag ]:1: Syntax error in expression (near Id.Expr_Name) ===== CASE: = >>= ===== = >>= ^~~ [ -c flag ]:1: Syntax error in expression (near Id.Arith_DGreatEqual) ===== CASE: = %( ===== = %( ^ [ -c flag ]:1: Unexpected token in array literal: '' ===== CASE: = 42, ===== = 42, ^ [ -c flag ]:1: Write singleton tuples with tup(), not a trailing comma ===== CASE: = (42,) ===== = (42,) ^ [ -c flag ]:1: Write singleton tuples with tup(), not a trailing comma ===== CASE: =a ===== =a ^ [ -c flag ]:1: =word isn't allowed when shopt 'parse_equals' is on. Hint: add a space after = to pretty print an expression ===== CASE: name=val ===== name=val ^~~~~ [ -c flag ]:1: name=val isn't allowed when shopt 'parse_equals' is on. Hint: add 'env' before it, or spaces around = ===== CASE: echo $'\u{03bc' ===== (C {} { (single_quoted left: tokens: [ ] multiline: F ) } ) ===== CASE: +O parse_backslash -n -c echo parse_backslash $'\u{03bc' ===== echo parse_backslash $'\u{03bc' ^ [ -c flag ]:1: Invalid char escape in C-style string literal ===== CASE: bad = $'\u{03bc' ===== bad = $'\u{03bc' ^ [ -c flag ]:1: Invalid char escape in C-style string literal ===== CASE: echo $'\z' ===== (C {} { (single_quoted left: tokens: [ ] multiline: F ) } ) ===== CASE: bad = $'\z' ===== bad = $'\z' ^ [ -c flag ]:1: Invalid char escape in C-style string literal ===== CASE: echo $'\101' ===== (C {} { (single_quoted left: tokens: [] multiline: F ) } ) ===== CASE: bad = $'\101' ===== bad = $'\101' ^~~~ [ -c flag ]:1: Use \xhh or \u{...} instead of octal escapes in Oil strings ===== CASE: bad = c'\xf' ===== bad = c'\xf' ^ [ -c flag ]:1: Syntax error in expression (near Id.Left_SingleQuote) ===== CASE: echo "\z" ===== (C {} {(DQ )}) ===== CASE: +O parse_backslash -n -c echo parse_backslash "\z" ===== echo parse_backslash "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: echo "\z" ===== echo "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: bad = "\z" ===== bad = "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: echo "\u1234" ===== (C {} {(DQ )}) ===== CASE: echo "\u1234" ===== echo "\u1234" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: bad = "\u1234" ===== bad = "\u1234" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: echo "`echo hi`" ===== (C {} {(DQ (command_sub left_token: child:(C {} {})))}) ===== CASE: echo "`echo hi`" ===== echo "`echo hi`" ^ [ -c flag ]:1: Use $(cmd) instead of backticks (parse_backticks) ===== CASE: bad = "`echo hi`" ===== bad = "`echo hi`" ^ [ -c flag ]:1: Invalid backtick: use $(cmd) or \` in Oil strings ===== CASE: setvar x = "\z" ===== setvar x = "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: setvar x = $'\z' ===== setvar x = $'\z' ^ [ -c flag ]:1: Invalid char escape in C-style string literal ===== CASE: echo `echo hi` ===== (C {} {(command_sub left_token: child:(C {} {}))}) ===== CASE: echo "foo = `echo hi`" ===== (C {} {(DQ <'foo = '> (command_sub left_token: child:(C {} {})))}) ===== CASE: +O parse_backticks -n -c echo `echo hi` ===== echo `echo hi` ^ [ -c flag ]:1: Use $(cmd) instead of backticks (parse_backticks) ===== CASE: +O parse_backticks -n -c echo "foo = `echo hi`" ===== echo "foo = `echo hi`" ^ [ -c flag ]:1: Use $(cmd) instead of backticks (parse_backticks) ===== CASE: echo $ ===== (C {} {}) ===== CASE: +O parse_dollar -n -c echo $ ===== echo $ ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo $ ===== echo $ ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo $: ===== (C {} { }) ===== CASE: +O parse_dollar -n -c echo $: ===== echo $: ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo $: ===== echo $: ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo "$" ===== (C {} {(DQ )}) ===== CASE: +O parse_dollar -n -c echo "$" ===== echo "$" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo "$" ===== echo "$" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo "$:" ===== (C {} {(DQ <':'>)}) ===== CASE: +O parse_dollar -n -c echo "$:" ===== echo "$:" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo "$:" ===== echo "$:" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo ${x:-$} ===== (C {} { (braced_var_sub token: suffix_op: (suffix_op.Unary tok: arg_word:{}) ) } ) ===== CASE: +O parse_dollar -n -c echo ${x:-$} ===== echo ${x:-$} ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo ${x:-$} ===== echo ${x:-$} ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo ${x:-$:} ===== (C {} { (braced_var_sub token: suffix_op: (suffix_op.Unary tok: arg_word:{ <':'>}) ) } ) ===== CASE: +O parse_dollar -n -c echo ${x:-$:} ===== echo ${x:-$:} ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo ${x:-$:} ===== echo ${x:-$:} ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo "${x:-$}" ===== (C {} { (DQ (braced_var_sub token: suffix_op: (suffix_op.Unary tok: arg_word:{}) ) ) } ) ===== CASE: +O parse_dollar -n -c echo "${x:-$}" ===== echo "${x:-$}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo "${x:-$}" ===== echo "${x:-$}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo "${x:-$:}" ===== (C {} { (DQ (braced_var_sub token: suffix_op: (suffix_op.Unary tok: arg_word: { <':'>} ) ) ) } ) ===== CASE: +O parse_dollar -n -c echo "${x:-$:}" ===== echo "${x:-$:}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo "${x:-$:}" ===== echo "${x:-$:}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: echo \( ===== (C {} {(word_part.EscapedLiteral token:)}) ===== CASE: echo \; ===== (C {} {(word_part.EscapedLiteral token:)}) ===== CASE: echo ~ ===== (C {} {(word_part.TildeSub token:)}) ===== CASE: echo \! ===== (C {} {(word_part.EscapedLiteral token:)}) ===== CASE: echo \% ===== (C {} {(word_part.EscapedLiteral token:)}) ===== CASE: echo \# ===== (C {} {(word_part.EscapedLiteral token:)}) ===== CASE: echo \. ===== echo \. ^~ [ -c flag ]:1: Invalid char escape (parse_backslash) ===== CASE: echo \- ===== echo \- ^~ [ -c flag ]:1: Invalid char escape (parse_backslash) ===== CASE: echo \/ ===== echo \/ ^~ [ -c flag ]:1: Invalid char escape (parse_backslash) ===== CASE: echo \a ===== echo \a ^~ [ -c flag ]:1: Invalid char escape (parse_backslash) ===== CASE: echo \Z ===== echo \Z ^~ [ -c flag ]:1: Invalid char escape (parse_backslash) ===== CASE: echo \0 ===== echo \0 ^~ [ -c flag ]:1: Invalid char escape (parse_backslash) ===== CASE: echo \9 ===== echo \9 ^~ [ -c flag ]:1: Invalid char escape (parse_backslash) ===== CASE: echo \. \- \/ \a \Z \0 \9 ===== (C {} {(word_part.EscapedLiteral token:)} {(word_part.EscapedLiteral token:)} {(word_part.EscapedLiteral token:)} {(word_part.EscapedLiteral token:)} {(word_part.EscapedLiteral token:)} {(word_part.EscapedLiteral token:)} {(word_part.EscapedLiteral token:)} ) ===== CASE: = ===== = ^ [ -c flag ]:1: Syntax error in expression (near Id.Eof_Real) ===== CASE: _ ===== _ ^ [ -c flag ]:1: Syntax error in expression (near Id.Eof_Real) ===== CASE: d = { name: 42 } ===== d = { name: ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_Newline) ===== CASE: proc p { echo 1; proc f { echo f }; echo 2 } ===== proc p { echo 1; proc f { echo f }; echo 2 } ^~~~ [ -c flag ]:1: procs and shell functions can't be nested ===== CASE: proc p { echo 1; +weird() { echo f; }; echo 2 } ===== proc p { echo 1; +weird() { echo f; }; echo 2 } ^ [ -c flag ]:1: procs and shell functions can't be nested ===== CASE: proc p { echo 1; function f { echo f; }; echo 2 } ===== proc p { echo 1; function f { echo f; }; echo 2 } ^~~~~~~~ [ -c flag ]:1: procs and shell functions can't be nested ===== CASE: f() { echo 1; proc inner { echo inner; }; echo 2; } ===== f() { echo 1; proc inner { echo inner; }; echo 2; } ^~~~ [ -c flag ]:1: procs and shell functions can't be nested ===== CASE: f() { echo 1; g() { echo g; }; echo 2; } ===== (command.ShFunction name: f body: (BraceGroup children: [ (command.Sentence child:(C {} {<1>}) terminator:) (command.Sentence child: (command.ShFunction name: g body: (BraceGroup children: [(command.Sentence child:(C {} {}) terminator:)] ) ) terminator: ) (command.Sentence child:(C {} {<2>}) terminator:) ] ) ) ===== CASE: proc p() { shopt --unset errexit { false hi } } ===== (command.Proc name:

sig: (proc_sig.Closed) body: (BraceGroup children: [ (command.Simple words: [{} {<--unset>} {}] block: (BraceGroup children:[(C {} {})]) do_fork: T ) ] ) ) ===== CASE: proc p(x) { echo hi var x = 2 # Cannot redeclare param } ===== var x = 2 # Cannot redeclare param ^ [ -c flag ]:4: 'x' was already declared ===== CASE: proc p { var x = 1 echo hi var x = 2 # Cannot redeclare local } ===== var x = 2 # Cannot redeclare local ^ [ -c flag ]:5: 'x' was already declared ===== CASE: proc p { var x = 1 echo hi const x = 2 # Cannot redeclare local } ===== const x = 2 # Cannot redeclare local ^ [ -c flag ]:5: 'x' was already declared ===== CASE: proc p { x = 1 echo hi x = 2 # Cannot redeclare local } ===== x = 2 # Cannot redeclare local ^ [ -c flag ]:5: 'x' was already declared ===== CASE: proc p(x, :out) { var out = 2 # Cannot redeclare out param } ===== var out = 2 # Cannot redeclare out param ^~~ [ -c flag ]:3: 'out' was already declared ===== CASE: proc p { var out = 2 # Cannot redeclare out param cd /tmp { var out = 3 } } ===== var out = 3 ^~~ [ -c flag ]:5: 'out' was already declared ===== CASE: var x = 1 proc p { echo hi var x = 2 } proc p2 { var x = 3 } ===== (command.CommandList children: [ (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (Const Id.Expr_DecInt 1) ) (command.Proc name:

sig: (proc_sig.Open) body: (BraceGroup children: [ (C {} {}) (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (Const Id.Expr_DecInt 2) ) ] ) ) (command.Proc name: sig: (proc_sig.Open) body: (BraceGroup children: [ (command.VarDecl keyword: lhs: [(name_type name:)] rhs: (Const Id.Expr_DecInt 3) ) ] ) ) ] ) ===== CASE: proc p(x) { var y = 1 setvar L = "L" # ERROR: not declared } ===== setvar L = "L" # ERROR: not declared ^ [ -c flag ]:4: 'L' hasn't been declared ===== CASE: proc p(x) { const c = 123 setvar c = 42 # ERROR: cannot modify constant } ===== setvar c = 42 # ERROR: cannot modify constant ^ [ -c flag ]:4: Can't modify constant 'c' ===== CASE: proc p(x) { setvar x = "X" # is mutating params allowed? I guess why not. } ===== (command.Proc name:

sig: (proc_sig.Closed params:[(param name:)]) body: (BraceGroup children: [ (command.PlaceMutation keyword: lhs: [(place_expr.Var name:)] op: rhs: (DQ ) ) ] ) ) ===== CASE: echo @ ===== echo @ ^ [ -c flag ]:1: Literal @ starting a word must be quoted (parse_at_all) ===== CASE: echo @@ ===== echo @@ ^ [ -c flag ]:1: Literal @ starting a word must be quoted (parse_at_all) ===== CASE: echo @{foo} ===== echo @{foo} ^ [ -c flag ]:1: Literal @ starting a word must be quoted (parse_at_all) ===== CASE: echo @/foo/ ===== echo @/foo/ ^ [ -c flag ]:1: Literal @ starting a word must be quoted (parse_at_all) ===== CASE: echo @"foo" ===== echo @"foo" ^ [ -c flag ]:1: Literal @ starting a word must be quoted (parse_at_all) ---------------------- ===== CASE: test/parse-errors/01-bad-func.sh ===== foo (ls) ^~ test/parse-errors/01-bad-func.sh:14: Expected ) in function definition ===== CASE: test/parse-errors/02-bad-func.sh ===== foo() ^ test/parse-errors/02-bad-func.sh:3: Unexpected word while parsing compound command ===== CASE: 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: 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: 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: 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: test/parse-errors/07-unterminated-here-doc.sh ===== cat <