PATCH: link rubyIdentifier to NONE when ruby_no_identifiers is set

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

PATCH: link rubyIdentifier to NONE when ruby_no_identifiers is set

Doug Kearns
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
_______________________________________________
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: link rubyIdentifier to NONE when ruby_no_identifiers is set

Nikolai Weibull-5
Doug Kearns wrote:

> Nikolai, you're the only one I've come across who actually uses this
> so let me know if there are any problems.

Please excuse my tardiness.  Actually, I have my own funky handling of
identifiers.  I don't think that what you've done should cause any
problems, though.

This is what I have:

syn match  rubyScopeSpecifier           display containedin=rubyClassVariable,rubyInstanceVariable,rubyGlobalVariable "\%(@\+\|\$\)"
syn match  rubyClassVariable "@@\h\w*" display
syn match  rubyInstanceVariable "@\h\w*" display
syn match  rubyGlobalVariable "$\%(\h\w*\|-.\)"       display

I like having global variables highlighted (so as to not use thum).  And
I like having the scope-specifier highlighted in @blah and @@bluh.
Having them highlighted makes them stand out, without hurting my eyes,
        nikolai

--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
_______________________________________________
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: link rubyIdentifier to NONE when ruby_no_identifiers is set

Doug Kearns
On Thu, Aug 25, 2005 at 01:48:03AM +0200, Nikolai Weibull wrote:

> Doug Kearns wrote:
>
> > Nikolai, you're the only one I've come across who actually uses this
> > so let me know if there are any problems.
>
> Please excuse my tardiness.  Actually, I have my own funky handling of
> identifiers.  I don't think that what you've done should cause any
> problems, though.
>
> This is what I have:
>
> syn match  rubyScopeSpecifier           display containedin=rubyClassVariable,rubyInstanceVariable,rubyGlobalVariable "\%(@\+\|\$\)"
> syn match  rubyClassVariable "@@\h\w*" display
> syn match  rubyInstanceVariable "@\h\w*" display
> syn match  rubyGlobalVariable "$\%(\h\w*\|-.\)"       display
>
> I like having global variables highlighted (so as to not use thum).  And
> I like having the scope-specifier highlighted in @blah and @@bluh.
> Having them highlighted makes them stand out, without hurting my eyes,

I wonder if this would be worth including as an option?

Regards,
Doug
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel