diff options
author | murphy <murphy@rubychan.de> | 2010-06-01 22:06:55 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-06-01 22:06:55 +0000 |
commit | a5c8578cf92373eae4ca41abea113593ad8546a9 (patch) | |
tree | 4b473ad00ea3c19aa66faa4dfd99157e4cf7dd5b | |
parent | 137a034642fab3add7ac7fad73014f1b4bed3aa7 (diff) | |
download | coderay-a5c8578cf92373eae4ca41abea113593ad8546a9.tar.gz |
Ruby scanner does no longer highlight \ at the end of the input as :error. This is more friendly for intelligent diff highlighting.
-rw-r--r-- | lib/coderay/scanners/ruby.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index 0bc3e85..d7df1a1 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -103,7 +103,7 @@ module Scanners when state.delim, '\\' encoder.text_token match + m, :char when nil - encoder.text_token match, :error + encoder.text_token match, :content else encoder.text_token match + m, :content end @@ -237,7 +237,7 @@ module Scanners encoder.begin_group :regexp encoder.text_token match, :delimiter interpreted = true - state = patterns::StringState.new :regexp, interpreted, match + state = patterns::StringState.new :regexp, interpreted, '/' elsif match = scan(value_expected ? /[-+]?#{patterns::NUMERIC}/o : /#{patterns::NUMERIC}/o) if method_call_expected @@ -316,6 +316,9 @@ module Scanners encoder.text_token match, :class_variable value_expected = false + elsif match = scan(/\\\z/) + encoder.text_token match, :space + else if method_call_expected method_call_expected = false |