ext/libsass/src/parser.cpp in sassc-1.12.0 vs ext/libsass/src/parser.cpp in sassc-1.12.1

- old
+ new

@@ -1576,11 +1576,11 @@ nr->is_interpolant(false); nr->is_delayed(true); return nr; } - Value_Ptr Parser::lexed_hex_color(const ParserState& pstate, const std::string& parsed) + Expression_Ptr Parser::lexed_hex_color(const ParserState& pstate, const std::string& parsed) { Color_Ptr color = NULL; if (parsed[0] != '#') { return SASS_MEMORY_NEW(String_Quoted, pstate, parsed); } @@ -1626,23 +1626,10 @@ color->is_interpolant(false); color->is_delayed(false); return color; } - Value_Ptr Parser::color_or_string(const std::string& lexed) const - { - if (auto color = name_to_color(lexed)) { - auto c = SASS_MEMORY_NEW(Color, color); - c->is_delayed(true); - c->pstate(pstate); - c->disp(lexed); - return c; - } else { - return SASS_MEMORY_NEW(String_Constant, pstate, lexed); - } - } - // parse one value for a list Expression_Obj Parser::parse_value() { lex< css_comments >(false); if (lex< ampersand >()) @@ -1681,11 +1668,11 @@ if (lex< kwd_null >()) { return SASS_MEMORY_NEW(Null, pstate); } if (lex< identifier >()) { - return color_or_string(lexed); + return SASS_MEMORY_NEW(String_Constant, pstate, lexed); } if (lex< percentage >()) { return lexed_percentage(lexed); } @@ -1852,22 +1839,23 @@ } return schema->length() > 0 ? schema.detach() : NULL; } - Value_Obj Parser::parse_static_value() + String_Constant_Obj Parser::parse_static_value() { lex< static_value >(); Token str(lexed); // static values always have trailing white- // space and end delimiter (\s*[;]$) included --pstate.offset.column; --after_token.column; --str.end; --position; - return color_or_string(str.time_wspace());; + String_Constant_Ptr str_node = SASS_MEMORY_NEW(String_Constant, pstate, str.time_wspace()); + return str_node; } String_Obj Parser::parse_string() { return parse_interpolated_chunk(Token(lexed)); @@ -1972,11 +1960,11 @@ } Expression_Obj ex; if (lex< re_static_expression >()) { ex = SASS_MEMORY_NEW(String_Constant, pstate, lexed); } else { - ex = parse_list(true); + ex = parse_list(); } ex->is_interpolant(true); schema->append(ex); if (!lex < exactly < rbrace > >()) { css_error("Invalid CSS", " after ", ": expected \"}\", was "); @@ -1996,11 +1984,11 @@ if ((*position == '"' || *position == '\'') || peek < alternatives < alpha > >()) { // need_space = true; } if (peek < exactly < '-' > >()) break; } - else if (lex< identifier >()) { + else if (lex< sequence < identifier > >()) { schema->append(SASS_MEMORY_NEW(String_Constant, pstate, lexed)); if ((*position == '"' || *position == '\'') || peek < alternatives < alpha > >()) { // need_space = true; } } @@ -2701,13 +2689,11 @@ // if ((rv = lex_block_comment())) return rv; // if ((rv = lex_single_line_comment())) return rv; if ((rv = lex_interp_string())) return rv; if ((rv = lex_interp_uri())) return rv; if ((rv = lex_interpolation())) return rv; - if (lex< alternatives< hex, hex0 > >()) - { return lexed_hex_color(lexed); } - return rv; + return rv; } String_Schema_Obj Parser::parse_almost_any_value() { @@ -2789,22 +2775,20 @@ peek < re_selector_list >(p) ) { bool could_be_property = peek< sequence< exactly<'-'>, exactly<'-'> > >(p) != 0; - bool could_be_escaped = false; while (p < q) { // did we have interpolations? if (*p == '#' && *(p+1) == '{') { rv.has_interpolants = true; p = q; break; } // A property that's ambiguous with a nested selector is interpreted as a // custom property. - if (*p == ':' && !could_be_escaped) { + if (*p == ':') { rv.is_custom_property = could_be_property || p+1 == q || peek< space >(p+1); } - could_be_escaped = *p == '\\'; ++ p; } // store anyway }