lib/rouge/lexer.rb in rouge-0.2.8 vs lib/rouge/lexer.rb in rouge-0.2.9
- old
+ new
@@ -263,17 +263,13 @@
#
# For performance reasons, the "debug" option of a lexer cannot
# be changed once it has begun lexing. This method will redefine
# itself on the first call to a noop if "debug" is not set.
if option(:debug)
- class << self
- def debug; puts yield; end
- end
+ def self.debug; puts yield; end
else
- class << self
- def debug; end
- end
+ def self.debug; end
end
debug(&b)
end
@@ -297,10 +293,10 @@
reset! unless opts[:continue]
# consolidate consecutive tokens of the same type
last_token = nil
last_val = nil
- stream_tokens(StringScanner.new(string)) do |tok, val|
+ stream_tokens(string) do |tok, val|
next if val.empty?
if tok == last_token
last_val << val
next