Fast encoder producing simple debug output.
It is readable and diff-able and is used for testing.
You cannot fully restore the tokens information from the output, because consecutive :space tokens are merged. Use Tokens#dump for caching purposes.
See also: Scanners::Debug
# File lib/coderay/encoders/debug.rb, line 36 36: def begin_group kind 37: @opened << kind 38: @out << kind.to_s << '<' 39: end
# File lib/coderay/encoders/debug.rb, line 50 50: def begin_line kind 51: @out << kind.to_s << '[' 52: end
# File lib/coderay/encoders/debug.rb, line 41 41: def end_group kind 42: if @opened.last != kind 43: puts @out 44: raise "we are inside #{@opened.inspect}, not #{kind}" 45: end 46: @opened.pop 47: @out << '>' 48: end
# File lib/coderay/encoders/debug.rb, line 54 54: def end_line kind 55: @out << ']' 56: end
# File lib/coderay/encoders/debug.rb, line 26 26: def text_token text, kind 27: if kind == :space 28: @out << text 29: else 30: # TODO: Escape ( 31: text = text.gsub(/[)\\]/, '\\\0') # escape ) and \ 32: @out << kind.to_s << '(' << text << ')' 33: end 34: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.