From 48e144a20829faaeca9a7db8fbc6128f1f5d7297 Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 4 Oct 2005 04:04:07 +0000 Subject: Two new encoders: debug and xml. encoder.rb: new token handling encoders/statistic.rb: using new handling ruby_helper.rb: small improvements ruby.rb: - escapes in subtoken - Float detection changed - some multi-char operators are now scanned as one token - def and module definition handling changed bin/coderay: improved, new interface (still in progress) plugin.rb: more expressive load error message --- lib/coderay/encoders/debug.rb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lib/coderay/encoders/debug.rb (limited to 'lib/coderay/encoders/debug.rb') diff --git a/lib/coderay/encoders/debug.rb b/lib/coderay/encoders/debug.rb new file mode 100644 index 0000000..b084733 --- /dev/null +++ b/lib/coderay/encoders/debug.rb @@ -0,0 +1,38 @@ +module CodeRay + module Encoders + + # = Debug Encoder + class Debug < Encoder + + include Streamable + register_for :debug + + FILE_EXTENSION = 'debug' + + protected + def text_token text, kind + @out << + if kind == :space + text + else + text = text.gsub(/[)\\]/, '\\\\\0') + "#{kind}(#{text})" + end + end + + def block_token action, kind + @out << super + end + + def open_token kind + "#{kind}<" + end + + def close_token kind + ">" + end + + end + + end +end -- cgit v1.2.1