diff options
author | murphy <murphy@rubychan.de> | 2010-05-21 14:19:35 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-05-21 14:19:35 +0000 |
commit | a4bbe4db2bedd03a2f675731614833b62df5e118 (patch) | |
tree | b130cbfb7a2d55bb14c5dbd659968de637085007 /lib/coderay/scanners | |
parent | c03a1110463c0a8d46716403ff4e657d52e83848 (diff) | |
download | coderay-a4bbe4db2bedd03a2f675731614833b62df5e118.tar.gz |
Fixed a bug in the YAML scanner (see #231).
Diffstat (limited to 'lib/coderay/scanners')
-rw-r--r-- | lib/coderay/scanners/yaml.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/coderay/scanners/yaml.rb b/lib/coderay/scanners/yaml.rb index 3c3928f..514838d 100644 --- a/lib/coderay/scanners/yaml.rb +++ b/lib/coderay/scanners/yaml.rb @@ -75,20 +75,18 @@ module Scanners when match = scan(/[,{}\[\]]/) encoder.text_token match, :operator next - when state == :initial && match = scan(/[\w.() ]*\S(?=: |:$)/) + when state == :initial && match = scan(/[\w.() ]*\S(?= *:(?: |$))/) encoder.text_token match, :key key_indent = column(pos - match.size - 1) - # encoder.text_token key_indent.inspect, :debug state = :colon next - when match = scan(/(?:"[^"\n]*"|'[^'\n]*')(?=: |:$)/) + 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,1], :delimiter encoder.end_group :key key_indent = column(pos - match.size - 1) - # encoder.text_token key_indent.inspect, :debug state = :colon next when match = scan(/(![\w\/]+)(:([\w:]+))?/) |