comparison vendor/vim-syntax/ruby.vim @ 661:c74dffea6a0a

[vim-syntax] Update syntax
author nanaya <me@nanaya.pro>
date Fri, 10 Dec 2021 19:02:27 +0900
parents ced2ee9efd9f
children 6cdd7d26260d
comparison
equal deleted inserted replaced
660:56ac9d97d81b 661:c74dffea6a0a
1 " Vim syntax file 1 " Vim syntax file
2 " Language: Ruby 2 " Language: Ruby
3 " Maintainer: Doug Kearns <dougkearns@gmail.com> 3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
4 " URL: https://github.com/vim-ruby/vim-ruby 4 " URL: https://github.com/vim-ruby/vim-ruby
5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com> 5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
6 " Last Change: 2019 Jul 13 6 " Last Change: 2021 Jun 06
7 " ---------------------------------------------------------------------------- 7 " ----------------------------------------------------------------------------
8 " 8 "
9 " Previous Maintainer: Mirko Nasato 9 " Previous Maintainer: Mirko Nasato
10 " Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN) 10 " Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN)
11 " ---------------------------------------------------------------------------- 11 " ----------------------------------------------------------------------------
64 endfunction 64 endfunction
65 65
66 com! -nargs=* SynFold call s:run_syntax_fold(<q-args>) 66 com! -nargs=* SynFold call s:run_syntax_fold(<q-args>)
67 67
68 " Not-Top Cluster {{{1 68 " Not-Top Cluster {{{1
69 syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses 69 syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses,@Spell
70 70
71 " Whitespace Errors {{{1 71 " Whitespace Errors {{{1
72 if exists("ruby_space_errors") 72 if exists("ruby_space_errors")
73 if !exists("ruby_no_trail_space_error") 73 if !exists("ruby_no_trail_space_error")
74 syn match rubySpaceError display excludenl "\s\+$" 74 syn match rubySpaceError display excludenl "\s\+$"
90 syn match rubyComparisonOperator "<=>\|<=\|<\|>=\|[-=]\@1<!>" 90 syn match rubyComparisonOperator "<=>\|<=\|<\|>=\|[-=]\@1<!>"
91 syn match rubyBitwiseOperator "[~^|]\|&\.\@!\|<<\|>>" 91 syn match rubyBitwiseOperator "[~^|]\|&\.\@!\|<<\|>>"
92 syn match rubyBooleanOperator "\%(\w\|[^\x00-\x7F]\)\@1<!!\|&&\|||" 92 syn match rubyBooleanOperator "\%(\w\|[^\x00-\x7F]\)\@1<!!\|&&\|||"
93 syn match rubyRangeOperator "\.\.\.\=" 93 syn match rubyRangeOperator "\.\.\.\="
94 syn match rubyAssignmentOperator "=>\@!\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|||=\||=\|%=\|+=\|>>=\|<<=\|\^=" 94 syn match rubyAssignmentOperator "=>\@!\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|||=\||=\|%=\|+=\|>>=\|<<=\|\^="
95 syn match rubyAssignmentOperator "=>\@!" containedin=rubyBlockParameterList " TODO: this is inelegant 95 syn match rubyAssignmentOperator "=>\@!" contained containedin=rubyBlockParameterList " TODO: this is inelegant
96 syn match rubyEqualityOperator "===\|==\|!=\|!\~\|=\~" 96 syn match rubyEqualityOperator "===\|==\|!=\|!\~\|=\~"
97 97
98 syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\%(\w\|[^\x00-\x7F]\)[?!]\=\|[]})]\)\@2<=\[" end="]" contains=ALLBUT,@rubyNotTop 98 syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\%(\w\|[^\x00-\x7F]\)[?!]\=\|[]})]\)\@2<=\[" end="]" contains=ALLBUT,@rubyNotTop
99 99
100 syn match rubyScopeOperator "::" 100 syn match rubyScopeOperator "::"
132 syn match rubyParenthesisEscape "\\[()]" contained display 132 syn match rubyParenthesisEscape "\\[()]" contained display
133 syn match rubyCurlyBraceEscape "\\[{}]" contained display 133 syn match rubyCurlyBraceEscape "\\[{}]" contained display
134 syn match rubyAngleBracketEscape "\\[<>]" contained display 134 syn match rubyAngleBracketEscape "\\[<>]" contained display
135 syn match rubySquareBracketEscape "\\[[\]]" contained display 135 syn match rubySquareBracketEscape "\\[[\]]" contained display
136 136
137 syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=rubyString end=")" transparent contained 137 syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" end=")" transparent contained
138 syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyString end="}" transparent contained 138 syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" end="}" transparent contained
139 syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained 139 syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" end=">" transparent contained
140 syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained 140 syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" end="\]" transparent contained
141 141
142 syn cluster rubySingleCharEscape contains=rubyBackslashEscape,rubyQuoteEscape,rubySpaceEscape,rubyParenthesisEscape,rubyCurlyBraceEscape,rubyAngleBracketEscape,rubySquareBracketEscape 142 syn cluster rubySingleCharEscape contains=rubyBackslashEscape,rubyQuoteEscape,rubySpaceEscape,rubyParenthesisEscape,rubyCurlyBraceEscape,rubyAngleBracketEscape,rubySquareBracketEscape
143 syn cluster rubyNestedBrackets contains=rubyNested.\+ 143 syn cluster rubyNestedBrackets contains=rubyNested.\+
144 syn cluster rubyStringSpecial contains=rubyInterpolation,rubyStringEscape 144 syn cluster rubyStringSpecial contains=rubyInterpolation,rubyStringEscape
145 syn cluster rubyStringNotTop contains=@rubyStringSpecial,@rubyNestedBrackets,@rubySingleCharEscape 145 syn cluster rubyStringNotTop contains=@rubyStringSpecial,@rubyNestedBrackets,@rubySingleCharEscape
191 SynFold ':' syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape,rubyBackslashEscape 191 SynFold ':' syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape,rubyBackslashEscape
192 SynFold ':' syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial 192 SynFold ':' syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial
193 193
194 syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@=" 194 syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@="
195 195
196 syn region rubyParentheses start="(" end=")" contains=ALLBUT,@rubyNotTop containedin=rubyBlockParameterList 196 syn region rubyParentheses start="(" end=")" contains=ALLBUT,@rubyNotTop contained containedin=rubyBlockParameterList
197 syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\_s*\)\@32<=|" end="|" contains=ALLBUT,@rubyNotTop,@rubyProperOperator 197 syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\_s*\)\@32<=|" end="|" contains=ALLBUT,@rubyNotTop,@rubyProperOperator
198 198
199 if exists('ruby_global_variable_error') 199 if exists('ruby_global_variable_error')
200 syn match rubyGlobalVariableError "$[^A-Za-z_]" display 200 syn match rubyGlobalVariableError "$[^A-Za-z_]" display
201 syn match rubyGlobalVariableError "$-[^0FIKWadilpvw]" display 201 syn match rubyGlobalVariableError "$-[^0FIKWadilpvw]" display
330 330
331 " Module, Class, Method and Alias Declarations {{{1 331 " Module, Class, Method and Alias Declarations {{{1
332 syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,@rubyGlobalVariable nextgroup=rubyAliasDeclaration2 skipwhite 332 syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,@rubyGlobalVariable nextgroup=rubyAliasDeclaration2 skipwhite
333 syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,@rubyGlobalVariable 333 syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,@rubyGlobalVariable
334 syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable 334 syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable
335 syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyClassName,rubyScopeOperator nextgroup=rubySuperClassOperator skipwhite skipnl 335 syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyClassName,rubyScopeOperator nextgroup=rubySuperClassOperator skipwhite
336 syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyModuleName,rubyScopeOperator 336 syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyModuleName,rubyScopeOperator
337 337
338 syn match rubyMethodName "\<\%([_[:alpha:]]\|[^\x00-\x7F]\)\%([_[:alnum:]]\|[^\x00-\x7F]\)*[?!=]\=\%([[:alnum:]_.:?!=]\|[^\x00-\x7F]\)\@!" contained containedin=rubyMethodDeclaration 338 syn match rubyMethodName "\<\%([_[:alpha:]]\|[^\x00-\x7F]\)\%([_[:alnum:]]\|[^\x00-\x7F]\)*[?!=]\=\%([[:alnum:]_.:?!=]\|[^\x00-\x7F]\)\@!" contained containedin=rubyMethodDeclaration
339 syn match rubyMethodName "\%(\s\|^\)\@1<=\%([_[:alpha:]]\|[^\x00-\x7F]\)\%([_[:alnum:]]\|[^\x00-\x7F]\)*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 339 syn match rubyMethodName "\%(\s\|^\)\@1<=\%([_[:alpha:]]\|[^\x00-\x7F]\)\%([_[:alnum:]]\|[^\x00-\x7F]\)*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2
340 syn match rubyMethodName "\%([[:space:].]\|^\)\@1<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration 340 syn match rubyMethodName "\%([[:space:].]\|^\)\@1<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration
460 syn match rubyControl "\%#=1\<exit!" display 460 syn match rubyControl "\%#=1\<exit!" display
461 endif 461 endif
462 syn match rubyDefinedOperator "\%#=1\<defined?" display 462 syn match rubyDefinedOperator "\%#=1\<defined?" display
463 463
464 " 1.9-style Hash Keys and Keyword Parameters {{{1 464 " 1.9-style Hash Keys and Keyword Parameters {{{1
465 syn match rubySymbol "\%([{(|,]\_s*\)\@<=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1 465 syn match rubySymbol "\%(\w\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1 contained containedin=rubyBlockParameterList,rubyCurlyBlock
466 syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="he=e-1 466 syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="he=e-1
467 syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="hs=s+1,he=e-1 467 syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="hs=s+1,he=e-1
468 468
469 " __END__ Directive {{{1 469 " __END__ Directive {{{1
470 SynFold '__END__' syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" 470 SynFold '__END__' syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$"