diff options
author | murphy <murphy@rubychan.de> | 2010-03-26 03:18:12 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-03-26 03:18:12 +0000 |
commit | 7fd577f8c2959902c4eb79d3c20b70a274e41618 (patch) | |
tree | de117473e8d308f08900514dfcf0c27e9acfea53 /lib/coderay/scanners/yaml.rb | |
parent | cfa0257f846a01e6777e6e620751165410b328c8 (diff) | |
download | coderay-7fd577f8c2959902c4eb79d3c20b70a274e41618.tar.gz |
Cleanups for C, C++, CSS, Delphi, Groovy, Java, PHP, Python, RHTML, XML, and YAML scanners.
Diffstat (limited to 'lib/coderay/scanners/yaml.rb')
-rw-r--r-- | lib/coderay/scanners/yaml.rb | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/coderay/scanners/yaml.rb b/lib/coderay/scanners/yaml.rb index 52fca90..fa29701 100644 --- a/lib/coderay/scanners/yaml.rb +++ b/lib/coderay/scanners/yaml.rb @@ -1,7 +1,7 @@ module CodeRay module Scanners - # YAML Scanner + # Scanner for YAML. # # Based on the YAML scanner from Syntax by Jamis Buck. class YAML < Scanner @@ -11,6 +11,8 @@ module Scanners KINDS_NOT_LOC = :all + protected + def scan_tokens tokens, options value_expected = nil @@ -21,14 +23,7 @@ module Scanners kind = nil match = nil - - if bol? - key_indent = nil - if $DEBUG - indent = check(/ +/) ? matched.size : 0 - tokens << [indent.to_s, :debug] - end - end + key_indent = nil if bol? if match = scan(/ +[\t ]*/) kind = :space @@ -128,7 +123,10 @@ module Scanners match ||= matched - raise_inspect 'Error token %p in line %d' % [[match, kind], line], tokens if $DEBUG && !kind + if $CODERAY_DEBUG and not kind + raise_inspect 'Error token %p in line %d' % + [[match, kind], line], tokens + end raise_inspect 'Empty token', tokens unless match tokens << [match, kind] |