node_modules/gulp-sass/node_modules/node-sass/src/libsass/src/parser.cpp
// parse a selector schema that will be evaluated in the eval stage
// uses a string schema internally to do the actual schema handling
// in the eval stage we will be re-parse it into an actual selector
parse a selector schema that will be evaluated in the eval stage
uses a string schema internally to do the actual schema handling
in the eval stage we will be re-parse it into an actual selector
parse a selector schema that will be evaluated in the eval stage uses a string schema internally to do the actual schema handling in the eval stage we will be re - parse it into an actual selector
Selector_Schema* Parser::parse_selector_schema(const char* end_of_selector)
  {
    lex< optional_spaces >();
    const char* i = position;
    String_Schema* schema = SASS_MEMORY_NEW(ctx.mem, String_Schema, pstate);
    Selector_Schema* selector_schema = SASS_MEMORY_NEW(ctx.mem, Selector_Schema, pstate, schema);
    selector_schema->media_block(last_media_block);
    while (i < end_of_selector) {
      if (const char* p = find_first_in_interval< exactly<hash_lbrace> >(i, end_of_selector)) {
        if (i < p) (*schema) << SASS_MEMORY_NEW(ctx.mem, String_Constant, pstate, std::string(i, p));
        if (peek < sequence < optional_spaces, exactly<rbrace> > >(p+2)) { position = p+2;
          css_error("Invalid CSS", " after ", ": expected expression (e.g. 1px, bold), was ");
        }
        const char* j = skip_over_scopes< exactly<hash_lbrace>, exactly<rbrace> >(p + 2, end_of_selector);
        Expression* interpolant = Parser::from_c_str(p+2, j, ctx, pstate).parse_list();
        interpolant->is_interpolant(true);
        (*schema) << interpolant;
        i = j;
      }
      else {
        if (i < end_of_selector) (*schema) << SASS_MEMORY_NEW(ctx.mem, String_Constant, pstate, std::string(i, end_of_selector));
        i = end_of_selector;
      }
    }
    position = i;
    selector_schema->update_pstate(pstate);
    return selector_schema;
  }
Selector_Schema * Parser :: parse_selector_schema ( const char * end_of_selector ) { lex < optional_spaces > ( ) ; const char * i = position ; String_Schema * schema = SASS_MEMORY_NEW ( ctx . mem , String_Schema , pstate ) ; Selector_Schema * selector_schema = SASS_MEMORY_NEW ( ctx . mem , Selector_Schema , pstate , schema ) ; selector_schema -> media_block ( last_media_block ) ; while ( i < end_of_selector ) { if ( const char * p = find_first_in_interval < exactly < hash_lbrace > > ( i , end_of_selector ) ) { if ( i < p ) ( * schema ) << SASS_MEMORY_NEW ( ctx . mem , String_Constant , pstate , std :: string ( i , p ) ) ; if ( peek < sequence < optional_spaces , exactly < rbrace > > > ( p + 2 ) ) { position = p + 2 ; css_error ( " " , " " , " " ) ; } const char * j = skip_over_scopes < exactly < hash_lbrace > , exactly < rbrace > > ( p + 2 , end_of_selector ) ; Expression * interpolant = Parser :: from_c_str ( p + 2 , j , ctx , pstate ) . parse_list ( ) ; interpolant -> is_interpolant ( true ) ; ( * schema ) << interpolant ; i = j ; } else { if ( i < end_of_selector ) ( * schema ) << SASS_MEMORY_NEW ( ctx . mem , String_Constant , pstate , std :: string ( i , end_of_selector ) ) ; i = end_of_selector ; } } position = i ; selector_schema -> update_pstate ( pstate ) ; return selector_schema ; }
parse a selector schema that will be evaluated in the eval stage
uses a string schema internally to do the actual schema handling
in the eval stage we will be re-parse it into an actual selector
parse a selector schema that will be evaluated in the eval stage uses a string schema internally to do the actual schema handling in the eval stage we will be re - parse it into an actual selector
// move up to the start // selector schema re-uses string schema implementation // the selector schema is pretty much just a wrapper for the string schema // process until end // try to parse mutliple interpolants // accumulate the preceding segment if the position has advanced // check if the interpolation only contains white-space (error out) // skip over all nested inner interpolations up to our own delimiter // pass inner expression to the parser to resolve nested interpolations // set status on the list expression // add to the string schema // advance position // no more interpolants have been found // add the last segment if there is one // make sure to add the last bits of the string up to the end (if any) // exit loop // EO until eos // update position // update for end position // return parsed result