summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/debug.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-06-12 16:04:51 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2013-06-12 16:04:51 +0200
commitaddcbd446066d0da1627112814e3ce1b8d404da0 (patch)
tree55a4a46e10e89afb185b014f28d4d769c0144948 /lib/coderay/encoders/debug.rb
parent7d2c3e59d1691bcde16fc3e51d92797bfc9a2442 (diff)
parent40bd2ef5d33d32c3b3987da1d115b717259819e4 (diff)
downloadcoderay-addcbd446066d0da1627112814e3ce1b8d404da0.tar.gz
Merge branch 'master' into go-scanner
Diffstat (limited to 'lib/coderay/encoders/debug.rb')
-rw-r--r--lib/coderay/encoders/debug.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/coderay/encoders/debug.rb b/lib/coderay/encoders/debug.rb
index 95d6138..c03d3fb 100644
--- a/lib/coderay/encoders/debug.rb
+++ b/lib/coderay/encoders/debug.rb
@@ -24,11 +24,12 @@ module Encoders
end
def text_token text, kind
+ raise 'empty token' if $CODERAY_DEBUG && text.empty?
if kind == :space
@out << text
else
# TODO: Escape (
- text = text.gsub(/[)\\]/, '\\\\\0') # escape ) and \
+ text = text.gsub(/[)\\]/, '\\\\\0') if text.index(/[)\\]/)
@out << kind.to_s << '(' << text << ')'
end
end