PATCH: reorder identifier syntax matching

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

PATCH: reorder identifier syntax matching

Doug Kearns
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
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: reorder identifier syntax matching

Doug Kearns
On Sun, Jul 31, 2005 at 01:17:21AM +1000, Doug Kearns wrote:
> 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'.

Scrap that... just make it a special case.
 
Regards,
Doug


Index: syntax/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/syntax/ruby.vim,v
retrieving revision 1.49
diff -u -r1.49 ruby.vim
--- syntax/ruby.vim 30 Jul 2005 15:22:23 -0000 1.49
+++ syntax/ruby.vim 1 Aug 2005 15:00:11 -0000
@@ -68,17 +68,6 @@
 syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
 
 if !exists("ruby_no_identifiers")
-  syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\_`~1-9]#
-  syn match rubyPredefinedVariable "$-[0FIKadilpvw]" display
-  syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display
-  syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display
-  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>" display
-  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>" display
-  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>" display
-  "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
@@ -89,6 +78,18 @@
   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 "$_\>" display
+  syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display
+  syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display
+  syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display
+  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>" display
+  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>" display
+  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>" display
+  "Obsolete Global Constants
+  "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
+  "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(NotImplementError\)\>"
 else
   syn match NONE +$['"]+
 endif
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel