From 30c6aee79f739cf9d6c5f7052a376c25b695b482 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Sat, 21 Apr 2012 12:25:00 +0300 Subject: [PATCH] More comments on parsing |(a, b)| --- indent/ruby.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/indent/ruby.vim b/indent/ruby.vim index 9f47670f..fe91518d 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -92,6 +92,14 @@ let s:continuation_regex = let s:bracket_continuation_regex = '\%([({[]\)\s*\%(#.*\)\=$' " Regex that defines blocks. +" +" Note that there's a slight problem with this regex and s:continuation_regex. +" Code like this will be matched by both: +" +" method_call do |(a, b)| +" +" The reason is that the pipe matches a hanging "|" operator. +" let s:block_regex = \ '\%(\\|{\)\s*\%(|\s*(\=\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(\=\s*[*@&]\=\h\w*)\=\)*|\)\=\s*\%(#.*\)\=$'