summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/debug.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-06-10 23:50:03 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2013-06-10 23:50:03 +0200
commit4540eb3ceb8882e28908073b20657b239ff2f878 (patch)
tree4d5d4f3a0f3929dfb8df7d3f2a318b1cac066a85 /lib/coderay/encoders/debug.rb
parent8ad02d8bde0515636a63247a74098b4d819b7950 (diff)
parenta69d5d43b79a4f2cf5aaccc50b2275bf0dab4aba (diff)
downloadcoderay-4540eb3ceb8882e28908073b20657b239ff2f878.tar.gz
Merge branch 'master' into javascript-keep-state
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