lib/rouge/lexers/yaml.rb in rouge-3.5.1 vs lib/rouge/lexers/yaml.rb in rouge-3.6.0
- old
+ new
@@ -177,11 +177,11 @@
groups Name::Attribute, Punctuation::Indicator
set_indent m[0], :implicit => true
end
# literal and folded scalars
- rule %r/[\|>]/ do
+ rule %r/[\|>][+-]?/ do
token Punctuation::Indicator
push :block_scalar_content
push :block_scalar_header
end
end
@@ -244,11 +244,11 @@
pop!
push :indentation
end
end
- rule %r/[^\n\r\f\v]+/, Name::Constant
+ rule %r/[^\n\r\f\v]+/, Str
end
state :block_scalar_header do
# optional indentation indicator and chomping flag, in either order
rule %r(
@@ -326,20 +326,22 @@
end
state :plain_scalar_in_block_context do
# the : indicator ends a scalar
rule %r/[ ]*(?=:[ \n]|:$)/, Text, :pop!
- rule %r/[ ]*:/, Str
+ rule %r/[ ]*:\S+/, Str
rule %r/[ ]+(?=#)/, Text, :pop!
rule %r/[ ]+$/, Text
# check for new documents or dedents at the new line
rule %r/\n+/ do
token Text
push :plain_scalar_in_block_context_new_line
end
rule %r/[ ]+/, Str
rule SPECIAL_VALUES, Name::Constant
+ rule %r/\d+(?:\.\d+)?(?=(\r?\n)| +#)/, Literal::Number, :pop!
+
# regular non-whitespace characters
rule %r/[^\s:]+/, Str
end
state :plain_scalar_in_flow_context do