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

- old
+ new

@@ -40,12 +40,12 @@ open = Regexp.escape(m[2]) close = Regexp.escape(delimiter_map[m[2]] || m[2]) interp = /[rQWxI]/ === m[1] toktype = Str::Other - debug { " open: #{open.inspect}" } - debug { " close: #{close.inspect}" } + puts " open: #{open.inspect}" if @debug + puts " close: #{close.inspect}" if @debug # regexes if m[1] == 'r' toktype = Str::Regex push :regex_flags @@ -239,21 +239,21 @@ rule /(\n)([^#\\\n]*)$/ do |m| tolerant, heredoc_name = @heredoc_queue.first check = tolerant ? m[2].strip : m[2].rstrip - group Str::Heredoc - # check if we found the end of the heredoc - if check == heredoc_name - group Name::Constant + line_tok = if check == heredoc_name @heredoc_queue.shift # if there's no more, we're done looking. pop! if @heredoc_queue.empty? + Name::Constant else - group Str::Heredoc + Str::Heredoc end + + groups(Str::Heredoc, line_tok) end rule /[#\\\n]/, Str::Heredoc rule /[^#\\\n]+/, Str::Heredoc end @@ -267,10 +267,10 @@ [a-zA-Z_][\w_]*[!?]? | \*\*? | [-+]@? | [/%&\|^`~] | \[\]=? | <<? | >>? | <=>? | >= | ===? ) )x do |m| - debug { "matches: #{[m[0], m[1], m[2], m[3]].inspect}" } + puts "matches: #{[m[0], m[1], m[2], m[3]].inspect}" if @debug groups Name::Class, Operator, Name::Function pop! end rule(//) { pop! }