summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/debug.rb
diff options
context:
space:
mode:
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