[PATCH] Improved iterator matching, show whitespace errors

Doug Kearns dougkearns at gmail.com
Wed Mar 30 09:32:31 EST 2005


On Tue, Feb 08, 2005 at 08:31:48PM +0100, Tilman Sauerbeck wrote:
> Hi,
> I sent these two patches to Doug Kearns 1-2 weeks ago, but I didn't get
> any feedback, so I'm posting them here now :)
> 
> ruby.vim-iterator.diff improves the regex for iterators, so that it now
> correctly recognizes and hilights |(foo, bar)| for example.

<snip>

> Index: syntax/ruby.vim
> ===================================================================
> RCS file: /var/cvs/vim-ruby/vim-ruby/syntax/ruby.vim,v
> retrieving revision 1.39
> diff -u -r1.39 ruby.vim
> --- syntax/ruby.vim	27 Nov 2004 14:44:37 -0000	1.39
> +++ syntax/ruby.vim	29 Jan 2005 21:13:33 -0000
> @@ -59,7 +59,7 @@
>    syn match  rubySymbol			":\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
>    syn match  rubySymbol			":\@<!:\%(\$\|@@\=\)\=\h\w*[?!=]\="
>    syn region rubySymbol			start=":\@<!:\"" end="\"" skip="\\\\\|\\\""
> -  syn match  rubyIterator		"|[ ,a-zA-Z0-9_*]\+|"	display
> +  syn match  rubyIterator		"|[ ,a-zA-Z0-9_*()]\+|" display

What if we make it a little more constrained with something like:

syn match  rubyIterator  "|[ ,a-zA-Z0-9_*]\+|"                display
syn match  rubyIterator  "|\s*(\s*[ ,a-zA-Z0-9_*]\+\s*)\s*|"  display

>    syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\_`~1-9]#
>    syn match rubyPredefinedVariable "$-[0FIKadilpvw]"									display

<snip>

Regards,
Doug


More information about the vim-ruby-devel mailing list