@@ -151,7 +151,7 @@ namespace Sass {
151151 // loop until end of string
152152 while (position < end) {
153153
154- // parse comment blocks
154+ // we should be able to refactor this
155155 parse_block_comments ();
156156 lex < css_whitespace >();
157157
@@ -717,6 +717,7 @@ namespace Sass {
717717 Complex_Selector* Parser::parse_complex_selector (bool in_root)
718718 {
719719
720+ String* reference = 0 ;
720721 lex < block_comment >();
721722 // parse the left hand side
722723 Compound_Selector* lhs = 0 ;
@@ -734,6 +735,13 @@ namespace Sass {
734735 if (lex< exactly<' +' > >()) combinator = Complex_Selector::ADJACENT_TO;
735736 else if (lex< exactly<' ~' > >()) combinator = Complex_Selector::PRECEDES;
736737 else if (lex< exactly<' >' > >()) combinator = Complex_Selector::PARENT_OF;
738+ else if (lex< sequence < exactly<' /' >, negate < exactly < ' *' > > > >()) {
739+ // comments are allowed, but not spaces?
740+ combinator = Complex_Selector::REFERENCE;
741+ if (!lex < identifier >()) return 0 ; // ToDo: error msg?
742+ reference = new (ctx.mem ) String_Quoted (pstate, lexed);
743+ if (!lex < exactly < ' /' > >()) return 0 ; // ToDo: error msg?
744+ }
737745 else /* if (lex< zero >()) */ combinator = Complex_Selector::ANCESTOR_OF;
738746
739747 if (!lhs && combinator == Complex_Selector::ANCESTOR_OF) return 0 ;
@@ -742,6 +750,7 @@ namespace Sass {
742750 // source position of a complex selector points to the combinator
743751 // ToDo: make sure we update pstate for ancestor of (lex < zero >());
744752 Complex_Selector* sel = new (ctx.mem ) Complex_Selector (pstate, combinator, lhs);
753+ if (combinator == Complex_Selector::REFERENCE) sel->reference (reference);
745754 // has linfeed after combinator?
746755 sel->has_line_break (peek_newline ());
747756 // sel->has_line_feed(has_line_feed);
@@ -841,7 +850,7 @@ namespace Sass {
841850 else if (lex< quoted_string >()) {
842851 return new (ctx.mem ) Type_Selector (pstate, unquote (lexed));
843852 }
844- else if (lex< alternatives < variable, number, kwd_sel_deep > >()) {
853+ else if (lex< alternatives < variable, number, re_reference_selector > >()) {
845854 return new (ctx.mem ) Type_Selector (pstate, lexed);
846855 }
847856 else if (peek< pseudo_not >()) {
@@ -939,7 +948,7 @@ namespace Sass {
939948 ParserState p = pstate;
940949 if (!lex_css< attribute_name >()) error (" invalid attribute name in attribute selector" , pstate);
941950 string name (lexed);
942- if (lex_css< exactly<' ]' > >()) return new (ctx.mem ) Attribute_Selector (p, name, " " , 0 );
951+ if (lex_css< alternatives < exactly<' ]' >, exactly< ' / ' > > >()) return new (ctx.mem ) Attribute_Selector (p, name, " " , 0 );
943952 if (!lex_css< alternatives< exact_match, class_match, dash_match,
944953 prefix_match, suffix_match, substring_match > >()) {
945954 error (" invalid operator in attribute selector for " + name, pstate);
@@ -957,7 +966,7 @@ namespace Sass {
957966 error (" expected a string constant or identifier in attribute selector for " + name, pstate);
958967 }
959968
960- if (!lex_css< exactly<' ]' > >()) error (" unterminated attribute selector for " + name, pstate);
969+ if (!lex_css< alternatives < exactly<' ]' >, exactly< ' / ' > > >()) error (" unterminated attribute selector for " + name, pstate);
961970 return new (ctx.mem ) Attribute_Selector (p, name, matcher, value);
962971 }
963972
@@ -2137,7 +2146,7 @@ namespace Sass {
21372146 spaces, block_comment, line_comment,
21382147 // match `/deep/` selector (pass-trough)
21392148 // there is no functionality for it yet
2140- exactly<sel_deep_kwd> ,
2149+ re_reference_selector ,
21412150 // match selector ops /[*&%,()\[\]]/
21422151 class_char < selector_lookahead_ops >,
21432152 // match selector combinators /[>+~]/
0 commit comments