PATCH: reorder identifier syntax matching

Doug Kearns dougkearns at gmail.com
Sat Jul 30 11:17:21 EDT 2005


This reorders the identifier matching so that those containing some of
the more unusual predefined identifiers, such as $_, will match properly
without having to mess around with 'iskeyword'.

Regards,
Doug 


Index: syntax/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/syntax/ruby.vim,v
retrieving revision 1.48
diff -u -r1.48 ruby.vim
--- syntax/ruby.vim	28 Jul 2005 06:12:33 -0000	1.48
+++ syntax/ruby.vim	30 Jul 2005 14:51:03 -0000
@@ -68,17 +68,6 @@
 syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
 
 if !exists("ruby_no_identifiers")
-  syn match  rubyConstant		"\%(::\)\=\zs\u\w*"	display
-  syn match  rubyClassVariable		"@@\h\w*"		display
-  syn match  rubyInstanceVariable	"@\h\w*"		display
-  syn match  rubyGlobalVariable		"$\%(\h\w*\|-.\)"
-  syn match  rubySymbol			":\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
-  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		"|\s*([ ,a-zA-Z0-9_*]\+)\s*|"	display
-
   syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\_`~1-9]#
   syn match rubyPredefinedVariable "$-[0FIKadilpvw]"									display
   syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>"					display
@@ -89,6 +78,17 @@
   "Obsolete Global Constants
   "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
   "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(NotImplementError\)\>"
+
+  syn match  rubyConstant		"\%(::\)\=\zs\u\w*"	display
+  syn match  rubyClassVariable		"@@\h\w*"		display
+  syn match  rubyInstanceVariable	"@\h\w*"		display
+  syn match  rubyGlobalVariable		"$\%(\h\w*\|-.\)"
+  syn match  rubySymbol			":\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
+  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		"|\s*([ ,a-zA-Z0-9_*]\+)\s*|"	display
 else
   syn match NONE +$['"]+
 endif


More information about the vim-ruby-devel mailing list