vendor/sass/lib/sass/scss/parser.rb in haml-3.1.0.alpha.19 vs vendor/sass/lib/sass/scss/parser.rb in haml-3.1.0.alpha.22

- old
+ new

@@ -136,13 +136,13 @@ block(node(Sass::Tree::MixinDefNode.new(name, args)), :directive) end def include_directive name = tok! IDENT - args = sass_script(:parse_mixin_include_arglist) + args, keywords = sass_script(:parse_mixin_include_arglist) ss - node(Sass::Tree::MixinNode.new(name, args)) + node(Sass::Tree::MixinNode.new(name, args, keywords)) end def debug_directive node(Sass::Tree::DebugNode.new(sass_script(:parse))) end @@ -819,20 +819,23 @@ raise Sass::SyntaxError.new( "Invalid CSS after \"#{after}\": expected #{expected}, was \"#{was}\"", :line => line) end + # Avoid allocating lots of new strings for `#tok`. + # This is important because `#tok` is called all the time. + NEWLINE = "\n" + def tok(rx) res = @scanner.scan(rx) if res - @line += res.count("\n") + @line += res.count(NEWLINE) @expected = nil if !@strs.empty? && rx != COMMENT && rx != SINGLE_LINE_COMMENT @strs.each {|s| s << res} end + res end - - res end end end end