lib/rouge/lexers/yaml.rb in rouge-0.5.1 vs lib/rouge/lexers/yaml.rb in rouge-0.5.2
- old
+ new
@@ -56,16 +56,16 @@
def continue_indent(match)
debug { " yaml: continue_indent" }
@next_indent += match.size
end
- def set_indent(opts={})
+ def set_indent(match, opts={})
if indent < @next_indent
@indent_stack << @next_indent
end
- @next_indent += @last_match[0].size unless opts[:implicit]
+ @next_indent += match.size unless opts[:implicit]
end
plain_scalar_start = /[^ \t\n\r\f\v?:,\[\]{}#&*!\|>'"%@`]/
start { reset_indent }
@@ -117,11 +117,11 @@
token Text
continue_indent(m[0])
end
# block collection indicators
- rule(/[?:-](?=[ ]|$)/) { token Punctuation::Indicator; set_indent }
+ rule(/[?:-](?=[ ]|$)/) { |m| token Punctuation::Indicator; set_indent m[0] }
# the beginning of a block line
rule(/[ ]*/) { |m| token Text; continue_indent(m[0]); pop! }
end
@@ -161,12 +161,12 @@
rule /\*[\w-]+/, Name::Variable
end
state :block_nodes do
# implicit key
- rule /:(?=\s|$)/ do
+ rule /:(?=\s|$)/ do |m|
token Punctuation::Indicator
- set_indent :implicit => true
+ set_indent m[0], :implicit => true
end
# literal and folded scalars
rule /[\|>]/ do
token Punctuation::Indicator