Permalink
Browse files

Fix another problem with |(a, b)| blocks

Instead of matching a single "(" or ")" with the "\=" pattern, match as
many as possible with a "*". This is needed when the braces are nested:
|(a, (b, c)), d|
  • Loading branch information...
1 parent 30c6aee commit c39ccaaa7ad7cfc3eb7fe0b611dfce303c1a2429 @AndrewRadev AndrewRadev committed Apr 21, 2012
Showing with 6 additions and 1 deletion.
  1. +5 −0 etc/examples/indent/blocks.rb
  2. +1 −1 indent/ruby.vim
View
5 etc/examples/indent/blocks.rb
@@ -8,6 +8,11 @@
puts b
end
+proc do |(a, (b, c)), d|
+ puts a, b
+ puts c, d
+end
+
define_method "something" do |param|
if param == 42
do_something
View
2 indent/ruby.vim
@@ -101,7 +101,7 @@ let s:bracket_continuation_regex = '\%([({[]\)\s*\%(#.*\)\=$'
" The reason is that the pipe matches a hanging "|" operator.
"
let s:block_regex =
- \ '\%(\<do:\@!\>\|{\)\s*\%(|\s*(\=\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(\=\s*[*@&]\=\h\w*)\=\)*|\)\=\s*\%(#.*\)\=$'
+ \ '\%(\<do:\@!\>\|{\)\s*\%(|\s*(*\s*\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(*\s*[*@&]\=\h\w*\s*)*\s*\)*|\)\=\s*\%(#.*\)\=$'
" 2. Auxiliary Functions {{{1
" ======================

0 comments on commit c39ccaa

Please sign in to comment.