@@ -524,12 +524,12 @@ namespace Sass {
524524 // At-rules -- arbitrary directives beginning with "@" that may have an
525525 // optional statement block.
526526 // /////////////////////////////////////////////////////////////////////
527- class At_Rule : public Has_Block {
527+ class Directive : public Has_Block {
528528 ADD_PROPERTY (std::string, keyword)
529529 ADD_PROPERTY (Selector*, selector)
530530 ADD_PROPERTY (Expression*, value)
531531 public:
532- At_Rule (ParserState pstate, std::string kwd, Selector* sel = 0 , Block* b = 0 , Expression* val = 0 )
532+ Directive (ParserState pstate, std::string kwd, Selector* sel = 0 , Block* b = 0 , Expression* val = 0 )
533533 : Has_Block(pstate, b), keyword_(kwd), selector_(sel), value_(val) // set value manually if needed
534534 { statement_type (DIRECTIVE); }
535535 bool bubbles () { return is_keyframes () || is_media (); }
@@ -1471,6 +1471,9 @@ namespace Sass {
14711471 { concrete_type (STRING); }
14721472 static std::string type_name () { return " string" ; }
14731473 virtual ~String () = 0 ;
1474+ virtual void rtrim () = 0;
1475+ virtual void ltrim () = 0;
1476+ virtual void trim () = 0;
14741477 virtual bool operator ==(const Expression& rhs) const = 0 ;
14751478 ATTACH_OPERATIONS ()
14761479 };
@@ -1499,6 +1502,9 @@ namespace Sass {
14991502 }
15001503 return false ;
15011504 }
1505+ virtual void rtrim ();
1506+ virtual void ltrim ();
1507+ virtual void trim ();
15021508
15031509 virtual size_t hash ()
15041510 {
@@ -1539,6 +1545,9 @@ namespace Sass {
15391545 std::string type () { return " string" ; }
15401546 static std::string type_name () { return " string" ; }
15411547 virtual bool is_invisible () const ;
1548+ virtual void rtrim ();
1549+ virtual void ltrim ();
1550+ virtual void trim ();
15421551
15431552 virtual size_t hash ()
15441553 {
@@ -1696,60 +1705,33 @@ namespace Sass {
16961705 // ///////////////////////////////////////////////
16971706 // At root expressions (for use inside @at-root).
16981707 // ///////////////////////////////////////////////
1699- class At_Root_Expression : public Expression {
1708+ class At_Root_Query : public Expression {
17001709 private:
1701- ADD_PROPERTY (String *, feature)
1710+ ADD_PROPERTY (Expression *, feature)
17021711 ADD_PROPERTY (Expression*, value)
1703- ADD_PROPERTY (bool , is_interpolated)
17041712 public:
1705- At_Root_Expression (ParserState pstate, String * f = 0 , Expression* v = 0 , bool i = false )
1706- : Expression(pstate), feature_(f), value_(v), is_interpolated_(i)
1713+ At_Root_Query (ParserState pstate, Expression * f = 0 , Expression* v = 0 , bool i = false )
1714+ : Expression(pstate), feature_(f), value_(v)
17071715 { }
1708- bool exclude (std::string str)
1709- {
1710- bool with = feature () && unquote (feature ()->to_string ()).compare (" with" ) == 0 ;
1711- List* l = static_cast <List*>(value ());
1712- std::string v;
1713-
1714- if (with)
1715- {
1716- if (!l || l->length () == 0 ) return str.compare (" rule" ) != 0 ;
1717- for (size_t i = 0 , L = l->length (); i < L; ++i)
1718- {
1719- v = unquote ((*l)[i]->to_string ());
1720- if (v.compare (" all" ) == 0 || v == str) return false ;
1721- }
1722- return true ;
1723- }
1724- else
1725- {
1726- if (!l || !l->length ()) return str.compare (" rule" ) == 0 ;
1727- for (size_t i = 0 , L = l->length (); i < L; ++i)
1728- {
1729- v = unquote ((*l)[i]->to_string ());
1730- if (v.compare (" all" ) == 0 || v == str) return true ;
1731- }
1732- return false ;
1733- }
1734- }
1716+ bool exclude (std::string str);
17351717 ATTACH_OPERATIONS ()
17361718 };
17371719
17381720 // /////////
17391721 // At-root.
17401722 // /////////
17411723 class At_Root_Block : public Has_Block {
1742- ADD_PROPERTY (At_Root_Expression *, expression)
1724+ ADD_PROPERTY (At_Root_Query *, expression)
17431725 public:
1744- At_Root_Block (ParserState pstate, Block* b = 0 , At_Root_Expression * e = 0 )
1726+ At_Root_Block (ParserState pstate, Block* b = 0 , At_Root_Query * e = 0 )
17451727 : Has_Block(pstate, b), expression_(e)
17461728 { statement_type (ATROOT); }
17471729 bool is_hoistable () { return true ; }
17481730 bool bubbles () { return true ; }
17491731 bool exclude_node (Statement* s) {
17501732 if (s->statement_type () == Statement::DIRECTIVE)
17511733 {
1752- return expression ()->exclude (static_cast <At_Rule *>(s)->keyword ().erase (0 , 1 ));
1734+ return expression ()->exclude (static_cast <Directive *>(s)->keyword ().erase (0 , 1 ));
17531735 }
17541736 if (s->statement_type () == Statement::MEDIA)
17551737 {
@@ -1763,7 +1745,7 @@ namespace Sass {
17631745 {
17641746 return expression ()->exclude (" supports" );
17651747 }
1766- if (static_cast <At_Rule *>(s)->is_keyframes ())
1748+ if (static_cast <Directive *>(s)->is_keyframes ())
17671749 {
17681750 return expression ()->exclude (" keyframes" );
17691751 }
0 commit comments