diff --git a/lib/sass/scss/parser.rb b/lib/sass/scss/parser.rb index 56fcf548..18255863 100644 --- a/lib/sass/scss/parser.rb +++ b/lib/sass/scss/parser.rb @@ -59,6 +59,11 @@ module Sass true end + def whitespace + return unless tok(S) || tok(SINGLE_LINE_COMMENT) || tok(COMMENT) + ss + end + def process_comment(text, node) pre_str = @scanner.string[/(?:\A|\n)(.*)\/\*/, 1].gsub(/[^\s]/, ' ') node << Sass::Tree::CommentNode.new(pre_str + text, false) @@ -336,7 +341,7 @@ module Sass end def combinator - tok(PLUS) || tok(GREATER) || tok(TILDE) || tok(S) + tok(PLUS) || tok(GREATER) || tok(TILDE) || str?{whitespace} end def simple_selector_sequence @@ -555,6 +560,13 @@ MESSAGE @strs.pop end + def str? + @strs.push "" + yield && @strs.last + ensure + @strs.pop + end + def node(node) node.line = @line node diff --git a/test/sass/scss/css_test.rb b/test/sass/scss/css_test.rb index 57784a4c..99f03508 100755 --- a/test/sass/scss/css_test.rb +++ b/test/sass/scss/css_test.rb @@ -147,6 +147,16 @@ CSS SCSS end + def test_selector_comments + assert_equal <