lib/rouge/lexers/yaml.rb in rouge-2.0.7 vs lib/rouge/lexers/yaml.rb in rouge-2.1.0
- old
+ new
@@ -6,17 +6,19 @@
title "YAML"
desc "Yaml Ain't Markup Language (yaml.org)"
mimetypes 'text/x-yaml'
tag 'yaml'
aliases 'yml'
+ filenames '*.yaml', '*.yml'
def self.analyze_text(text)
# look for the %YAML directive
return 1 if text =~ /\A\s*%YAML/m
end
- filenames '*.yaml', '*.yml'
+ SPECIAL_VALUES = Regexp.union(%w(true false null))
+
# NB: Tabs are forbidden in YAML, which is why you see things
# like /[ ]+/.
# reset the indentation levels
def reset_indent
@@ -333,9 +335,10 @@
token Text
push :plain_scalar_in_block_context_new_line
end
rule /[ ]+/, Str
+ rule SPECIAL_VALUES, Name::Constant
# regular non-whitespace characters
rule /[^\s:]+/, Str
end
state :plain_scalar_in_flow_context do