@@ -110,9 +110,9 @@ namespace Sass {
110110 semicolon = true ;
111111 error_message = " top-level variable binding must be terminated by ';'" ;
112112 }
113- /* else if (peek< sequence< optional< exactly<'*'> >, alternatives< identifier_schema, identifier >, optional_spaces, exactly<':'>, optional_spaces, exactly<'{'> > >(position)) {
114- (*root) << parse_propset();
115- } */
113+ // parse comment blocks
114+
115+
116116 else if (peek< kwd_include >() /* || peek< exactly<'+'> >() */ ) {
117117 Mixin_Call* mixin_call = parse_mixin_call ();
118118 (*root) << mixin_call;
@@ -467,29 +467,7 @@ namespace Sass {
467467 return var;
468468 }
469469
470- /* not used anymore - remove?
471- Propset* Parser::parse_propset()
472- {
473- String* property_segment;
474- if (peek< sequence< optional< exactly<'*'> >, identifier_schema > >()) {
475- property_segment = parse_identifier_schema();
476- }
477- else {
478- lex< sequence< optional< exactly<'*'> >, identifier > >();
479- property_segment = new (ctx.mem) String_Quoted(pstate, lexed);
480- }
481- Propset* propset = new (ctx.mem) Propset(pstate, property_segment);
482- lex< exactly<':'> >();
483-
484- if (!peek< exactly<'{'> >()) error("expected a '{' after namespaced property", pstate);
485-
486- propset->block(parse_block());
487-
488- propset->tabs(indentation);
489-
490- return propset;
491- } */
492-
470+ // a ruleset connects a selector and a block
493471 Ruleset* Parser::parse_ruleset (Selector_Lookahead lookahead)
494472 {
495473 Selector* sel;
@@ -521,13 +499,13 @@ namespace Sass {
521499 const char * i = position;
522500 // selector schema re-uses string schema implementation
523501 String_Schema* schema = new (ctx.mem ) String_Schema (pstate);
524- // process until end
502+ // the selector schema is pretty much just a wrapper for the string schema
525503 while (i < end_of_selector) {
526504 // try to parse mutliple interpolants
527505 if (const char * p = find_first_in_interval< exactly<hash_lbrace> >(i, end_of_selector)) {
528506 // accumulate the preceding segment if the position has advanced
529507 if (i < p) (*schema) << new (ctx.mem ) String_Quoted (pstate, string (i, p));
530- // skip to the delimiter by skipping occurences in quoted strings
508+ // check if the interpolation only contains white-space (error out)
531509 if (peek < sequence < optional_spaces, exactly<rbrace> > >(p+2 )) { position = p+2 ;
532510 css_error (" Invalid CSS" , " after " , " : expected expression (e.g. 1px, bold), was " );
533511 }
@@ -625,7 +603,7 @@ namespace Sass {
625603 exactly<' ~' >,
626604 exactly<' >' >
627605 > >())
628- // no selector before the combinator
606+ // parse the left hand side
629607 { lhs = 0 ; }
630608 else {
631609 lhs = parse_simple_selector_sequence ();
@@ -649,7 +627,7 @@ namespace Sass {
649627 exactly<' ;' >,
650628 optional
651629 > >())
652- // no selector after the combinator
630+ // parse combinator between lhs and rhs
653631 { rhs = 0 ; }
654632 else {
655633 rhs = parse_selector_combination ();
@@ -670,22 +648,22 @@ namespace Sass {
670648 seq->last_block (block_stack.back ());
671649 bool sawsomething = false ;
672650 if (lex_css< exactly<' &' > >()) {
673- // check if we have a parent selector on the root level block
651+ // remove all block comments (don't skip white-space)
674652 if (block_stack.back () && block_stack.back ()->is_root ()) {
675- // error("Base-level rules cannot contain the parent-selector-referencing character '&'.", pstate);
653+ // this produces a linefeed!?
676654 }
677655 (*seq) << new (ctx.mem ) Selector_Reference (pstate);
678656 sawsomething = true ;
679- // if you see a space after a &, then you're done
657+ // parse type selector
680658 if (peek< spaces >() || peek< alternatives < spaces, exactly<' ;' > > >()) {
681659 return seq;
682660 }
683661 }
684662 if (sawsomething && lex_css< sequence< negate< functional >, alternatives< identifier_alnums, universal, quoted_string, dimension, percentage, number > > >()) {
685- // saw an ampersand, then allow type selectors with arbitrary number of hyphens at the beginning
663+ // peek for abort conditions
686664 (*seq) << new (ctx.mem ) Type_Selector (pstate, unquote (lexed));
687665 } else if (lex_css< sequence< negate< functional >, alternatives< type_selector, universal, quoted_string, dimension, percentage, number > > >()) {
688- // if you see a type selector
666+ // otherwise parse another simple selector
689667 (*seq) << new (ctx.mem ) Type_Selector (pstate, lexed);
690668 sawsomething = true ;
691669 }
@@ -740,7 +718,7 @@ namespace Sass {
740718 else {
741719 error (" invalid selector after " + lexed.to_string (), pstate);
742720 }
743- // unreachable statement
721+ // failed
744722 return 0 ;
745723 }
746724
@@ -1027,7 +1005,7 @@ namespace Sass {
10271005 if (!lex_css< one_plus< exactly<' :' > > >()) error (" property \" " + property + " \" must be followed by a ':'" , pstate);
10281006 if (peek_css< exactly<' ;' > >()) error (" style declaration must contain a value" , pstate);
10291007 if (peek_css< static_value >()) {
1030- return new (ctx.mem ) Declaration (prop->pstate (), prop, parse_static_value ()/* , lex<important >()*/ );
1008+ return new (ctx.mem ) Declaration (prop->pstate (), prop, parse_static_value ()/* , lex<kwd_important >()*/ );
10311009 }
10321010 else {
10331011 Expression* value;
@@ -1145,7 +1123,7 @@ namespace Sass {
11451123 > >(position))
11461124 { return new (ctx.mem ) List (pstate, 0 ); }
11471125 Expression* list1 = parse_space_list ();
1148- // if it's a singleton, return it directly; don't wrap it
1126+ // now try to parse a space list
11491127 if (!peek_css< exactly<' ,' > >(position)) return list1;
11501128
11511129 List* comma_list = new (ctx.mem ) List (pstate, 2 , List::COMMA);
@@ -1173,7 +1151,7 @@ namespace Sass {
11731151 Expression* Parser::parse_space_list ()
11741152 {
11751153 Expression* disj1 = parse_disjunction ();
1176- // if it's a singleton, return it directly; don't wrap it
1154+ // if it's a singleton, return it ( don't wrap it)
11771155 if (peek_css< alternatives <
11781156 // exactly<'!'>,
11791157 exactly<' ;' >,
@@ -1213,7 +1191,7 @@ namespace Sass {
12131191 Expression* Parser::parse_disjunction ()
12141192 {
12151193 Expression* conj1 = parse_conjunction ();
1216- // if it's a singleton, return it directly; don't wrap it
1194+ // parse the left hand side conjunction
12171195 if (!peek_css< kwd_or >()) return conj1;
12181196
12191197 vector<Expression*> operands;
@@ -1226,7 +1204,7 @@ namespace Sass {
12261204 Expression* Parser::parse_conjunction ()
12271205 {
12281206 Expression* rel1 = parse_relation ();
1229- // if it's a singleton, return it directly; don't wrap it
1207+ // parse the left hand side relation
12301208 if (!peek_css< kwd_and >()) return rel1;
12311209
12321210 vector<Expression*> operands;
@@ -1239,7 +1217,7 @@ namespace Sass {
12391217 Expression* Parser::parse_relation ()
12401218 {
12411219 Expression* expr1 = parse_expression ();
1242- // if it's a singleton, return it directly; don't wrap it
1220+ // parse the left hand side expression
12431221 if (!(peek< alternatives <
12441222 kwd_eq,
12451223 kwd_neq,
@@ -1267,7 +1245,7 @@ namespace Sass {
12671245 Expression* Parser::parse_expression ()
12681246 {
12691247 Expression* term1 = parse_term ();
1270- // if it's a singleton, return it directly; don't wrap it
1248+ // if it's a singleton, return it ( don't wrap it)
12711249 if (!(peek< exactly<' +' > >(position) ||
12721250 (peek< no_spaces >(position) && peek< sequence< negate< unsigned_number >, exactly<' -' >, negate< space > > >(position)) ||
12731251 (peek< sequence< negate< unsigned_number >, exactly<' -' >, negate< unsigned_number > > >(position))) ||
@@ -1292,7 +1270,7 @@ namespace Sass {
12921270 String_Schema* ss = dynamic_cast <String_Schema*>(factor);
12931271 if (ss && ss->has_interpolants ()) return factor;
12941272 }
1295- // if it's a singleton, return it directly; don't wrap it
1273+ // if it's a singleton, return it ( don't wrap it)
12961274 if (!peek< class_char< static_ops > >(position)) return factor;
12971275 return parse_operators (factor);
12981276 }
@@ -1642,36 +1620,6 @@ namespace Sass {
16421620 return schema;
16431621 }
16441622
1645- /* not used anymore - remove?
1646- String_Schema* Parser::parse_url_schema()
1647- {
1648- String_Schema* schema = new (ctx.mem) String_Schema(pstate);
1649-
1650- while (position < end) {
1651- if (position[0] == '/') {
1652- lexed = Token(position, position+1, before_token);
1653- (*schema) << new (ctx.mem) String_Quoted(pstate, lexed);
1654- ++position;
1655- }
1656- else if (lex< interpolant >()) {
1657- Token insides(Token(lexed.begin + 2, lexed.end - 1, before_token));
1658- Expression* interp_node = Parser::from_token(insides, ctx, pstate).parse_list();
1659- interp_node->is_interpolant(true);
1660- (*schema) << interp_node;
1661- }
1662- else if (lex< sequence< identifier, exactly<':'> > >()) {
1663- (*schema) << new (ctx.mem) String_Quoted(pstate, lexed);
1664- }
1665- else if (lex< filename >()) {
1666- (*schema) << new (ctx.mem) String_Quoted(pstate, lexed);
1667- }
1668- else {
1669- error("error parsing interpolated url", pstate);
1670- }
1671- }
1672- return schema;
1673- } */
1674-
16751623 // this parses interpolation outside other strings
16761624 // means the result must not be quoted again later
16771625 String* Parser::parse_identifier_schema ()
0 commit comments