lib/rouge/lexers/yaml.rb in rouge-1.1.0 vs lib/rouge/lexers/yaml.rb in rouge-1.2.0

- old
+ new

@@ -15,11 +15,11 @@ # NB: Tabs are forbidden in YAML, which is why you see things # like /[ ]+/. # reset the indentation levels def reset_indent - debug { " yaml: reset_indent" } + puts " yaml: reset_indent" if @debug @indent_stack = [0] @next_indent = 0 @block_scalar_indent = nil end @@ -37,26 +37,26 @@ end # Save a possible indentation level def save_indent(match) @next_indent = match.size - debug { " yaml: indent: #{self.indent}/#@next_indent" } - debug { " yaml: popping indent stack - before: #@indent_stack" } + puts " yaml: indent: #{self.indent}/#@next_indent" if @debug + puts " yaml: popping indent stack - before: #@indent_stack" if @debug if dedent?(@next_indent) @indent_stack.pop while dedent?(@next_indent) - debug { " yaml: popping indent stack - after: #@indent_stack" } - debug { " yaml: indent: #{self.indent}/#@next_indent" } + puts " yaml: popping indent stack - after: #@indent_stack" if @debug + puts " yaml: indent: #{self.indent}/#@next_indent" if @debug # dedenting to a state not previously indented to is an error [match[0...self.indent], match[self.indent..-1]] else [match, ''] end end def continue_indent(match) - debug { " yaml: continue_indent" } + puts " yaml: continue_indent" if @debug @next_indent += match.size end def set_indent(match, opts={}) if indent < @next_indent @@ -340,22 +340,21 @@ rule /[^\s,:?\[\]{}]+/, Name::Variable end state :yaml_directive do rule /([ ]+)(\d+\.\d+)/ do - group Text; group Num - pop!; push :ignored_line + groups Text, Num + goto :ignored_line end end state :tag_directive do rule %r( ([ ]+)(!|![\w-]*!) # prefix ([ ]+)(!|!?[\w;/?:@&=+$,.!~*'()\[\]%-]+) # tag handle )x do - group Text; group Keyword::Type - group Text; group Keyword::Type - pop!; push :ignored_line + groups Text, Keyword::Type, Text, Keyword::Type + goto :ignored_line end end end end end