codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: Ruby3" Maintainer: Doug Kearns <dougkearns@gmail.com>4" URL: https://github.com/vim-ruby/vim-ruby5" Last Change: 2023 Mar 166" ----------------------------------------------------------------------------7"8" Previous Maintainer: Mirko Nasato9" Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN)10" ----------------------------------------------------------------------------11 12" Prelude {{{113if exists("b:current_syntax")14 finish15endif16 17" this file uses line continuations18let s:cpo_sav = &cpo19set cpo&vim20 21" eRuby Config {{{122if exists('main_syntax') && main_syntax == 'eruby'23 let b:ruby_no_expensive = 124endif25 26" Folding Config {{{127if has("folding") && exists("ruby_fold")28 setlocal foldmethod=syntax29endif30 31let s:foldable_groups = split(32 \ get(33 \ b:,34 \ 'ruby_foldable_groups',35 \ get(g:, 'ruby_foldable_groups', 'ALL')36 \ )37 \ )38 39function! s:foldable(...) abort40 if index(s:foldable_groups, 'NONE') > -141 return 042 endif43 44 if index(s:foldable_groups, 'ALL') > -145 return 146 endif47 48 for l:i in a:00049 if index(s:foldable_groups, l:i) > -150 return 151 endif52 endfor53 54 return 055endfunction56 57function! s:run_syntax_fold(args) abort58 let [_0, _1, groups, cmd; _] = matchlist(a:args, '\(["'']\)\(.\{-}\)\1\s\+\(.*\)')59 if call('s:foldable', split(groups))60 let cmd .= ' fold'61 endif62 exe cmd63endfunction64 65com! -nargs=* SynFold call s:run_syntax_fold(<q-args>)66 67" Not-Top Cluster {{{168syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyDoubleQuoteSymbolDelimiter,rubySingleQuoteSymbolDelimiter,rubyParentheses,@Spell69 70" Whitespace Errors {{{171if exists("ruby_space_errors")72 if !exists("ruby_no_trail_space_error")73 syn match rubySpaceError display excludenl "\s\+$"74 endif75 if !exists("ruby_no_tab_space_error")76 syn match rubySpaceError display " \+\t"me=e-177 endif78endif79 80" Operators {{{181 82syn match rubyEnglishBooleanOperator "\<\%(and\|or\|not\)\>"83 84if exists("ruby_operators") || exists("ruby_pseudo_operators")85 syn match rubyDotOperator "\.\|&\."86 87 syn match rubyTernaryOperator "\%(\w\|[^\x00-\x7F]\)\@1<!?\|:"88 syn match rubyArithmeticOperator "\*\*\|[*/%+]\|->\@!"89 syn match rubyComparisonOperator "<=>\|<=\|<\|>=\|[-=]\@1<!>"90 syn match rubyBitwiseOperator "[~^|]\|&\.\@!\|<<\|>>"91 syn match rubyBooleanOperator "\%(\w\|[^\x00-\x7F]\)\@1<!!\|&&\|||"92 syn match rubyRangeOperator "\.\.\.\="93 syn match rubyAssignmentOperator "=>\@!\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|||=\||=\|%=\|+=\|>>=\|<<=\|\^="94 syn match rubyAssignmentOperator "=>\@!" contained containedin=rubyBlockParameterList " TODO: this is inelegant95 syn match rubyEqualityOperator "===\|==\|!=\|!\~\|=\~"96 97 syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\%(\w\|[^\x00-\x7F]\)[?!]\=\|[]})]\)\@2<=\[" end="]" contains=ALLBUT,@rubyNotTop98 99 syn match rubyScopeOperator "::"100 syn match rubySuperClassOperator "<" contained101 syn match rubyEigenClassOperator "<<" contained102 syn match rubyLambdaOperator "->"103 syn match rubySplatOperator "\%([[{(|,=]\_s*\)\@<=\*"104 syn match rubySplatOperator "\%(^\|\s\)\@1<=\*\%(\h\|[^\x00-\x7F]\|[:$@[]\)\@="105 syn match rubyDoubleSplatOperator "\%([{(|,]\_s*\)\@<=\*\*"106 syn match rubyDoubleSplatOperator "\s\@1<=\*\*\%(\h\|[^\x00-\x7F]\|[:$@{]\)\@="107 syn match rubyProcOperator "\%([[(|,]\_s*\)\@<=&"108 syn match rubyProcOperator "\s\@1<=&\%(\h\|[^\x00-\x7F]\|[:$@]\|->\)\@="109 110 syn cluster rubyProperOperator contains=rubyTernaryOperator,rubyArithmeticOperator,rubyComparisonOperator,rubyBitwiseOperator,rubyBooleanOperator,rubyRangeOperator,rubyAssignmentOperator,rubyEqualityOperator,rubyDefinedOperator,rubyEnglishBooleanOperator111 syn cluster rubyClassOperator contains=rubyEigenClassOperator,rubySuperClassOperator112 syn cluster rubyPseudoOperator contains=rubyDotOperator,rubyScopeOperator,rubyEigenClassOperator,rubySuperClassOperator,rubyLambdaOperator,rubySplatOperator,rubyDoubleSplatOperator,rubyProcOperator113 syn cluster rubyOperator contains=ruby.*Operator114endif115 116" String Interpolation and Backslash Notation {{{1117syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,@rubyNotTop118syn match rubyInterpolation "#\$\%(-\w\|[!$&"'*+,./0:;<>?@\`~_]\|\w\+\)" display contained contains=rubyInterpolationDelimiter,@rubyGlobalVariable119syn match rubyInterpolation "#@@\=\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable120syn match rubyInterpolationDelimiter "#\ze[$@]" display contained121 122syn match rubyStringEscape "\\\_." contained display123syn match rubyStringEscape "\\\o\{1,3}\|\\x\x\{1,2}" contained display124syn match rubyStringEscape "\\u\%(\x\{4}\|{\x\{1,6}\%(\s\+\x\{1,6}\)*}\)" contained display125syn match rubyStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=.\)" contained display126 127syn match rubyBackslashEscape "\\\\" contained display128syn match rubyQuoteEscape "\\'" contained display129syn match rubySpaceEscape "\\ " contained display130 131syn match rubyParenthesisEscape "\\[()]" contained display132syn match rubyCurlyBraceEscape "\\[{}]" contained display133syn match rubyAngleBracketEscape "\\[<>]" contained display134syn match rubySquareBracketEscape "\\[[\]]" contained display135 136syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" end=")" transparent contained137syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" end="}" transparent contained138syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" end=">" transparent contained139syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" end="\]" transparent contained140 141syn cluster rubySingleCharEscape contains=rubyBackslashEscape,rubyQuoteEscape,rubySpaceEscape,rubyParenthesisEscape,rubyCurlyBraceEscape,rubyAngleBracketEscape,rubySquareBracketEscape142syn cluster rubyNestedBrackets contains=rubyNested.\+143syn cluster rubyStringSpecial contains=rubyInterpolation,rubyStringEscape144syn cluster rubyStringNotTop contains=@rubyStringSpecial,@rubyNestedBrackets,@rubySingleCharEscape145 146" Regular Expression Metacharacters {{{1147syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\\\\|\\)" end=")" contained148syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\%(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\\\\|\\)" end=")" contained transparent contains=@rubyRegexpSpecial149syn region rubyRegexpBrackets matchgroup=rubyRegexpCharClass start="\[\^\=" skip="\\\\\|\\\]" end="\]" contained transparent contains=rubyRegexpBrackets,rubyStringEscape,rubyRegexpEscape,rubyRegexpCharClass,rubyRegexpIntersection oneline150syn match rubyRegexpCharClass "\\[DdHhRSsWw]" contained display151syn match rubyRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|word\|xdigit\):\]" contained152syn match rubyRegexpCharClass "\\[pP]{^\=.\{-}}" contained display153syn match rubyRegexpEscape "\\[].*?+^$|\\/(){}[]" contained " see commit e477f10154syn match rubyRegexpQuantifier "[*?+][?+]\=" contained display155syn match rubyRegexpQuantifier "{\d\+\%(,\d*\)\=}?\=" contained display156syn match rubyRegexpAnchor "[$^]\|\\[ABbGZz]" contained display157syn match rubyRegexpDot "\.\|\\X" contained display158syn match rubyRegexpIntersection "&&" contained display159syn match rubyRegexpSpecial "\\K" contained display160syn match rubyRegexpSpecial "|" contained display161syn match rubyRegexpSpecial "\\[1-9]\d\=\d\@!" contained display162syn match rubyRegexpSpecial "\\k<\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\=>" contained display163syn match rubyRegexpSpecial "\\k'\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\='" contained display164syn match rubyRegexpSpecial "\\g<\%([a-z_]\w*\|-\=\d\+\)>" contained display165syn match rubyRegexpSpecial "\\g'\%([a-z_]\w*\|-\=\d\+\)'" contained display166 167syn cluster rubyRegexpSpecial contains=@rubyStringSpecial,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment,rubyRegexpIntersection168 169" Numbers {{{1170syn match rubyInteger "\%(\%(\w\|[^\x00-\x7F]\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*r\=i\=\>" display171syn match rubyInteger "\%(\%(\w\|[^\x00-\x7F]\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)r\=i\=\>" display172syn match rubyInteger "\%(\%(\w\|[^\x00-\x7F]\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*r\=i\=\>" display173syn match rubyInteger "\%(\%(\w\|[^\x00-\x7F]\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*r\=i\=\>" display174syn match rubyFloat "\%(\%(\w\|[^\x00-\x7F]\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*r\=i\=\>" display175syn match rubyFloat "\%(\%(\w\|[^\x00-\x7F]\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)i\=\>" display176 177" Identifiers {{{1178syn match rubyClassName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<[[:upper:]]\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" contained179syn match rubyModuleName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<[[:upper:]]\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" contained180syn match rubyConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<[[:upper:]]\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!"181syn match rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display182syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display183syn match rubyGlobalVariable "$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)"184syn match rubySymbolDelimiter ":" contained185syn match rubySymbol "[]})\"':]\@1<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" contains=rubySymbolDelimiter186syn match rubySymbol "[]})\"':]\@1<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" contains=rubySymbolDelimiter187syn match rubySymbol "[]})\"':]\@1<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" contains=rubySymbolDelimiter188syn match rubySymbol "[]})\"':]\@1<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" contains=rubySymbolDelimiter189 190SynFold ':' syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape,rubyBackslashEscape191SynFold ':' syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial192 193syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@="194 195syn region rubyParentheses start="(" end=")" contains=ALLBUT,@rubyNotTop contained containedin=rubyBlockParameterList196syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\_s*\)\@32<=|" end="|" contains=ALLBUT,@rubyNotTop,@rubyProperOperator197 198if exists('ruby_global_variable_error')199 syn match rubyGlobalVariableError "$[^A-Za-z_]" display200 syn match rubyGlobalVariableError "$-[^0FIKWadilpvw]" display201endif202 203syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<>?@\`~]#204syn match rubyPredefinedVariable "$\d\+" display205syn match rubyPredefinedVariable "$_\>" display206syn match rubyPredefinedVariable "$-[0FIWadilpvw]\>" display207syn match rubyPredefinedVariable "$\%(stderr\|stdin\|stdout\)\>" display208syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display209syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(ARGF\|ARGV\|ENV\|DATA\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\)\>\%(\s*(\)\@!"210syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(RUBY_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!"211 212" Deprecated/removed in 1.9213syn match rubyPredefinedVariable "$="214syn match rubyPredefinedVariable "$-K\>" display215syn match rubyPredefinedVariable "$\%(deferr\|defout\)\>" display216syn match rubyPredefinedVariable "$KCODE\>" display217" Deprecated/removed in 2.4218syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(FALSE\|NIL\|TRUE\)\>\%(\s*(\)\@!"219 220syn cluster rubyGlobalVariable contains=rubyGlobalVariable,rubyPredefinedVariable,rubyGlobalVariableError221 222" Normal Regular Expressions {{{1223SynFold '/' syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial nextgroup=@rubyModifier skipwhite224SynFold '/' syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\s\+\)\@<=/\%(=\|\_s\)\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial nextgroup=@rubyModifier skipwhite225 226" Generalized Regular Expressions {{{1227SynFold '%' syn region rubyRegexp matchgroup=rubyPercentRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial nextgroup=@rubyModifier skipwhite228SynFold '%' syn region rubyRegexp matchgroup=rubyPercentRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial229SynFold '%' syn region rubyRegexp matchgroup=rubyPercentRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets230SynFold '%' syn region rubyRegexp matchgroup=rubyPercentRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial231SynFold '%' syn region rubyRegexp matchgroup=rubyPercentRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial232SynFold '%' syn region rubyRegexp matchgroup=rubyPercentRegexpDelimiter start="%r\z(\s\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial233 234" Characters {{{1235syn match rubyCharacter "\%(\w\|[^\x00-\x7F]\|[]})\"'/]\)\@1<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\[[:space:]]\|\\\=[^[:space:]]\)\)"236syn match rubyCharacter "\%(\w\|[^\x00-\x7F]\|[]})\"'/]\)\@1<!?\\u\%(\x\{4}\|{\x\{1,6}}\)"237 238" Normal Strings {{{1239let s:spell_cluster = exists('ruby_spellcheck_strings') ? ',@Spell' : ''240let s:fold_arg = s:foldable('string') ? ' fold' : ''241exe 'syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial' . s:spell_cluster . s:fold_arg242exe 'syn region rubyString matchgroup=rubyStringDelimiter start="''" end="''" skip="\\\\\|\\''" contains=rubyQuoteEscape,rubyBackslashEscape' . s:spell_cluster . s:fold_arg243unlet s:spell_cluster s:fold_arg244 245" Shell Command Output {{{1246SynFold 'string' syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial247 248" Generalized Single Quoted Strings, Symbols, Array of Strings and Array of Symbols {{{1249 250" Non-bracket punctuation delimiters {{{2251let s:names = { '~': 'Tilde', '`': 'BackQuote', '!': 'Bang', '@': 'At', '#': 'Hash', '$': 'Dollar', '%': 'Percent', '^': 'Caret',252 \ '&': 'Ampersand', '*': 'Asterix', '_': 'Underscore', '-': 'Dash', '+': 'Plus', '=': 'Equals', '|': 'Bar',253 \ '\': 'Backslash', ':': 'Colon', ';': 'Semicolon', '"': 'DoubleQuote', "'": 'Quote', ',': 'Comma', '.': 'Period',254 \ '?': 'QuestionMark', '/': 'ForwardSlash' }255 256for s:delimiter in keys(s:names)257 let s:group = 'ruby' . s:names[s:delimiter] . 'Escape'258 259 if s:delimiter =~ '[\"]'260 let s:delimiter = '\' . s:delimiter261 endif262 263 exe 'syn match ' . s:group . ' "\V\\' . s:delimiter . '" contained display'264 exe 'syn cluster rubySingleCharEscape add=' . s:group265 exe 'SynFold ''%'' syn region rubyString matchgroup=rubyPercentStringDelimiter start="\V%q' . s:delimiter . '" end="\V' . s:delimiter . '" skip="\V\\\\\|\\' . s:delimiter . '" contains=rubyBackslashEscape,' . s:group . ' nextgroup=@rubyModifier skipwhite'266 exe 'SynFold ''%'' syn region rubyString matchgroup=rubyPercentStringDelimiter start="\V%w' . s:delimiter . '" end="\V' . s:delimiter . '" skip="\V\\\\\|\\' . s:delimiter . '" contains=rubyBackslashEscape,rubySpaceEscape,' . s:group . ' nextgroup=@rubyModifier skipwhite'267 exe 'SynFold ''%'' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="\V%s' . s:delimiter . '" end="\V' . s:delimiter . '" skip="\V\\\\\|\\' . s:delimiter . '" contains=rubyBackslashEscape,' . s:group . ' nextgroup=@rubyModifier skipwhite'268 exe 'SynFold ''%'' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="\V%i' . s:delimiter . '" end="\V' . s:delimiter . '" skip="\V\\\\\|\\' . s:delimiter . '" contains=rubyBackslashEscape,rubySpaceEscape,' . s:group . ' nextgroup=@rubyModifier skipwhite'269 exe 'hi def link ' . s:group . ' rubyStringEscape'270endfor271 272unlet s:delimiter s:group s:names273" }}}2274 275SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%q{" end="}" skip="\\\\\|\\}" contains=rubyBackslashEscape,rubyCurlyBraceEscape,rubyNestedCurlyBraces276SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%q<" end=">" skip="\\\\\|\\>" contains=rubyBackslashEscape,rubyAngleBracketEscape,rubyNestedAngleBrackets277SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%q\[" end="\]" skip="\\\\\|\\\]" contains=rubyBackslashEscape,rubySquareBracketEscape,rubyNestedSquareBrackets278SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%q(" end=")" skip="\\\\\|\\)" contains=rubyBackslashEscape,rubyParenthesisEscape,rubyNestedParentheses279SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%q\z(\s\)" end="\z1" skip="\\\\\|\\\z1" contains=rubyBackslashEscape,rubySpaceEscape280 281SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%w{" end="}" skip="\\\\\|\\}" contains=rubyBackslashEscape,rubySpaceEscape,rubyCurlyBraceEscape,rubyNestedCurlyBraces282SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%w<" end=">" skip="\\\\\|\\>" contains=rubyBackslashEscape,rubySpaceEscape,rubyAngleBracketEscape,rubyNestedAngleBrackets283SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%w\[" end="\]" skip="\\\\\|\\\]" contains=rubyBackslashEscape,rubySpaceEscape,rubySquareBracketEscape,rubyNestedSquareBrackets284SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%w(" end=")" skip="\\\\\|\\)" contains=rubyBackslashEscape,rubySpaceEscape,rubyParenthesisEscape,rubyNestedParentheses285 286SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" contains=rubyBackslashEscape,rubyCurlyBraceEscape,rubyNestedCurlyBraces287SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" contains=rubyBackslashEscape,rubyAngleBracketEscape,rubyNestedAngleBrackets288SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" contains=rubyBackslashEscape,rubySquareBracketEscape,rubyNestedSquareBrackets289SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" contains=rubyBackslashEscape,rubyParenthesisEscape,rubyNestedParentheses290SynFold '%' syn region rubyString matchgroup=rubyPercentSymbolDelimiter start="%s\z(\s\)" end="\z1" skip="\\\\\|\\\z1" contains=rubyBackslashEscape,rubySpaceEscape291 292SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%i{" end="}" skip="\\\\\|\\}" contains=rubyBackslashEscape,rubySpaceEscape,rubyCurlyBraceEscape,rubyNestedCurlyBraces293SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%i<" end=">" skip="\\\\\|\\>" contains=rubyBackslashEscape,rubySpaceEscape,rubyAngleBracketEscape,rubyNestedAngleBrackets294SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%i\[" end="\]" skip="\\\\\|\\\]" contains=rubyBackslashEscape,rubySpaceEscape,rubySquareBracketEscape,rubyNestedSquareBrackets295SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%i(" end=")" skip="\\\\\|\\)" contains=rubyBackslashEscape,rubySpaceEscape,rubyParenthesisEscape,rubyNestedParentheses296 297" Generalized Double Quoted Strings, Array of Strings, Array of Symbols and Shell Command Output {{{1298SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="\%(\%(\w\|[^\x00-\x7F]\|]\)\s*\)\@<!%=" end="=" skip="\\\\\|\\=" contains=@rubyStringSpecial nextgroup=@rubyModifier skipwhite299SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial nextgroup=@rubyModifier skipwhite300SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial nextgroup=@rubyModifier skipwhite301SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces302SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets303SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets304SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses305SynFold '%' syn region rubyString matchgroup=rubyPercentStringDelimiter start="%[Qx]\z(\s\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial306 307SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%I\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial nextgroup=@rubyModifier skipwhite308SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%I{" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces309SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%I<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets310SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%I\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets311SynFold '%' syn region rubySymbol matchgroup=rubyPercentSymbolDelimiter start="%I(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses312 313" Here Documents {{{1314syn region rubyHeredocStart matchgroup=rubyHeredocDelimiter start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})"'`]\)\s\|\w\)\@<!<<[-~]\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop315 316syn region rubyHeredocStart matchgroup=rubyHeredocDelimiter start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})"'`]\)\s\|\w\)\@<!<<[-~]\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop317syn region rubyHeredocStart matchgroup=rubyHeredocDelimiter start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})"'`]\)\s\|\w\)\@<!<<[-~]\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop318syn region rubyHeredocStart matchgroup=rubyHeredocDelimiter start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})"'`]\)\s\|\w\)\@<!<<[-~]\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop319 320SynFold '<<' syn region rubyString start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})"'`]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyHeredocDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend321SynFold '<<' syn region rubyString start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})"'`]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyHeredocDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend322SynFold '<<' syn region rubyString start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})"'`]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyHeredocDelimiter end=+^\z1$+ contains=rubyHeredocStart keepend323SynFold '<<' syn region rubyString start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})"'`]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyHeredocDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend324 325SynFold '<<' syn region rubyString start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyHeredocDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend326SynFold '<<' syn region rubyString start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyHeredocDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend327SynFold '<<' syn region rubyString start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyHeredocDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart keepend328SynFold '<<' syn region rubyString start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([]})]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyHeredocDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend329 330" Module, Class, Method and Alias Declarations {{{1331syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,@rubyGlobalVariable nextgroup=rubyAliasDeclaration2 skipwhite332syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,@rubyGlobalVariable333syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable334syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyClassName,rubyScopeOperator nextgroup=rubySuperClassOperator skipwhite335syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyModuleName,rubyScopeOperator336 337syn match rubyMethodName "\<\%([_[:alpha:]]\|[^\x00-\x7F]\)\%([_[:alnum:]]\|[^\x00-\x7F]\)*[?!=]\=\%([[:alnum:]_.:?!=]\|[^\x00-\x7F]\)\@!" contained containedin=rubyMethodDeclaration338syn match rubyMethodName "\%(\s\|^\)\@1<=\%([_[:alpha:]]\|[^\x00-\x7F]\)\%([_[:alnum:]]\|[^\x00-\x7F]\)*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2339syn match rubyMethodName "\%([[:space:].]\|^\)\@1<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration340 341syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyMethodName342 343" Keywords {{{1344" TODO: reorganise345syn match rubyControl "\%#=1\<\%(break\|in\|next\|redo\|retry\|return\)\>"346syn match rubyKeyword "\%#=1\<\%(super\|yield\)\>"347syn match rubyBoolean "\%#=1\<\%(true\|false\)\>[?!]\@!"348syn match rubyPseudoVariable "\%#=1\<\%(self\|nil\)\>[?!]\@!"349syn match rubyPseudoVariable "\%#=1\<__\%(ENCODING\|dir\|FILE\|LINE\|callee\|method\)__\>"350syn match rubyBeginEnd "\%#=1\<\%(BEGIN\|END\)\>"351 352" Expensive Mode {{{1353" Match 'end' with the appropriate opening keyword for syntax based folding354" and special highlighting of module/class/method definitions355if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")356 syn match rubyDefine "\<alias\>" nextgroup=rubyAliasDeclaration skipwhite skipnl357 syn match rubyDefine "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl358 syn match rubyDefine "\<undef\>" nextgroup=rubyMethodName skipwhite skipnl359 syn match rubyClass "\<class\>" nextgroup=rubyClassDeclaration,rubyEigenClassOperator skipwhite skipnl360 syn match rubyModule "\<module\>" nextgroup=rubyModuleDeclaration skipwhite skipnl361 362 SynFold 'def' syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine skip="\<end:\|\%(\<def\_s\+\)\@<=end\>" end="\<end\>" contains=ALLBUT,@rubyNotTop363 SynFold 'class' syn region rubyClassBlock start="\<class\>" matchgroup=rubyClass skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop364 SynFold 'module' syn region rubyModuleBlock start="\<module\>" matchgroup=rubyModule skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop365 366 " endless def367 syn match rubyDefine "\<def\s\+\ze[^[:space:];#(]\+\%(\s\+\|\s*(.*)\s*\)=" nextgroup=rubyMethodDeclaration skipwhite368 369 " modifiers370 syn match rubyLineContinuation "\\$" nextgroup=@rubyModifier skipwhite skipnl371 syn match rubyConditionalModifier "\<\%(if\|unless\)\>"372 syn match rubyRepeatModifier "\<\%(while\|until\)\>"373 syn match rubyRescueModifier "\<rescue\>"374 375 syn cluster rubyModifier contains=rubyConditionalModifier,rubyRepeatModifier,rubyRescueModifier376 377 SynFold 'do' syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop378 379 " curly bracket block or hash literal380 SynFold '{' syn region rubyCurlyBlock matchgroup=rubyCurlyBlockDelimiter start="{" end="}" contains=ALLBUT,@rubyNotTop381 SynFold '[' syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\%(\w\|[^\x00-\x7F]\)[?!]\=\|[]})]\)\@2<!\[" end="]" contains=ALLBUT,@rubyNotTop382 383 " statements without 'do'384 SynFold 'begin' syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop385 SynFold 'case' syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop386 387 SynFold 'if' syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\<then\s\|\%(\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop388 389 syn match rubyConditional "\<\%(then\|else\|when\)\>" contained containedin=rubyCaseExpression390 syn match rubyConditional "\<\%(then\|else\|elsif\)\>" contained containedin=rubyConditionalExpression391 392 syn match rubyExceptionHandler "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>" contained containedin=rubyBlockExpression,rubyDoBlock393 syn match rubyExceptionHandler2 "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>" contained containedin=rubyModuleBlock,rubyClassBlock,rubyMethodBlock394 syn cluster rubyExceptionHandler contains=rubyExceptionHandler,rubyExceptionHandler2395 396 " statements with optional 'do'397 syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\@<![!?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\<do\>" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyNotTop398 399 SynFold 'for' syn region rubyRepeatExpression start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\@<![!?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine400 401else402 syn match rubyControl "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl403 syn match rubyControl "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl404 syn match rubyControl "\<module\>" nextgroup=rubyModuleDeclaration skipwhite skipnl405 syn match rubyControl "\<\%(case\|begin\|do\|for\|if\|unless\|while\|until\|else\|elsif\|rescue\|ensure\|then\|when\|end\)\>"406 syn match rubyKeyword "\<\%(alias\|undef\)\>"407endif408 409if !exists("ruby_minlines")410 let ruby_minlines = 500411endif412exe "syn sync minlines=" . ruby_minlines413 414" Special Methods {{{1415if !exists("ruby_no_special_methods")416 syn match rubyAccess "\<\%(public\|protected\|private\)\>" " use re=2417 syn match rubyAccess "\%#=1\<\%(public\|private\)_class_method\>"418 syn match rubyAccess "\%#=1\<\%(public\|private\)_constant\>"419 syn match rubyAccess "\%#=1\<module_function\>"420 syn match rubyAttribute "\%#=1\%(\%(^\|;\)\s*\)\@<=attr\>\%(\s*[.=]\)\@!" " attr is a common variable name421 syn match rubyAttribute "\%#=1\<attr_\%(accessor\|reader\|writer\)\>"422 syn match rubyControl "\%#=1\<\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>"423 syn match rubyEval "\%#=1\<eval\>"424 syn match rubyEval "\%#=1\<\%(class\|instance\|module\)_eval\>"425 syn match rubyException "\%#=1\<\%(raise\|fail\|catch\|throw\)\>"426 syn match rubyInclude "\%#=1\<\%(autoload\|gem\|load\|require\%(_relative\)\=\)\>"427 syn match rubyKeyword "\%#=1\<\%(callcc\|caller\|lambda\|proc\)\>"428 syn match rubyMacro "\%#=1\<\%(extend\|include\|prepend\|refine\|using\)\>"429 syn match rubyMacro "\%#=1\<\%(alias\|define\|define_singleton\|remove\|undef\)_method\>"430endif431 432" Comments and Documentation {{{1433syn match rubySharpBang "\%^#!.*" display434syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained435syn match rubyEncoding "[[:alnum:]-_]\+" contained display436syn match rubyMagicComment "\c\%<3l#\s*\zs\%(coding\|encoding\):" contained nextgroup=rubyEncoding skipwhite437syn match rubyMagicComment "\c\%<10l#\s*\zs\%(frozen[-_]string[-_]literal\|warn[-_]indent\|warn[-_]past[-_]scope\):" contained nextgroup=rubyBoolean skipwhite438syn match rubyMagicComment "\c\%<10l#\s*\zs\%(shareable[-_]constant[-_]value\):" contained nextgroup=rubyEncoding skipwhite439syn match rubyComment "#.*" contains=@rubyCommentSpecial,rubySpaceError,@Spell440 441syn cluster rubyCommentSpecial contains=rubySharpBang,rubyTodo,rubyMagicComment442syn cluster rubyCommentNotTop contains=@rubyCommentSpecial,rubyEncoding443 444if !exists("ruby_no_comment_fold") && s:foldable('#')445 syn region rubyMultilineComment start="^\s*#.*\n\%(^\s*#\)\@=" end="^\s*#.*\n\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend446 syn region rubyDocumentation start="^=begin\ze\%(\s.*\)\=$" end="^=end\%(\s.*\)\=$" contains=rubySpaceError,rubyTodo,@Spell fold447else448 syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell449endif450 451" {{{1 Useless Line Continuations452syn match rubyUselessLineContinuation "\%([.:,;{([<>~\*%&^|+=-]\|%(\%(\w\|[^\x00-\x7F]\)\@1<![?!]\)\s*\zs\\$" nextgroup=rubyUselessLineContinuation skipwhite skipempty453syn match rubyUselessLineContinuation "\\$" nextgroup=rubyUselessLineContinuation skipwhite skipempty contained454 455" Keyword Nobbling {{{1456" prevent methods with keyword names being highlighted as keywords when called457syn match rubyKeywordAsMethod "\%(\%(\.\@1<!\.\)\|&\.\|::\)\_s*\%([_[:lower:]][_[:alnum:]]*\|\%(BEGIN\|END\)\>\)" transparent contains=rubyDotOperator,rubyScopeOperator458 459" Bang and Predicate Methods and Operators {{{1460syn match rubyBangPredicateMethod "\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]"461 462if !exists("ruby_no_special_methods")463 syn match rubyControl "\%#=1\<exit!" display464endif465syn match rubyDefinedOperator "\%#=1\<defined?" display466 467" 1.9-style Hash Keys and Keyword Parameters {{{1468syn match rubySymbol "\%(\w\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1 contained containedin=rubyBlockParameterList,rubyCurlyBlock469syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="he=e-1470syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="hs=s+1,he=e-1471syn match rubySingleQuoteSymbolDelimiter "'" contained472syn match rubySymbol "'\%(\\.\|[^']\)*'::\@!"he=e-1 contains=rubyQuoteEscape,rubyBackslashEscape,rubySingleQuoteSymbolDelimiter473syn match rubyDoubleQuoteSymbolDelimiter "\"" contained474syn match rubySymbol "\"\%(\\.\|[^\"]\)*\"::\@!"he=e-1 contains=@rubyStringSpecial,rubyDoubleQuoteSymbolDelimiter475 476" __END__ Directive {{{1477SynFold '__END__' syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$"478 479" Default Highlighting {{{1480hi def link rubyClass rubyDefine481hi def link rubyModule rubyDefine482hi def link rubyExceptionHandler2 rubyDefine483hi def link rubyDefine Define484hi def link rubyAccess rubyMacro485hi def link rubyAttribute rubyMacro486hi def link rubyMacro Macro487hi def link rubyMethodName rubyFunction488hi def link rubyFunction Function489hi def link rubyConditional Conditional490hi def link rubyConditionalModifier rubyConditional491hi def link rubyExceptionHandler rubyConditional492hi def link rubyRescueModifier rubyExceptionHandler493hi def link rubyRepeat Repeat494hi def link rubyRepeatModifier rubyRepeat495hi def link rubyOptionalDo rubyRepeat496hi def link rubyControl Statement497hi def link rubyInclude Include498hi def link rubyInteger Number499hi def link rubyCharacter Character500hi def link rubyFloat Float501hi def link rubyBoolean Boolean502hi def link rubyException Exception503if !exists("ruby_no_identifiers")504 hi def link rubyIdentifier Identifier505else506 hi def link rubyIdentifier NONE507endif508hi def link rubyClassVariable rubyIdentifier509hi def link rubyConstant Type510hi def link rubyClassName rubyConstant511hi def link rubyModuleName rubyConstant512hi def link rubyGlobalVariable rubyIdentifier513hi def link rubyInstanceVariable rubyIdentifier514hi def link rubyPredefinedIdentifier rubyIdentifier515hi def link rubyPredefinedConstant rubyPredefinedIdentifier516hi def link rubyPredefinedVariable rubyPredefinedIdentifier517hi def link rubySymbol Constant518hi def link rubyKeyword Keyword519 520hi def link rubyOperator Operator521hi def link rubyDefinedOperator rubyOperator522hi def link rubyEnglishBooleanOperator rubyOperator523if exists("ruby_operators")524 hi def link rubyTernaryOperator rubyOperator525 hi def link rubyArithmeticOperator rubyOperator526 hi def link rubyComparisonOperator rubyOperator527 hi def link rubyBitwiseOperator rubyOperator528 hi def link rubyBooleanOperator rubyOperator529 hi def link rubyRangeOperator rubyOperator530 hi def link rubyAssignmentOperator rubyOperator531 hi def link rubyEqualityOperator rubyOperator532endif533 534if exists("ruby_pseudo_operators")535 hi def link rubyPseudoOperator Special536 hi def link rubyDotOperator rubyPseudoOperator537 hi def link rubyScopeOperator rubyPseudoOperator538 hi def link rubySuperClassOperator rubyPseudoOperator539 hi def link rubyEigenClassOperator rubyPseudoOperator540 hi def link rubyLambdaOperator rubyPseudoOperator541 hi def link rubyDoubleSplatOperator rubyPseudoOperator542 hi def link rubySplatOperator rubyPseudoOperator543 hi def link rubyProcOperator rubyPseudoOperator544endif545 546hi def link rubyBeginEnd Statement547hi def link rubyEval Statement548hi def link rubyPseudoVariable Constant549hi def link rubyCapitalizedMethod NONE550 551hi def link rubyComment Comment552hi def link rubyEncoding Constant553hi def link rubyMagicComment SpecialComment554hi def link rubyData Comment555hi def link rubyDataDirective Delimiter556hi def link rubyDocumentation Comment557hi def link rubyTodo Todo558 559hi def link rubyBackslashEscape rubyStringEscape560hi def link rubyQuoteEscape rubyStringEscape561hi def link rubySpaceEscape rubyStringEscape562hi def link rubyParenthesisEscape rubyStringEscape563hi def link rubyCurlyBraceEscape rubyStringEscape564hi def link rubyAngleBracketEscape rubyStringEscape565hi def link rubySquareBracketEscape rubyStringEscape566hi def link rubyStringEscape Special567 568hi def link rubyInterpolationDelimiter Delimiter569hi def link rubySharpBang PreProc570hi def link rubyStringDelimiter Delimiter571hi def link rubyHeredocDelimiter rubyStringDelimiter572hi def link rubyPercentRegexpDelimiter rubyRegexpDelimiter573hi def link rubyPercentStringDelimiter rubyStringDelimiter574hi def link rubyPercentSymbolDelimiter rubySymbolDelimiter575hi def link rubyDoubleQuoteSymbolDelimiter rubySymbolDelimiter576hi def link rubySingleQuoteSymbolDelimiter rubySymbolDelimiter577hi def link rubyRegexpDelimiter rubyStringDelimiter578hi def link rubySymbolDelimiter rubySymbol579hi def link rubyString String580hi def link rubyRegexpEscape rubyRegexpSpecial581hi def link rubyRegexpQuantifier rubyRegexpSpecial582hi def link rubyRegexpAnchor rubyRegexpSpecial583hi def link rubyRegexpDot rubyRegexpCharClass584hi def link rubyRegexpCharClass rubyRegexpSpecial585hi def link rubyRegexpIntersection rubyRegexpSpecial586hi def link rubyRegexpSpecial Special587hi def link rubyRegexpComment Comment588hi def link rubyRegexp rubyString589 590hi def link rubyError Error591if exists("ruby_line_continuation_error")592 hi def link rubyUselessLineContinuation rubyError593endif594hi def link rubyGlobalVariableError rubyError595hi def link rubySpaceError rubyError596 597" Postscript {{{1598let b:current_syntax = "ruby"599 600let &cpo = s:cpo_sav601unlet! s:cpo_sav602 603delc SynFold604 605" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:606 