diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-14 19:25:35 +0100 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-14 19:25:35 +0100 |
commit | 90c5c9161f53ee6e8400b3af2e967820ba0addd9 (patch) | |
tree | 7b10bb3fd98da1b432cfc49482f598213701bfa9 /lib/coderay/scanners/c2.rb | |
parent | 14339bfc8f58ac883bb5f202411804f03966f462 (diff) | |
download | coderay-90c5c9161f53ee6e8400b3af2e967820ba0addd9.tar.gz |
remove templates, yay!
Diffstat (limited to 'lib/coderay/scanners/c2.rb')
-rw-r--r-- | lib/coderay/scanners/c2.rb | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/lib/coderay/scanners/c2.rb b/lib/coderay/scanners/c2.rb index 7ae382a..3103e54 100644 --- a/lib/coderay/scanners/c2.rb +++ b/lib/coderay/scanners/c2.rb @@ -87,40 +87,24 @@ module Scanners on %r//, pop_state # TODO: add otherwise method for this end - scan_tokens_code = <<-"RUBY" - def scan_tokens encoder, options#{ def_line = __LINE__; nil } - state = @state - label_expected = true - case_expected = false - label_expected_before_preproc_line = nil - in_preproc_line = false - - states = [state] - - until eos? - # last_pos = pos - case state -#{ @code.chomp.gsub(/^/, ' ') } - else - raise_inspect 'Unknown state: %p' % [state], encoder - end - - # raise_inspect 'nothing was consumed! states = %p' % [states], encoder if pos == last_pos - end + protected + + def setup + super - if state == :string + @label_expected = true + @case_expected = false + @label_expected_before_preproc_line = nil + @in_preproc_line = false + end + + def close_groups encoder, states + if states.last == :string encoder.end_group :string end - - encoder end - RUBY - if ENV['PUTS'] - puts CodeRay.scan(scan_tokens_code, :ruby).terminal - puts "callbacks: #{callbacks.size}" - end - class_eval scan_tokens_code, __FILE__, def_line end + end end |