diff options
author | murphy <murphy@rubychan.de> | 2010-05-18 06:24:16 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-05-18 06:24:16 +0000 |
commit | 591b2823d986bc877697e3bd485ffa9c9adff3ed (patch) | |
tree | 4ed11e333a3e3913402dc186d0e4b457baba9f0e /lib/coderay/scanners/ruby.rb | |
parent | 4437cd00c14540b7eaf75fd0681058f34569d621 (diff) | |
download | coderay-591b2823d986bc877697e3bd485ffa9c9adff3ed.tar.gz |
Ruby scanner handles :keep_state option.
Diffstat (limited to 'lib/coderay/scanners/ruby.rb')
-rw-r--r-- | lib/coderay/scanners/ruby.rb | 13 |
1 files changed, 12 insertions, 1 deletions
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 |