From f01dd70e76c89025d09436a5157e71b283d03c37 Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 29 Jul 2008 16:51:44 +0000 Subject: [KK] Just a little code cleanup and new task 187. --- Rakefile | 4 ++ etc/coderay-lib.tmproj | 6 ++- etc/coderay.tmproj | 83 +---------------------------------- lib/coderay/scanner.rb | 4 +- lib/coderay/scanners/ruby/patterns.rb | 2 +- 5 files changed, 13 insertions(+), 86 deletions(-) diff --git a/Rakefile b/Rakefile index bd859c5..5482cd9 100644 --- a/Rakefile +++ b/Rakefile @@ -35,6 +35,10 @@ task '18' do RUBY.replace 'ruby' end +task '187' do + RUBY.replace 'ruby187' +end + task 'yarv' do RUBY.replace 'ruby-yarv' end diff --git a/etc/coderay-lib.tmproj b/etc/coderay-lib.tmproj index 1801248..d97a407 100644 --- a/etc/coderay-lib.tmproj +++ b/etc/coderay-lib.tmproj @@ -75,8 +75,6 @@ ../Rakefile lastUsed 2006-10-31T02:10:52Z - selected - filename @@ -89,6 +87,10 @@ filename ../TODO + lastUsed + 2008-01-21T03:03:08Z + selected + name diff --git a/etc/coderay.tmproj b/etc/coderay.tmproj index ed8791c..2597bf4 100644 --- a/etc/coderay.tmproj +++ b/etc/coderay.tmproj @@ -2,8 +2,6 @@ - currentDocument - ../rake_tasks/gem.rake documents @@ -20,86 +18,7 @@ fileHierarchyDrawerWidth 312 metaData - - ../lib/coderay/scanners/ruby.rb - - caret - - column - 50 - line - 11 - - firstVisibleColumn - 0 - firstVisibleLine - 0 - - ../lib/coderay/scanners/ruby/patterns.rb - - caret - - column - 43 - line - 18 - - firstVisibleColumn - 0 - firstVisibleLine - 0 - - ../rake_tasks/gem.rake - - caret - - column - 44 - line - 89 - - firstVisibleColumn - 0 - firstVisibleLine - 77 - - ../test/scanners/coderay_suite.rb - - caret - - column - 29 - line - 316 - - firstVisibleColumn - 0 - firstVisibleLine - 305 - - ../test/scanners/ruby/regexp.in.rb - - caret - - column - 51 - line - 4 - - firstVisibleColumn - 0 - firstVisibleLine - 0 - - - openDocuments - - ../lib/coderay/scanners/ruby.rb - ../test/scanners/coderay_suite.rb - ../test/scanners/ruby/regexp.in.rb - ../rake_tasks/gem.rake - ../lib/coderay/scanners/ruby/patterns.rb - + showFileHierarchyDrawer windowFrame diff --git a/lib/coderay/scanner.rb b/lib/coderay/scanner.rb index 6ea57eb..d33e2f2 100644 --- a/lib/coderay/scanner.rb +++ b/lib/coderay/scanner.rb @@ -66,7 +66,9 @@ module CodeRay end def normify code - code = code.to_s.to_unix + code = code.to_s + code.force_encoding 'binary' if code.respond_to? :force_encoding + code.to_unix end def file_extension extension = nil diff --git a/lib/coderay/scanners/ruby/patterns.rb b/lib/coderay/scanners/ruby/patterns.rb index 6f044f2..75937b7 100644 --- a/lib/coderay/scanners/ruby/patterns.rb +++ b/lib/coderay/scanners/ruby/patterns.rb @@ -49,7 +49,7 @@ module Scanners CLASS_VARIABLE = / @@ #{IDENT} /ox OBJECT_VARIABLE = / @@? #{IDENT} /ox GLOBAL_VARIABLE = / \$ (?: #{IDENT} | [1-9]\d* | 0\w* | [~&+`'=\/,;_.<>!@$?*":\\] | -[a-zA-Z_0-9] ) /ox - PREFIX_VARIABLE = / #{GLOBAL_VARIABLE} |#{OBJECT_VARIABLE} /ox + PREFIX_VARIABLE = / #{GLOBAL_VARIABLE} | #{OBJECT_VARIABLE} /ox VARIABLE = / @?@? #{IDENT} | #{GLOBAL_VARIABLE} /ox QUOTE_TO_TYPE = { -- cgit v1.2.1