Mercurial > vim
comparison runtime/syntax/ruby.vim @ 2225:dd5c1983e355 vim73
Runtime file updates.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 28 May 2010 20:54:39 +0200 |
parents | 7bc41231fbc7 |
children | a5352e73dc00 |
comparison
equal
deleted
inserted
replaced
2224:a0cce15dd2a9 | 2225:dd5c1983e355 |
---|---|
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 " Info: $Id: ruby.vim,v 1.152 2008/06/29 04:33:41 tpope Exp $ | 4 " Last Change: 2009 Dec 2 |
5 " URL: http://vim-ruby.rubyforge.org | 5 " URL: http://vim-ruby.rubyforge.org |
6 " Anon CVS: See above site | 6 " Anon CVS: See above site |
7 " Release Coordinator: Doug Kearns <dougkearns@gmail.com> | 7 " Release Coordinator: Doug Kearns <dougkearns@gmail.com> |
8 " ---------------------------------------------------------------------------- | 8 " ---------------------------------------------------------------------------- |
9 " | 9 " |
17 | 17 |
18 if has("folding") && exists("ruby_fold") | 18 if has("folding") && exists("ruby_fold") |
19 setlocal foldmethod=syntax | 19 setlocal foldmethod=syntax |
20 endif | 20 endif |
21 | 21 |
22 syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyTodo | 22 syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo |
23 | 23 |
24 if exists("ruby_space_errors") | 24 if exists("ruby_space_errors") |
25 if !exists("ruby_no_trail_space_error") | 25 if !exists("ruby_no_trail_space_error") |
26 syn match rubySpaceError display excludenl "\s\+$" | 26 syn match rubySpaceError display excludenl "\s\+$" |
27 endif | 27 endif |
36 syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\)" | 36 syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\)" |
37 syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop | 37 syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop |
38 endif | 38 endif |
39 | 39 |
40 " Expression Substitution and Backslash Notation | 40 " Expression Substitution and Backslash Notation |
41 syn match rubyStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display | 41 syn match rubyStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display |
42 syn match rubyStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display | 42 syn match rubyStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display |
43 syn match rubyQuoteEscape "\\[\\']" contained display | |
43 | 44 |
44 syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,@rubyNotTop | 45 syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,@rubyNotTop |
45 syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable,rubyPredefinedVariable | 46 syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable,rubyPredefinedVariable |
46 syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained | 47 syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained |
47 syn match rubyInterpolation "#\$\%(-\w\|\W\)" display contained contains=rubyInterpolationDelimiter,rubyPredefinedVariable,rubyInvalidVariable | 48 syn match rubyInterpolation "#\$\%(-\w\|\W\)" display contained contains=rubyInterpolationDelimiter,rubyPredefinedVariable,rubyInvalidVariable |
48 syn match rubyInterpolationDelimiter "#\ze\$\%(-\w\|\W\)" display contained | 49 syn match rubyInterpolationDelimiter "#\ze\$\%(-\w\|\W\)" display contained |
49 syn region rubyNoInterpolation start="\\#{" end="}" contained | 50 syn region rubyNoInterpolation start="\\#{" end="}" contained |
50 syn match rubyNoInterpolation "\\#{" display contained | 51 syn match rubyNoInterpolation "\\#{" display contained |
51 syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained | 52 syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained |
52 syn match rubyNoInterpolation "\\#\$\W" display contained | 53 syn match rubyNoInterpolation "\\#\$\W" display contained |
53 | 54 |
54 syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE | 55 syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE |
55 | 56 |
56 syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=rubyString end=")" transparent contained | 57 syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=rubyString end=")" transparent contained |
57 syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyString end="}" transparent contained | 58 syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyString end="}" transparent contained |
58 syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained | 59 syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained |
59 syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained | 60 syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained |
60 | 61 |
61 " These are mostly Oniguruma ready | 62 " These are mostly Oniguruma ready |
62 syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\)" end=")" contained | 63 syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\)" end=")" contained |
63 syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\)" end=")" contained transparent contains=@rubyRegexpSpecial | 64 syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\)" end=")" contained transparent contains=@rubyRegexpSpecial |
64 syn region rubyRegexpBrackets matchgroup=rubyRegexpCharClass start="\[\^\=" skip="\\\]" end="\]" contained transparent contains=rubyStringEscape,rubyRegexpEscape,rubyRegexpCharClass oneline | 65 syn region rubyRegexpBrackets matchgroup=rubyRegexpCharClass start="\[\^\=" skip="\\\]" end="\]" contained transparent contains=rubyStringEscape,rubyRegexpEscape,rubyRegexpCharClass oneline |
65 syn match rubyRegexpCharClass "\\[DdHhSsWw]" contained display | 66 syn match rubyRegexpCharClass "\\[DdHhSsWw]" contained display |
66 syn match rubyRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\):\]" contained | 67 syn match rubyRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\):\]" contained |
67 syn match rubyRegexpEscape "\\[].*?+^$|\\/(){}[]" contained display | 68 syn match rubyRegexpEscape "\\[].*?+^$|\\/(){}[]" contained |
68 syn match rubyRegexpQuantifier "[*?+][?+]\=" contained display | 69 syn match rubyRegexpQuantifier "[*?+][?+]\=" contained display |
69 syn match rubyRegexpQuantifier "{\d\+\%(,\d*\)\=}?\=" contained display | 70 syn match rubyRegexpQuantifier "{\d\+\%(,\d*\)\=}?\=" contained display |
70 syn match rubyRegexpAnchor "[$^]\|\\[ABbGZz]" contained display | 71 syn match rubyRegexpAnchor "[$^]\|\\[ABbGZz]" contained display |
71 syn match rubyRegexpDot "\." contained display | 72 syn match rubyRegexpDot "\." contained display |
72 syn match rubyRegexpSpecial "|" contained display | 73 syn match rubyRegexpSpecial "|" contained display |
73 syn match rubyRegexpSpecial "\\[1-9]\d\=\d\@!" contained display | 74 syn match rubyRegexpSpecial "\\[1-9]\d\=\d\@!" contained display |
74 syn match rubyRegexpSpecial "\\k<\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\=>" contained display | 75 syn match rubyRegexpSpecial "\\k<\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\=>" contained display |
75 syn match rubyRegexpSpecial "\\k'\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\='" contained display | 76 syn match rubyRegexpSpecial "\\k'\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\='" contained display |
76 syn match rubyRegexpSpecial "\\g<\%([a-z_]\w*\|-\=\d\+\)>" contained display | 77 syn match rubyRegexpSpecial "\\g<\%([a-z_]\w*\|-\=\d\+\)>" contained display |
77 syn match rubyRegexpSpecial "\\g'\%([a-z_]\w*\|-\=\d\+\)'" contained display | 78 syn match rubyRegexpSpecial "\\g'\%([a-z_]\w*\|-\=\d\+\)'" contained display |
78 | 79 |
79 syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape | 80 syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape |
80 syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets | 81 syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets |
81 syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment | 82 syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment |
82 | 83 |
83 " Numbers and ASCII Codes | 84 " Numbers and ASCII Codes |
84 syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)" | 85 syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)" |
85 syn match rubyInteger "\<0[xX]\x\+\%(_\x\+\)*\>" display | 86 syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*\>" display |
86 syn match rubyInteger "\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display | 87 syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display |
87 syn match rubyInteger "\<0[oO]\=\o\+\%(_\o\+\)*\>" display | 88 syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*\>" display |
88 syn match rubyInteger "\<0[bB][01]\+\%(_[01]\+\)*\>" display | 89 syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*\>" display |
89 syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display | 90 syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display |
90 syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display | 91 syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display |
91 | 92 |
92 " Identifiers | 93 " Identifiers |
93 syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent | 94 syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent |
94 syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent | 95 syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent |
95 | 96 |
96 syn match rubyConstant "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=\%(\s*(\)\@!" | 97 syn match rubyConstant "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=\%(\s*(\)\@!" |
97 syn match rubyClassVariable "@@\h\w*" display | 98 syn match rubyClassVariable "@@\h\w*" display |
98 syn match rubyInstanceVariable "@\h\w*" display | 99 syn match rubyInstanceVariable "@\h\w*" display |
99 syn match rubyGlobalVariable "$\%(\h\w*\|-.\)" | 100 syn match rubyGlobalVariable "$\%(\h\w*\|-.\)" |
100 syn match rubySymbol "[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" | 101 syn match rubySymbol "[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" |
101 syn match rubySymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" | 102 syn match rubySymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" |
102 syn match rubySymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\h\w*" | 103 syn match rubySymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\h\w*" |
103 syn match rubySymbol "[]})\"':]\@<!:\h\w*\%([?!=]>\@!\)\=" | 104 syn match rubySymbol "[]})\"':]\@<!:\h\w*\%([?!=]>\@!\)\=" |
104 syn region rubySymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" | 105 syn match rubySymbol "\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1 |
105 syn region rubySymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold | 106 syn match rubySymbol "[]})\"':]\@<!\h\w*[!?]\=:\s\@="he=e-1 |
106 | 107 syn region rubySymbol start="[]})\"':]\@<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold |
107 syn match rubyBlockParameter "\h\w*" contained | 108 syn region rubySymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold |
108 syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter | 109 |
109 | 110 syn match rubyBlockParameter "\h\w*" contained |
110 syn match rubyInvalidVariable "$[^ A-Za-z_-]" | 111 syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter |
112 | |
113 syn match rubyInvalidVariable "$[^ A-Za-z_-]" | |
111 syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]# | 114 syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]# |
112 syn match rubyPredefinedVariable "$_\>" display | 115 syn match rubyPredefinedVariable "$_\>" display |
113 syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display | 116 syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display |
114 syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display | 117 syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display |
115 syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display | 118 syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display |
123 " Normal Regular Expression | 126 " Normal Regular Expression |
124 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial keepend fold | 127 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial keepend fold |
125 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold | 128 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold |
126 | 129 |
127 " Generalized Regular Expression | 130 " Generalized Regular Expression |
128 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold | 131 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold |
129 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold | 132 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold |
130 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold | 133 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold |
131 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold | 134 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold |
132 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold | 135 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold |
133 | 136 |
134 " Normal String and Shell Command Output | 137 " Normal String and Shell Command Output |
135 syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold | 138 syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold |
136 syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" fold | 139 syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold |
137 syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold | 140 syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold |
138 | 141 |
139 " Generalized Single Quoted String, Symbol and Array of Strings | 142 " Generalized Single Quoted String, Symbol and Array of Strings |
140 syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold | 143 syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold |
141 syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape | 144 syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape |
142 syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape | 145 syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape |
143 syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape | 146 syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape |
144 syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape | 147 syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape |
145 syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold | 148 syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold |
146 syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape | 149 syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape |
147 syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape | 150 syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape |
148 syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape | 151 syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape |
149 syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape | 152 syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape |
150 | 153 |
151 " Generalized Double Quoted String and Array of Strings and Shell Command Output | 154 " Generalized Double Quoted String and Array of Strings and Shell Command Output |
152 " Note: %= is not matched here as the beginning of a double quoted string | 155 " Note: %= is not matched here as the beginning of a double quoted string |
153 syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold | 156 syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold |
154 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold | 157 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold |
155 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold | 158 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold |
156 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold | 159 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold |
157 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold | 160 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold |
158 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold | 161 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold |
159 | 162 |
160 " Here Document | 163 " Here Document |
161 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs\%(\h\w*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop | 164 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs\%(\h\w*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop |
162 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop | 165 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop |
163 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop | 166 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop |
164 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop | 167 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop |
165 | 168 |
166 syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<\z(\h\w*\)\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend | 169 syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<\z(\h\w*\)\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend |
167 syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<"\z([^"]*\)"\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend | 170 syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<"\z([^"]*\)"\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend |
168 syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<'\z([^']*\)'\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart fold keepend | 171 syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<'\z([^']*\)'\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart fold keepend |
169 syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<`\z([^`]*\)`\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend | 172 syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<`\z([^`]*\)`\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend |
170 | 173 |
171 syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-\z(\h\w*\)\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend | 174 syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-\z(\h\w*\)\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend |
172 syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-"\z([^"]*\)"\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend | 175 syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-"\z([^"]*\)"\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend |
173 syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-'\z([^']*\)'\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend | 176 syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-'\z([^']*\)'\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend |
174 syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-`\z([^`]*\)`\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend | 177 syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-`\z([^`]*\)`\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend |
175 | 178 |
176 if exists('main_syntax') && main_syntax == 'eruby' | 179 if exists('main_syntax') && main_syntax == 'eruby' |
177 let b:ruby_no_expensive = 1 | 180 let b:ruby_no_expensive = 1 |
178 end | 181 end |
179 | 182 |
180 syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable nextgroup=rubyAliasDeclaration2 skipwhite | 183 syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable nextgroup=rubyAliasDeclaration2 skipwhite |
181 syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable | 184 syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable |
182 syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable | 185 syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable |
183 syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator | 186 syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator |
184 syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator | 187 syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator |
185 syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:].:?!=]\@!" contained containedin=rubyMethodDeclaration | 188 syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration |
186 syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 | 189 syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 |
187 syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration | 190 syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration |
188 | 191 |
189 syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter | 192 syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter |
193 | |
194 " Keywords | |
195 " Note: the following keywords have already been defined: | |
196 " begin case class def do end for if module unless until while | |
197 syn match rubyControl "\<\%(and\|break\|in\|next\|not\|or\|redo\|rescue\|retry\|return\)\>[?!]\@!" | |
198 syn match rubyOperator "\<defined?" display | |
199 syn match rubyKeyword "\<\%(super\|yield\)\>[?!]\@!" | |
200 syn match rubyBoolean "\<\%(true\|false\)\>[?!]\@!" | |
201 syn match rubyPseudoVariable "\<\%(nil\|self\|__FILE__\|__LINE__\)\>[?!]\@!" | |
202 syn match rubyBeginEnd "\<\%(BEGIN\|END\)\>[?!]\@!" | |
190 | 203 |
191 " Expensive Mode - match 'end' with the appropriate opening keyword for syntax | 204 " Expensive Mode - match 'end' with the appropriate opening keyword for syntax |
192 " based folding and special highlighting of module/class/method definitions | 205 " based folding and special highlighting of module/class/method definitions |
193 if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") | 206 if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") |
194 syn match rubyDefine "\<alias\>" nextgroup=rubyAliasDeclaration skipwhite skipnl | 207 syn match rubyDefine "\<alias\>" nextgroup=rubyAliasDeclaration skipwhite skipnl |
195 syn match rubyDefine "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl | 208 syn match rubyDefine "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl |
196 syn match rubyDefine "\<undef\>" nextgroup=rubyFunction skipwhite skipnl | 209 syn match rubyDefine "\<undef\>" nextgroup=rubyFunction skipwhite skipnl |
197 syn match rubyClass "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl | 210 syn match rubyClass "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl |
198 syn match rubyModule "\<module\>" nextgroup=rubyModuleDeclaration skipwhite skipnl | 211 syn match rubyModule "\<module\>" nextgroup=rubyModuleDeclaration skipwhite skipnl |
199 syn region rubyBlock start="\<def\>" matchgroup=rubyDefine end="\%(\<def\_s\+\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold | 212 |
200 syn region rubyBlock start="\<class\>" matchgroup=rubyClass end="\<end\>" contains=ALLBUT,@rubyNotTop fold | 213 syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine end="\%(\<def\_s\+\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold |
201 syn region rubyBlock start="\<module\>" matchgroup=rubyModule end="\<end\>" contains=ALLBUT,@rubyNotTop fold | 214 syn region rubyBlock start="\<class\>" matchgroup=rubyClass end="\<end\>" contains=ALLBUT,@rubyNotTop fold |
215 syn region rubyBlock start="\<module\>" matchgroup=rubyModule end="\<end\>" contains=ALLBUT,@rubyNotTop fold | |
202 | 216 |
203 " modifiers | 217 " modifiers |
204 syn match rubyConditionalModifier "\<\%(if\|unless\)\>" display | 218 syn match rubyConditionalModifier "\<\%(if\|unless\)\>" display |
205 syn match rubyRepeatModifier "\<\%(while\|until\)\>" display | 219 syn match rubyRepeatModifier "\<\%(while\|until\)\>" display |
206 | 220 |
207 syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold | 221 syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold |
208 " curly bracket block or hash literal | 222 " curly bracket block or hash literal |
209 syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyNotTop fold | 223 syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyNotTop fold |
210 syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop fold | 224 syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop fold |
211 | 225 |
212 " statements without 'do' | 226 " statements without 'do' |
213 syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold | 227 syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold |
214 syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold | 228 syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold |
215 syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold | 229 syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold |
216 | 230 |
217 syn match rubyConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=rubyCaseExpression | 231 syn match rubyConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=rubyCaseExpression |
218 syn match rubyConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=rubyConditionalExpression | 232 syn match rubyConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=rubyConditionalExpression |
233 | |
234 syn match rubyExceptional "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>[?!]\@!" contained containedin=rubyBlockExpression | |
235 syn match rubyMethodExceptional "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>[?!]\@!" contained containedin=rubyMethodBlock | |
219 | 236 |
220 " statements with optional 'do' | 237 " statements with optional 'do' |
221 syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyNotTop | 238 syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyNotTop |
222 syn region rubyRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine fold | 239 syn region rubyRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine fold |
223 | 240 |
225 let ruby_minlines = 50 | 242 let ruby_minlines = 50 |
226 endif | 243 endif |
227 exec "syn sync minlines=" . ruby_minlines | 244 exec "syn sync minlines=" . ruby_minlines |
228 | 245 |
229 else | 246 else |
230 syn match rubyControl "\<def\>[?!]\@!" nextgroup=rubyMethodDeclaration skipwhite skipnl | 247 syn match rubyControl "\<def\>[?!]\@!" nextgroup=rubyMethodDeclaration skipwhite skipnl |
231 syn match rubyControl "\<class\>[?!]\@!" nextgroup=rubyClassDeclaration skipwhite skipnl | 248 syn match rubyControl "\<class\>[?!]\@!" nextgroup=rubyClassDeclaration skipwhite skipnl |
232 syn match rubyControl "\<module\>[?!]\@!" nextgroup=rubyModuleDeclaration skipwhite skipnl | 249 syn match rubyControl "\<module\>[?!]\@!" nextgroup=rubyModuleDeclaration skipwhite skipnl |
233 syn match rubyControl "\<\%(case\|begin\|do\|for\|if\|unless\|while\|until\|else\|elsif\|then\|when\|end\)\>[?!]\@!" | 250 syn match rubyControl "\<\%(case\|begin\|do\|for\|if\|unless\|while\|until\|else\|elsif\|ensure\|then\|when\|end\)\>[?!]\@!" |
234 syn match rubyKeyword "\<\%(alias\|undef\)\>[?!]\@!" | 251 syn match rubyKeyword "\<\%(alias\|undef\)\>[?!]\@!" |
235 endif | 252 endif |
236 | |
237 " Keywords | |
238 " Note: the following keywords have already been defined: | |
239 " begin case class def do end for if module unless until while | |
240 syn match rubyControl "\<\%(and\|break\|ensure\|in\|next\|not\|or\|redo\|rescue\|retry\|return\)\>[?!]\@!" | |
241 syn match rubyOperator "\<defined?" display | |
242 syn match rubyKeyword "\<\%(super\|yield\)\>[?!]\@!" | |
243 syn match rubyBoolean "\<\%(true\|false\)\>[?!]\@!" | |
244 syn match rubyPseudoVariable "\<\%(nil\|self\|__FILE__\|__LINE__\)\>[?!]\@!" | |
245 syn match rubyBeginEnd "\<\%(BEGIN\|END\)\>[?!]\@!" | |
246 | 253 |
247 " Special Methods | 254 " Special Methods |
248 if !exists("ruby_no_special_methods") | 255 if !exists("ruby_no_special_methods") |
249 syn keyword rubyAccess public protected private module_function | 256 syn keyword rubyAccess public protected private module_function |
250 " attr is a common variable name | 257 " attr is a common variable name |
258 syn keyword rubyInclude autoload extend load require | 265 syn keyword rubyInclude autoload extend load require |
259 syn keyword rubyKeyword callcc caller lambda proc | 266 syn keyword rubyKeyword callcc caller lambda proc |
260 endif | 267 endif |
261 | 268 |
262 " Comments and Documentation | 269 " Comments and Documentation |
263 syn match rubySharpBang "\%^#!.*" display | 270 syn match rubySharpBang "\%^#!.*" display |
264 syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE XXX contained | 271 syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE XXX contained |
265 syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell | 272 syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell |
266 if !exists("ruby_no_comment_fold") | 273 if !exists("ruby_no_comment_fold") |
267 syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend | 274 syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend |
268 syn region rubyDocumentation start="^=begin\ze\%(\s.*\)\=$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell fold | 275 syn region rubyDocumentation start="^=begin\ze\%(\s.*\)\=$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell fold |
269 else | 276 else |
270 syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell | 277 syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell |
271 endif | 278 endif |
272 | 279 |
273 " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver | 280 " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver |
274 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|and\|begin\|break\|case\|class\|def\|defined\|do\|else\)\>" transparent contains=NONE | 281 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|and\|begin\|break\|case\|class\|def\|defined\|do\|else\)\>" transparent contains=NONE |
275 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|in\|module\|next\|nil\)\>" transparent contains=NONE | 282 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|in\|module\|next\|nil\)\>" transparent contains=NONE |
276 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(not\|or\|redo\|rescue\|retry\|return\|self\|super\|then\|true\)\>" transparent contains=NONE | 283 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(not\|or\|redo\|rescue\|retry\|return\|self\|super\|then\|true\)\>" transparent contains=NONE |
277 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|BEGIN\|END\|__FILE__\|__LINE__\)\>" transparent contains=NONE | 284 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|BEGIN\|END\|__FILE__\|__LINE__\)\>" transparent contains=NONE |
278 | 285 |
279 syn match rubyKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE | 286 syn match rubyKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE |
280 syn match rubyKeywordAsMethod "\<\%(if\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE | 287 syn match rubyKeywordAsMethod "\<\%(if\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE |
281 | 288 |
282 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|attr\|attr_accessor\|attr_reader\)\>" transparent contains=NONE | 289 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|attr\|attr_accessor\|attr_reader\)\>" transparent contains=NONE |
283 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(attr_writer\|autoload\|callcc\|catch\|caller\)\>" transparent contains=NONE | 290 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(attr_writer\|autoload\|callcc\|catch\|caller\)\>" transparent contains=NONE |
284 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(eval\|class_eval\|instance_eval\|module_eval\|exit\)\>" transparent contains=NONE | 291 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(eval\|class_eval\|instance_eval\|module_eval\|exit\)\>" transparent contains=NONE |
285 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fail\|fork\|include\|lambda\)\>" transparent contains=NONE | 292 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fail\|fork\|include\|lambda\)\>" transparent contains=NONE |
286 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(load\|loop\|private\|proc\|protected\)\>" transparent contains=NONE | 293 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(load\|loop\|private\|proc\|protected\)\>" transparent contains=NONE |
287 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(public\|require\|raise\|throw\|trap\)\>" transparent contains=NONE | 294 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(public\|require\|raise\|throw\|trap\)\>" transparent contains=NONE |
288 | 295 |
289 " __END__ Directive | 296 " __END__ Directive |
290 syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" fold | 297 syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" fold |
291 | 298 |
292 hi def link rubyClass rubyDefine | 299 hi def link rubyClass rubyDefine |
293 hi def link rubyModule rubyDefine | 300 hi def link rubyModule rubyDefine |
301 hi def link rubyMethodExceptional rubyDefine | |
294 hi def link rubyDefine Define | 302 hi def link rubyDefine Define |
295 hi def link rubyFunction Function | 303 hi def link rubyFunction Function |
296 hi def link rubyConditional Conditional | 304 hi def link rubyConditional Conditional |
297 hi def link rubyConditionalModifier rubyConditional | 305 hi def link rubyConditionalModifier rubyConditional |
306 hi def link rubyExceptional rubyConditional | |
298 hi def link rubyRepeat Repeat | 307 hi def link rubyRepeat Repeat |
299 hi def link rubyRepeatModifier rubyRepeat | 308 hi def link rubyRepeatModifier rubyRepeat |
300 hi def link rubyOptionalDo rubyRepeat | 309 hi def link rubyOptionalDo rubyRepeat |
301 hi def link rubyControl Statement | 310 hi def link rubyControl Statement |
302 hi def link rubyInclude Include | 311 hi def link rubyInclude Include |
332 hi def link rubyData Comment | 341 hi def link rubyData Comment |
333 hi def link rubyDataDirective Delimiter | 342 hi def link rubyDataDirective Delimiter |
334 hi def link rubyDocumentation Comment | 343 hi def link rubyDocumentation Comment |
335 hi def link rubyTodo Todo | 344 hi def link rubyTodo Todo |
336 | 345 |
346 hi def link rubyQuoteEscape rubyStringEscape | |
337 hi def link rubyStringEscape Special | 347 hi def link rubyStringEscape Special |
338 hi def link rubyInterpolationDelimiter Delimiter | 348 hi def link rubyInterpolationDelimiter Delimiter |
339 hi def link rubyNoInterpolation rubyString | 349 hi def link rubyNoInterpolation rubyString |
340 hi def link rubySharpBang PreProc | 350 hi def link rubySharpBang PreProc |
341 hi def link rubyRegexpDelimiter rubyStringDelimiter | 351 hi def link rubyRegexpDelimiter rubyStringDelimiter |