Permalink
Browse files

improve highlighting of the optional 'do' in looping constructs

  • Loading branch information...
1 parent 29ab88d commit bfcc936a287ed9014d6a2c61bc2505079efbf271 @dkearns dkearns committed Aug 17, 2005
Showing with 6 additions and 5 deletions.
  1. +3 −0 ChangeLog
  2. +3 −5 syntax/ruby.vim
View
3 ChangeLog
@@ -1,5 +1,8 @@
2005-08-17 Doug Kearns <djkea2@gus.gscit.monash.edu.au>
+ * syntax/ruby.vim: improve highlighting of the optional 'do' in
+ looping constructs
+
* syntax/ruby.vim: remove accidentally added 'keepend' from
rubyOptDoBlock
View
8 syntax/ruby.vim
@@ -148,7 +148,7 @@ if !exists("ruby_no_expensive")
syn match rubyControl "\<\%(if\|unless\|while\|until\)\>" display
" *do* requiring *end*
- syn region rubyDoBlock matchgroup=rubyControl start="\%(\<\%(for\|until\|while\)\s.*\s\)\@<!do\>" end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
+ syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
" *{* requiring *}*
syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
@@ -157,10 +157,8 @@ if !exists("ruby_no_expensive")
syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/]\)\s*\zs\%(if\|unless\)\>" end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
" statement with optional *do*
- syn region rubyOptDoBlock matchgroup=rubyControl start="\<for\>" start="\%(^\|;\)\s*\zs\%(while\|until\)\>" end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
-
- " optional *do*
- syn match rubyControl "\%(\<\%(for\|until\|while\)\s.*\s\)\@<=\%(do\|:\)\>"
+ syn region rubyOptDoLine matchgroup=rubyControl start="\<\%(for\|until\|while\)\>" end="\%(\<do\>\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo
+ syn region rubyOptDoBlock start="\<\%(for\|until\|while\)\>" matchgroup=rubyControl end="\<end\>" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold
if !exists("ruby_minlines")
let ruby_minlines = 50

0 comments on commit bfcc936

Please sign in to comment.