4242" Expression Substitution and Backslash Notation
4343syn match rubyEscape " \\\\\|\\ [abefnrstv]\|\\\o\{ 1,3}\|\\ x\x\{ 1,2}" contained display
4444syn match rubyEscape " \% (\\ M-\\ C-\|\\ C-\\ M-\|\\ M-\\ c\|\\ c\\ M-\|\\ c\|\\ C-\|\\ M-\)\% (\\\o\{ 1,3}\|\\ x\x\{ 1,2}\|\\\=\S\) " contained display
45- syn region rubyInterpolated matchgroup =rubyInterpolation start =" #{" end =" }" contains =TOP contained
45+ syn region rubyInterpolated matchgroup =rubyInterpolation start =" \\\@ <! #{" end =" }" contains =TOP contained
4646" syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained contains=rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable display
4747syn match rubyInterpolation " #\z e\% (\$\| @@\=\)\w\+ " contained display nextgroup =rubyClassVariable,rubyInstanceVariable,rubyGlobalVariable
4848syn region rubyNoInterpolation start =" \\ #{" end =" }" contained
@@ -149,12 +149,17 @@ if exists('main_syntax') && main_syntax == 'eruby'
149149 let b: ruby_no_expensive = 1
150150end
151151
152- syn match rubyMethodDeclaration " [_[:alnum:]@$][^[:space:];#(]*" contained contains =rubyFunction,rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable
153- syn match rubyClassDeclaration " [_[:alnum:]@$][^[:space:];#(]*" contained contains =rubyConstant
154- syn match rubyModuleDeclaration " [_[:alnum:]@$][^[:space:];#(]*" contained contains =rubyConstant
155- syn match rubyFunction " \< [_[:lower:]][_[:alnum:]]*[?!=]\= .\@ !" contained
152+ syn match rubyAliasDeclaration " [^[:space:];#.()]\+ " contained nextgroup =rubyAliasDeclaration2 skipwhite
153+ syn match rubyAliasDeclaration2 " [^[:space:];#.()]\+ " contained
154+ syn match rubyMethodDeclaration " [^[:space:];#(]\+ " contained contains =rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable
155+ syn match rubyClassDeclaration " [^[:space:];#(]\+ " contained contains =rubyConstant
156+ syn match rubyModuleDeclaration " [^[:space:];#(]\+ " contained contains =rubyConstant
157+ syn match rubyFunction " \< [_[:lower:]][_[:alnum:]]*[?!=]\=\.\@ !" contained containedin =rubyMethodDeclaration
158+ syn match rubyFunction " \% (\s\| ^\)\@ <=[_[:lower:]][_[:alnum:]]*[?!=]\=\% (\s\| $\)\@ =" contained containedin =rubyAliasDeclaration,rubyAliasDeclaration2
159+ syn match rubyFunction " \% ([[:space:].]\| ^\)\@ <=\% (\[\] =\=\|\*\*\| [+-]@\=\| [*/%|^~]\| <<\| >>\| [<>]=\=\| <=>\| ===\| =\~\)\% ([[:space:];#(]\| $\)\@ =" contained containedin =rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration
156160" Expensive Mode - colorize *end* according to opening statement
157161if ! exists (" b:ruby_no_expensive" ) && ! exists (" ruby_no_expensive" )
162+ syn match rubyDefine " \< alias\> " nextgroup =rubyAliasDeclaration skipwhite skipnl
158163 syn match rubyDefine " \< def\> " nextgroup =rubyMethodDeclaration skipwhite skipnl
159164 syn match rubyClass " \< class\> " nextgroup =rubyClassDeclaration skipwhite skipnl
160165 syn match rubyModule " \< module\> " nextgroup =rubyModuleDeclaration skipwhite skipnl
@@ -164,7 +169,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
164169
165170 " modifiers
166171 syn match rubyConditional " \<\% (if\| unless\)\> " display
167- syn match rubyLoop " \<\% (while\| until\)\> " display
172+ syn match rubyRepeat " \<\% (while\| until\)\> " display
168173
169174 " *do* requiring *end*
170175 syn region rubyDoBlock matchgroup =rubyControl start =" \< do\> " end =" \< end\> " contains =TOP fold
@@ -178,8 +183,8 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
178183 syn keyword rubyConditional else elsif then when
179184
180185 " statement with optional *do*
181- syn region rubyOptDoLine matchgroup =rubyLoop start =" \< for\> " start =" \% (\% (^\|\.\.\.\=\| [?:,;=([<>~\* /%&^|+-]\|\% (\< [_[:lower:]][_[:alnum:]]*\)\@ <![!=?]\)\s *\)\@ <=\<\% (until\| while\)\> " end="\% (\< do\>\| :\) " end="\z e\% (;\| $\) " oneline contains=TOP
182- syn region rubyOptDoBlock start =" \< for\> " start =" \% (\% (^\|\.\.\.\=\| [:,;([<>~\* /%&^|+-]\|\% (\< [_[:lower:]][_[:alnum:]]*\)\@ <![!=?]\)\s *\)\@ <=\<\% (until\| while\)\> " matchgroup=rubyLoop end="\< end\> " contains=TOP nextgroup=rubyOptDoLine fold
186+ syn region rubyOptDoLine matchgroup =rubyRepeat start =" \< for\> " start =" \% (\% (^\|\.\.\.\=\| [?:,;=([<>~\* /%&^|+-]\|\% (\< [_[:lower:]][_[:alnum:]]*\)\@ <![!=?]\)\s *\)\@ <=\<\% (until\| while\)\> " end="\% (\< do\>\| :\) " end="\z e\% (;\| $\) " oneline contains=TOP
187+ syn region rubyOptDoBlock start =" \< for\> " start =" \% (\% (^\|\.\.\.\=\| [:,;([<>~\* /%&^|+-]\|\% (\< [_[:lower:]][_[:alnum:]]*\)\@ <![!=?]\)\s *\)\@ <=\<\% (until\| while\)\> " matchgroup=rubyRepeat end="\< end\> " contains=TOP nextgroup=rubyOptDoLine fold
183188
184189 if ! exists (" ruby_minlines" )
185190 let ruby_minlines = 50
@@ -191,14 +196,15 @@ else
191196 syn match rubyControl " \< class\> " nextgroup =rubyClassDeclaration skipwhite skipnl
192197 syn match rubyControl " \< module\> " nextgroup =rubyModuleDeclaration skipwhite skipnl
193198 syn keyword rubyControl case begin do for if unless while until else elsif then when end
199+ syn keyword rubyKeyword alias
194200endif
195201
196202" Keywords
197203" Note: the following keywords have already been defined:
198204" begin case class def do end for if module unless until while
199205syn keyword rubyControl and break ensure in next not or redo rescue retry return
200206syn match rubyOperator " \< defined?" display
201- syn keyword rubyKeyword alias super undef yield
207+ syn keyword rubyKeyword super undef yield
202208syn keyword rubyBoolean true false
203209syn keyword rubyPseudoVariable nil self __FILE__ __LINE__
204210syn keyword rubyBeginEnd BEGIN END
@@ -257,7 +263,7 @@ if version >= 508 || !exists("did_ruby_syntax_inits")
257263 HiLink rubyDefine Define
258264 HiLink rubyFunction Function
259265 HiLink rubyConditional Conditional
260- HiLink rubyLoop Repeat
266+ HiLink rubyRepeat Repeat
261267 HiLink rubyControl Statement
262268 HiLink rubyInclude Include
263269 HiLink rubyInteger Number
0 commit comments