From 591b2823d986bc877697e3bd485ffa9c9adff3ed Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 18 May 2010 06:24:16 +0000 Subject: Ruby scanner handles :keep_state option. --- lib/coderay/scanners/ruby.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/coderay/scanners/ruby.rb') diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index a2e5fed..923d681 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -28,11 +28,19 @@ module Scanners protected + def setup + @state = :initial + end + def scan_tokens encoder, options patterns = Patterns # avoid constant lookup - state = :initial + state = @state + if state.instance_of? patterns::StringState + encoder.begin_group state.type + end + last_state = nil method_call_expected = false @@ -414,6 +422,9 @@ module Scanners end # cleaning up + if options[:keep_state] + @state = state + end if state.is_a? patterns::StringState encoder.end_group state.type end -- cgit v1.2.1