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/json5.rb | |
parent | 14339bfc8f58ac883bb5f202411804f03966f462 (diff) | |
download | coderay-90c5c9161f53ee6e8400b3af2e967820ba0addd9.tar.gz |
remove templates, yay!
Diffstat (limited to 'lib/coderay/scanners/json5.rb')
-rw-r--r-- | lib/coderay/scanners/json5.rb | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/lib/coderay/scanners/json5.rb b/lib/coderay/scanners/json5.rb index dcfdd3f..8b0a8bd 100644 --- a/lib/coderay/scanners/json5.rb +++ b/lib/coderay/scanners/json5.rb @@ -41,43 +41,11 @@ module Scanners on %r/ \\ /x, :error, pop end - protected - - scan_tokens_code = <<-"RUBY" - def scan_tokens encoder, options#{ def_line = __LINE__; nil } - state = options[:state] || @state - - if [:string, :key].include? state - encoder.begin_group state - end - - states = [state] - - until eos? - case state -#{ @code.chomp.gsub(/^/, ' ') } - else - raise_inspect 'Unknown state: %p' % [state], encoder - end - end - - if options[:keep_state] - @state = state - end - - if [:string, :key].include? state - encoder.end_group state + def close_groups encoder, states + if [:string, :key].include? states.last + encoder.end_group states.last 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 |