summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/yaml.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-06-23 05:34:08 -0700
committerKornelius Kalnbach <murphy@rubychan.de>2013-06-23 05:34:08 -0700
commitd7f1669cdf1d48204f3e1b0078d467da448c31d2 (patch)
tree80a8c1ab927661743329f10cd1dd415f2a8bca0f /lib/coderay/scanners/yaml.rb
parent1e330f16c21c45eff375ba3b12f966c76ba0b393 (diff)
parent56f4163e99689912c3797e5d3b2b97244ce65782 (diff)
downloadcoderay-d7f1669cdf1d48204f3e1b0078d467da448c31d2.tar.gz
Merge pull request #144 from rubychan/fix-with-debug-lint
Fixes using DebugLint
Diffstat (limited to 'lib/coderay/scanners/yaml.rb')
-rw-r--r--lib/coderay/scanners/yaml.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/coderay/scanners/yaml.rb b/lib/coderay/scanners/yaml.rb
index 96f4e93..32c8e2c 100644
--- a/lib/coderay/scanners/yaml.rb
+++ b/lib/coderay/scanners/yaml.rb
@@ -47,7 +47,7 @@ module Scanners
when !check(/(?:"[^"]*")(?=: |:$)/) && match = scan(/"/)
encoder.begin_group :string
encoder.text_token match, :delimiter
- encoder.text_token match, :content if match = scan(/ [^"\\]* (?: \\. [^"\\]* )* /mx)
+ encoder.text_token match, :content if (match = scan(/ [^"\\]* (?: \\. [^"\\]* )* /mx)) && !match.empty?
encoder.text_token match, :delimiter if match = scan(/"/)
encoder.end_group :string
next
@@ -84,7 +84,7 @@ module Scanners
when match = scan(/(?:"[^"\n]*"|'[^'\n]*')(?= *:(?: |$))/)
encoder.begin_group :key
encoder.text_token match[0,1], :delimiter
- encoder.text_token match[1..-2], :content
+ encoder.text_token match[1..-2], :content if match.size > 2
encoder.text_token match[-1,1], :delimiter
encoder.end_group :key
key_indent = column(pos - match.size) - 1