PATCH: link rubyIdentifier to NONE when ruby_no_identifiers is set
Doug Kearns
dougkearns at gmail.com
Thu Aug 11 09:17:15 EDT 2005
This links the rubyIdentifier syntax group to NONE when
ruby_no_identifiers is set. Too much of the highlighting now relies on
the identifier matches to use the current implementation.
Nikolai, you're the only one I've come across who actually uses this so
let me know if there are any problems.
Regards,
Doug
Index: syntax/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/syntax/ruby.vim,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- syntax/ruby.vim 6 Aug 2005 08:11:44 -0000 1.52
+++ syntax/ruby.vim 6 Aug 2005 12:55:44 -0000 1.53
@@ -67,32 +67,28 @@
" Identifiers
syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
-if !exists("ruby_no_identifiers")
- syn match rubyConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\u\w*\>\%(\s*(\)\@!"
- 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 "$_\>" 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 "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!"
- syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>\%(\s*(\)\@!"
- syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!"
- "Obsolete Global Constants
- "syn match rubyPredefinedConstant "\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
- "syn match rubyPredefinedConstant "\%(::\)\=\zs\%(NotImplementError\)\>"
-else
- syn match NONE +$['"]+
-endif
+syn match rubyConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\u\w*\>\%(\s*(\)\@!"
+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 "$_\>" 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 "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!"
+syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>\%(\s*(\)\@!"
+syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!"
+"Obsolete Global Constants
+"syn match rubyPredefinedConstant "\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
+"syn match rubyPredefinedConstant "\%(::\)\=\zs\%(NotImplementError\)\>"
" Normal Regular Expression
syn region rubyString matchgroup=rubyStringDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\)\|[\~=!|&(,[]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial
@@ -244,7 +240,11 @@
HiLink rubyException Exception
HiLink rubyClass Type
HiLink rubyModule Type
+ if !exists("ruby_no_identifiers")
HiLink rubyIdentifier Identifier
+ else
+ HiLink rubyIdentifier NONE
+ endif
HiLink rubyClassVariable rubyIdentifier
HiLink rubyConstant rubyIdentifier
HiLink rubyGlobalVariable rubyIdentifier
More information about the vim-ruby-devel
mailing list