From a5c8578cf92373eae4ca41abea113593ad8546a9 Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 1 Jun 2010 22:06:55 +0000 Subject: Ruby scanner does no longer highlight \ at the end of the input as :error. This is more friendly for intelligent diff highlighting. --- lib/coderay/scanners/ruby.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/coderay/scanners/ruby.rb') 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 -- cgit v1.2.1