diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 7b555d3ca1779..443594d5b6a06 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 9.2. Last change: 2026 Jul 29 +*syntax.txt* For Vim version 9.2. Last change: 2026 Aug 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3705,12 +3705,15 @@ reduce this, the "sh_maxlines" internal variable can be set. Example: > The default is to use the twice sh_minlines. Set it to a smaller number to speed up displaying. The disadvantage is that highlight errors may appear. -syntax/sh.vim tries to flag certain problems as errors; usually things like -unmatched "]", "done", "fi", etc. If you find the error handling problematic -for your purposes, you may suppress such error highlighting by putting -the following line in your .vimrc: > +Unmatched "]", "done", "fi", etc., are highlighted as errors by default. If +you find this error handling problematic, you may suppress it with: > - let g:sh_no_error= 1 + let g:sh_no_error = 1 +< +As a refinement, you may suppress only certain classes of errors by looking +up their syntax rule names and listing them with: > + + let g:sh_no_error_rules = ["shCurlyError", "shParenError"] < *sh-embed* *sh-awk* diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 52d50df85300a..97cfbc448447a 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -189,6 +189,29 @@ else com! -nargs=* ShFoldIfDoFor endif +" Set up a syntax error command for shell {{{1 +" ======================================= +if exists("g:sh_no_error_rules") && type(g:sh_no_error_rules) == type([]) + fun! s:DefineSyntaxErrorRule(rule) abort + " Read shFooName from either ([syn, match, ]shFooName, "regexp") etc. + " or ([hi, def, ]link, shFooName). + let parts = matchlist(a:rule, '\(\(\S\+\)\s\+\(\S\+\)\s*\)\{2}') + " Do not define rules for names listed in "g:sh_no_error_rules". + if len(parts) < 4 || !xor(index(g:sh_no_error_rules, parts[2]) < 0, index(g:sh_no_error_rules, parts[3]) < 0) + exec a:rule + endif + endfun +elseif exists("g:sh_no_error") + fun! s:DefineSyntaxErrorRule(_) + endfun +else + fun! s:DefineSyntaxErrorRule(rule) abort + exec a:rule + endfun +endif + +com! -nargs=+ ShDefSynErrRule call s:DefineSyntaxErrorRule() + " Generate bracket expression items {{{1 " ================================= " Note that the following function can be invoked as many times as necessary @@ -258,7 +281,7 @@ syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial syn cluster shDerefVarList contains=shDerefOffset,shDerefOp,shDerefVarArray,shDerefOpError syn cluster shEchoList contains=shArithmetic,shBracketExpr,shCommandSub,shCommandSubBQ,shDerefVarArray,shSubshare,shValsub,shDeref,shDerefSimple,shEscape,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote syn cluster shExprList1 contains=shBracketExpr,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq -syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest,shFunctionNameError +syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest,shFunctionNameAssignError syn cluster shFunctionCmds contains=shFor,shCaseEsac,shIf,shRepeat,shDblBrace,shDblParen if exists("b:is_ksh88") || exists("b:is_mksh") " Offer "shFunctionCmds" as is. @@ -284,7 +307,7 @@ if exists("b:is_kornshell") || exists("b:is_bash") endif syn cluster shPPSLeftList contains=shAlias,shArithmetic,shBracketExpr,shCmdParenRegion,shCommandSub,shSubshare,shValsub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable syn cluster shPPSRightList contains=shDeref,shDerefSimple,shEscape,shPosnParm -syn cluster shSubShList contains=shBracketExpr,@shCommandSubList,shCommandSubBQ,shSubshare,shValsub,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator,shFunctionNameError +syn cluster shSubShList contains=shBracketExpr,@shCommandSubList,shCommandSubBQ,shSubshare,shValsub,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator,shFunctionNameAssignError syn cluster shTestList contains=shArithmetic,shBracketExpr,shCommandSub,shCommandSubBQ,shSubshare,shValsub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr syn cluster shNoZSList contains=shSpecialNoZS syn cluster shForList contains=shTestOpr,shNumber,shDerefSimple,shDeref,shCommandSub,shCommandSubBQ,shSubshare,shValsub,shArithmetic @@ -323,20 +346,18 @@ endif " Error Codes: {{{1 " ============ -if !exists("g:sh_no_error") - syn match shDoError "\" - syn match shIfError "\" - syn match shInError "\" - syn match shCaseError ";;" - syn match shEsacError "\" - syn match shCurlyError "}" - syn match shParenError ")" - syn match shOK '\.\(done\|fi\|in\|esac\)' - if exists("b:is_kornshell") || exists("b:is_bash") - syn match shDTestError "]]" - endif - syn match shTestError "]" +ShDefSynErrRule syn match shDoError "\" +ShDefSynErrRule syn match shIfError "\" +ShDefSynErrRule syn match shInError "\" +ShDefSynErrRule syn match shCaseError ";;" +ShDefSynErrRule syn match shEsacError "\" +ShDefSynErrRule syn match shCurlyError "}" +ShDefSynErrRule syn match shParenError ")" +ShDefSynErrRule syn match shOK '\.\(done\|fi\|in\|esac\)' +if exists("b:is_kornshell") || exists("b:is_bash") + ShDefSynErrRule syn match shDTestError "]]" endif +ShDefSynErrRule syn match shTestError "]" " Options: {{{1 " ==================== @@ -427,8 +448,8 @@ ShFoldIfDoFor syn region shCaseEsac matchgroup=shConditional start="\" en syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote if exists("b:is_bash") || (exists("b:is_kornshell") && !exists("b:is_ksh88")) syn region shCaseExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained -elseif !exists("g:sh_no_error") - syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained +else + ShDefSynErrRule syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained endif syn region shCaseSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained syn region shCaseDoubleQuote matchgroup=shQuote start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained @@ -472,8 +493,8 @@ if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList syn match shSkipInitWS contained "^\s\+" syn region shArithParen matchgroup=shArithRegion contained start="(" end=")" contains=@shArithParenList -elseif !exists("g:sh_no_error") - syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList +else + ShDefSynErrRule syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList endif syn region shCmdParenRegion matchgroup=shCmdSubRegion start="((\@!" skip='\\\\\|\\.' end=")" contains=@shCommandSubList @@ -534,9 +555,9 @@ if exists("b:is_bash") || exists("b:is_kornshell") syn match shSpecial "^\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained syn region shExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial nextgroup=shSpecialNxt syn region shExDoubleQuote matchgroup=shQuote start=+\$"+ skip=+\\\\\|\\.\|\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,shSpecial nextgroup=shSpecialNxt -elseif !exists("g:sh_no_error") - syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial - syn region shExDoubleQuote matchGroup=Error start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial +else + ShDefSynErrRule syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial + ShDefSynErrRule syn region shExDoubleQuote matchGroup=Error start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial endif syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell nextgroup=shSpecialStart,shSpecialSQ syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@|&$;\t ]\+\)\+\)\@>\s*()\ze\_s*\%(\%(for\|case\|select\|if\|while\|until\)\>\|\[\[\s\|((\)" skipwhite skipnl nextgroup=@shFunctionCmds contains=shFunctionParens syn match shFunctionCmdTwo "\%#=1\%(\%(\<\k\+\>\|[^()<>|&$;\t ]\+\)\+\)\@>\ze\s*\%(()\ze\)\=\_s*\%(\<\%(for\|case\|select\|if\|while\|until\)\>\|\[\[\s\|((\)" contained skipwhite skipnl nextgroup=@shFunctionCmds contains=shFunctionParens syn match shFunctionOne "\%#=1^\s*\zs\%(\%(\<\k\+\|[^()<>|&$;\t ]\+\)\+\)\@>\s*()\ze\_s*{" skipwhite skipnl nextgroup=shFunctionExpr contains=shFunctionParens - syn match shFunctionTwo "\%#=1\%(\%(\<\k\+\|[^()<>|&$;\t ]\+\)\+\)\@>\ze\s*\%(()\ze\)\=\_s*{" contained skipwhite skipnl nextgroup=shFunctionExpr contains=shFunctionParens syn match shFunctionThree "\%#=1^\s*\zs\%(\%(\<\k\+\|[^()<>|&$;\t ]\+\)\+\)\@>\s*()\ze\_s*((\@!" skipwhite skipnl nextgroup=shFunctionSubSh contains=shFunctionParens - syn match shFunctionFour "\%#=1\%(\%(\<\k\+\|[^()<>|&$;\t ]\+\)\+\)\@>\ze\s*\%(\%(()\ze\)\=\)\@>\_s*((\@!" contained skipwhite skipnl nextgroup=shFunctionSubSh contains=shFunctionParens + " Proof against future changes by inducing priority-driven "backtracking" + " between shFunctionFour (goes before) and shFunctionTwo (goes after) so + " that e.g. "function f () {}" is still claimed by shFunctionTwo (observe + " "f[[:blank:]]()"). + syn match shFunctionFour "\%#=1\%(\%(\<\k\+\|[^()<>|&$;\t ]\+\)\+\)\@>\ze\%(\%(\s*()\ze\)\=\)\@>\_s*((\@!" contained skipwhite skipnl nextgroup=shFunctionSubSh contains=shFunctionParens + syn match shFunctionTwo "\%#=1\%(\%(\<\k\+\|[^()<>|&$;\t ]\+\)\+\)\@>\ze\%(\%(\s*()\ze\)\=\)\@>\_s*{" contained skipwhite skipnl nextgroup=shFunctionExpr contains=shFunctionParens " Claim empty array assignments. syn match shArrayEmptyDecl "\%#=1\ze\%(\<\h\w*=\)\@>()" transparent nextgroup=shVariable - - if !exists("g:sh_no_error") - syn match shFunctionNameError "\%#=1\%(\%(\<\h\w*\)\@>=\)\%(\%(\w\+\)\@>=\=\)\+()" skipwhite skipnl nextgroup=shExpr,shSubSh - endif + " Claim commented out function declaration headers. + syn match shFunctionComment "^\s*\zs\ze#" transparent nextgroup=shComment + ShDefSynErrRule syn match shFunctionNameAssignError "\%#=1\%(\%(\<\h\w*\)\@>=\)\%(\%(\w\+\)\@>=\=\)\+()" skipwhite skipnl nextgroup=shExpr,shSubSh + ShDefSynErrRule syn match shFunctionNameCommentError "#" contained elseif exists("b:is_ksh88") " AT&T ksh88 syn match shFunctionCmdOne "^\s*\zs\h\w*\s*()\ze\_s*\%(\%(for\|case\|select\|if\|while\|until\)\>\|\[\[\s\|((\)" skipwhite skipnl nextgroup=@shFunctionCmds contains=shFunctionParens @@ -687,17 +713,13 @@ else syn match shFunctionFour "\<\h\w*\>\s*()\ze\_s*(" contained skipwhite skipnl nextgroup=shFunctionSubSh contains=shFunctionParens endif -if !exists("g:sh_no_error") - syn match shDoError "\#+0&#ffffff0|!|/|b|i|n|/|b|a|s|h| +0#0000000&@61 | +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |s|e|t|l|o|c|a|l| |f|e|n| |f|d|c|=|2| |f|d|l|=|8| |f|d|m|=|s|y|n|t|a|x| +0#0000000&@20 | +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|s|h|_|f|o|l|d|_|e|n|a|b|l|e|d| |=| |1| |+| |2| |+| |4| +0#0000000&@22 +| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i|g|h|l|i|g|h|t| |l|i|n|k| |s|h|F|u|n|c|t|i|o|n|E|x|p|r|R|e|g|i|o|n| |T|o|d|o| +0#0000000&@15 +| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i|g|h|l|i|g|h|t| |l|i|n|k| |s|h|F|u|n|c|t|i|o|n|S|u|b|S|h|R|e|g|i|o|n| |T|o|d|o| +0#0000000&@14 +| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|s|h|_|n|o|_|e|r@1|o|r|_|r|u|l|e|s| |=| |[|'|s|h|D|e|r|e|f|W|o|r|d|E|r@1|o|r|'|]| +0#0000000&@9 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 | +0#0000e05#a8a8a8255@1|t+0#af5f00255#ffffff0|y|p|e|s|e|t| +0#0000000&|-+0#e000e06&|i| +0#0000000&|n+0#00e0e07&|=+0#0000000&|0+0#e000002&| +0#0000000&@58 @@ -12,9 +17,4 @@ |-+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|o| +0#0000000&@70 ||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|:| @67 ||+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|o|n|e| +0#0000000&@68 -| +0#0000e05#a8a8a8255@1|t+0#0000000#ffffff0|h|e|n|c|e| @66 -| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 -| +0#0000e05#a8a8a8255@1|w+0#00e0e07#ffffff0|h|i|l|e|s|(+0#e000e06&|)| +0#0000000&|w+0#af5f00255&|h|i|l|e| |f|a|l|s|e|;| |d|o| +0#0000000&|:|;+0#af5f00255&| +0#0000000&|d+0#af5f00255&|o|n|e|;+0#0000000&| |w|h|i|l|e|s| @32 -| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 -|-+0#0000e05#a8a8a8255| |e+0#00e0e07#ffffff0|l|s|e|w|h|e|r|e|(+0#e000e06&|)| +0#0000000&|i+0#af5f00255&|f| |:+0#0000000&| @56 |i|s|_|b|a|s|h|:| |1|,| @45|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/sh_functions_bash_01.dump b/runtime/syntax/testdir/dumps/sh_functions_bash_01.dump index aba361e65eea7..7582f8ddc8dc5 100644 --- a/runtime/syntax/testdir/dumps/sh_functions_bash_01.dump +++ b/runtime/syntax/testdir/dumps/sh_functions_bash_01.dump @@ -1,9 +1,14 @@ -||+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|o|n|e| +0#0000000&@68 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 +| +0#0000e05#a8a8a8255@1|t+0#00e0e07#ffffff0|h|e|n|c|e|(+0#e000e06&|)| +0#0000000&@64 +| +0#0000e05#a8a8a8255@1|u+0#af5f00255#ffffff0|n|t|i|l| |:| +0#0000000&@65 +|-+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|o| +0#0000000&@70 +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|:| @67 +||+0#0000e05#a8a8a8255| >d+0#af5f00255#ffffff0|o|n|e| +0#0000000&@68 | +0#0000e05#a8a8a8255@1|t+0#0000000#ffffff0|h|e|n|c|e| @66 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 | +0#0000e05#a8a8a8255@1|w+0#00e0e07#ffffff0|h|i|l|e|s|(+0#e000e06&|)| +0#0000000&|w+0#af5f00255&|h|i|l|e| |f|a|l|s|e|;| |d|o| +0#0000000&|:|;+0#af5f00255&| +0#0000000&|d+0#af5f00255&|o|n|e|;+0#0000000&| |w|h|i|l|e|s| @32 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 -|-+0#0000e05#a8a8a8255| >e+0#00e0e07#ffffff0|l|s|e|w|h|e|r|e|(+0#e000e06&|)| +0#0000000&|i+0#af5f00255&|f| |:+0#0000000&| @56 +|-+0#0000e05#a8a8a8255| |e+0#00e0e07#ffffff0|l|s|e|w|h|e|r|e|(+0#e000e06&|)| +0#0000000&|i+0#af5f00255&|f| |:+0#0000000&| @56 ||+0#0000e05#a8a8a8255| |t+0#af5f00255#ffffff0|h|e|n| +0#0000000&|:|;+0#af5f00255&| +0#0000000&|f+0#af5f00255&|i|;+0#0000000&| |e|l|s|e|w|h|e|r|e| @51 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 |-+0#0000e05#a8a8a8255| |s+0#00e0e07#ffffff0|e|l|e|c|t|o|r|(+0#e000e06&|)| +0#0000000&|s+0#af5f00255&|e|l|e|c|t| |x+0#0000000&| |i+0#af5f00255&|n| +0#0000000&|1+0#e000002&| +0#0000000&|2+0#e000002&|;+0#0000000&| |d+0#af5f00255&|o| +0#0000000&@42 @@ -12,9 +17,4 @@ | +0#0000e05#a8a8a8255@1|s+0#0000000#ffffff0|e|l|e|c|t|o|r| |0+0#e000002&|<+0#af5f00255&|/+0#0000000&|d|e|v|/|n|u|l@1| |2+0#e000002&|>+0#af5f00255&|/+0#0000000&|d|e|v|/|n|u|l@1| ||@1| |:| @35 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 | +0#0000e05#a8a8a8255@1|c+0#00e0e07#ffffff0|a|s|e|d|(+0#e000e06&|)| +0#0000000&|c+0#af5f00255&|a|s|e| +0#0000000&|"+0#af5f00255&|$+0#e000e06&|#|"+0#af5f00255&| +0#0000000&|i+0#af5f00255&|n| +0#0000000&|*|)+0#af5f00255&| +0#0000000&|:|;+0#af5f00255&@1| +0#0000000&|e+0#af5f00255&|s|a|c|;+0#0000000&| |c|a|s|e|d| @33 -| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 -| +0#0000e05#a8a8a8255@1|f+0#00e0e07#ffffff0|o|r|e|(+0#e000e06&|)| +0#0000000&@66 -| +0#0000e05#a8a8a8255@1|f+0#af5f00255#ffffff0|o|r| +0#0000000&|x| |i+0#af5f00255&|n| +0#0000000&|1+0#e000002&| +0#0000000&|2+0#e000002&| +0#0000000&@60 -|-+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|o| +0#0000000&@70 -||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|:| @67 -@57|1|9|,|1| @9|1|6|%| +@57|1|9|,|1| @9|1@1|%| diff --git a/runtime/syntax/testdir/dumps/sh_functions_bash_02.dump b/runtime/syntax/testdir/dumps/sh_functions_bash_02.dump index 8901e58ac323f..53bb1a60b7514 100644 --- a/runtime/syntax/testdir/dumps/sh_functions_bash_02.dump +++ b/runtime/syntax/testdir/dumps/sh_functions_bash_02.dump @@ -1,20 +1,20 @@ -||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|:| @67 +| +0#0000e05#a8a8a8255@1|c+0#00e0e07#ffffff0|a|s|e|d|(+0#e000e06&|)| +0#0000000&|c+0#af5f00255&|a|s|e| +0#0000000&|"+0#af5f00255&|$+0#e000e06&|#|"+0#af5f00255&| +0#0000000&|i+0#af5f00255&|n| +0#0000000&|*|)+0#af5f00255&| +0#0000000&|:|;+0#af5f00255&@1| +0#0000000&|e+0#af5f00255&|s|a|c|;+0#0000000&| |c|a|s|e|d| @33 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 +| +0#0000e05#a8a8a8255@1|f+0#00e0e07#ffffff0|o|r|e|(+0#e000e06&|)| +0#0000000&@66 +| +0#0000e05#a8a8a8255@1|f+0#af5f00255#ffffff0|o|r| +0#0000000&|x| |i+0#af5f00255&|n| +0#0000000&|1+0#e000002&| +0#0000000&|2+0#e000002&| +0#0000000&@60 +|-+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|o| +0#0000000&@70 +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3>:| @67 ||+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|o|n|e| +0#0000000&@68 | +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o|r|e| @68 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 | +0#0000e05#a8a8a8255@1|i+0#00e0e07#ffffff0|f@1|y|(+0#e000e06&|)| +0#0000000&|f+0#af5f00255&|o|r| |(@1|;@1|)@1| +0#0000000&@55 -|-+0#0000e05#a8a8a8255| >d+0#af5f00255#ffffff0|o| +0#0000000&@70 +|-+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|o| +0#0000000&@70 ||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|b+0#af5f00255&|r|e|a|k| +0#0000000&@63 ||+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|o|n|e| +0#0000000&@68 | +0#0000e05#a8a8a8255@1|i+0#0000000#ffffff0|f@1|y| @68 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 |-+0#0000e05#a8a8a8255| |i+0#af5f00255#ffffff0|f| |:+0#0000000&|;+0#af5f00255&| +0#0000000&|t+0#af5f00255&|h|e|n| +0#0000000&@62 ||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|!+0#00e0e07&|?|#|(+0#e000e06&|)| +0#0000000&@54 -|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|(+0#af5f00255&| +0#0000000&@67 -|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|@+0#00e0e07&|α|!| +0#0000000&|{+0#e000e06&| +0#0000000&@50 -|3+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@11|e+0#af5f00255&|c|h|o| +0#e000002&|"+0#af5f00255&|$+0#e000e06&|1|"+0#af5f00255&| +0#0000000&@51 -|3+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|}+0#e000e06&| +0#0000000&@63 -|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|@|α|!+0#af5f00255&| +0#0000000&|"+0#af5f00255&|$+0#e000e06&|1|"+0#af5f00255&| +0#0000000&@56 -|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|)+0#af5f00255&| +0#0000000&@67 -||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|v|a|l| +0#0000000&|!+0#af5f00255&|?+0#0000000&|\+0#e000e06&|#| +0#0000000&|"+0#af5f00255&|\+0#e000e06&|"|$|1|\|"|"+0#af5f00255&| +0#0000000&@50 -@57|3|7|,|1| @9|4|0|%| +|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|(+0#0000001#ffff4012| +0#0000000#ffffff0@67 +|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|@+0#00e0e07&|α|!| +0#0000000&|{+0#0000001#ffff4012| +0#0000000#ffffff0@50 +@57|3|7|,|5| @9|2|7|%| diff --git a/runtime/syntax/testdir/dumps/sh_functions_bash_03.dump b/runtime/syntax/testdir/dumps/sh_functions_bash_03.dump index 98fcc942e8487..9cce6dfd5ad9e 100644 --- a/runtime/syntax/testdir/dumps/sh_functions_bash_03.dump +++ b/runtime/syntax/testdir/dumps/sh_functions_bash_03.dump @@ -1,9 +1,14 @@ -||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|v|a|l| +0#0000000&|!+0#af5f00255&|?+0#0000000&|\+0#e000e06&|#| +0#0000000&|"+0#af5f00255&|\+0#e000e06&|"|$|1|\|"|"+0#af5f00255&| +0#0000000&@50 +|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|@+0#00e0e07&|α|!| +0#0000000&|{+0#0000001#ffff4012| +0#0000000#ffffff0@50 +|3+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@11|e+0#af5f00255&|c|h|o| +0#e000002&|"+0#af5f00255&|$+0#e000e06&|1|"+0#af5f00255&| +0#0000000&@51 +|3+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|}+0#0000001#ffff4012| +0#0000000#ffffff0@63 +|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|@|α|!+0#af5f00255&| +0#0000000&|"+0#af5f00255&|$+0#e000e06&|1|"+0#af5f00255&| +0#0000000&@56 +|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|)+0#0000001#ffff4012| +0#0000000#ffffff0@67 +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3>e+0#af5f00255&|v|a|l| +0#0000000&|!+0#af5f00255&|?+0#0000000&|\+0#e000e06&|#| +0#0000000&|"+0#af5f00255&|\+0#e000e06&|"|$|1|\|"|"+0#af5f00255&| +0#0000000&@50 ||+0#0000e05#a8a8a8255| |f+0#af5f00255#ffffff0|i| +0#0000000&@70 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 | +0#0000e05#a8a8a8255@1|n+0#00e0e07#ffffff0|a|m|e|s|p|a|c|e| |(+0#e000e06&|)| +0#0000000&@60 -|-+0#0000e05#a8a8a8255| |{+0#e000e06#ffffff0| +0#0000000&|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|#|;+0#af5f00255&| +0#0000000&@62 -||+0#0000e05#a8a8a8255| >}+0#e000e06#ffffff0|;+0#0000000&| |n|a|m|e|s|p|a|c|e| |$+0#e000e06&|@| +0#0000000&@57 +|-+0#0000e05#a8a8a8255| |{+0#0000001#ffff4012| +0#0000000#ffffff0|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|#|;+0#af5f00255&| +0#0000000&@62 +||+0#0000e05#a8a8a8255| |}+0#0000001#ffff4012|;+0#0000000#ffffff0| |n|a|m|e|s|p|a|c|e| |$+0#e000e06&|@| +0#0000000&@57 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 | +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |W|h|e|t|h|e|r| |"|=|"| |b|e|l|o|n|g|s| |t|o| |a| |n|a|m|e| |o|r| |d|e|l|i|m|i|t|s| |a| |n|a|m|e| |d|e|p|e|n|d|s| |o|n| |w|h|e|t|h|e|r| +0#0000000&@3 | +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |t|h|e| |r|e|s|e|r|v|e|d| |w|o|r|d| |"|f|u|n|c|t|i|o|n|"| |i|s| |p|r|e|s|e|n|t|,| |i|f| |s|o|,| |t|h|e|n| |"|=|"| |i|s| |p|a|r|t| |o|f| +0#0000000&@3 @@ -12,9 +17,4 @@ | +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |"|=|"|;| |o|t|h|e|r|w|i|s|e|,| |"|=|"| |i|s| |p|a|r|t| |o|f| |t|h|e| |f|u|n|c|t|i|o|n| |n|a|m|e| |w|h|e|n| |t|h|i|s| |n|a|m|e| |h|a|s| +0#0000000&@3 | +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |o|n|e| |o|r| |m|o|r|e| |s|u|p@1|o|r|t|e|d| |N|O|N|-|a|l|p|h|a|n|u|m|e|r|i|c| |(|o|r| |"|_|"|)| |c|h|a|r|a|c|t|e|r|s| |b|e|f|o|r|e| |"|=|"|.| +0#0000000& | +0#0000e05#a8a8a8255@1|x+0#00e0e07#ffffff0|s|=+0#0000000&|(+0#e000e06&|)| +0#0000000&@67 -| +0#0000e05#a8a8a8255@1|(+0#e000e06#ffffff0| +0#0000000&@71 -| +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@3|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|(@1| |1+0#e000002&| +0#e000e06&|+| |$|{|#|x|s|[|*+0#0000000&|]+0#e000e06&|}| |)@1| +0#0000000&@43 -| +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@3|x+0#00e0e07&|s|=+0#0000000&|(+0#e000e06&|)| +0#0000000&@63 -| +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@3|{| +0#0000000&@67 -| +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@7|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|(@1| |2+0#e000002&| +0#e000e06&|+| |$|{|#|x|s|[|*+0#0000000&|]+0#e000e06&|}| |)@1| +0#0000000&@39 -@57|5@1|,|1| @9|6|3|%| +@57|5@1|,|5| @9|4|2|%| diff --git a/runtime/syntax/testdir/dumps/sh_functions_bash_04.dump b/runtime/syntax/testdir/dumps/sh_functions_bash_04.dump index d1be88c7d3a3f..c382653cd1d49 100644 --- a/runtime/syntax/testdir/dumps/sh_functions_bash_04.dump +++ b/runtime/syntax/testdir/dumps/sh_functions_bash_04.dump @@ -1,20 +1,20 @@ -| +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@7|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|(@1| |2+0#e000002&| +0#e000e06&|+| |$|{|#|x|s|[|*+0#0000000&|]+0#e000e06&|}| |)@1| +0#0000000&@39 +| +0#0000e05#a8a8a8255@1|x+0#00e0e07#ffffff0|s|=+0#0000000&|(+0#e000e06&|)| +0#0000000&@67 +| +0#0000e05#a8a8a8255@1|(+0#e000e06#ffffff0| +0#0000000&@71 +| +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@3|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|(@1| |1+0#e000002&| +0#e000e06&|+| |$|{|#|x|s|[|*+0#0000000&|]+0#e000e06&|}| |)@1| +0#0000000&@43 +| +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@3|x+0#00e0e07&|s|=+0#0000000&|(+0#e000e06&|)| +0#0000000&@63 +| +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@3|{| +0#0000000&@67 +| +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@7>e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|(@1| |2+0#e000002&| +0#e000e06&|+| |$|{|#|x|s|[|*+0#0000000&|]+0#e000e06&|}| |)@1| +0#0000000&@39 | +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@7|x+0#00e0e07&|s|=+0#0000000&|(+0#e000e06&|)| +0#0000000&@59 | +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@7|i+0#af5f00255&|f| |:+0#e000e06&|;+0#af5f00255&| +0#e000e06&|t+0#af5f00255&|h|e|n| +0#e000e06&|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|(@1| |3+0#e000002&| +0#e000e06&|+| |$|{|#|x|s|[|*+0#0000000&|]+0#e000e06&|}| |)@1|;+0#af5f00255&| +0#e000e06&|f+0#af5f00255&|i| +0#0000000&@24 | +0#0000e05#a8a8a8255@1| +0#e000e06#ffffff0@3|}| +0#0000000&@67 | +0#0000e05#a8a8a8255@1|)+0#e000e06#ffffff0| +0#0000000&@71 -| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72 -|-+0#0000e05#a8a8a8255| |i+0#00e0e07#ffffff0|δ|=|(+0#e000e06&|)| +0#0000000&|(+0#af5f00255&| +0#0000000&@65 -|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|=+0#00e0e07&|i|d|=|(+0#e000e06&|)| +0#0000000&|{+0#e000e06&| +0#0000000&@60 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 +|-+0#0000e05#a8a8a8255| |i+0#00e0e07#ffffff0|δ|=|(+0#e000e06&|)| +0#0000000&|(+0#0000001#ffff4012| +0#0000000#ffffff0@65 +|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|=+0#00e0e07&|i|d|=|(+0#e000e06&|)| +0#0000000&|{+0#0000001#ffff4012| +0#0000000#ffffff0@60 |2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|=+0#00e0e07&@2|(+0#e000e06&|)| +0#0000000&@59 |2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|i+0#af5f00255&|f| |:+0#0000000&|;+0#af5f00255&| +0#0000000&|t+0#af5f00255&|h|e|n| +0#0000000&|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|*|;+0#af5f00255&| +0#0000000&|f+0#af5f00255&|i|;| +0#0000000&|=+0#af5f00255&@2| +0#0000000&|$+0#e000e06&|*| +0#0000000&@34 -|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|}+0#e000e06&|;+0#af5f00255&| +0#0000000&|=+0#af5f00255&|i|d|=| +0#0000000&|$+0#e000e06&|*| +0#0000000&@58 -||+0#0000e05#a8a8a8255| |)+0#af5f00255#ffffff0|;+0#0000000&| |i+0#af5f00255&|d|=| +0#0000000&|i|δ|=+0#af5f00255&| +0#0000000&|i|δ|=+0#af5f00255&| +0#0000000&|i|δ|=+0#af5f00255&| +0#0000000&@54 +|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|}+0#0000001#ffff4012|;+0#af5f00255#ffffff0| +0#0000000&|=+0#af5f00255&|i|d|=| +0#0000000&|$+0#e000e06&|*| +0#0000000&@58 +||+0#0000e05#a8a8a8255| |)+0#0000001#ffff4012|;+0#0000000#ffffff0| |i+0#af5f00255&|d|=| +0#0000000&|i|δ|=+0#af5f00255&| +0#0000000&|i|δ|=+0#af5f00255&| +0#0000000&|i|δ|=+0#af5f00255&| +0#0000000&@54 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 -|-+0#0000e05#a8a8a8255| |f+0#af5f00255#ffffff0|u|n|c|t|i|o|n| +0#0000000&|f+0#00e0e07&|=|(+0#e000e06&|)| +0#0000000&|(+0#af5f00255&| +0#0000000&@57 -|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|f+0#00e0e07&|=|f| +0#0000000&|{+0#e000e06&| +0#0000000&@54 -|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|f+0#00e0e07&|=|f|=| +0#0000000&@51 -|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|i+0#af5f00255&|f| |:+0#0000000&|;+0#af5f00255&| +0#0000000&|t+0#af5f00255&|h|e|n| +0#0000000&|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|*|;+0#af5f00255&| +0#0000000&|f+0#af5f00255&|i|;| +0#0000000&|f|\+0#e000e06&|=|f+0#0000000&|\+0#e000e06&|=| +0#0000000&|$+0#e000e06&|*| +0#0000000&@31 -|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|}+0#e000e06&|;+0#af5f00255&| +0#0000000&|f|\+0#e000e06&|=|f+0#0000000&| |$+0#e000e06&|*| +0#0000000&@58 -||+0#0000e05#a8a8a8255| |)+0#af5f00255#ffffff0|;+0#0000000&| |f+0#00e0e07&|=+0#0000000&| |f|\|=+0#af5f00255&| +0#0000000&|f+0#00e0e07&|=+0#0000000&| |f+0#00e0e07&|=+0#0000000&| @57 -@57|7|3|,|0|-|1| @7|8|7|%| +|-+0#0000e05#a8a8a8255| |f+0#af5f00255#ffffff0|u|n|c|t|i|o|n| +0#0000000&|f+0#00e0e07&|=|(+0#e000e06&|)| +0#0000000&|(+0#0000001#ffff4012| +0#0000000#ffffff0@57 +@57|7|3|,|9| @9|5|8|%| diff --git a/runtime/syntax/testdir/dumps/sh_functions_bash_05.dump b/runtime/syntax/testdir/dumps/sh_functions_bash_05.dump index 9b805c1891879..32d12a03ab16c 100644 --- a/runtime/syntax/testdir/dumps/sh_functions_bash_05.dump +++ b/runtime/syntax/testdir/dumps/sh_functions_bash_05.dump @@ -1,20 +1,20 @@ -||+0#0000e05#a8a8a8255| |)+0#af5f00255#ffffff0|;+0#0000000&| |f+0#00e0e07&|=+0#0000000&| |f|\|=+0#af5f00255&| +0#0000000&|f+0#00e0e07&|=+0#0000000&| |f+0#00e0e07&|=+0#0000000&| @57 +|-+0#0000e05#a8a8a8255| |f+0#af5f00255#ffffff0|u|n|c|t|i|o|n| +0#0000000&|f+0#00e0e07&|=|(+0#e000e06&|)| +0#0000000&|(+0#0000001#ffff4012| +0#0000000#ffffff0@57 +|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|f+0#00e0e07&|=|f| +0#0000000&|{+0#0000001#ffff4012| +0#0000000#ffffff0@54 +|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|f+0#00e0e07&|=|f|=| +0#0000000&@51 +|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|i+0#af5f00255&|f| |:+0#0000000&|;+0#af5f00255&| +0#0000000&|t+0#af5f00255&|h|e|n| +0#0000000&|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|*|;+0#af5f00255&| +0#0000000&|f+0#af5f00255&|i|;| +0#0000000&|f|\+0#e000e06&|=|f+0#0000000&|\+0#e000e06&|=| +0#0000000&|$+0#e000e06&|*| +0#0000000&@31 +|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|}+0#0000001#ffff4012|;+0#af5f00255#ffffff0| +0#0000000&|f|\+0#e000e06&|=|f+0#0000000&| |$+0#e000e06&|*| +0#0000000&@58 +||+0#0000e05#a8a8a8255| >)+0#0000001#ffff4012|;+0#0000000#ffffff0| |f+0#00e0e07&|=+0#0000000&| |f|\|=+0#af5f00255&| +0#0000000&|f+0#00e0e07&|=+0#0000000&| |f+0#00e0e07&|=+0#0000000&| @57 | +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 -| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |P|a|r|e|n|s| |a|r|e| |n|o|t| |e|s|c|a|p|e|d|,| |h|e|n|c|e| |t|h|i|s| |i|s| |i|n|v|a|l|i|d| |v|a|r|i|a|b|l|e| |a|s@1|i|g|n|m|e|n|t|.| +0#0000000&@4 -| +0#0000e05#a8a8a8255@1|f+0#ffffff16#ff404010|=|f|(|)| +0#0000000#ffffff0@67 -| +0#0000e05#a8a8a8255@1|{+0#e000e06#ffffff0| +0#0000000&@71 -| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3>f+0#ffffff16#ff404010|=|f|=|(|)| +0#0000000#ffffff0@62 -| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|(+0#af5f00255&| +0#0000000&@67 -| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@7|f+0#ffffff16#ff404010|=|f|=|f|(|)| +0#0000000#ffffff0@57 -| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@7|i+0#af5f00255&|f| |:+0#0000000&|;+0#af5f00255&| +0#0000000&|t+0#af5f00255&|h|e|n| +0#0000000&|:|;+0#af5f00255&| +0#0000000&|f+0#af5f00255&|i| +0#0000000&@48 -| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|)+0#af5f00255&| +0#0000000&@67 -| +0#0000e05#a8a8a8255@1|}+0#e000e06#ffffff0| +0#0000000&@71 -|~+0#4040ff13&| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -| +0#0000000&@56|9|1|,|5| @9|B|o|t| +| +0#0000e05#a8a8a8255@1|#+0&#ffffff0|f|u|n|c|t|i|o|n|(|)| |{| +0#0000000&@59 +| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| @2|e|c|h|o| |"|$|1|"| +0#0000000&@59 +| +0#0000e05#a8a8a8255@1|#+0&#ffffff0|}| +0#0000000&@70 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 +|-+0#0000e05#a8a8a8255| |f+0#af5f00255#ffffff0|u|n|c|t|i|o|n| +0#0000000&|f+0#00e0e07&|u|n|c|t|i|o|n| +0#0000000&|{+0#0000001#ffff4012| +0#0000000#ffffff0@53 +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|s+0#af5f00255&|e|t| +0#00e0e07&|-@1| |$+0#e000e06&|{|*|/+0#af5f00255&|\+0#0000000&| @56 +||+0#0000e05#a8a8a8255| |#+0#0000000#ffffff0|.|/+0#af5f00255&|}+0#e000e06&| +0#0000000&@68 +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|s+0#af5f00255&|e|t| +0#00e0e07&|-@1| |`+0#e000e06&|p+0#af5f00255&|r|i|n|t|f| +0#e000e06&|%|\| +0#0000000&@51 +||+0#0000e05#a8a8a8255| |#+0&#ffffff0|.|f|\| @1|$|*| |2|>|/|d|e|v|/|n|u|l@1|`+0#e000e06&|;+0#af5f00255&|:+0#0000000&| |#+0#0000e05&| |F+0#0000001#ffff4012|I|X|M|E|:+0#0000e05#ffffff0| |N|o|t| |a| |c|o|m@1|e|n|t| |(|%|\|)| +0#0000000&@21 +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|s+0#af5f00255&|e|t| +0#00e0e07&|-@1| |$+0#e000e06&|{|*|%+0#af5f00255&|.+0#0000000&|}+0#e000e06&| +0#0000000&@55 +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|l+0#af5f00255&|o|c|a|l| +0#0000000&|I+0#e000e06&|F|S|=+0#af5f00255&|++0#0000000&| @57 +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|(@2|"+0#af5f00255&|$+0#e000e06&|{|*|\| +0#0000000&@54 +@57|9|1|,|1| @9|7|4|%| diff --git a/runtime/syntax/testdir/dumps/sh_functions_bash_06.dump b/runtime/syntax/testdir/dumps/sh_functions_bash_06.dump new file mode 100644 index 0000000000000..f0e7db401f942 --- /dev/null +++ b/runtime/syntax/testdir/dumps/sh_functions_bash_06.dump @@ -0,0 +1,20 @@ +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|c|h|o| +0#e000002&|$+0#e000e06&|(@2|"+0#af5f00255&|$+0#e000e06&|{|*|\| +0#0000000&@54 +||+0#0000e05#a8a8a8255| |#+0#e000e06#ffffff0|f|u|n|c|t|i|o|n|(|)|}|"+0#af5f00255&|)+0#e000e06&| |/| |$|{|\| +0#0000000&@52 +||+0#0000e05#a8a8a8255| |#+0#e000e06#ffffff0|}| |+| |1+0#e000002&|6|\+0#e000e06&| +0#0000000&@64 +||+0#0000e05#a8a8a8255| |#+0&#ffffff0|0|\| +0#0000000&@69 +||+0#0000e05#a8a8a8255| |)+0#e000e06#ffffff0@1|;+0#af5f00255&|:+0#0000000&| |#+0#0000e05&| |F+0#0000001#ffff4012|I|X|M|E|:+0#0000e05#ffffff0| |N|o|t| |a| |c|o|m@1|e|n|t| |(|1|6|\|)| +0#0000000&@39 +||+0#0000e05#a8a8a8255| >}+0#0000001#ffff4012|;+0#0000000#ffffff0| |e+0#af5f00255&|v|a|l| +0#0000000&|"+0#af5f00255&|\+0#e000e06&|f|u+0#e000002&|n|c|t|i|o|n|"+0#af5f00255&| +0#0000000&|$+0#e000e06&|@| +0#0000000&@50 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 +|-+0#0000e05#a8a8a8255| |f+0#af5f00255#ffffff0|u|n|c|t|i|o|n| +0#0000000&|f+0#00e0e07&|u|n|c|t|i|o|n|#|f|u|n|c|t|i|o|n| |(+0#e000e06&|)| +0#0000000&|{+0#0000001#ffff4012| +0#0000000#ffffff0@41 +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|c|h|o| +0#e000002&|"+0#af5f00255&|$+0#e000e06&|1|"+0#af5f00255&| +0#0000000&@59 +||+0#0000e05#a8a8a8255| |}+0#0000001#ffff4012|;+0#0000000#ffffff0| |e+0#af5f00255&|v|a|l| +0#0000000&|"+0#af5f00255&|f+0#e000002&|u|n|c|t|i|o|n|#|f|u|n|c|t|i|o|n|"+0#af5f00255&| +0#0000000&|"+0#af5f00255&|$+0#e000e06&|1|"+0#af5f00255&| +0#0000000&@40 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 +|-+0#0000e05#a8a8a8255| |f+0#00e0e07#ffffff0|u|n|c|t|i|o|n|#| |(+0#e000e06&|)| +0#0000000&|{+0#0000001#ffff4012| +0#0000000#ffffff0@58 +||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|c|h|o| +0#e000002&|"+0#af5f00255&|$+0#e000e06&|1|"+0#af5f00255&| +0#0000000&@59 +||+0#0000e05#a8a8a8255| |}+0#0000001#ffff4012|;+0#0000000#ffffff0| |f|u|n|c|t|i|o|n|#| |"+0#af5f00255&|$+0#e000e06&|1|"+0#af5f00255&| +0#0000000&@55 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 +| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |P|a|r|e|n|s| |a|r|e| |n|o|t| |e|s|c|a|p|e|d|,| |h|e|n|c|e| |t|h|i|s| |i|s| |i|n|v|a|l|i|d| |v|a|r|i|a|b|l|e| |a|s@1|i|g|n|m|e|n|t|.| +0#0000000&@4 +| +0#0000e05#a8a8a8255@1|f+0#ffffff16#ff404010|=|f|(|)| +0#0000000#ffffff0@67 +| +0#0000e05#a8a8a8255@1|{+0#e000e06#ffffff0| +0#0000000&@71 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|f+0#ffffff16#ff404010|=|f|=|(|)| +0#0000000#ffffff0@62 +@57|1|0|9|,|1| @8|9|0|%| diff --git a/runtime/syntax/testdir/dumps/sh_functions_bash_07.dump b/runtime/syntax/testdir/dumps/sh_functions_bash_07.dump new file mode 100644 index 0000000000000..656794a863ebb --- /dev/null +++ b/runtime/syntax/testdir/dumps/sh_functions_bash_07.dump @@ -0,0 +1,20 @@ +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|f+0#ffffff16#ff404010|=|f|=|(|)| +0#0000000#ffffff0@62 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|(+0#af5f00255&| +0#0000000&@67 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@7|f+0#ffffff16#ff404010|=|f|=|f|(|)| +0#0000000#ffffff0@57 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@7|i+0#af5f00255&|f| |:+0#0000000&|;+0#af5f00255&| +0#0000000&|t+0#af5f00255&|h|e|n| +0#0000000&|:|;+0#af5f00255&| +0#0000000&|f+0#af5f00255&|i| +0#0000000&@48 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|)+0#af5f00255&| +0#0000000&@67 +| +0#0000e05#a8a8a8255@1>}+0#e000e06#ffffff0| +0#0000000&@71 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72 +| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |I|d|e|n|t|i|f|i|e|r|s| |c|a|n@1|o|t| |h|a|v|e| |a| |l|e|a|d|i|n|g| |"|#|"| |i|n| |t|h|e|i|r| |n|a|m|e|s| |u|n|l|e|s@1| |t|h|e| |s|h|e|l@1| +0#0000000&@1 +| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |o|p|t|i|o|n| |"|i|n|t|e|r|a|c|t|i|v|e|_|c|o|m@1|e|n|t|s|"| |i|s| |u|n|s|e|t| |a|n|d| |i|s| |i|n| |e|f@1|e|c|t|.| +0#0000000&@14 +| +0#0000e05#a8a8a8255@1|f+0#af5f00255#ffffff0|u|n|c|t|i|o|n| +0#0000000&|#+0#ffffff16#ff404010|f+0#0000000#ffffff0|u|n|c|t|i|o|n|(+0#e000e06&|)| +0#0000000&|{+0#e000e06&| +0#0000000&@50 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|e+0#af5f00255&|c|h|o| +0#e000002&|"+0#af5f00255&|$+0#e000e06&|1|"+0#af5f00255&| +0#0000000&@59 +| +0#0000e05#a8a8a8255@1|}+0#e000e06#ffffff0| +0#0000000&@71 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@56|1|2|7|,|1| @8|B|o|t| diff --git a/runtime/syntax/testdir/input/sh_functions_bash.sh b/runtime/syntax/testdir/input/sh_functions_bash.sh index 714d2a74b3748..d91905640d02c 100644 --- a/runtime/syntax/testdir/input/sh_functions_bash.sh +++ b/runtime/syntax/testdir/input/sh_functions_bash.sh @@ -1,6 +1,11 @@ #!/bin/bash # VIM_TEST_SETUP setlocal fen fdc=2 fdl=8 fdm=syntax # VIM_TEST_SETUP let g:sh_fold_enabled = 1 + 2 + 4 +# VIM_TEST_SETUP highlight link shFunctionExprRegion Todo +# VIM_TEST_SETUP highlight link shFunctionSubShRegion Todo +# VIM_TEST_SETUP let g:sh_no_error_rules = ['shDerefWordError'] + + typeset -i n=0 @@ -85,6 +90,32 @@ function f=() ( }; f\=f $* ); f= f\= f= f= +#function() { +# echo "$1" +#} + +function function { + set -- ${*/\ +#./} + set -- `printf %\ +#.f\ $* 2>/dev/null`;: # FIXME: Not a comment (%\) + set -- ${*%.} + local IFS=+ + echo $((("${*\ +#function()}") / ${\ +#} + 16\ +#0\ +));: # FIXME: Not a comment (16\) +}; eval "\function" $@ + +function function#function () { + echo "$1" +}; eval "function#function" "$1" + +function# () { + echo "$1" +}; function# "$1" + # Parens are not escaped, hence this is invalid variable assignment. f=f() { @@ -94,3 +125,9 @@ f=f() if :; then :; fi ) } + +# Identifiers cannot have a leading "#" in their names unless the shell +# option "interactive_comments" is unset and is in effect. +function #function() { + echo "$1" +}