PATCH: differentiate between class methods and constants

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

PATCH: differentiate between class methods and constants

Doug Kearns
This allows the highlighting to differentiate between constants and
capitalized class methods invoked using the 'scope operator'.

Regards,
Doug


Index: syntax/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/syntax/ruby.vim,v
retrieving revision 1.50
diff -u -r1.50 ruby.vim
--- syntax/ruby.vim 1 Aug 2005 15:27:38 -0000 1.50
+++ syntax/ruby.vim 2 Aug 2005 14:49:09 -0000
@@ -68,7 +68,7 @@
 syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
 
 if !exists("ruby_no_identifiers")
-  syn match  rubyConstant "\%(::\)\=\zs\u\w*" display
+  syn match  rubyConstant               "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\u\w*\>\%(\s*(\)\@!" display
   syn match  rubyClassVariable "@@\h\w*" display
   syn match  rubyInstanceVariable "@\h\w*" display
   syn match  rubyGlobalVariable "$\%(\h\w*\|-.\)"
@@ -84,12 +84,12 @@
   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
+  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\)\>"
+  "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
Reply | Threaded
Open this post in threaded view
|

PATCH: contributors file

Doug Kearns
I've added a new file listing all the contributors to this project.

My apologies to anyone I've missed; if you feel that you should be
included let me know.

Regards,
Doug


Index: CONTRIBUTORS
===================================================================
RCS file: CONTRIBUTORS
diff -N CONTRIBUTORS
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CONTRIBUTORS 3 Aug 2005 13:52:35 -0000
@@ -0,0 +1,15 @@
+Maintainers:
+ Tim Hammerquist <[hidden email]>
+ Doug Kearns <[hidden email]>
+ Gavin Sinclair <[hidden email]>
+
+Developers:
+ Nikolai Weibull <[hidden email]>
+
+Other contributors:
+ Ned Konz <[hidden email]>
+ Ken Miller <[hidden email]>
+ Hugh Sasse <[hidden email]>
+ Tilman Sauerbeck <[hidden email]>
+ Bertram Scharpf <[hidden email]>
+ Aaron Son <[hidden email]>
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

PATCH: new eRuby syntax file

Doug Kearns
I've added a new eRuby syntax file to the repository - to meet a feature
request in the tracker more than anything.

I don't actually use eRuby but it appears to be usable; if that's not
the case speak up. ;-)

Regards,
Doug

PS. Thanks to Michael Brailsford for writing a version of this which can
be found at http://vim.sourceforge.net/scripts/script.php?script_id=403
We haven't been able to contact him so I've written a new version with
several improvements...I think.


Index: syntax/eruby.vim
===================================================================
RCS file: syntax/eruby.vim
diff -N syntax/eruby.vim
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ syntax/eruby.vim 11 Aug 2005 09:18:15 -0000
@@ -0,0 +1,62 @@
+" Vim syntax file
+" Language: eRuby
+" Maintainer: Doug Kearns <djkea2 at gus.gscit.monash.edu.au>
+" Info: $Id$
+" URL: http://vim-ruby.sourceforge.net
+" Anon CVS: See above site
+" Licence: GPL (http://www.gnu.org)
+" Disclaimer:
+"    This program is distributed in the hope that it will be useful,
+"    but WITHOUT ANY WARRANTY; without even the implied warranty of
+"    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+"    GNU General Public License for more details.
+" ----------------------------------------------------------------------------
+
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+if !exists("main_syntax")
+  let main_syntax = 'eruby'
+endif
+
+if version < 600
+  so <sfile>:p:h/html.vim
+  syn include @rubyTop <sfile>:p:h/ruby.vim
+else
+  runtime! syntax/html.vim
+  unlet b:current_syntax
+  syn include @rubyTop syntax/ruby.vim
+endif
+
+syn region erubyOneLiner matchgroup=erubyDelimiter start="^\s*\zs%" end="$"  contains=@rubyTop,erubyDelimiter keepend
+syn region erubyBlock    matchgroup=erubyDelimiter start="<%=\="    end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment keepend
+syn region erubyComment  matchgroup=erubyDelimiter start="<%#"      end="%>" keepend
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_eruby_syntax_inits")
+  if version < 508
+    let did_ruby_syntax_inits = 1
+    command -nargs=+ HiLink hi link <args>
+  else
+    command -nargs=+ HiLink hi def link <args>
+  endif
+
+  HiLink erubyDelimiter Delimiter
+  HiLink erubyComment Comment
+
+  delcommand HiLink
+endif
+let b:current_syntax = "eruby"
+
+if main_syntax == 'eruby'
+  unlet main_syntax
+endif
+
+" vim: sw=2 sts=2 ts=8 ff=unix nowrap:
Index: bin/vim-ruby-install.rb
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/bin/vim-ruby-install.rb,v
retrieving revision 1.3
diff -u -r1.3 vim-ruby-install.rb
--- bin/vim-ruby-install.rb 8 Aug 2005 03:39:41 -0000 1.3
+++ bin/vim-ruby-install.rb 11 Aug 2005 09:18:15 -0000
@@ -23,6 +23,7 @@
   ftdetect/ruby.vim
   ftplugin/ruby.vim
   indent/ruby.vim
+  syntax/eruby.vim
   syntax/ruby.vim
 }
 # XXX: what do we do with 'filetype/filetype.vim' ???
Index: CONTRIBUTORS
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/CONTRIBUTORS,v
retrieving revision 1.2
diff -u -r1.2 CONTRIBUTORS
--- CONTRIBUTORS 9 Aug 2005 11:57:21 -0000 1.2
+++ CONTRIBUTORS 11 Aug 2005 09:18:15 -0000
@@ -7,6 +7,7 @@
  Nikolai Weibull <[hidden email]>
 
 Other contributors:
+ Michael Brailsford <[hidden email]>
  Sean Flanagan <[hidden email]>
  Ken Miller <[hidden email]>
  Hugh Sasse <[hidden email]>
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel