7
|
1 " Vim syntax file
|
529
|
2 " Language: Ruby
|
|
3 " Maintainer: Doug Kearns <djkea2 at gus.gscit.monash.edu.au>
|
|
4 " Info: $Id$
|
|
5 " URL: http://vim-ruby.sourceforge.net
|
|
6 " Anon CVS: See above site
|
|
7 " Licence: GPL (http://www.gnu.org)
|
|
8 " Disclaimer:
|
|
9 " This program is distributed in the hope that it will be useful,
|
|
10 " but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 " GNU General Public License for more details.
|
|
13 " ----------------------------------------------------------------------------
|
|
14 "
|
7
|
15 " Previous Maintainer: Mirko Nasato
|
|
16 " Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN)
|
529
|
17 " ----------------------------------------------------------------------------
|
7
|
18
|
|
19 " For version 5.x: Clear all syntax items
|
|
20 " For version 6.x: Quit when a syntax file was already loaded
|
|
21 if version < 600
|
|
22 syntax clear
|
|
23 elseif exists("b:current_syntax")
|
|
24 finish
|
|
25 endif
|
|
26
|
529
|
27 if has("folding") && exists("ruby_fold")
|
|
28 setlocal foldmethod=syntax
|
|
29 endif
|
7
|
30
|
529
|
31 if exists("ruby_space_errors")
|
|
32 if !exists("ruby_no_trail_space_error")
|
|
33 syn match rubySpaceError display excludenl "\s\+$"
|
|
34 endif
|
|
35 if !exists("ruby_no_tab_space_error")
|
|
36 syn match rubySpaceError display " \+\t"me=e-1
|
|
37 endif
|
7
|
38 endif
|
|
39
|
529
|
40 " Expression Substitution and Backslash Notation
|
|
41 syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
|
|
42 syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
|
|
43 syn match rubyInterpolation "#{[^}]*}" contained
|
|
44 syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained display
|
|
45 syn match rubyNoInterpolation "\\#{[^}]*}" contained
|
|
46 syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display
|
|
47
|
|
48 syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE
|
|
49
|
|
50 syn region rubyNestedParentheses start="(" end=")" skip="\\\\\|\\)" transparent contained contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape
|
|
51 syn region rubyNestedCurlyBraces start="{" end="}" skip="\\\\\|\\}" transparent contained contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape
|
|
52 syn region rubyNestedAngleBrackets start="<" end=">" skip="\\\\\|\\>" transparent contained contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape
|
|
53 syn region rubyNestedSquareBrackets start="\[" end="\]" skip="\\\\\|\\\]" transparent contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape
|
|
54
|
|
55 syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape
|
|
56 syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets
|
|
57
|
|
58 " Numbers and ASCII Codes
|
|
59 syn match rubyASCIICode "\w\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)"
|
|
60 syn match rubyInteger "\<0[xX]\x\+\%(_\x\+\)*\>" display
|
|
61 syn match rubyInteger "\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display
|
|
62 syn match rubyInteger "\<0[oO]\=\o\+\%(_\o\+\)*\>" display
|
|
63 syn match rubyInteger "\<0[bB][01]\+\%(_[01]\+\)*\>" display
|
|
64 syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display
|
|
65 syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display
|
7
|
66
|
529
|
67 " Identifiers
|
|
68 syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
|
|
69 syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent
|
|
70
|
|
71 syn match rubyConstant "\%(\%(\.\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\>\%(\s*(\)\@!"
|
|
72 syn match rubyClassVariable "@@\h\w*" display
|
|
73 syn match rubyInstanceVariable "@\h\w*" display
|
|
74 syn match rubyGlobalVariable "$\%(\h\w*\|-.\)"
|
|
75 syn match rubySymbol ":\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
|
|
76 syn match rubySymbol ":\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
|
|
77 syn match rubySymbol ":\@<!:\%(\$\|@@\=\)\=\h\w*[?!=]\="
|
|
78 syn region rubySymbol start=":\@<!:\"" end="\"" skip="\\\\\|\\\""
|
|
79 syn match rubyBlockParameter "\%(\%(\<do\>\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display
|
7
|
80
|
529
|
81 syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]#
|
532
|
82 syn match rubyPredefinedVariable "$_\>" display
|
|
83 syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display
|
|
84 syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display
|
|
85 syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display
|
529
|
86 syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!"
|
|
87 syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>\%(\s*(\)\@!"
|
|
88 syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!"
|
|
89 "Obsolete Global Constants
|
|
90 "syn match rubyPredefinedConstant "\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
|
|
91 "syn match rubyPredefinedConstant "\%(::\)\=\zs\%(NotImplementError\)\>"
|
|
92
|
|
93 " Normal Regular Expression
|
|
94 syn region rubyString matchgroup=rubyStringDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\)\|[\~=!|&(,[]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial
|
|
95 syn region rubyString matchgroup=rubyStringDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial
|
7
|
96
|
|
97 " Normal String and Shell Command Output
|
529
|
98 syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial
|
|
99 syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'"
|
|
100 syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial
|
|
101
|
|
102 " Generalized Regular Expression
|
|
103 syn region rubyString matchgroup=rubyStringDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomx]*" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
|
104 syn region rubyString matchgroup=rubyStringDelimiter start="%r{" end="}[iomx]*" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold
|
|
105 syn region rubyString matchgroup=rubyStringDelimiter start="%r<" end=">[iomx]*" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
|
106 syn region rubyString matchgroup=rubyStringDelimiter start="%r\[" end="\][iomx]*" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
|
|
107 syn region rubyString matchgroup=rubyStringDelimiter start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
|
7
|
108
|
529
|
109 " Generalized Single Quoted String, Symbol and Array of Strings
|
|
110 syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
|
111 syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape
|
|
112 syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
|
|
113 syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
|
|
114 syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
|
|
115
|
|
116 " Generalized Double Quoted String and Array of Strings and Shell Command Output
|
|
117 " Note: %= is not matched here as the beginning of a double quoted string
|
|
118 syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
|
119 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
|
120 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold
|
|
121 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
|
122 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
|
|
123 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
|
7
|
124
|
|
125 " Here Document
|
529
|
126 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<-\=\zs\%(\h\w*\)+ end=+$+ oneline contains=TOP
|
|
127 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<-\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=TOP
|
|
128 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<-\=\zs'\%([^']*\)'+ end=+$+ oneline contains=TOP
|
|
129 syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<-\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=TOP
|
7
|
130
|
529
|
131 syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<\z(\h\w*\)\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial nextgroup=rubyFunction fold keepend
|
|
132 syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<"\z([^"]*\)"\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial nextgroup=rubyFunction fold keepend
|
|
133 syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<'\z([^']*\)'\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart nextgroup=rubyFunction fold keepend
|
|
134 syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<`\z([^`]*\)`\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial nextgroup=rubyFunction fold keepend
|
|
135
|
|
136 syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<-\z(\h\w*\)\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial nextgroup=rubyFunction fold keepend
|
|
137 syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<-"\z([^"]*\)"\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial nextgroup=rubyFunction fold keepend
|
|
138 syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<-'\z([^']*\)'\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart nextgroup=rubyFunction fold keepend
|
|
139 syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<-`\z([^`]*\)`\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial nextgroup=rubyFunction fold keepend
|
|
140
|
|
141 if exists('main_syntax') && main_syntax == 'eruby'
|
|
142 let ruby_no_expensive = 1
|
|
143 end
|
7
|
144
|
|
145 " Expensive Mode - colorize *end* according to opening statement
|
|
146 if !exists("ruby_no_expensive")
|
529
|
147 syn region rubyFunction matchgroup=rubyDefine start="\<def\s\+" end="\ze\%(\s\|(\|;\|$\)" oneline
|
|
148 syn region rubyClass matchgroup=rubyDefine start="\<class\s\+" end="\ze\%(\s\|<\|;\|$\)" oneline
|
|
149 syn match rubyDefine "\<class\ze<<"
|
|
150 syn region rubyModule matchgroup=rubyDefine start="\<module\s\+" end="\ze\%(\s\|;\|$\)" oneline
|
7
|
151
|
529
|
152 syn region rubyBlock start="\<def\>" matchgroup=rubyDefine end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyFunction fold
|
|
153 syn region rubyBlock start="\<class\>" matchgroup=rubyDefine end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyClass fold
|
|
154 syn region rubyBlock start="\<module\>" matchgroup=rubyDefine end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyModule fold
|
7
|
155
|
529
|
156 " modifiers
|
|
157 syn match rubyControl "\<\%(if\|unless\|while\|until\)\>" display
|
7
|
158
|
|
159 " *do* requiring *end*
|
529
|
160 syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
|
7
|
161
|
|
162 " *{* requiring *}*
|
529
|
163 syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
|
7
|
164
|
|
165 " statements without *do*
|
529
|
166 syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\)\s*\zs\%(if\|unless\)\>" end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
|
7
|
167
|
|
168 " statement with optional *do*
|
532
|
169 syn region rubyOptDoLine matchgroup=rubyControl start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%!&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" end="\%(\<do\>\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo
|
|
170 syn region rubyOptDoBlock start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyControl end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold
|
7
|
171
|
|
172 if !exists("ruby_minlines")
|
|
173 let ruby_minlines = 50
|
|
174 endif
|
|
175 exec "syn sync minlines=" . ruby_minlines
|
|
176
|
529
|
177 else
|
|
178 syn region rubyFunction matchgroup=rubyControl start="\<def\s\+" end="\ze\%(\s\|(\|;\|$\)" oneline
|
|
179 syn region rubyClass matchgroup=rubyControl start="\<class\s\+" end="\ze\%(\s\|<\|;\|$\)" oneline
|
|
180 syn match rubyControl "\<class\ze<<"
|
|
181 syn region rubyModule matchgroup=rubyControl start="\<module\s\+" end="\ze\%(\s\|;\|$\)" oneline
|
7
|
182 syn keyword rubyControl case begin do for if unless while until end
|
529
|
183 endif
|
7
|
184
|
|
185 " Keywords
|
529
|
186 " Note: the following keywords have already been defined:
|
|
187 " begin case class def do end for if module unless until while
|
|
188 syn keyword rubyControl and break else elsif ensure in next not or redo rescue retry return then when
|
|
189 syn match rubyOperator "\<defined?" display
|
|
190 syn keyword rubyKeyword alias super undef yield
|
|
191 syn keyword rubyBoolean true false
|
|
192 syn keyword rubyPseudoVariable nil self __FILE__ __LINE__
|
|
193 syn keyword rubyBeginEnd BEGIN END
|
|
194
|
|
195 " Special Methods
|
|
196 if !exists("ruby_no_special_methods")
|
|
197 syn keyword rubyAccess public protected private
|
|
198 syn keyword rubyAttribute attr attr_accessor attr_reader attr_writer
|
532
|
199 syn match rubyControl "\<\%(exit!\|\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>\)"
|
529
|
200 syn keyword rubyEval eval class_eval instance_eval module_eval
|
|
201 syn keyword rubyException raise fail catch throw
|
|
202 syn keyword rubyInclude autoload extend include load require
|
|
203 syn keyword rubyKeyword callcc caller lambda proc
|
|
204 endif
|
7
|
205
|
|
206 " Comments and Documentation
|
529
|
207 syn match rubySharpBang "\%^#!.*" display
|
|
208 syn keyword rubyTodo FIXME NOTE TODO XXX contained
|
|
209 syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell
|
|
210 syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubySpaceError,rubyTodo,@Spell fold
|
7
|
211
|
529
|
212 " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver
|
|
213 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|and\|begin\|break\|case\|class\|def\|defined\|do\|else\)\>" transparent contains=NONE
|
|
214 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|in\|module\|next\|nil\)\>" transparent contains=NONE
|
|
215 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(not\|or\|redo\|rescue\|retry\|return\|self\|super\|then\|true\)\>" transparent contains=NONE
|
|
216 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|BEGIN\|END\|__FILE__\|__LINE__\)\>" transparent contains=NONE
|
|
217
|
|
218 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|attr\|attr_accessor\|attr_reader\)\>" transparent contains=NONE
|
|
219 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(attr_writer\|autoload\|callcc\|catch\|caller\)\>" transparent contains=NONE
|
|
220 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(eval\|class_eval\|instance_eval\|module_eval\|exit\)\>" transparent contains=NONE
|
|
221 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fail\|fork\|include\|lambda\)\>" transparent contains=NONE
|
|
222 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(load\|loop\|private\|proc\|protected\)\>" transparent contains=NONE
|
|
223 syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(public\|require\|raise\|throw\|trap\)\>" transparent contains=NONE
|
7
|
224
|
|
225 " __END__ Directive
|
529
|
226 syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" fold
|
7
|
227
|
|
228 " Define the default highlighting.
|
|
229 " For version 5.7 and earlier: only when not done already
|
|
230 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
231 if version >= 508 || !exists("did_ruby_syntax_inits")
|
|
232 if version < 508
|
|
233 let did_ruby_syntax_inits = 1
|
|
234 command -nargs=+ HiLink hi link <args>
|
|
235 else
|
|
236 command -nargs=+ HiLink hi def link <args>
|
|
237 endif
|
|
238
|
|
239 HiLink rubyDefine Define
|
|
240 HiLink rubyFunction Function
|
|
241 HiLink rubyControl Statement
|
|
242 HiLink rubyInclude Include
|
529
|
243 HiLink rubyInteger Number
|
|
244 HiLink rubyASCIICode rubyInteger
|
|
245 HiLink rubyFloat Float
|
|
246 HiLink rubyBoolean rubyPseudoVariable
|
7
|
247 HiLink rubyException Exception
|
529
|
248 HiLink rubyClass Type
|
|
249 HiLink rubyModule Type
|
|
250 if !exists("ruby_no_identifiers")
|
|
251 HiLink rubyIdentifier Identifier
|
|
252 else
|
|
253 HiLink rubyIdentifier NONE
|
|
254 endif
|
7
|
255 HiLink rubyClassVariable rubyIdentifier
|
|
256 HiLink rubyConstant rubyIdentifier
|
|
257 HiLink rubyGlobalVariable rubyIdentifier
|
529
|
258 HiLink rubyBlockParameter rubyIdentifier
|
7
|
259 HiLink rubyInstanceVariable rubyIdentifier
|
|
260 HiLink rubyPredefinedIdentifier rubyIdentifier
|
|
261 HiLink rubyPredefinedConstant rubyPredefinedIdentifier
|
|
262 HiLink rubyPredefinedVariable rubyPredefinedIdentifier
|
|
263 HiLink rubySymbol rubyIdentifier
|
|
264 HiLink rubyKeyword Keyword
|
529
|
265 HiLink rubyOperator Operator
|
7
|
266 HiLink rubyBeginEnd Statement
|
529
|
267 HiLink rubyAccess Statement
|
|
268 HiLink rubyAttribute Statement
|
|
269 HiLink rubyEval Statement
|
|
270 HiLink rubyPseudoVariable Constant
|
7
|
271
|
|
272 HiLink rubyComment Comment
|
|
273 HiLink rubyData Comment
|
|
274 HiLink rubyDataDirective Delimiter
|
529
|
275 HiLink rubyDocumentation Comment
|
|
276 HiLink rubyEscape Special
|
|
277 HiLink rubyInterpolation Special
|
|
278 HiLink rubyNoInterpolation rubyString
|
|
279 HiLink rubySharpBang PreProc
|
|
280 HiLink rubyStringDelimiter Delimiter
|
|
281 HiLink rubyString String
|
|
282 HiLink rubyTodo Todo
|
|
283
|
|
284 HiLink rubyError Error
|
|
285 HiLink rubySpaceError rubyError
|
7
|
286
|
|
287 delcommand HiLink
|
|
288 endif
|
|
289
|
|
290 let b:current_syntax = "ruby"
|
|
291
|
529
|
292 " vim: nowrap sw=2 sts=2 ts=8 ff=unix:
|