diff --git a/src/ast.cpp b/src/ast.cpp index c1e64cb92..09c65274e 100644 --- a/src/ast.cpp +++ b/src/ast.cpp @@ -76,7 +76,7 @@ namespace Sass { Inspect i(emitter); i.in_declaration = true; // ToDo: inspect should be const - const_cast(this)->perform(&i); + const_cast(this)->perform(&i); return i.get_buffer(); } @@ -173,7 +173,7 @@ namespace Sass { { statement_type(RULESET); } bool Ruleset::is_invisible() const { - if (Selector_List_Ptr sl = Cast(selector())) { + if (Selector_List* sl = Cast(selector())) { for (size_t i = 0, L = sl->length(); i < L; ++i) if (!(*sl)[i]->has_placeholder()) return false; } @@ -594,7 +594,7 @@ namespace Sass { { try { - Unary_Expression_Ptr_Const m = Cast(&rhs); + const Unary_Expression* m = Cast(&rhs); if (m == 0) return false; return type() == m->type() && *operand() == *m->operand(); @@ -647,7 +647,7 @@ namespace Sass { { try { - Argument_Ptr_Const m = Cast(&rhs); + const Argument* m = Cast(&rhs); if (!(m && name() == m->name())) return false; return *value() == *m->value(); } @@ -794,7 +794,7 @@ namespace Sass { bool At_Root_Query::exclude(std::string str) { bool with = feature() && unquote(feature()->to_string()).compare("with") == 0; - List_Ptr l = static_cast(value().ptr()); + List* l = static_cast(value().ptr()); std::string v; if (with) diff --git a/src/ast2c.cpp b/src/ast2c.cpp index fe2c777e7..f167b7ea7 100644 --- a/src/ast2c.cpp +++ b/src/ast2c.cpp @@ -7,28 +7,28 @@ namespace Sass { - union Sass_Value* AST2C::operator()(Boolean_Ptr b) + union Sass_Value* AST2C::operator()(Boolean* b) { return sass_make_boolean(b->value()); } - union Sass_Value* AST2C::operator()(Number_Ptr n) + union Sass_Value* AST2C::operator()(Number* n) { return sass_make_number(n->value(), n->unit().c_str()); } - union Sass_Value* AST2C::operator()(Custom_Warning_Ptr w) + union Sass_Value* AST2C::operator()(Custom_Warning* w) { return sass_make_warning(w->message().c_str()); } - union Sass_Value* AST2C::operator()(Custom_Error_Ptr e) + union Sass_Value* AST2C::operator()(Custom_Error* e) { return sass_make_error(e->message().c_str()); } - union Sass_Value* AST2C::operator()(Color_RGBA_Ptr c) + union Sass_Value* AST2C::operator()(Color_RGBA* c) { return sass_make_color(c->r(), c->g(), c->b(), c->a()); } - union Sass_Value* AST2C::operator()(Color_HSLA_Ptr c) + union Sass_Value* AST2C::operator()(Color_HSLA* c) { Color_RGBA_Obj rgba = c->copyAsRGBA(); return operator()(rgba.ptr()); } - union Sass_Value* AST2C::operator()(String_Constant_Ptr s) + union Sass_Value* AST2C::operator()(String_Constant* s) { if (s->quote_mark()) { return sass_make_qstring(s->value().c_str()); @@ -37,10 +37,10 @@ namespace Sass { } } - union Sass_Value* AST2C::operator()(String_Quoted_Ptr s) + union Sass_Value* AST2C::operator()(String_Quoted* s) { return sass_make_qstring(s->value().c_str()); } - union Sass_Value* AST2C::operator()(List_Ptr l) + union Sass_Value* AST2C::operator()(List* l) { union Sass_Value* v = sass_make_list(l->length(), l->separator(), l->is_bracketed()); for (size_t i = 0, L = l->length(); i < L; ++i) { @@ -49,7 +49,7 @@ namespace Sass { return v; } - union Sass_Value* AST2C::operator()(Map_Ptr m) + union Sass_Value* AST2C::operator()(Map* m) { union Sass_Value* v = sass_make_map(m->length()); int i = 0; @@ -61,7 +61,7 @@ namespace Sass { return v; } - union Sass_Value* AST2C::operator()(Arguments_Ptr a) + union Sass_Value* AST2C::operator()(Arguments* a) { union Sass_Value* v = sass_make_list(a->length(), SASS_COMMA, false); for (size_t i = 0, L = a->length(); i < L; ++i) { @@ -70,11 +70,11 @@ namespace Sass { return v; } - union Sass_Value* AST2C::operator()(Argument_Ptr a) + union Sass_Value* AST2C::operator()(Argument* a) { return a->value()->perform(this); } // not strictly necessary because of the fallback - union Sass_Value* AST2C::operator()(Null_Ptr n) + union Sass_Value* AST2C::operator()(Null* n) { return sass_make_null(); } }; diff --git a/src/ast2c.hpp b/src/ast2c.hpp index a1b2dee40..cd99a17c3 100644 --- a/src/ast2c.hpp +++ b/src/ast2c.hpp @@ -14,22 +14,22 @@ namespace Sass { AST2C() { } ~AST2C() { } - union Sass_Value* operator()(Boolean_Ptr); - union Sass_Value* operator()(Number_Ptr); - union Sass_Value* operator()(Color_RGBA_Ptr); - union Sass_Value* operator()(Color_HSLA_Ptr); - union Sass_Value* operator()(String_Constant_Ptr); - union Sass_Value* operator()(String_Quoted_Ptr); - union Sass_Value* operator()(Custom_Warning_Ptr); - union Sass_Value* operator()(Custom_Error_Ptr); - union Sass_Value* operator()(List_Ptr); - union Sass_Value* operator()(Map_Ptr); - union Sass_Value* operator()(Null_Ptr); - union Sass_Value* operator()(Arguments_Ptr); - union Sass_Value* operator()(Argument_Ptr); + union Sass_Value* operator()(Boolean*); + union Sass_Value* operator()(Number*); + union Sass_Value* operator()(Color_RGBA*); + union Sass_Value* operator()(Color_HSLA*); + union Sass_Value* operator()(String_Constant*); + union Sass_Value* operator()(String_Quoted*); + union Sass_Value* operator()(Custom_Warning*); + union Sass_Value* operator()(Custom_Error*); + union Sass_Value* operator()(List*); + union Sass_Value* operator()(Map*); + union Sass_Value* operator()(Null*); + union Sass_Value* operator()(Arguments*); + union Sass_Value* operator()(Argument*); // return sass error if type is not supported - union Sass_Value* fallback(AST_Node_Ptr x) + union Sass_Value* fallback(AST_Node* x) { return sass_make_error("unknown type for C-API"); } }; diff --git a/src/ast_def_macros.hpp b/src/ast_def_macros.hpp index cfe489daa..d610aa835 100644 --- a/src/ast_def_macros.hpp +++ b/src/ast_def_macros.hpp @@ -70,47 +70,47 @@ public: \ #ifdef DEBUG_SHARED_PTR #define ATTACH_ABSTRACT_AST_OPERATIONS(klass) \ - virtual klass##_Ptr copy(std::string, size_t) const = 0; \ - virtual klass##_Ptr clone(std::string, size_t) const = 0; \ + virtual klass* copy(std::string, size_t) const = 0; \ + virtual klass* clone(std::string, size_t) const = 0; \ #define ATTACH_VIRTUAL_AST_OPERATIONS(klass) \ klass(const klass* ptr); \ - virtual klass##_Ptr copy(std::string, size_t) const override = 0; \ - virtual klass##_Ptr clone(std::string, size_t) const override = 0; \ + virtual klass* copy(std::string, size_t) const override = 0; \ + virtual klass* clone(std::string, size_t) const override = 0; \ #define ATTACH_AST_OPERATIONS(klass) \ klass(const klass* ptr); \ - virtual klass##_Ptr copy(std::string, size_t) const override; \ - virtual klass##_Ptr clone(std::string, size_t) const override; \ + virtual klass* copy(std::string, size_t) const override; \ + virtual klass* clone(std::string, size_t) const override; \ #else #define ATTACH_ABSTRACT_AST_OPERATIONS(klass) \ - virtual klass##_Ptr copy() const = 0; \ - virtual klass##_Ptr clone() const = 0; \ + virtual klass* copy() const = 0; \ + virtual klass* clone() const = 0; \ #define ATTACH_VIRTUAL_AST_OPERATIONS(klass) \ klass(const klass* ptr); \ - virtual klass##_Ptr copy() const override = 0; \ - virtual klass##_Ptr clone() const override = 0; \ + virtual klass* copy() const override = 0; \ + virtual klass* clone() const override = 0; \ #define ATTACH_AST_OPERATIONS(klass) \ klass(const klass* ptr); \ - virtual klass##_Ptr copy() const override; \ - virtual klass##_Ptr clone() const override; \ + virtual klass* copy() const override; \ + virtual klass* clone() const override; \ #endif #ifdef DEBUG_SHARED_PTR #define IMPLEMENT_AST_OPERATORS(klass) \ - klass##_Ptr klass::copy(std::string file, size_t line) const { \ - klass##_Ptr cpy = new klass(this); \ + klass* klass::copy(std::string file, size_t line) const { \ + klass* cpy = new klass(this); \ cpy->trace(file, line); \ return cpy; \ } \ - klass##_Ptr klass::clone(std::string file, size_t line) const { \ - klass##_Ptr cpy = copy(file, line); \ + klass* klass::clone(std::string file, size_t line) const { \ + klass* cpy = copy(file, line); \ cpy->cloneChildren(); \ return cpy; \ } \ @@ -118,11 +118,11 @@ public: \ #else #define IMPLEMENT_AST_OPERATORS(klass) \ - klass##_Ptr klass::copy() const { \ + klass* klass::copy() const { \ return new klass(this); \ } \ - klass##_Ptr klass::clone() const { \ - klass##_Ptr cpy = copy(); \ + klass* klass::clone() const { \ + klass* cpy = copy(); \ cpy->cloneChildren(); \ return cpy; \ } \ diff --git a/src/ast_fwd_decl.hpp b/src/ast_fwd_decl.hpp index a66495985..b0067de04 100644 --- a/src/ast_fwd_decl.hpp +++ b/src/ast_fwd_decl.hpp @@ -19,260 +19,104 @@ namespace Sass { class AST_Node; - typedef AST_Node* AST_Node_Ptr; - typedef AST_Node const* AST_Node_Ptr_Const; class Has_Block; - typedef Has_Block* Has_Block_Ptr; - typedef Has_Block const* Has_Block_Ptr_Const; class Simple_Selector; - typedef Simple_Selector* Simple_Selector_Ptr; - typedef Simple_Selector const* Simple_Selector_Ptr_Const; class Parent_Reference; - typedef Parent_Reference* Parent_Reference_Ptr; - typedef Parent_Reference const* Parent_Reference_Ptr_Const; class PreValue; - typedef PreValue* PreValue_Ptr; - typedef PreValue const* PreValue_Ptr_Const; class Block; - typedef Block* Block_Ptr; - typedef Block const* Block_Ptr_Const; class Expression; - typedef Expression* Expression_Ptr; - typedef Expression const* Expression_Ptr_Const; class Statement; - typedef Statement* Statement_Ptr; - typedef Statement const* Statement_Ptr_Const; class Value; - typedef Value* Value_Ptr; - typedef Value const* Value_Ptr_Const; class Declaration; - typedef Declaration* Declaration_Ptr; - typedef Declaration const* Declaration_Ptr_Const; class Ruleset; - typedef Ruleset* Ruleset_Ptr; - typedef Ruleset const* Ruleset_Ptr_Const; class Bubble; - typedef Bubble* Bubble_Ptr; - typedef Bubble const* Bubble_Ptr_Const; class Trace; - typedef Trace* Trace_Ptr; - typedef Trace const* Trace_Ptr_Const; class Media_Block; - typedef Media_Block* Media_Block_Ptr; - typedef Media_Block const* Media_Block_Ptr_Const; class Supports_Block; - typedef Supports_Block* Supports_Block_Ptr; - typedef Supports_Block const* Supports_Block_Ptr_Const; class Directive; - typedef Directive* Directive_Ptr; - typedef Directive const* Directive_Ptr_Const; class Keyframe_Rule; - typedef Keyframe_Rule* Keyframe_Rule_Ptr; - typedef Keyframe_Rule const* Keyframe_Rule_Ptr_Const; class At_Root_Block; - typedef At_Root_Block* At_Root_Block_Ptr; - typedef At_Root_Block const* At_Root_Block_Ptr_Const; class Assignment; - typedef Assignment* Assignment_Ptr; - typedef Assignment const* Assignment_Ptr_Const; class Import; - typedef Import* Import_Ptr; - typedef Import const* Import_Ptr_Const; class Import_Stub; - typedef Import_Stub* Import_Stub_Ptr; - typedef Import_Stub const* Import_Stub_Ptr_Const; class Warning; - typedef Warning* Warning_Ptr; - typedef Warning const* Warning_Ptr_Const; class Error; - typedef Error* Error_Ptr; - typedef Error const* Error_Ptr_Const; class Debug; - typedef Debug* Debug_Ptr; - typedef Debug const* Debug_Ptr_Const; class Comment; - typedef Comment* Comment_Ptr; - typedef Comment const* Comment_Ptr_Const; class If; - typedef If* If_Ptr; - typedef If const* If_Ptr_Const; class For; - typedef For* For_Ptr; - typedef For const* For_Ptr_Const; class Each; - typedef Each* Each_Ptr; - typedef Each const* Each_Ptr_Const; class While; - typedef While* While_Ptr; - typedef While const* While_Ptr_Const; class Return; - typedef Return* Return_Ptr; - typedef Return const* Return_Ptr_Const; class Content; - typedef Content* Content_Ptr; - typedef Content const* Content_Ptr_Const; class Extension; - typedef Extension* Extension_Ptr; - typedef Extension const* Extension_Ptr_Const; class Definition; - typedef Definition* Definition_Ptr; - typedef Definition const* Definition_Ptr_Const; class List; - typedef List* List_Ptr; - typedef List const* List_Ptr_Const; class Map; - typedef Map* Map_Ptr; - typedef Map const* Map_Ptr_Const; class Function; - typedef Function* Function_Ptr; - typedef Function const* Function_Ptr_Const; class Mixin_Call; - typedef Mixin_Call* Mixin_Call_Ptr; - typedef Mixin_Call const* Mixin_Call_Ptr_Const; class Binary_Expression; - typedef Binary_Expression* Binary_Expression_Ptr; - typedef Binary_Expression const* Binary_Expression_Ptr_Const; class Unary_Expression; - typedef Unary_Expression* Unary_Expression_Ptr; - typedef Unary_Expression const* Unary_Expression_Ptr_Const; class Function_Call; - typedef Function_Call* Function_Call_Ptr; - typedef Function_Call const* Function_Call_Ptr_Const; class Custom_Warning; - typedef Custom_Warning* Custom_Warning_Ptr; - typedef Custom_Warning const* Custom_Warning_Ptr_Const; class Custom_Error; - typedef Custom_Error* Custom_Error_Ptr; - typedef Custom_Error const* Custom_Error_Ptr_Const; class Variable; - typedef Variable* Variable_Ptr; - typedef Variable const* Variable_Ptr_Const; class Number; - typedef Number* Number_Ptr; - typedef Number const* Number_Ptr_Const; class Color; - typedef Color* Color_Ptr; - typedef Color const* Color_Ptr_Const; class Color_RGBA; - typedef Color_RGBA* Color_RGBA_Ptr; - typedef Color_RGBA const* Color_RGBA_Ptr_Const; class Color_HSLA; - typedef Color_HSLA* Color_HSLA_Ptr; - typedef Color_HSLA const* Color_HSLA_Ptr_Const; class Boolean; - typedef Boolean* Boolean_Ptr; - typedef Boolean const* Boolean_Ptr_Const; class String; - typedef String* String_Ptr; - typedef String const* String_Ptr_Const; class String_Schema; - typedef String_Schema* String_Schema_Ptr; - typedef String_Schema const* String_Schema_Ptr_Const; class String_Constant; - typedef String_Constant* String_Constant_Ptr; - typedef String_Constant const* String_Constant_Ptr_Const; class String_Quoted; - typedef String_Quoted* String_Quoted_Ptr; - typedef String_Quoted const* String_Quoted_Ptr_Const; class Media_Query; - typedef Media_Query* Media_Query_Ptr; - typedef Media_Query const* Media_Query_Ptr_Const; class Media_Query_Expression; - typedef Media_Query_Expression* Media_Query_Expression_Ptr; - typedef Media_Query_Expression const* Media_Query_Expression_Ptr_Const; class Supports_Condition; - typedef Supports_Condition* Supports_Condition_Ptr; - typedef Supports_Condition const* Supports_Condition_Ptr_Const; class Supports_Operator; - typedef Supports_Operator* Supports_Operator_Ptr; - typedef Supports_Operator const* Supports_Operator_Ptr_Const; class Supports_Negation; - typedef Supports_Negation* Supports_Negation_Ptr; - typedef Supports_Negation const* Supports_Negation_Ptr_Const; class Supports_Declaration; - typedef Supports_Declaration* Supports_Declaration_Ptr; - typedef Supports_Declaration const* Supports_Declaration_Ptr_Const; class Supports_Interpolation; - typedef Supports_Interpolation* Supports_Interpolation_Ptr; - typedef Supports_Interpolation const* Supports_Interpolation_Ptr_Const; class Null; - typedef Null* Null_Ptr; - typedef Null const* Null_Ptr_Const; class At_Root_Query; - typedef At_Root_Query* At_Root_Query_Ptr; - typedef At_Root_Query const* At_Root_Query_Ptr_Const; class Parent_Selector; - typedef Parent_Selector* Parent_Selector_Ptr; - typedef Parent_Selector const* Parent_Selector_Ptr_Const; class Parameter; - typedef Parameter* Parameter_Ptr; - typedef Parameter const* Parameter_Ptr_Const; class Parameters; - typedef Parameters* Parameters_Ptr; - typedef Parameters const* Parameters_Ptr_Const; class Argument; - typedef Argument* Argument_Ptr; - typedef Argument const* Argument_Ptr_Const; class Arguments; - typedef Arguments* Arguments_Ptr; - typedef Arguments const* Arguments_Ptr_Const; class Selector; - typedef Selector* Selector_Ptr; - typedef Selector const* Selector_Ptr_Const; class Selector_Schema; - typedef Selector_Schema* Selector_Schema_Ptr; - typedef Selector_Schema const* Selector_Schema_Ptr_Const; class Placeholder_Selector; - typedef Placeholder_Selector* Placeholder_Selector_Ptr; - typedef Placeholder_Selector const* Placeholder_Selector_Ptr_Const; class Type_Selector; - typedef Type_Selector* Type_Selector_Ptr; - typedef Type_Selector const* Type_Selector_Ptr_Const; class Class_Selector; - typedef Class_Selector* Class_Selector_Ptr; - typedef Class_Selector const* Class_Selector_Ptr_Const; class Id_Selector; - typedef Id_Selector* Id_Selector_Ptr; - typedef Id_Selector const* Id_Selector_Ptr_Const; class Attribute_Selector; - typedef Attribute_Selector* Attribute_Selector_Ptr; - typedef Attribute_Selector const* Attribute_Selector_Ptr_Const; class Pseudo_Selector; - typedef Pseudo_Selector* Pseudo_Selector_Ptr; - typedef Pseudo_Selector const * Pseudo_Selector_Ptr_Const; class Wrapped_Selector; - typedef Wrapped_Selector* Wrapped_Selector_Ptr; - typedef Wrapped_Selector const * Wrapped_Selector_Ptr_Const; class Compound_Selector; - typedef Compound_Selector* Compound_Selector_Ptr; - typedef Compound_Selector const * Compound_Selector_Ptr_Const; class Complex_Selector; - typedef Complex_Selector* Complex_Selector_Ptr; - typedef Complex_Selector const * Complex_Selector_Ptr_Const; class Selector_List; - typedef Selector_List* Selector_List_Ptr; - typedef Selector_List const * Selector_List_Ptr_Const; // common classes @@ -447,10 +291,10 @@ namespace Sass { typedef std::set CompoundSelectorSet; typedef std::unordered_set SimpleSelectorDict; - typedef std::vector BlockStack; + typedef std::vector BlockStack; typedef std::vector CalleeStack; typedef std::vector CallStack; - typedef std::vector MediaStack; + typedef std::vector MediaStack; typedef std::vector SelectorStack; typedef std::vector ImporterStack; diff --git a/src/ast_sel_cmp.cpp b/src/ast_sel_cmp.cpp index 531f8ee19..e6bb1b799 100644 --- a/src/ast_sel_cmp.cpp +++ b/src/ast_sel_cmp.cpp @@ -168,8 +168,8 @@ namespace Sass { size_t L = std::min(length(), rhs.length()); for (size_t i = 0; i < L; ++i) { - Simple_Selector_Ptr l = (*this)[i]; - Simple_Selector_Ptr r = rhs[i]; + Simple_Selector* l = (*this)[i]; + Simple_Selector* r = rhs[i]; if (!l && !r) return false; else if (!r) return false; else if (!l) return true; @@ -199,10 +199,10 @@ namespace Sass { bool Complex_Selector::operator< (const Complex_Selector& rhs) const { // const iterators for tails - Complex_Selector_Ptr_Const l = this; - Complex_Selector_Ptr_Const r = &rhs; - Compound_Selector_Ptr l_h = NULL; - Compound_Selector_Ptr r_h = NULL; + const Complex_Selector* l = this; + const Complex_Selector* r = &rhs; + Compound_Selector* l_h = NULL; + Compound_Selector* r_h = NULL; if (l) l_h = l->head(); if (r) r_h = r->head(); // process all tails @@ -268,10 +268,10 @@ namespace Sass { bool Complex_Selector::operator== (const Complex_Selector& rhs) const { // const iterators for tails - Complex_Selector_Ptr_Const l = this; - Complex_Selector_Ptr_Const r = &rhs; - Compound_Selector_Ptr l_h = NULL; - Compound_Selector_Ptr r_h = NULL; + const Complex_Selector* l = this; + const Complex_Selector* r = &rhs; + Compound_Selector* l_h = NULL; + Compound_Selector* r_h = NULL; if (l) l_h = l->head(); if (r) r_h = r->head(); // process all tails diff --git a/src/ast_sel_unify.cpp b/src/ast_sel_unify.cpp index 41c260e19..00d898c56 100644 --- a/src/ast_sel_unify.cpp +++ b/src/ast_sel_unify.cpp @@ -21,7 +21,7 @@ namespace Sass { - Compound_Selector_Ptr Compound_Selector::unify_with(Compound_Selector_Ptr rhs) + Compound_Selector* Compound_Selector::unify_with(Compound_Selector* rhs) { #ifdef DEBUG_UNIFY const std::string debug_call = "unify(Compound[" + this->to_string() + "], Compound[" + rhs->to_string() + "])"; @@ -41,7 +41,7 @@ namespace Sass { return unified.detach(); } - Compound_Selector_Ptr Simple_Selector::unify_with(Compound_Selector_Ptr rhs) + Compound_Selector* Simple_Selector::unify_with(Compound_Selector* rhs) { #ifdef DEBUG_UNIFY const std::string debug_call = "unify(Simple[" + this->to_string() + "], Compound[" + rhs->to_string() + "])"; @@ -50,9 +50,9 @@ namespace Sass { if (rhs->length() == 1) { if (rhs->at(0)->is_universal()) { - Compound_Selector_Ptr this_compound = SASS_MEMORY_NEW(Compound_Selector, pstate(), 1); + Compound_Selector* this_compound = SASS_MEMORY_NEW(Compound_Selector, pstate(), 1); this_compound->append(SASS_MEMORY_COPY(this)); - Compound_Selector_Ptr unified = rhs->at(0)->unify_with(this_compound); + Compound_Selector* unified = rhs->at(0)->unify_with(this_compound); if (unified == nullptr || unified != this_compound) delete this_compound; #ifdef DEBUG_UNIFY @@ -79,7 +79,7 @@ namespace Sass { return rhs; } - Simple_Selector_Ptr Type_Selector::unify_with(Simple_Selector_Ptr rhs) + Simple_Selector* Type_Selector::unify_with(Simple_Selector* rhs) { #ifdef DEBUG_UNIFY const std::string debug_call = "unify(Type[" + this->to_string() + "], Simple[" + rhs->to_string() + "])"; @@ -117,7 +117,7 @@ namespace Sass { return this; } - Compound_Selector_Ptr Type_Selector::unify_with(Compound_Selector_Ptr rhs) + Compound_Selector* Type_Selector::unify_with(Compound_Selector* rhs) { #ifdef DEBUG_UNIFY const std::string debug_call = "unify(Type[" + this->to_string() + "], Compound[" + rhs->to_string() + "])"; @@ -131,9 +131,9 @@ namespace Sass { #endif return rhs; } - Type_Selector_Ptr rhs_0 = Cast(rhs->at(0)); + Type_Selector* rhs_0 = Cast(rhs->at(0)); if (rhs_0 != nullptr) { - Simple_Selector_Ptr unified = unify_with(rhs_0); + Simple_Selector* unified = unify_with(rhs_0); if (unified == nullptr) { #ifdef DEBUG_UNIFY std::cerr << "> " << debug_call << " = nullptr" << std::endl; @@ -150,16 +150,16 @@ namespace Sass { return rhs; } - Compound_Selector_Ptr Class_Selector::unify_with(Compound_Selector_Ptr rhs) + Compound_Selector* Class_Selector::unify_with(Compound_Selector* rhs) { rhs->has_line_break(has_line_break()); return Simple_Selector::unify_with(rhs); } - Compound_Selector_Ptr Id_Selector::unify_with(Compound_Selector_Ptr rhs) + Compound_Selector* Id_Selector::unify_with(Compound_Selector* rhs) { for (const Simple_Selector_Obj& sel : rhs->elements()) { - if (Id_Selector_Ptr id_sel = Cast(sel)) { + if (Id_Selector* id_sel = Cast(sel)) { if (id_sel->name() != name()) return nullptr; } } @@ -167,11 +167,11 @@ namespace Sass { return Simple_Selector::unify_with(rhs); } - Compound_Selector_Ptr Pseudo_Selector::unify_with(Compound_Selector_Ptr rhs) + Compound_Selector* Pseudo_Selector::unify_with(Compound_Selector* rhs) { if (is_pseudo_element()) { for (const Simple_Selector_Obj& sel : rhs->elements()) { - if (Pseudo_Selector_Ptr pseudo_sel = Cast(sel)) { + if (Pseudo_Selector* pseudo_sel = Cast(sel)) { if (pseudo_sel->is_pseudo_element() && pseudo_sel->name() != name()) return nullptr; } } @@ -179,7 +179,7 @@ namespace Sass { return Simple_Selector::unify_with(rhs); } - Selector_List_Ptr Complex_Selector::unify_with(Complex_Selector_Ptr rhs) + Selector_List* Complex_Selector::unify_with(Complex_Selector* rhs) { #ifdef DEBUG_UNIFY const std::string debug_call = "unify(Complex[" + this->to_string() + "], Complex[" + rhs->to_string() + "])"; @@ -187,8 +187,8 @@ namespace Sass { #endif // get last tails (on the right side) - Complex_Selector_Ptr l_last = this->mutable_last(); - Complex_Selector_Ptr r_last = rhs->mutable_last(); + Complex_Selector* l_last = this->mutable_last(); + Complex_Selector* r_last = rhs->mutable_last(); // check valid pointers (assertion) SASS_ASSERT(l_last, "lhs is null"); @@ -201,8 +201,8 @@ namespace Sass { if (r_last->combinator() != Combinator::ANCESTOR_OF) return nullptr; // get the headers for the last tails - Compound_Selector_Ptr l_last_head = l_last->head(); - Compound_Selector_Ptr r_last_head = r_last->head(); + Compound_Selector* l_last_head = l_last->head(); + Compound_Selector* r_last_head = r_last->head(); // check valid head pointers (assertion) SASS_ASSERT(l_last_head, "lhs head is null"); @@ -246,7 +246,7 @@ namespace Sass { return result->length() ? result.detach() : nullptr; } - Selector_List_Ptr Selector_List::unify_with(Selector_List_Ptr rhs) { + Selector_List* Selector_List::unify_with(Selector_List* rhs) { #ifdef DEBUG_UNIFY const std::string debug_call = "unify(List[" + this->to_string() + "], List[" + rhs->to_string() + "])"; std::cerr << debug_call << std::endl; @@ -267,7 +267,7 @@ namespace Sass { } // Creates the final Selector_List by combining all the complex selectors - Selector_List_Ptr final_result = SASS_MEMORY_NEW(Selector_List, pstate(), result.size()); + Selector_List* final_result = SASS_MEMORY_NEW(Selector_List, pstate(), result.size()); for (Complex_Selector_Obj& sel : result) { final_result->append(sel); } diff --git a/src/ast_selectors.cpp b/src/ast_selectors.cpp index 98cfd5c92..a8576489f 100644 --- a/src/ast_selectors.cpp +++ b/src/ast_selectors.cpp @@ -40,7 +40,7 @@ namespace Sass { hash_(ptr->hash_) { concrete_type(SELECTOR); } - void Selector::set_media_block(Media_Block_Ptr mb) + void Selector::set_media_block(Media_Block* mb) { media_block(mb); } @@ -202,7 +202,7 @@ namespace Sass { return false; } - bool Simple_Selector::is_superselector_of(Compound_Selector_Ptr_Const sub) const + bool Simple_Selector::is_superselector_of(const Compound_Selector* sub) const { return false; } @@ -373,7 +373,7 @@ namespace Sass { : Simple_Selector(ptr), selector_(ptr->selector_) { simple_type(WRAPPED_SEL); } - bool Wrapped_Selector::is_superselector_of(Wrapped_Selector_Ptr_Const sub) const + bool Wrapped_Selector::is_superselector_of(const Wrapped_Selector* sub) const { if (this->name() != sub->name()) return false; if (this->name() == ":current") return false; @@ -485,7 +485,7 @@ namespace Sass { return false; } - bool Compound_Selector::is_superselector_of(Selector_List_Ptr_Const rhs, std::string wrapped) const + bool Compound_Selector::is_superselector_of(const Selector_List* rhs, std::string wrapped) const { for (Complex_Selector_Obj item : rhs->elements()) { if (is_superselector_of(item, wrapped)) return true; @@ -493,18 +493,18 @@ namespace Sass { return false; } - bool Compound_Selector::is_superselector_of(Complex_Selector_Ptr_Const rhs, std::string wrapped) const + bool Compound_Selector::is_superselector_of(const Complex_Selector* rhs, std::string wrapped) const { if (rhs->head()) return is_superselector_of(rhs->head(), wrapped); return false; } - bool Compound_Selector::is_superselector_of(Compound_Selector_Ptr_Const rhs, std::string wrapping) const + bool Compound_Selector::is_superselector_of(const Compound_Selector* rhs, std::string wrapping) const { // Check if pseudo-elements are the same between the selectors { std::array, 2> pseudosets; - std::array compounds = {{this, rhs}}; + std::array compounds = {{this, rhs}}; for (int i = 0; i < 2; ++i) { for (const Simple_Selector_Obj& el : compounds[i]->elements()) { if (el->is_pseudo_element()) { @@ -518,21 +518,21 @@ namespace Sass { } { - Simple_Selector_Ptr_Const lbase = this->base(); - Simple_Selector_Ptr_Const rbase = rhs->base(); + const Simple_Selector* lbase = this->base(); + const Simple_Selector* rbase = rhs->base(); if (lbase && rbase) { return *lbase == *rbase && - contains_all(std::unordered_set(rhs->begin(), rhs->end()), - std::unordered_set(this->begin(), this->end())); + contains_all(std::unordered_set(rhs->begin(), rhs->end()), + std::unordered_set(this->begin(), this->end())); } } - std::unordered_set lset; + std::unordered_set lset; for (size_t i = 0, iL = length(); i < iL; ++i) { - Selector_Ptr_Const wlhs = (*this)[i].ptr(); + const Selector* wlhs = (*this)[i].ptr(); // very special case for wrapped matches selector - if (Wrapped_Selector_Ptr_Const wrapped = Cast(wlhs)) { + if (const Wrapped_Selector* wrapped = Cast(wlhs)) { if (wrapped->name() == ":not") { if (Selector_List_Obj not_list = Cast(wrapped->selector())) { if (not_list->is_superselector_of(rhs, wrapped->name())) return false; @@ -543,7 +543,7 @@ namespace Sass { if (wrapped->name() == ":matches" || wrapped->name() == ":-moz-any") { wlhs = wrapped->selector(); if (Selector_List_Obj list = Cast(wrapped->selector())) { - if (Compound_Selector_Ptr_Const comp = Cast(rhs)) { + if (const Compound_Selector* comp = Cast(rhs)) { if (!wrapping.empty() && wrapping != wrapped->name()) return false; if (wrapping.empty() || wrapping != wrapped->name()) {; if (list->is_superselector_of(comp, wrapped->name())) return true; @@ -551,9 +551,9 @@ namespace Sass { } } } - Simple_Selector_Ptr rhs_sel = nullptr; + Simple_Selector* rhs_sel = nullptr; if (rhs->elements().size() > i) rhs_sel = (*rhs)[i]; - if (Wrapped_Selector_Ptr wrapped_r = Cast(rhs_sel)) { + if (Wrapped_Selector* wrapped_r = Cast(rhs_sel)) { if (wrapped->name() == wrapped_r->name()) { if (wrapped->is_superselector_of(wrapped_r)) { continue; @@ -565,7 +565,7 @@ namespace Sass { if (lset.empty()) return true; - std::unordered_set rset; + std::unordered_set rset; for (size_t n = 0, nL = rhs->length(); n < nL; ++n) { Selector_Obj r = (*rhs)[n]; @@ -608,7 +608,7 @@ namespace Sass { {}); } - Simple_Selector_Ptr Compound_Selector::base() const { + Simple_Selector* Compound_Selector::base() const { if (length() == 0) return 0; // ToDo: why is this needed? if (Cast((*this)[0])) @@ -654,9 +654,9 @@ namespace Sass { pstate_.offset += element->pstate().offset; } - Compound_Selector_Ptr Compound_Selector::minus(Compound_Selector_Ptr rhs) + Compound_Selector* Compound_Selector::minus(Compound_Selector* rhs) { - Compound_Selector_Ptr result = SASS_MEMORY_NEW(Compound_Selector, pstate()); + Compound_Selector* result = SASS_MEMORY_NEW(Compound_Selector, pstate()); // result->has_parent_reference(has_parent_reference()); // not very efficient because it needs to preserve order @@ -751,7 +751,7 @@ namespace Sass { return sum; } - void Complex_Selector::set_media_block(Media_Block_Ptr mb) { + void Complex_Selector::set_media_block(Media_Block* mb) { media_block(mb); if (tail_) tail_->set_media_block(mb); if (head_) head_->set_media_block(mb); @@ -790,9 +790,9 @@ namespace Sass { void Complex_Selector::addSources(ComplexSelectorSet& sources) { // members.map! {|m| m.is_a?(SimpleSequence) ? m.with_more_sources(sources) : m} - Complex_Selector_Ptr pIter = this; + Complex_Selector* pIter = this; while (pIter) { - Compound_Selector_Ptr pHead = pIter->head(); + Compound_Selector* pHead = pIter->head(); if (pHead) { pHead->mergeSources(sources); @@ -804,9 +804,9 @@ namespace Sass { void Complex_Selector::clearSources() { - Complex_Selector_Ptr pIter = this; + Complex_Selector* pIter = this; while (pIter) { - Compound_Selector_Ptr pHead = pIter->head(); + Compound_Selector* pHead = pIter->head(); if (pHead) { pHead->clearSources(); @@ -837,21 +837,21 @@ namespace Sass { (tail() && tail()->has_real_parent_ref()); } - bool Complex_Selector::is_superselector_of(Compound_Selector_Ptr_Const rhs, std::string wrapping) const + bool Complex_Selector::is_superselector_of(const Compound_Selector* rhs, std::string wrapping) const { return last()->head() && last()->head()->is_superselector_of(rhs, wrapping); } - bool Complex_Selector::is_superselector_of(Complex_Selector_Ptr_Const rhs, std::string wrapping) const + bool Complex_Selector::is_superselector_of(const Complex_Selector* rhs, std::string wrapping) const { - Complex_Selector_Ptr_Const lhs = this; + const Complex_Selector* lhs = this; // check for selectors with leading or trailing combinators if (!lhs->head() || !rhs->head()) { return false; } - Complex_Selector_Ptr_Const l_innermost = lhs->last(); + const Complex_Selector* l_innermost = lhs->last(); if (l_innermost->combinator() != Complex_Selector::ANCESTOR_OF) { return false; } - Complex_Selector_Ptr_Const r_innermost = rhs->last(); + const Complex_Selector* r_innermost = rhs->last(); if (r_innermost->combinator() != Complex_Selector::ANCESTOR_OF) { return false; } // more complex (i.e., longer) selectors are always more specific @@ -876,7 +876,7 @@ namespace Sass { } bool found = false; - Complex_Selector_Ptr_Const marker = rhs; + const Complex_Selector* marker = rhs; for (size_t i = 0, L = rhs->length(); i < L; ++i) { if (i == L-1) { return false; } @@ -949,29 +949,29 @@ namespace Sass { size_t i; size_t L = h->length(); if (Cast(h->first())) { - if (Class_Selector_Ptr cs = Cast(rh->last())) { - Class_Selector_Ptr sqs = SASS_MEMORY_COPY(cs); + if (Class_Selector* cs = Cast(rh->last())) { + Class_Selector* sqs = SASS_MEMORY_COPY(cs); sqs->name(sqs->name() + (*h)[0]->name()); sqs->pstate((*h)[0]->pstate()); (*rh)[rh->length()-1] = sqs; rh->pstate(h->pstate()); for (i = 1; i < L; ++i) rh->append((*h)[i]); - } else if (Id_Selector_Ptr is = Cast(rh->last())) { - Id_Selector_Ptr sqs = SASS_MEMORY_COPY(is); + } else if (Id_Selector* is = Cast(rh->last())) { + Id_Selector* sqs = SASS_MEMORY_COPY(is); sqs->name(sqs->name() + (*h)[0]->name()); sqs->pstate((*h)[0]->pstate()); (*rh)[rh->length()-1] = sqs; rh->pstate(h->pstate()); for (i = 1; i < L; ++i) rh->append((*h)[i]); - } else if (Type_Selector_Ptr ts = Cast(rh->last())) { - Type_Selector_Ptr tss = SASS_MEMORY_COPY(ts); + } else if (Type_Selector* ts = Cast(rh->last())) { + Type_Selector* tss = SASS_MEMORY_COPY(ts); tss->name(tss->name() + (*h)[0]->name()); tss->pstate((*h)[0]->pstate()); (*rh)[rh->length()-1] = tss; rh->pstate(h->pstate()); for (i = 1; i < L; ++i) rh->append((*h)[i]); - } else if (Placeholder_Selector_Ptr ps = Cast(rh->last())) { - Placeholder_Selector_Ptr pss = SASS_MEMORY_COPY(ps); + } else if (Placeholder_Selector* ps = Cast(rh->last())) { + Placeholder_Selector* pss = SASS_MEMORY_COPY(ps); pss->name(pss->name() + (*h)[0]->name()); pss->pstate((*h)[0]->pstate()); (*rh)[rh->length()-1] = pss; @@ -990,10 +990,10 @@ namespace Sass { // std::cerr << "has no or empty head\n"; } - Complex_Selector_Ptr last = mutable_last(); + Complex_Selector* last = mutable_last(); if (last) { if (last->combinator() != ANCESTOR_OF && c != ANCESTOR_OF) { - Complex_Selector_Ptr inter = SASS_MEMORY_NEW(Complex_Selector, pstate()); + Complex_Selector* inter = SASS_MEMORY_NEW(Complex_Selector, pstate()); inter->reference(r); inter->combinator(c); inter->tail(t); @@ -1009,14 +1009,14 @@ namespace Sass { } - Selector_List_Ptr Complex_Selector::resolve_parent_refs(SelectorStack& pstack, Backtraces& traces, bool implicit_parent) + Selector_List* Complex_Selector::resolve_parent_refs(SelectorStack& pstack, Backtraces& traces, bool implicit_parent) { Complex_Selector_Obj tail = this->tail(); Compound_Selector_Obj head = this->head(); - Selector_List_Ptr parents = pstack.back(); + Selector_List* parents = pstack.back(); if (!this->has_real_parent_ref() && !implicit_parent) { - Selector_List_Ptr retval = SASS_MEMORY_NEW(Selector_List, pstate(), 1); + Selector_List* retval = SASS_MEMORY_NEW(Selector_List, pstate(), 1); retval->append(this); return retval; } @@ -1142,8 +1142,8 @@ namespace Sass { } for (Simple_Selector_Obj ss : head->elements()) { - if (Wrapped_Selector_Ptr ws = Cast(ss)) { - if (Selector_List_Ptr sl = Cast(ws->selector())) { + if (Wrapped_Selector* ws = Cast(ss)) { + if (Selector_List* sl = Cast(ws->selector())) { if (parents) ws->selector(sl->resolve_parent_refs(pstack, traces, implicit_parent)); } } @@ -1156,9 +1156,9 @@ namespace Sass { return this->tails(tails); } - Selector_List_Ptr Complex_Selector::tails(Selector_List_Ptr tails) + Selector_List* Complex_Selector::tails(Selector_List* tails) { - Selector_List_Ptr rv = SASS_MEMORY_NEW(Selector_List, pstate_); + Selector_List* rv = SASS_MEMORY_NEW(Selector_List, pstate_); if (tails && tails->length()) { for (size_t i = 0, iL = tails->length(); i < iL; ++i) { Complex_Selector_Obj pr = SASS_MEMORY_CLONE(this); @@ -1173,11 +1173,11 @@ namespace Sass { } // return the last tail that is defined - Complex_Selector_Ptr_Const Complex_Selector::first() const + const Complex_Selector* Complex_Selector::first() const { // declare variables used in loop - Complex_Selector_Ptr_Const cur = this; - Compound_Selector_Ptr_Const head; + const Complex_Selector* cur = this; + const Compound_Selector* head; // processing loop while (cur) { @@ -1194,16 +1194,16 @@ namespace Sass { return cur; } - Complex_Selector_Ptr Complex_Selector::mutable_first() + Complex_Selector* Complex_Selector::mutable_first() { - return const_cast(first()); + return const_cast(first()); } // return the last tail that is defined - Complex_Selector_Ptr_Const Complex_Selector::last() const + const Complex_Selector* Complex_Selector::last() const { - Complex_Selector_Ptr_Const cur = this; - Complex_Selector_Ptr_Const nxt = cur; + const Complex_Selector* cur = this; + const Complex_Selector* nxt = cur; // loop until last while (nxt) { cur = nxt; @@ -1212,9 +1212,9 @@ namespace Sass { return cur; } - Complex_Selector_Ptr Complex_Selector::mutable_last() + Complex_Selector* Complex_Selector::mutable_last() { - return const_cast(last()); + return const_cast(last()); } Complex_Selector::Combinator Complex_Selector::clear_innermost() @@ -1243,7 +1243,7 @@ namespace Sass { // it's a superselector if every selector of the right side // list is a superselector of the given left side selector - bool Complex_Selector::is_superselector_of(Selector_List_Ptr_Const sub, std::string wrapping) const + bool Complex_Selector::is_superselector_of(const Selector_List* sub, std::string wrapping) const { // Check every rhs selector against left hand list for(size_t i = 0, L = sub->length(); i < L; ++i) { @@ -1286,10 +1286,10 @@ namespace Sass { return list; } - Selector_List_Ptr Selector_List::resolve_parent_refs(SelectorStack& pstack, Backtraces& traces, bool implicit_parent) + Selector_List* Selector_List::resolve_parent_refs(SelectorStack& pstack, Backtraces& traces, bool implicit_parent) { if (!this->has_parent_ref()) return this; - Selector_List_Ptr ss = SASS_MEMORY_NEW(Selector_List, pstate()); + Selector_List* ss = SASS_MEMORY_NEW(Selector_List, pstate()); for (size_t si = 0, sL = this->length(); si < sL; ++si) { Selector_List_Obj rv = at(si)->resolve_parent_refs(pstack, traces, implicit_parent); ss->concat(rv); @@ -1352,7 +1352,7 @@ namespace Sass { // it's a superselector if every selector of the right side // list is a superselector of the given left side selector - bool Selector_List::is_superselector_of(Selector_List_Ptr_Const sub, std::string wrapping) const + bool Selector_List::is_superselector_of(const Selector_List* sub, std::string wrapping) const { // Check every rhs selector against left hand list for(size_t i = 0, L = sub->length(); i < L; ++i) { @@ -1363,7 +1363,7 @@ namespace Sass { // it's a superselector if every selector on the right side // is a superselector of any one of the left side selectors - bool Selector_List::is_superselector_of(Compound_Selector_Ptr_Const sub, std::string wrapping) const + bool Selector_List::is_superselector_of(const Compound_Selector* sub, std::string wrapping) const { // Check every lhs selector against right hand for(size_t i = 0, L = length(); i < L; ++i) { @@ -1374,7 +1374,7 @@ namespace Sass { // it's a superselector if every selector on the right side // is a superselector of any one of the left side selectors - bool Selector_List::is_superselector_of(Complex_Selector_Ptr_Const sub, std::string wrapping) const + bool Selector_List::is_superselector_of(const Complex_Selector* sub, std::string wrapping) const { // Check every lhs selector against right hand for(size_t i = 0, L = length(); i < L; ++i) { @@ -1386,7 +1386,7 @@ namespace Sass { void Selector_List::populate_extends(Selector_List_Obj extendee, Subset_Map& extends) { - Selector_List_Ptr extender = this; + Selector_List* extender = this; for (auto complex_sel : extendee->elements()) { Complex_Selector_Obj c = complex_sel; @@ -1440,7 +1440,7 @@ namespace Sass { return sum; } - void Selector_List::set_media_block(Media_Block_Ptr mb) + void Selector_List::set_media_block(Media_Block* mb) { media_block(mb); for (Complex_Selector_Obj cs : elements()) { diff --git a/src/ast_selectors.hpp b/src/ast_selectors.hpp index a0663b3dc..b7257083a 100644 --- a/src/ast_selectors.hpp +++ b/src/ast_selectors.hpp @@ -48,7 +48,7 @@ namespace Sass { ADD_PROPERTY(bool, is_optional) // must not be a reference counted object // otherwise we create circular references - ADD_PROPERTY(Media_Block_Ptr, media_block) + ADD_PROPERTY(Media_Block*, media_block) protected: mutable size_t hash_; public: @@ -57,7 +57,7 @@ namespace Sass { size_t hash() const override = 0; virtual unsigned long specificity() const = 0; virtual int unification_order() const = 0; - virtual void set_media_block(Media_Block_Ptr mb); + virtual void set_media_block(Media_Block* mb); virtual bool has_parent_ref() const; virtual bool has_real_parent_ref() const; // dispatch to correct handlers @@ -78,7 +78,7 @@ namespace Sass { ADD_PROPERTY(bool, connect_parent); // must not be a reference counted object // otherwise we create circular references - ADD_PROPERTY(Media_Block_Ptr, media_block) + ADD_PROPERTY(Media_Block*, media_block) // store computed hash mutable size_t hash_; public: @@ -132,12 +132,12 @@ namespace Sass { virtual bool has_placeholder(); virtual ~Simple_Selector() = 0; - virtual Compound_Selector_Ptr unify_with(Compound_Selector_Ptr); + virtual Compound_Selector* unify_with(Compound_Selector*); virtual bool has_parent_ref() const override; virtual bool has_real_parent_ref() const override; virtual bool is_pseudo_element() const; - virtual bool is_superselector_of(Compound_Selector_Ptr_Const sub) const; + virtual bool is_superselector_of(const Compound_Selector* sub) const; bool operator<(const Selector& rhs) const final override; bool operator==(const Selector& rhs) const final override; @@ -221,8 +221,8 @@ namespace Sass { { return Constants::UnificationOrder_Element; } - Simple_Selector_Ptr unify_with(Simple_Selector_Ptr); - Compound_Selector_Ptr unify_with(Compound_Selector_Ptr) override; + Simple_Selector* unify_with(Simple_Selector*); + Compound_Selector* unify_with(Compound_Selector*) override; bool operator<(const Simple_Selector& rhs) const final override; bool operator==(const Simple_Selector& rhs) const final override; bool operator<(const Type_Selector& rhs) const; @@ -242,7 +242,7 @@ namespace Sass { { return Constants::UnificationOrder_Class; } - Compound_Selector_Ptr unify_with(Compound_Selector_Ptr) override; + Compound_Selector* unify_with(Compound_Selector*) override; bool operator<(const Simple_Selector& rhs) const final override; bool operator==(const Simple_Selector& rhs) const final override; bool operator<(const Class_Selector& rhs) const; @@ -262,7 +262,7 @@ namespace Sass { { return Constants::UnificationOrder_Id; } - Compound_Selector_Ptr unify_with(Compound_Selector_Ptr) override; + Compound_Selector* unify_with(Compound_Selector*) override; bool operator<(const Simple_Selector& rhs) const final override; bool operator==(const Simple_Selector& rhs) const final override; bool operator<(const Id_Selector& rhs) const; @@ -328,7 +328,7 @@ namespace Sass { bool operator==(const Simple_Selector& rhs) const final override; bool operator<(const Pseudo_Selector& rhs) const; bool operator==(const Pseudo_Selector& rhs) const; - Compound_Selector_Ptr unify_with(Compound_Selector_Ptr) override; + Compound_Selector* unify_with(Compound_Selector*) override; ATTACH_AST_OPERATIONS(Pseudo_Selector) ATTACH_CRTP_PERFORM_METHODS() }; @@ -341,7 +341,7 @@ namespace Sass { public: Wrapped_Selector(ParserState pstate, std::string n, Selector_List_Obj sel); using Simple_Selector::is_superselector_of; - bool is_superselector_of(Wrapped_Selector_Ptr_Const sub) const; + bool is_superselector_of(const Wrapped_Selector* sub) const; // Selectors inside the negation pseudo-class are counted like any // other, but the negation itself does not count as a pseudo-class. size_t hash() const override; @@ -383,14 +383,14 @@ namespace Sass { void append(Simple_Selector_Obj element) override; bool is_universal() const; Complex_Selector_Obj to_complex(); - Compound_Selector_Ptr unify_with(Compound_Selector_Ptr rhs); - // virtual Placeholder_Selector_Ptr find_placeholder(); + Compound_Selector* unify_with(Compound_Selector* rhs); + // virtual Placeholder_Selector* find_placeholder(); bool has_parent_ref() const override; bool has_real_parent_ref() const override; - Simple_Selector_Ptr base() const; - bool is_superselector_of(Compound_Selector_Ptr_Const sub, std::string wrapped = "") const; - bool is_superselector_of(Complex_Selector_Ptr_Const sub, std::string wrapped = "") const; - bool is_superselector_of(Selector_List_Ptr_Const sub, std::string wrapped = "") const; + Simple_Selector* base() const; + bool is_superselector_of(const Compound_Selector* sub, std::string wrapped = "") const; + bool is_superselector_of(const Complex_Selector* sub, std::string wrapped = "") const; + bool is_superselector_of(const Selector_List* sub, std::string wrapped = "") const; size_t hash() const override; virtual unsigned long specificity() const override; virtual bool has_placeholder(); @@ -416,7 +416,7 @@ namespace Sass { void clearSources() { sources_.clear(); } void mergeSources(ComplexSelectorSet& sources); - Compound_Selector_Ptr minus(Compound_Selector_Ptr rhs); + Compound_Selector* minus(Compound_Selector* rhs); void cloneChildren() override; ATTACH_AST_OPERATIONS(Compound_Selector) ATTACH_CRTP_PERFORM_METHODS() @@ -456,30 +456,30 @@ namespace Sass { // can still have a tail bool is_empty_ancestor() const; - Selector_List_Ptr tails(Selector_List_Ptr tails); + Selector_List* tails(Selector_List* tails); // front returns the first real tail // skips over parent and empty ones - Complex_Selector_Ptr_Const first() const; - Complex_Selector_Ptr mutable_first(); + const Complex_Selector* first() const; + Complex_Selector* mutable_first(); // last returns the last real tail - Complex_Selector_Ptr_Const last() const; - Complex_Selector_Ptr mutable_last(); + const Complex_Selector* last() const; + Complex_Selector* mutable_last(); size_t length() const; - Selector_List_Ptr resolve_parent_refs(SelectorStack& pstack, Backtraces& traces, bool implicit_parent = true); - bool is_superselector_of(Compound_Selector_Ptr_Const sub, std::string wrapping = "") const; - bool is_superselector_of(Complex_Selector_Ptr_Const sub, std::string wrapping = "") const; - bool is_superselector_of(Selector_List_Ptr_Const sub, std::string wrapping = "") const; - Selector_List_Ptr unify_with(Complex_Selector_Ptr rhs); + Selector_List* resolve_parent_refs(SelectorStack& pstack, Backtraces& traces, bool implicit_parent = true); + bool is_superselector_of(const Compound_Selector* sub, std::string wrapping = "") const; + bool is_superselector_of(const Complex_Selector* sub, std::string wrapping = "") const; + bool is_superselector_of(const Selector_List* sub, std::string wrapping = "") const; + Selector_List* unify_with(Complex_Selector* rhs); Combinator clear_innermost(); void append(Complex_Selector_Obj, Backtraces& traces); void set_innermost(Complex_Selector_Obj, Combinator); size_t hash() const override; virtual unsigned long specificity() const override; - virtual void set_media_block(Media_Block_Ptr mb) override; + virtual void set_media_block(Media_Block* mb) override; virtual bool has_placeholder(); int unification_order() const override { @@ -523,17 +523,17 @@ namespace Sass { bool has_parent_ref() const override; bool has_real_parent_ref() const override; void remove_parent_selectors(); - Selector_List_Ptr resolve_parent_refs(SelectorStack& pstack, Backtraces& traces, bool implicit_parent = true); - bool is_superselector_of(Compound_Selector_Ptr_Const sub, std::string wrapping = "") const; - bool is_superselector_of(Complex_Selector_Ptr_Const sub, std::string wrapping = "") const; - bool is_superselector_of(Selector_List_Ptr_Const sub, std::string wrapping = "") const; - Selector_List_Ptr unify_with(Selector_List_Ptr); + Selector_List* resolve_parent_refs(SelectorStack& pstack, Backtraces& traces, bool implicit_parent = true); + bool is_superselector_of(const Compound_Selector* sub, std::string wrapping = "") const; + bool is_superselector_of(const Complex_Selector* sub, std::string wrapping = "") const; + bool is_superselector_of(const Selector_List* sub, std::string wrapping = "") const; + Selector_List* unify_with(Selector_List*); void populate_extends(Selector_List_Obj, Subset_Map&); Selector_List_Obj eval(Eval& eval); size_t hash() const override; virtual unsigned long specificity() const override; - virtual void set_media_block(Media_Block_Ptr mb) override; + virtual void set_media_block(Media_Block* mb) override; virtual bool has_placeholder(); int unification_order() const override { diff --git a/src/ast_values.cpp b/src/ast_values.cpp index 4ec2b00dc..8473e4104 100644 --- a/src/ast_values.cpp +++ b/src/ast_values.cpp @@ -109,7 +109,7 @@ namespace Sass { // so we need to break before keywords for (size_t i = 0, L = length(); i < L; ++i) { Expression_Obj obj = this->at(i); - if (Argument_Ptr arg = Cast(obj)) { + if (Argument* arg = Cast(obj)) { if (!arg->name().empty()) return i; } } @@ -120,7 +120,7 @@ namespace Sass { Expression_Obj List::value_at_index(size_t i) { Expression_Obj obj = this->at(i); if (is_arglist_) { - if (Argument_Ptr arg = Cast(obj)) { + if (Argument* arg = Cast(obj)) { return arg->value(); } else { return obj; @@ -554,7 +554,7 @@ namespace Sass { return hash_; } - Color_HSLA_Ptr Color_RGBA::copyAsHSLA() const + Color_HSLA* Color_RGBA::copyAsHSLA() const { // Algorithm from http://en.wikipedia.org/wiki/wHSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV @@ -592,7 +592,7 @@ namespace Sass { ); } - Color_RGBA_Ptr Color_RGBA::copyAsRGBA() const + Color_RGBA* Color_RGBA::copyAsRGBA() const { return SASS_MEMORY_COPY(this); } @@ -649,7 +649,7 @@ namespace Sass { return m1; } - Color_RGBA_Ptr Color_HSLA::copyAsRGBA() const + Color_RGBA* Color_HSLA::copyAsRGBA() const { double h = absmod(h_ / 360.0, 1.0); @@ -671,7 +671,7 @@ namespace Sass { ); } - Color_HSLA_Ptr Color_HSLA::copyAsHSLA() const + Color_HSLA* Color_HSLA::copyAsHSLA() const { return SASS_MEMORY_COPY(this); } @@ -771,7 +771,7 @@ namespace Sass { void String_Schema::rtrim() { if (!empty()) { - if (String_Ptr str = Cast(last())) str->rtrim(); + if (String* str = Cast(last())) str->rtrim(); } } diff --git a/src/ast_values.hpp b/src/ast_values.hpp index 77568bad3..f95bb0274 100644 --- a/src/ast_values.hpp +++ b/src/ast_values.hpp @@ -253,11 +253,11 @@ namespace Sass { bool operator== (const Expression& rhs) const override; - virtual Color_RGBA_Ptr copyAsRGBA() const = 0; - virtual Color_RGBA_Ptr toRGBA() = 0; + virtual Color_RGBA* copyAsRGBA() const = 0; + virtual Color_RGBA* toRGBA() = 0; - virtual Color_HSLA_Ptr copyAsHSLA() const = 0; - virtual Color_HSLA_Ptr toHSLA() = 0; + virtual Color_HSLA* copyAsHSLA() const = 0; + virtual Color_HSLA* toHSLA() = 0; ATTACH_VIRTUAL_AST_OPERATIONS(Color) }; @@ -277,11 +277,11 @@ namespace Sass { size_t hash() const override; - Color_RGBA_Ptr copyAsRGBA() const override; - Color_RGBA_Ptr toRGBA() override { return this; } + Color_RGBA* copyAsRGBA() const override; + Color_RGBA* toRGBA() override { return this; } - Color_HSLA_Ptr copyAsHSLA() const override; - Color_HSLA_Ptr toHSLA() override { return copyAsHSLA(); } + Color_HSLA* copyAsHSLA() const override; + Color_HSLA* toHSLA() override { return copyAsHSLA(); } bool operator== (const Expression& rhs) const override; @@ -305,11 +305,11 @@ namespace Sass { size_t hash() const override; - Color_RGBA_Ptr copyAsRGBA() const override; - Color_RGBA_Ptr toRGBA() override { return copyAsRGBA(); } + Color_RGBA* copyAsRGBA() const override; + Color_RGBA* toRGBA() override { return copyAsRGBA(); } - Color_HSLA_Ptr copyAsHSLA() const override; - Color_HSLA_Ptr toHSLA() override { return this; } + Color_HSLA* copyAsHSLA() const override; + Color_HSLA* toHSLA() override { return this; } bool operator== (const Expression& rhs) const override; diff --git a/src/bind.cpp b/src/bind.cpp index 1874667a8..e9f6bbe44 100644 --- a/src/bind.cpp +++ b/src/bind.cpp @@ -67,7 +67,7 @@ namespace Sass { // We should always get a list for rest arguments if (List_Obj rest = Cast(a->value())) { // create a new list object for wrapped items - List_Ptr arglist = SASS_MEMORY_NEW(List, + List* arglist = SASS_MEMORY_NEW(List, p->pstate(), 0, rest->separator(), @@ -95,7 +95,7 @@ namespace Sass { } else if (a->is_keyword_argument()) { // expand keyword arguments into their parameters - List_Ptr arglist = SASS_MEMORY_NEW(List, p->pstate(), 0, SASS_COMMA, true); + List* arglist = SASS_MEMORY_NEW(List, p->pstate(), 0, SASS_COMMA, true); env->local_frame()[p->name()] = arglist; Map_Obj argmap = Cast(a->value()); for (auto key : argmap->keys()) { @@ -204,7 +204,7 @@ namespace Sass { // otherwise move one of the rest args into the param, converting to argument if necessary Expression_Obj obj = arglist->at(0); if (!(a = Cast(obj))) { - Expression_Ptr a_to_convert = obj; + Expression* a_to_convert = obj; a = SASS_MEMORY_NEW(Argument, a_to_convert->pstate(), a_to_convert, @@ -221,7 +221,7 @@ namespace Sass { Map_Obj argmap = Cast(a->value()); for (auto key : argmap->keys()) { - String_Constant_Ptr val = Cast(key); + String_Constant* val = Cast(key); if (val == NULL) { traces.push_back(Backtrace(key->pstate())); throw Exception::InvalidVarKwdType(key->pstate(), traces, key->inspect(), a); @@ -295,7 +295,7 @@ namespace Sass { env->local_frame()[leftover->name()] = varargs; } else if (leftover->default_value()) { - Expression_Ptr dv = leftover->default_value()->perform(eval); + Expression* dv = leftover->default_value()->perform(eval); env->local_frame()[leftover->name()] = dv; } else { diff --git a/src/c2ast.cpp b/src/c2ast.cpp index 3bcbe09d1..384e2dec5 100644 --- a/src/c2ast.cpp +++ b/src/c2ast.cpp @@ -8,11 +8,11 @@ namespace Sass { - Value_Ptr c2ast(union Sass_Value* v, Backtraces traces, ParserState pstate) + Value* c2ast(union Sass_Value* v, Backtraces traces, ParserState pstate) { using std::strlen; using std::strcpy; - Value_Ptr e = NULL; + Value* e = NULL; switch (sass_value_get_tag(v)) { case SASS_BOOLEAN: { e = SASS_MEMORY_NEW(Boolean, pstate, !!sass_boolean_get_value(v)); @@ -31,7 +31,7 @@ namespace Sass { } } break; case SASS_LIST: { - List_Ptr l = SASS_MEMORY_NEW(List, pstate, sass_list_get_length(v), sass_list_get_separator(v)); + List* l = SASS_MEMORY_NEW(List, pstate, sass_list_get_length(v), sass_list_get_separator(v)); for (size_t i = 0, L = sass_list_get_length(v); i < L; ++i) { l->append(c2ast(sass_list_get_value(v, i), traces, pstate)); } @@ -39,7 +39,7 @@ namespace Sass { e = l; } break; case SASS_MAP: { - Map_Ptr m = SASS_MEMORY_NEW(Map, pstate); + Map* m = SASS_MEMORY_NEW(Map, pstate); for (size_t i = 0, L = sass_map_get_length(v); i < L; ++i) { *m << std::make_pair( c2ast(sass_map_get_key(v, i), traces, pstate), diff --git a/src/c2ast.hpp b/src/c2ast.hpp index d6c0a97c3..7f6470969 100644 --- a/src/c2ast.hpp +++ b/src/c2ast.hpp @@ -7,7 +7,7 @@ namespace Sass { - Value_Ptr c2ast(union Sass_Value* v, Backtraces traces, ParserState pstate); + Value* c2ast(union Sass_Value* v, Backtraces traces, ParserState pstate); } diff --git a/src/check_nesting.cpp b/src/check_nesting.cpp index dd45e5ff8..b6ab1faa2 100644 --- a/src/check_nesting.cpp +++ b/src/check_nesting.cpp @@ -9,26 +9,26 @@ namespace Sass { CheckNesting::CheckNesting() - : parents(std::vector()), + : parents(std::vector()), traces(std::vector()), parent(0), current_mixin_definition(0) { } - void error(AST_Node_Ptr node, Backtraces traces, std::string msg) { + void error(AST_Node* node, Backtraces traces, std::string msg) { traces.push_back(Backtrace(node->pstate())); throw Exception::InvalidSass(node->pstate(), traces, msg); } - Statement_Ptr CheckNesting::visit_children(Statement_Ptr parent) + Statement* CheckNesting::visit_children(Statement* parent) { - Statement_Ptr old_parent = this->parent; + Statement* old_parent = this->parent; - if (At_Root_Block_Ptr root = Cast(parent)) { - std::vector old_parents = this->parents; - std::vector new_parents; + if (At_Root_Block* root = Cast(parent)) { + std::vector old_parents = this->parents; + std::vector new_parents; for (size_t i = 0, L = this->parents.size(); i < L; i++) { - Statement_Ptr p = this->parents.at(i); + Statement* p = this->parents.at(i); if (!root->exclude_node(p)) { new_parents.push_back(p); } @@ -36,8 +36,8 @@ namespace Sass { this->parents = new_parents; for (size_t i = this->parents.size(); i > 0; i--) { - Statement_Ptr p = 0; - Statement_Ptr gp = 0; + Statement* p = 0; + Statement* gp = 0; if (i > 0) p = this->parents.at(i - 1); if (i > 1) gp = this->parents.at(i - 2); @@ -47,8 +47,8 @@ namespace Sass { } } - At_Root_Block_Ptr ar = Cast(parent); - Block_Ptr ret = ar->block(); + At_Root_Block* ar = Cast(parent); + Block* ret = ar->block(); if (ret != NULL) { for (auto n : ret->elements()) { @@ -68,16 +68,16 @@ namespace Sass { this->parents.push_back(parent); - Block_Ptr b = Cast(parent); + Block* b = Cast(parent); - if (Trace_Ptr trace = Cast(parent)) { + if (Trace* trace = Cast(parent)) { if (trace->type() == 'i') { this->traces.push_back(Backtrace(trace->pstate())); } } if (!b) { - if (Has_Block_Ptr bb = Cast(parent)) { + if (Has_Block* bb = Cast(parent)) { b = bb->block(); } } @@ -91,7 +91,7 @@ namespace Sass { this->parent = old_parent; this->parents.pop_back(); - if (Trace_Ptr trace = Cast(parent)) { + if (Trace* trace = Cast(parent)) { if (trace->type() == 'i') { this->traces.pop_back(); } @@ -101,12 +101,12 @@ namespace Sass { } - Statement_Ptr CheckNesting::operator()(Block_Ptr b) + Statement* CheckNesting::operator()(Block* b) { return this->visit_children(b); } - Statement_Ptr CheckNesting::operator()(Definition_Ptr n) + Statement* CheckNesting::operator()(Definition* n) { if (!this->should_visit(n)) return NULL; if (!is_mixin(n)) { @@ -114,7 +114,7 @@ namespace Sass { return n; } - Definition_Ptr old_mixin_definition = this->current_mixin_definition; + Definition* old_mixin_definition = this->current_mixin_definition; this->current_mixin_definition = n; visit_children(n); @@ -124,18 +124,18 @@ namespace Sass { return n; } - Statement_Ptr CheckNesting::operator()(If_Ptr i) + Statement* CheckNesting::operator()(If* i) { this->visit_children(i); - if (Block_Ptr b = Cast(i->alternative())) { + if (Block* b = Cast(i->alternative())) { for (auto n : b->elements()) n->perform(this); } return i; } - bool CheckNesting::should_visit(Statement_Ptr node) + bool CheckNesting::should_visit(Statement* node) { if (!this->parent) return true; @@ -160,7 +160,7 @@ namespace Sass { if (this->is_function(this->parent)) { this->invalid_function_child(node); } - if (Declaration_Ptr d = Cast(node)) + if (Declaration* d = Cast(node)) { this->invalid_prop_parent(this->parent, node); this->invalid_value_child(d->value()); @@ -175,14 +175,14 @@ namespace Sass { return true; } - void CheckNesting::invalid_content_parent(Statement_Ptr parent, AST_Node_Ptr node) + void CheckNesting::invalid_content_parent(Statement* parent, AST_Node* node) { if (!this->current_mixin_definition) { error(node, traces, "@content may only be used within a mixin."); } } - void CheckNesting::invalid_charset_parent(Statement_Ptr parent, AST_Node_Ptr node) + void CheckNesting::invalid_charset_parent(Statement* parent, AST_Node* node) { if (!( is_root_node(parent) @@ -191,7 +191,7 @@ namespace Sass { } } - void CheckNesting::invalid_extend_parent(Statement_Ptr parent, AST_Node_Ptr node) + void CheckNesting::invalid_extend_parent(Statement* parent, AST_Node* node) { if (!( Cast(parent) || @@ -202,7 +202,7 @@ namespace Sass { } } - // void CheckNesting::invalid_import_parent(Statement_Ptr parent, AST_Node_Ptr node) + // void CheckNesting::invalid_import_parent(Statement* parent, AST_Node* node) // { // for (auto pp : this->parents) { // if ( @@ -227,9 +227,9 @@ namespace Sass { // } // } - void CheckNesting::invalid_mixin_definition_parent(Statement_Ptr parent, AST_Node_Ptr node) + void CheckNesting::invalid_mixin_definition_parent(Statement* parent, AST_Node* node) { - for (Statement_Ptr pp : this->parents) { + for (Statement* pp : this->parents) { if ( Cast(pp) || Cast(pp) || @@ -244,9 +244,9 @@ namespace Sass { } } - void CheckNesting::invalid_function_parent(Statement_Ptr parent, AST_Node_Ptr node) + void CheckNesting::invalid_function_parent(Statement* parent, AST_Node* node) { - for (Statement_Ptr pp : this->parents) { + for (Statement* pp : this->parents) { if ( Cast(pp) || Cast(pp) || @@ -261,7 +261,7 @@ namespace Sass { } } - void CheckNesting::invalid_function_child(Statement_Ptr child) + void CheckNesting::invalid_function_child(Statement* child) { if (!( Cast(child) || @@ -282,7 +282,7 @@ namespace Sass { } } - void CheckNesting::invalid_prop_child(Statement_Ptr child) + void CheckNesting::invalid_prop_child(Statement* child) { if (!( Cast(child) || @@ -298,7 +298,7 @@ namespace Sass { } } - void CheckNesting::invalid_prop_parent(Statement_Ptr parent, AST_Node_Ptr node) + void CheckNesting::invalid_prop_parent(Statement* parent, AST_Node* node) { if (!( is_mixin(parent) || @@ -312,13 +312,13 @@ namespace Sass { } } - void CheckNesting::invalid_value_child(AST_Node_Ptr d) + void CheckNesting::invalid_value_child(AST_Node* d) { - if (Map_Ptr m = Cast(d)) { + if (Map* m = Cast(d)) { traces.push_back(Backtrace(m->pstate())); throw Exception::InvalidValue(traces, *m); } - if (Number_Ptr n = Cast(d)) { + if (Number* n = Cast(d)) { if (!n->is_valid_css_unit()) { traces.push_back(Backtrace(n->pstate())); throw Exception::InvalidValue(traces, *n); @@ -329,14 +329,14 @@ namespace Sass { } - void CheckNesting::invalid_return_parent(Statement_Ptr parent, AST_Node_Ptr node) + void CheckNesting::invalid_return_parent(Statement* parent, AST_Node* node) { if (!this->is_function(parent)) { error(node, traces, "@return may only be used within a function."); } } - bool CheckNesting::is_transparent_parent(Statement_Ptr parent, Statement_Ptr grandparent) + bool CheckNesting::is_transparent_parent(Statement* parent, Statement* grandparent) { bool parent_bubbles = parent && parent->bubbles(); @@ -353,38 +353,38 @@ namespace Sass { valid_bubble_node; } - bool CheckNesting::is_charset(Statement_Ptr n) + bool CheckNesting::is_charset(Statement* n) { - Directive_Ptr d = Cast(n); + Directive* d = Cast(n); return d && d->keyword() == "charset"; } - bool CheckNesting::is_mixin(Statement_Ptr n) + bool CheckNesting::is_mixin(Statement* n) { - Definition_Ptr def = Cast(n); + Definition* def = Cast(n); return def && def->type() == Definition::MIXIN; } - bool CheckNesting::is_function(Statement_Ptr n) + bool CheckNesting::is_function(Statement* n) { - Definition_Ptr def = Cast(n); + Definition* def = Cast(n); return def && def->type() == Definition::FUNCTION; } - bool CheckNesting::is_root_node(Statement_Ptr n) + bool CheckNesting::is_root_node(Statement* n) { if (Cast(n)) return false; - Block_Ptr b = Cast(n); + Block* b = Cast(n); return b && b->is_root(); } - bool CheckNesting::is_at_root_node(Statement_Ptr n) + bool CheckNesting::is_at_root_node(Statement* n) { return Cast(n) != NULL; } - bool CheckNesting::is_directive_node(Statement_Ptr n) + bool CheckNesting::is_directive_node(Statement* n) { return Cast(n) || Cast(n) || diff --git a/src/check_nesting.hpp b/src/check_nesting.hpp index 687f4afdd..8a9d19c2e 100644 --- a/src/check_nesting.hpp +++ b/src/check_nesting.hpp @@ -6,59 +6,59 @@ namespace Sass { - class CheckNesting : public Operation_CRTP { + class CheckNesting : public Operation_CRTP { - std::vector parents; + std::vector parents; Backtraces traces; - Statement_Ptr parent; - Definition_Ptr current_mixin_definition; + Statement* parent; + Definition* current_mixin_definition; - Statement_Ptr before(Statement_Ptr); - Statement_Ptr visit_children(Statement_Ptr); + Statement* before(Statement*); + Statement* visit_children(Statement*); public: CheckNesting(); ~CheckNesting() { } - Statement_Ptr operator()(Block_Ptr); - Statement_Ptr operator()(Definition_Ptr); - Statement_Ptr operator()(If_Ptr); + Statement* operator()(Block*); + Statement* operator()(Definition*); + Statement* operator()(If*); template - Statement_Ptr fallback(U x) { - Statement_Ptr s = Cast(x); + Statement* fallback(U x) { + Statement* s = Cast(x); if (s && this->should_visit(s)) { - Block_Ptr b1 = Cast(s); - Has_Block_Ptr b2 = Cast(s); + Block* b1 = Cast(s); + Has_Block* b2 = Cast(s); if (b1 || b2) return visit_children(s); } return s; } private: - void invalid_content_parent(Statement_Ptr, AST_Node_Ptr); - void invalid_charset_parent(Statement_Ptr, AST_Node_Ptr); - void invalid_extend_parent(Statement_Ptr, AST_Node_Ptr); - // void invalid_import_parent(Statement_Ptr); - void invalid_mixin_definition_parent(Statement_Ptr, AST_Node_Ptr); - void invalid_function_parent(Statement_Ptr, AST_Node_Ptr); + void invalid_content_parent(Statement*, AST_Node*); + void invalid_charset_parent(Statement*, AST_Node*); + void invalid_extend_parent(Statement*, AST_Node*); + // void invalid_import_parent(Statement*); + void invalid_mixin_definition_parent(Statement*, AST_Node*); + void invalid_function_parent(Statement*, AST_Node*); - void invalid_function_child(Statement_Ptr); - void invalid_prop_child(Statement_Ptr); - void invalid_prop_parent(Statement_Ptr, AST_Node_Ptr); - void invalid_return_parent(Statement_Ptr, AST_Node_Ptr); - void invalid_value_child(AST_Node_Ptr); + void invalid_function_child(Statement*); + void invalid_prop_child(Statement*); + void invalid_prop_parent(Statement*, AST_Node*); + void invalid_return_parent(Statement*, AST_Node*); + void invalid_value_child(AST_Node*); - bool is_transparent_parent(Statement_Ptr, Statement_Ptr); + bool is_transparent_parent(Statement*, Statement*); - bool should_visit(Statement_Ptr); + bool should_visit(Statement*); - bool is_charset(Statement_Ptr); - bool is_mixin(Statement_Ptr); - bool is_function(Statement_Ptr); - bool is_root_node(Statement_Ptr); - bool is_at_root_node(Statement_Ptr); - bool is_directive_node(Statement_Ptr); + bool is_charset(Statement*); + bool is_mixin(Statement*); + bool is_function(Statement*); + bool is_root_node(Statement*); + bool is_at_root_node(Statement*); + bool is_directive_node(Statement*); }; } diff --git a/src/color_maps.cpp b/src/color_maps.cpp index 105d6beb2..a3de078be 100644 --- a/src/color_maps.cpp +++ b/src/color_maps.cpp @@ -455,7 +455,7 @@ namespace Sass { { 102 * 0x10000 + 51 * 0x100 + 153, ColorNames::rebeccapurple } }; - const std::map names_to_colors + const std::map names_to_colors { { ColorNames::aliceblue, &Colors::aliceblue }, { ColorNames::antiquewhite, &Colors::antiquewhite }, @@ -608,12 +608,12 @@ namespace Sass { { ColorNames::transparent, &Colors::transparent } }; - Color_RGBA_Ptr_Const name_to_color(const char* key) + const Color_RGBA* name_to_color(const char* key) { return name_to_color(std::string(key)); } - Color_RGBA_Ptr_Const name_to_color(const std::string& key) + const Color_RGBA* name_to_color(const std::string& key) { // case insensitive lookup. See #2462 std::string lower{key}; diff --git a/src/color_maps.hpp b/src/color_maps.hpp index 1e1978f1e..9ddc4cff7 100644 --- a/src/color_maps.hpp +++ b/src/color_maps.hpp @@ -320,8 +320,8 @@ namespace Sass { extern const Color_RGBA transparent; } - Color_RGBA_Ptr_Const name_to_color(const char*); - Color_RGBA_Ptr_Const name_to_color(const std::string&); + const Color_RGBA* name_to_color(const char*); + const Color_RGBA* name_to_color(const std::string&); const char* color_to_name(const int); const char* color_to_name(const Color_RGBA&); const char* color_to_name(const double); diff --git a/src/context.cpp b/src/context.cpp index 55f27d206..088a70d3f 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -392,7 +392,7 @@ namespace Sass { } - void Context::import_url (Import_Ptr imp, std::string load_path, const std::string& ctx_path) { + void Context::import_url (Import* imp, std::string load_path, const std::string& ctx_path) { ParserState pstate(imp->pstate()); std::string imp_path(unquote(load_path)); @@ -411,11 +411,11 @@ namespace Sass { imp->urls().push_back(SASS_MEMORY_NEW(String_Quoted, imp->pstate(), load_path)); } else if (imp_path.length() > 4 && imp_path.substr(imp_path.length() - 4, 4) == ".css") { - String_Constant_Ptr loc = SASS_MEMORY_NEW(String_Constant, pstate, unquote(load_path)); + String_Constant* loc = SASS_MEMORY_NEW(String_Constant, pstate, unquote(load_path)); Argument_Obj loc_arg = SASS_MEMORY_NEW(Argument, pstate, loc); Arguments_Obj loc_args = SASS_MEMORY_NEW(Arguments, pstate); loc_args->append(loc_arg); - Function_Call_Ptr new_url = SASS_MEMORY_NEW(Function_Call, pstate, std::string("url"), loc_args); + Function_Call* new_url = SASS_MEMORY_NEW(Function_Call, pstate, std::string("url"), loc_args); imp->urls().push_back(new_url); } else { @@ -431,7 +431,7 @@ namespace Sass { // call custom importers on the given (unquoted) load_path and eventually parse the resulting style_sheet - bool Context::call_loader(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import_Ptr imp, std::vector importers, bool only_one) + bool Context::call_loader(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import* imp, std::vector importers, bool only_one) { // unique counter size_t count = 0; @@ -742,14 +742,14 @@ namespace Sass { void register_function(Context& ctx, Signature sig, Native_Function f, Env* env) { - Definition_Ptr def = make_native_function(sig, f, ctx); + Definition* def = make_native_function(sig, f, ctx); def->environment(env); (*env)[def->name() + "[f]"] = def; } void register_function(Context& ctx, Signature sig, Native_Function f, size_t arity, Env* env) { - Definition_Ptr def = make_native_function(sig, f, ctx); + Definition* def = make_native_function(sig, f, ctx); std::stringstream ss; ss << def->name() << "[f]" << arity; def->environment(env); @@ -758,7 +758,7 @@ namespace Sass { void register_overload_stub(Context& ctx, std::string name, Env* env) { - Definition_Ptr stub = SASS_MEMORY_NEW(Definition, + Definition* stub = SASS_MEMORY_NEW(Definition, ParserState("[built-in function]"), 0, name, @@ -882,7 +882,7 @@ namespace Sass { } void register_c_function(Context& ctx, Env* env, Sass_Function_Entry descr) { - Definition_Ptr def = make_c_function(descr, ctx); + Definition* def = make_c_function(descr, ctx); def->environment(env); (*env)[def->name() + "[f]"] = def; } diff --git a/src/context.hpp b/src/context.hpp index 027ffca22..d18cd3817 100644 --- a/src/context.hpp +++ b/src/context.hpp @@ -27,14 +27,14 @@ namespace Sass { class Context { public: - void import_url (Import_Ptr imp, std::string load_path, const std::string& ctx_path); - bool call_headers(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import_Ptr imp) + void import_url (Import* imp, std::string load_path, const std::string& ctx_path); + bool call_headers(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import* imp) { return call_loader(load_path, ctx_path, pstate, imp, c_headers, false); }; - bool call_importers(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import_Ptr imp) + bool call_importers(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import* imp) { return call_loader(load_path, ctx_path, pstate, imp, c_importers, true); }; private: - bool call_loader(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import_Ptr imp, std::vector importers, bool only_one = true); + bool call_loader(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import* imp, std::vector importers, bool only_one = true); public: const std::string CWD; diff --git a/src/cssize.cpp b/src/cssize.cpp index 813929719..48ec8406a 100644 --- a/src/cssize.cpp +++ b/src/cssize.cpp @@ -15,15 +15,15 @@ namespace Sass { : ctx(ctx), traces(ctx.traces), block_stack(BlockStack()), - p_stack(std::vector()) + p_stack(std::vector()) { } - Statement_Ptr Cssize::parent() + Statement* Cssize::parent() { return p_stack.size() ? p_stack.back() : block_stack.front(); } - Block_Ptr Cssize::operator()(Block_Ptr b) + Block* Cssize::operator()(Block* b) { Block_Obj bb = SASS_MEMORY_NEW(Block, b->pstate(), b->length(), b->is_root()); // bb->tabs(b->tabs()); @@ -33,7 +33,7 @@ namespace Sass { return bb.detach(); } - Statement_Ptr Cssize::operator()(Trace_Ptr t) + Statement* Cssize::operator()(Trace* t) { traces.push_back(Backtrace(t->pstate())); auto result = t->block()->perform(this); @@ -41,11 +41,11 @@ namespace Sass { return result; } - Statement_Ptr Cssize::operator()(Declaration_Ptr d) + Statement* Cssize::operator()(Declaration* d) { String_Obj property = Cast(d->property()); - if (Declaration_Ptr dd = Cast(parent())) { + if (Declaration* dd = Cast(parent())) { String_Obj parent_property = Cast(dd->property()); property = SASS_MEMORY_NEW(String_Constant, d->property()->pstate(), @@ -81,7 +81,7 @@ namespace Sass { return 0; } - Statement_Ptr Cssize::operator()(Directive_Ptr r) + Statement* Cssize::operator()(Directive* r) { if (!r->block() || !r->block()->length()) return r; @@ -113,10 +113,10 @@ namespace Sass { } - Block_Ptr result = SASS_MEMORY_NEW(Block, rr->pstate()); + Block* result = SASS_MEMORY_NEW(Block, rr->pstate()); if (!(directive_exists || rr->is_keyframes())) { - Directive_Ptr empty_node = Cast(rr); + Directive* empty_node = Cast(rr); empty_node->block(SASS_MEMORY_NEW(Block, rr->block() ? rr->block()->pstate() : rr->pstate())); result->append(empty_node); } @@ -131,7 +131,7 @@ namespace Sass { return result; } - Statement_Ptr Cssize::operator()(Keyframe_Rule_Ptr r) + Statement* Cssize::operator()(Keyframe_Rule* r) { if (!r->block() || !r->block()->length()) return r; @@ -143,14 +143,14 @@ namespace Sass { return debubble(rr->block(), rr); } - Statement_Ptr Cssize::operator()(Ruleset_Ptr r) + Statement* Cssize::operator()(Ruleset* r) { p_stack.push_back(r); // this can return a string schema // string schema is not a statement! // r->block() is already a string schema // and that is comming from propset expand - Block_Ptr bb = operator()(r->block()); + Block* bb = operator()(r->block()); // this should protect us (at least a bit) from our mess // fixing this properly is harder that it should be ... if (Cast(bb) == NULL) { @@ -170,10 +170,10 @@ namespace Sass { } Block_Obj props = SASS_MEMORY_NEW(Block, rr->block()->pstate()); - Block_Ptr rules = SASS_MEMORY_NEW(Block, rr->block()->pstate()); + Block* rules = SASS_MEMORY_NEW(Block, rr->block()->pstate()); for (size_t i = 0, L = rr->block()->length(); i < L; i++) { - Statement_Ptr s = rr->block()->at(i); + Statement* s = rr->block()->at(i); if (bubblable(s)) rules->append(s); if (!bubblable(s)) props->append(s); } @@ -186,14 +186,14 @@ namespace Sass { for (size_t i = 0, L = rules->length(); i < L; i++) { - Statement_Ptr stm = rules->at(i); + Statement* stm = rules->at(i); stm->tabs(stm->tabs() + 1); } rules->unshift(rr); } - Block_Ptr ptr = rules; + Block* ptr = rules; rules = debubble(rules); void* lp = ptr; void* rp = rules; @@ -210,12 +210,12 @@ namespace Sass { return rules; } - Statement_Ptr Cssize::operator()(Null_Ptr m) + Statement* Cssize::operator()(Null* m) { return 0; } - Statement_Ptr Cssize::operator()(Media_Block_Ptr m) + Statement* Cssize::operator()(Media_Block* m) { if (parent()->statement_type() == Statement::RULESET) { return bubble(m); } @@ -236,7 +236,7 @@ namespace Sass { return debubble(mm->block(), mm); } - Statement_Ptr Cssize::operator()(Supports_Block_Ptr m) + Statement* Cssize::operator()(Supports_Block* m) { if (!m->block()->length()) { return m; } @@ -257,17 +257,17 @@ namespace Sass { return debubble(mm->block(), mm); } - Statement_Ptr Cssize::operator()(At_Root_Block_Ptr m) + Statement* Cssize::operator()(At_Root_Block* m) { bool tmp = false; for (size_t i = 0, L = p_stack.size(); i < L; ++i) { - Statement_Ptr s = p_stack[i]; + Statement* s = p_stack[i]; tmp |= m->exclude_node(s); } if (!tmp && m->block()) { - Block_Ptr bb = operator()(m->block()); + Block* bb = operator()(m->block()); for (size_t i = 0, L = bb->length(); i < L; ++i) { // (bb->elements())[i]->tabs(m->tabs()); Statement_Obj stm = bb->at(i); @@ -285,9 +285,9 @@ namespace Sass { return bubble(m); } - Statement_Ptr Cssize::bubble(Directive_Ptr m) + Statement* Cssize::bubble(Directive* m) { - Block_Ptr bb = SASS_MEMORY_NEW(Block, this->parent()->pstate()); + Block* bb = SASS_MEMORY_NEW(Block, this->parent()->pstate()); Has_Block_Obj new_rule = Cast(SASS_MEMORY_COPY(this->parent())); new_rule->block(bb); new_rule->tabs(this->parent()->tabs()); @@ -302,16 +302,16 @@ namespace Sass { wrapper_block); if (m->value()) mm->value(m->value()); - Bubble_Ptr bubble = SASS_MEMORY_NEW(Bubble, mm->pstate(), mm); + Bubble* bubble = SASS_MEMORY_NEW(Bubble, mm->pstate(), mm); return bubble; } - Statement_Ptr Cssize::bubble(At_Root_Block_Ptr m) + Statement* Cssize::bubble(At_Root_Block* m) { if (!m || !m->block()) return NULL; - Block_Ptr bb = SASS_MEMORY_NEW(Block, this->parent()->pstate()); + Block* bb = SASS_MEMORY_NEW(Block, this->parent()->pstate()); Has_Block_Obj new_rule = Cast(SASS_MEMORY_COPY(this->parent())); - Block_Ptr wrapper_block = SASS_MEMORY_NEW(Block, m->block()->pstate()); + Block* wrapper_block = SASS_MEMORY_NEW(Block, m->block()->pstate()); if (new_rule) { new_rule->block(bb); new_rule->tabs(this->parent()->tabs()); @@ -319,52 +319,52 @@ namespace Sass { wrapper_block->append(new_rule); } - At_Root_Block_Ptr mm = SASS_MEMORY_NEW(At_Root_Block, + At_Root_Block* mm = SASS_MEMORY_NEW(At_Root_Block, m->pstate(), wrapper_block, m->expression()); - Bubble_Ptr bubble = SASS_MEMORY_NEW(Bubble, mm->pstate(), mm); + Bubble* bubble = SASS_MEMORY_NEW(Bubble, mm->pstate(), mm); return bubble; } - Statement_Ptr Cssize::bubble(Supports_Block_Ptr m) + Statement* Cssize::bubble(Supports_Block* m) { Ruleset_Obj parent = Cast(SASS_MEMORY_COPY(this->parent())); - Block_Ptr bb = SASS_MEMORY_NEW(Block, parent->block()->pstate()); - Ruleset_Ptr new_rule = SASS_MEMORY_NEW(Ruleset, + Block* bb = SASS_MEMORY_NEW(Block, parent->block()->pstate()); + Ruleset* new_rule = SASS_MEMORY_NEW(Ruleset, parent->pstate(), parent->selector(), bb); new_rule->tabs(parent->tabs()); new_rule->block()->concat(m->block()); - Block_Ptr wrapper_block = SASS_MEMORY_NEW(Block, m->block()->pstate()); + Block* wrapper_block = SASS_MEMORY_NEW(Block, m->block()->pstate()); wrapper_block->append(new_rule); - Supports_Block_Ptr mm = SASS_MEMORY_NEW(Supports_Block, + Supports_Block* mm = SASS_MEMORY_NEW(Supports_Block, m->pstate(), m->condition(), wrapper_block); mm->tabs(m->tabs()); - Bubble_Ptr bubble = SASS_MEMORY_NEW(Bubble, mm->pstate(), mm); + Bubble* bubble = SASS_MEMORY_NEW(Bubble, mm->pstate(), mm); return bubble; } - Statement_Ptr Cssize::bubble(Media_Block_Ptr m) + Statement* Cssize::bubble(Media_Block* m) { Ruleset_Obj parent = Cast(SASS_MEMORY_COPY(this->parent())); - Block_Ptr bb = SASS_MEMORY_NEW(Block, parent->block()->pstate()); - Ruleset_Ptr new_rule = SASS_MEMORY_NEW(Ruleset, + Block* bb = SASS_MEMORY_NEW(Block, parent->block()->pstate()); + Ruleset* new_rule = SASS_MEMORY_NEW(Ruleset, parent->pstate(), parent->selector(), bb); new_rule->tabs(parent->tabs()); new_rule->block()->concat(m->block()); - Block_Ptr wrapper_block = SASS_MEMORY_NEW(Block, m->block()->pstate()); + Block* wrapper_block = SASS_MEMORY_NEW(Block, m->block()->pstate()); wrapper_block->append(new_rule); Media_Block_Obj mm = SASS_MEMORY_NEW(Media_Block, m->pstate(), @@ -376,17 +376,17 @@ namespace Sass { return SASS_MEMORY_NEW(Bubble, mm->pstate(), mm); } - bool Cssize::bubblable(Statement_Ptr s) + bool Cssize::bubblable(Statement* s) { return Cast(s) || s->bubbles(); } - Block_Ptr Cssize::flatten(Block_Ptr b) + Block* Cssize::flatten(Block* b) { - Block_Ptr result = SASS_MEMORY_NEW(Block, b->pstate(), 0, b->is_root()); + Block* result = SASS_MEMORY_NEW(Block, b->pstate(), 0, b->is_root()); for (size_t i = 0, L = b->length(); i < L; ++i) { - Statement_Ptr ss = b->at(i); - if (Block_Ptr bb = Cast(ss)) { + Statement* ss = b->at(i); + if (Block* bb = Cast(ss)) { Block_Obj bs = flatten(bb); for (size_t j = 0, K = bs->length(); j < K; ++j) { result->append(bs->at(j)); @@ -399,7 +399,7 @@ namespace Sass { return result; } - std::vector> Cssize::slice_by_bubble(Block_Ptr b) + std::vector> Cssize::slice_by_bubble(Block* b) { std::vector> results; @@ -414,7 +414,7 @@ namespace Sass { } else { - Block_Ptr wrapper_block = SASS_MEMORY_NEW(Block, value->pstate()); + Block* wrapper_block = SASS_MEMORY_NEW(Block, value->pstate()); wrapper_block->append(value); results.push_back(std::make_pair(key, wrapper_block)); } @@ -422,7 +422,7 @@ namespace Sass { return results; } - Block_Ptr Cssize::debubble(Block_Ptr children, Statement_Ptr parent) + Block* Cssize::debubble(Block* children, Statement* parent) { Has_Block_Obj previous_parent; std::vector> baz = slice_by_bubble(children); @@ -451,12 +451,12 @@ namespace Sass { for (size_t j = 0, K = slice->length(); j < K; ++j) { - Statement_Ptr ss; + Statement* ss; Statement_Obj stm = slice->at(j); // this has to go now here (too bad) Bubble_Obj node = Cast(stm); - Media_Block_Ptr m1 = NULL; - Media_Block_Ptr m2 = NULL; + Media_Block* m1 = NULL; + Media_Block* m2 = NULL; if (parent) m1 = Cast(parent); if (node) m2 = Cast(node->node()); if (!parent || @@ -496,7 +496,7 @@ namespace Sass { children->length(), children->is_root()); - Block_Ptr wrapper = flatten(bb); + Block* wrapper = flatten(bb); wrapper_block->append(wrapper); if (wrapper->length()) { @@ -512,11 +512,11 @@ namespace Sass { return flatten(result); } - void Cssize::append_block(Block_Ptr b, Block_Ptr cur) + void Cssize::append_block(Block* b, Block* cur) { for (size_t i = 0, L = b->length(); i < L; ++i) { Statement_Obj ith = b->at(i)->perform(this); - if (Block_Ptr bb = Cast(ith)) { + if (Block* bb = Cast(ith)) { for (size_t j = 0, K = bb->length(); j < K; ++j) { cur->append(bb->at(j)); } @@ -527,9 +527,9 @@ namespace Sass { } } - List_Ptr Cssize::merge_media_queries(Media_Block_Ptr m1, Media_Block_Ptr m2) + List* Cssize::merge_media_queries(Media_Block* m1, Media_Block* m2) { - List_Ptr qq = SASS_MEMORY_NEW(List, + List* qq = SASS_MEMORY_NEW(List, m1->media_queries()->pstate(), m1->media_queries()->length(), SASS_COMMA); @@ -538,9 +538,9 @@ namespace Sass { for (size_t j = 0, K = m2->media_queries()->length(); j < K; j++) { Expression_Obj l1 = m1->media_queries()->at(i); Expression_Obj l2 = m2->media_queries()->at(j); - Media_Query_Ptr mq1 = Cast(l1); - Media_Query_Ptr mq2 = Cast(l2); - Media_Query_Ptr mq = merge_media_query(mq1, mq2); + Media_Query* mq1 = Cast(l1); + Media_Query* mq2 = Cast(l2); + Media_Query* mq = merge_media_query(mq1, mq2); if (mq) qq->append(mq); } } @@ -549,7 +549,7 @@ namespace Sass { } - Media_Query_Ptr Cssize::merge_media_query(Media_Query_Ptr mq1, Media_Query_Ptr mq2) + Media_Query* Cssize::merge_media_query(Media_Query* mq1, Media_Query* mq2) { std::string type; @@ -585,7 +585,7 @@ namespace Sass { mod = m1.empty() ? m2 : m1; } - Media_Query_Ptr mm = SASS_MEMORY_NEW(Media_Query, + Media_Query* mm = SASS_MEMORY_NEW(Media_Query, mq1->pstate(), {}, mq1->length() + mq2->length(), diff --git a/src/cssize.hpp b/src/cssize.hpp index d6962fbf3..6742826a5 100644 --- a/src/cssize.hpp +++ b/src/cssize.hpp @@ -10,66 +10,66 @@ namespace Sass { struct Backtrace; - class Cssize : public Operation_CRTP { + class Cssize : public Operation_CRTP { Context& ctx; Backtraces& traces; BlockStack block_stack; - std::vector p_stack; + std::vector p_stack; public: Cssize(Context&); ~Cssize() { } - Selector_List_Ptr selector(); + Selector_List* selector(); - Block_Ptr operator()(Block_Ptr); - Statement_Ptr operator()(Ruleset_Ptr); - // Statement_Ptr operator()(Bubble_Ptr); - Statement_Ptr operator()(Media_Block_Ptr); - Statement_Ptr operator()(Supports_Block_Ptr); - Statement_Ptr operator()(At_Root_Block_Ptr); - Statement_Ptr operator()(Directive_Ptr); - Statement_Ptr operator()(Keyframe_Rule_Ptr); - Statement_Ptr operator()(Trace_Ptr); - Statement_Ptr operator()(Declaration_Ptr); - // Statement_Ptr operator()(Assignment_Ptr); - // Statement_Ptr operator()(Import_Ptr); - // Statement_Ptr operator()(Import_Stub_Ptr); - // Statement_Ptr operator()(Warning_Ptr); - // Statement_Ptr operator()(Error_Ptr); - // Statement_Ptr operator()(Comment_Ptr); - // Statement_Ptr operator()(If_Ptr); - // Statement_Ptr operator()(For_Ptr); - // Statement_Ptr operator()(Each_Ptr); - // Statement_Ptr operator()(While_Ptr); - // Statement_Ptr operator()(Return_Ptr); - // Statement_Ptr operator()(Extension_Ptr); - // Statement_Ptr operator()(Definition_Ptr); - // Statement_Ptr operator()(Mixin_Call_Ptr); - // Statement_Ptr operator()(Content_Ptr); - Statement_Ptr operator()(Null_Ptr); + Block* operator()(Block*); + Statement* operator()(Ruleset*); + // Statement* operator()(Bubble*); + Statement* operator()(Media_Block*); + Statement* operator()(Supports_Block*); + Statement* operator()(At_Root_Block*); + Statement* operator()(Directive*); + Statement* operator()(Keyframe_Rule*); + Statement* operator()(Trace*); + Statement* operator()(Declaration*); + // Statement* operator()(Assignment*); + // Statement* operator()(Import*); + // Statement* operator()(Import_Stub*); + // Statement* operator()(Warning*); + // Statement* operator()(Error*); + // Statement* operator()(Comment*); + // Statement* operator()(If*); + // Statement* operator()(For*); + // Statement* operator()(Each*); + // Statement* operator()(While*); + // Statement* operator()(Return*); + // Statement* operator()(Extension*); + // Statement* operator()(Definition*); + // Statement* operator()(Mixin_Call*); + // Statement* operator()(Content*); + Statement* operator()(Null*); - Statement_Ptr parent(); - std::vector> slice_by_bubble(Block_Ptr); - Statement_Ptr bubble(Directive_Ptr); - Statement_Ptr bubble(At_Root_Block_Ptr); - Statement_Ptr bubble(Media_Block_Ptr); - Statement_Ptr bubble(Supports_Block_Ptr); + Statement* parent(); + std::vector> slice_by_bubble(Block*); + Statement* bubble(Directive*); + Statement* bubble(At_Root_Block*); + Statement* bubble(Media_Block*); + Statement* bubble(Supports_Block*); - Block_Ptr debubble(Block_Ptr children, Statement_Ptr parent = 0); - Block_Ptr flatten(Block_Ptr); - bool bubblable(Statement_Ptr); + Block* debubble(Block* children, Statement* parent = 0); + Block* flatten(Block*); + bool bubblable(Statement*); - List_Ptr merge_media_queries(Media_Block_Ptr, Media_Block_Ptr); - Media_Query_Ptr merge_media_query(Media_Query_Ptr, Media_Query_Ptr); + List* merge_media_queries(Media_Block*, Media_Block*); + Media_Query* merge_media_query(Media_Query*, Media_Query*); // generic fallback template - Statement_Ptr fallback(U x) + Statement* fallback(U x) { return Cast(x); } - void append_block(Block_Ptr, Block_Ptr); + void append_block(Block*, Block*); }; } diff --git a/src/debugger.hpp b/src/debugger.hpp index 91d459523..53b0668e5 100644 --- a/src/debugger.hpp +++ b/src/debugger.hpp @@ -8,7 +8,7 @@ using namespace Sass; -inline void debug_ast(AST_Node_Ptr node, std::string ind = "", Env* env = 0); +inline void debug_ast(AST_Node* node, std::string ind = "", Env* env = 0); inline void debug_ast(const AST_Node* node, std::string ind = "", Env* env = 0) { debug_ast(const_cast(node), ind, env); @@ -48,7 +48,7 @@ inline std::string longToHex(long long t) { return is.str(); } -inline std::string pstate_source_position(AST_Node_Ptr node) +inline std::string pstate_source_position(AST_Node* node) { std::stringstream str; Position start(node->pstate()); @@ -64,26 +64,26 @@ inline std::string pstate_source_position(AST_Node_Ptr node) return str.str(); } -inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) +inline void debug_ast(AST_Node* node, std::string ind, Env* env) { if (node == 0) return; if (ind == "") std::cerr << "####################################################################\n"; if (Cast(node)) { - Bubble_Ptr bubble = Cast(node); + Bubble* bubble = Cast(node); std::cerr << ind << "Bubble " << bubble; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << bubble->tabs(); std::cerr << std::endl; debug_ast(bubble->node(), ind + " ", env); } else if (Cast(node)) { - Trace_Ptr trace = Cast(node); + Trace* trace = Cast(node); std::cerr << ind << "Trace " << trace; std::cerr << " (" << pstate_source_position(node) << ")" << " [name:" << trace->name() << ", type: " << trace->type() << "]" << std::endl; debug_ast(trace->block(), ind + " ", env); } else if (Cast(node)) { - At_Root_Block_Ptr root_block = Cast(node); + At_Root_Block* root_block = Cast(node); std::cerr << ind << "At_Root_Block " << root_block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << root_block->tabs(); @@ -91,7 +91,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(root_block->expression(), ind + ":", env); debug_ast(root_block->block(), ind + " ", env); } else if (Cast(node)) { - Selector_List_Ptr selector = Cast(node); + Selector_List* selector = Cast(node); std::cerr << ind << "Selector_List " << selector; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " <" << selector->hash() << ">"; @@ -108,11 +108,11 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) for(const Complex_Selector_Obj& i : selector->elements()) { debug_ast(i, ind + " ", env); } // } else if (Cast(node)) { -// Expression_Ptr expression = Cast(node); +// Expression* expression = Cast(node); // std::cerr << ind << "Expression " << expression << " " << expression->concrete_type() << std::endl; } else if (Cast(node)) { - Parent_Reference_Ptr selector = Cast(node); + Parent_Reference* selector = Cast(node); std::cerr << ind << "Parent_Reference " << selector; // if (selector->not_selector()) cerr << " [in_declaration]"; std::cerr << " (" << pstate_source_position(node) << ")"; @@ -121,7 +121,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) // debug_ast(selector->selector(), ind + "->", env); } else if (Cast(node)) { - Parent_Selector_Ptr selector = Cast(node); + Parent_Selector* selector = Cast(node); std::cerr << ind << "Parent_Selector " << selector; // if (selector->not_selector()) cerr << " [in_declaration]"; std::cerr << " (" << pstate_source_position(node) << ")"; @@ -131,7 +131,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) // debug_ast(selector->selector(), ind + "->", env); } else if (Cast(node)) { - Complex_Selector_Ptr selector = Cast(node); + Complex_Selector* selector = Cast(node); std::cerr << ind << "Complex_Selector " << selector << " (" << pstate_source_position(node) << ")" << " <" << selector->hash() << ">" @@ -164,7 +164,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) ComplexSelectorSet set = selector->sources(); // debug_sources_set(set, ind + " @--> "); } else if (Cast(node)) { - Compound_Selector_Ptr selector = Cast(node); + Compound_Selector* selector = Cast(node); std::cerr << ind << "Compound_Selector " << selector; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " <" << selector->hash() << ">"; @@ -178,7 +178,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << std::endl; for(const Simple_Selector_Obj& i : selector->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Wrapped_Selector_Ptr selector = Cast(node); + Wrapped_Selector* selector = Cast(node); std::cerr << ind << "Wrapped_Selector " << selector; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " <" << selector->hash() << ">"; @@ -190,7 +190,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << std::endl; debug_ast(selector->selector(), ind + " () ", env); } else if (Cast(node)) { - Pseudo_Selector_Ptr selector = Cast(node); + Pseudo_Selector* selector = Cast(node); std::cerr << ind << "Pseudo_Selector " << selector; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " <" << selector->hash() << ">"; @@ -202,7 +202,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << std::endl; debug_ast(selector->expression(), ind + " <= ", env); } else if (Cast(node)) { - Attribute_Selector_Ptr selector = Cast(node); + Attribute_Selector* selector = Cast(node); std::cerr << ind << "Attribute_Selector " << selector; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " <" << selector->hash() << ">"; @@ -214,7 +214,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << std::endl; debug_ast(selector->value(), ind + "[" + selector->matcher() + "] ", env); } else if (Cast(node)) { - Class_Selector_Ptr selector = Cast(node); + Class_Selector* selector = Cast(node); std::cerr << ind << "Class_Selector " << selector; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " <" << selector->hash() << ">"; @@ -225,7 +225,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << (selector->has_line_feed() ? " [line-feed]": " -"); std::cerr << std::endl; } else if (Cast(node)) { - Id_Selector_Ptr selector = Cast(node); + Id_Selector* selector = Cast(node); std::cerr << ind << "Id_Selector " << selector; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " <" << selector->hash() << ">"; @@ -236,7 +236,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << (selector->has_line_feed() ? " [line-feed]": " -"); std::cerr << std::endl; } else if (Cast(node)) { - Type_Selector_Ptr selector = Cast(node); + Type_Selector* selector = Cast(node); std::cerr << ind << "Type_Selector " << selector; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " <" << selector->hash() << ">"; @@ -249,7 +249,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << std::endl; } else if (Cast(node)) { - Placeholder_Selector_Ptr selector = Cast(node); + Placeholder_Selector* selector = Cast(node); std::cerr << ind << "Placeholder_Selector [" << selector->ns_name() << "] " << selector; std::cerr << " (" << pstate_source_position(selector) << ")" << " <" << selector->hash() << ">" @@ -266,7 +266,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << (selector->has_line_break() ? " [line-break]": " -") << (selector->has_line_feed() ? " [line-feed]": " -") << std::endl; } else if (Cast(node)) { - Selector_Schema_Ptr selector = Cast(node); + Selector_Schema* selector = Cast(node); std::cerr << ind << "Selector_Schema " << selector; std::cerr << " (" << pstate_source_position(node) << ")" << " [@media:" << selector->media_block() << "]" @@ -277,7 +277,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) // for(auto i : selector->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Selector_Ptr selector = Cast(node); + Selector* selector = Cast(node); std::cerr << ind << "Selector " << selector; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << (selector->has_line_break() ? " [line-break]": " -") @@ -285,7 +285,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) << std::endl; } else if (Cast(node)) { - Media_Query_Expression_Ptr block = Cast(node); + Media_Query_Expression* block = Cast(node); std::cerr << ind << "Media_Query_Expression " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << (block->is_interpolated() ? " [is_interpolated]": " -") @@ -294,7 +294,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(block->value(), ind + " value) "); } else if (Cast(node)) { - Media_Query_Ptr block = Cast(node); + Media_Query* block = Cast(node); std::cerr << ind << "Media_Query " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << (block->is_negated() ? " [is_negated]": " -") @@ -304,79 +304,79 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) for(const auto& i : block->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Media_Block_Ptr block = Cast(node); + Media_Block* block = Cast(node); std::cerr << ind << "Media_Block " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; debug_ast(block->media_queries(), ind + " =@ "); if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Supports_Block_Ptr block = Cast(node); + Supports_Block* block = Cast(node); std::cerr << ind << "Supports_Block " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; debug_ast(block->condition(), ind + " =@ "); debug_ast(block->block(), ind + " <>"); } else if (Cast(node)) { - Supports_Operator_Ptr block = Cast(node); + Supports_Operator* block = Cast(node); std::cerr << ind << "Supports_Operator " << block; std::cerr << " (" << pstate_source_position(node) << ")" << std::endl; debug_ast(block->left(), ind + " left) "); debug_ast(block->right(), ind + " right) "); } else if (Cast(node)) { - Supports_Negation_Ptr block = Cast(node); + Supports_Negation* block = Cast(node); std::cerr << ind << "Supports_Negation " << block; std::cerr << " (" << pstate_source_position(node) << ")" << std::endl; debug_ast(block->condition(), ind + " condition) "); } else if (Cast(node)) { - At_Root_Query_Ptr block = Cast(node); + At_Root_Query* block = Cast(node); std::cerr << ind << "At_Root_Query " << block; std::cerr << " (" << pstate_source_position(node) << ")" << std::endl; debug_ast(block->feature(), ind + " feature) "); debug_ast(block->value(), ind + " value) "); } else if (Cast(node)) { - Supports_Declaration_Ptr block = Cast(node); + Supports_Declaration* block = Cast(node); std::cerr << ind << "Supports_Declaration " << block; std::cerr << " (" << pstate_source_position(node) << ")" << std::endl; debug_ast(block->feature(), ind + " feature) "); debug_ast(block->value(), ind + " value) "); } else if (Cast(node)) { - Block_Ptr root_block = Cast(node); + Block* root_block = Cast(node); std::cerr << ind << "Block " << root_block; std::cerr << " (" << pstate_source_position(node) << ")"; if (root_block->is_root()) std::cerr << " [root]"; std::cerr << " " << root_block->tabs() << std::endl; for(const Statement_Obj& i : root_block->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Warning_Ptr block = Cast(node); + Warning* block = Cast(node); std::cerr << ind << "Warning " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; debug_ast(block->message(), ind + " : "); } else if (Cast(node)) { - Error_Ptr block = Cast(node); + Error* block = Cast(node); std::cerr << ind << "Error " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; } else if (Cast(node)) { - Debug_Ptr block = Cast(node); + Debug* block = Cast(node); std::cerr << ind << "Debug " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; debug_ast(block->value(), ind + " "); } else if (Cast(node)) { - Comment_Ptr block = Cast(node); + Comment* block = Cast(node); std::cerr << ind << "Comment " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << " <" << prettyprint(block->pstate().token.ws_before()) << ">" << std::endl; debug_ast(block->text(), ind + "// ", env); } else if (Cast(node)) { - If_Ptr block = Cast(node); + If* block = Cast(node); std::cerr << ind << "If " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; @@ -384,30 +384,30 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(block->block(), ind + " <>"); debug_ast(block->alternative(), ind + " ><"); } else if (Cast(node)) { - Return_Ptr block = Cast(node); + Return* block = Cast(node); std::cerr << ind << "Return " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; } else if (Cast(node)) { - Extension_Ptr block = Cast(node); + Extension* block = Cast(node); std::cerr << ind << "Extension " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; debug_ast(block->selector(), ind + "-> ", env); } else if (Cast(node)) { - Content_Ptr block = Cast(node); + Content* block = Cast(node); std::cerr << ind << "Content " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; debug_ast(block->arguments(), ind + " args: ", env); } else if (Cast(node)) { - Import_Stub_Ptr block = Cast(node); + Import_Stub* block = Cast(node); std::cerr << ind << "Import_Stub " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [" << block->imp_path() << "] "; std::cerr << " " << block->tabs() << std::endl; } else if (Cast(node)) { - Import_Ptr block = Cast(node); + Import* block = Cast(node); std::cerr << ind << "Import " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; @@ -415,13 +415,13 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) for (auto imp : block->urls()) debug_ast(imp, ind + "@: ", env); debug_ast(block->import_queries(), ind + "@@ "); } else if (Cast(node)) { - Assignment_Ptr block = Cast(node); + Assignment* block = Cast(node); std::cerr << ind << "Assignment " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " <<" << block->variable() << ">> " << block->tabs() << std::endl; debug_ast(block->value(), ind + "=", env); } else if (Cast(node)) { - Declaration_Ptr block = Cast(node); + Declaration* block = Cast(node); std::cerr << ind << "Declaration " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [is_custom_property: " << block->is_custom_property() << "] "; @@ -430,14 +430,14 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(block->value(), ind + " value: ", env); debug_ast(block->block(), ind + " ", env); } else if (Cast(node)) { - Keyframe_Rule_Ptr has_block = Cast(node); + Keyframe_Rule* has_block = Cast(node); std::cerr << ind << "Keyframe_Rule " << has_block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << has_block->tabs() << std::endl; if (has_block->name()) debug_ast(has_block->name(), ind + "@"); if (has_block->block()) for(const Statement_Obj& i : has_block->block()->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Directive_Ptr block = Cast(node); + Directive* block = Cast(node); std::cerr << ind << "Directive " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [" << block->keyword() << "] " << block->tabs() << std::endl; @@ -445,25 +445,25 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(block->value(), ind + "+", env); if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Each_Ptr block = Cast(node); + Each* block = Cast(node); std::cerr << ind << "Each " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - For_Ptr block = Cast(node); + For* block = Cast(node); std::cerr << ind << "For " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - While_Ptr block = Cast(node); + While* block = Cast(node); std::cerr << ind << "While " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << block->tabs() << std::endl; if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Definition_Ptr block = Cast(node); + Definition* block = Cast(node); std::cerr << ind << "Definition " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [name: " << block->name() << "] "; @@ -475,7 +475,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(block->parameters(), ind + " params: ", env); if (block->block()) debug_ast(block->block(), ind + " ", env); } else if (Cast(node)) { - Mixin_Call_Ptr block = Cast(node); + Mixin_Call* block = Cast(node); std::cerr << ind << "Mixin_Call " << block << " " << block->tabs(); std::cerr << " (" << pstate_source_position(block) << ")"; std::cerr << " [" << block->name() << "]"; @@ -483,7 +483,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(block->arguments(), ind + " args: ", env); debug_ast(block->block_parameters(), ind + " block_params: ", env); if (block->block()) debug_ast(block->block(), ind + " ", env); - } else if (Ruleset_Ptr ruleset = Cast(node)) { + } else if (Ruleset* ruleset = Cast(node)) { std::cerr << ind << "Ruleset " << ruleset; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [indent: " << ruleset->tabs() << "]"; @@ -493,14 +493,14 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(ruleset->selector(), ind + ">"); debug_ast(ruleset->block(), ind + " "); } else if (Cast(node)) { - Block_Ptr block = Cast(node); + Block* block = Cast(node); std::cerr << ind << "Block " << block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << (block->is_invisible() ? " [INVISIBLE]" : ""); std::cerr << " [indent: " << block->tabs() << "]" << std::endl; for(const Statement_Obj& i : block->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Variable_Ptr expression = Cast(node); + Variable* expression = Cast(node); std::cerr << ind << "Variable " << expression; std::cerr << " [interpolant: " << expression->is_interpolant() << "] "; std::cerr << " (" << pstate_source_position(node) << ")"; @@ -508,7 +508,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::string name(expression->name()); if (env && env->has(name)) debug_ast(Cast((*env)[name]), ind + " -> ", env); } else if (Cast(node)) { - Function_Call_Ptr expression = Cast(node); + Function_Call* expression = Cast(node); std::cerr << ind << "Function_Call " << expression; std::cerr << " [interpolant: " << expression->is_interpolant() << "] "; std::cerr << " (" << pstate_source_position(node) << ")"; @@ -520,14 +520,14 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(expression->arguments(), ind + " args: ", env); debug_ast(expression->func(), ind + " func: ", env); } else if (Cast(node)) { - Function_Ptr expression = Cast(node); + Function* expression = Cast(node); std::cerr << ind << "Function " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; if (expression->is_css()) std::cerr << " [css]"; std::cerr << std::endl; debug_ast(expression->definition(), ind + " definition: ", env); } else if (Cast(node)) { - Arguments_Ptr expression = Cast(node); + Arguments* expression = Cast(node); std::cerr << ind << "Arguments " << expression; if (expression->is_delayed()) std::cerr << " [delayed]"; std::cerr << " (" << pstate_source_position(node) << ")"; @@ -537,7 +537,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << std::endl; for(const Argument_Obj& i : expression->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Argument_Ptr expression = Cast(node); + Argument* expression = Cast(node); std::cerr << ind << "Argument " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [" << expression->value().ptr() << "]"; @@ -546,7 +546,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << " [keyword: " << expression->is_keyword_argument() << "] " << std::endl; debug_ast(expression->value(), ind + " value: ", env); } else if (Cast(node)) { - Parameters_Ptr expression = Cast(node); + Parameters* expression = Cast(node); std::cerr << ind << "Parameters " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [has_optional: " << expression->has_optional_parameters() << "] "; @@ -554,14 +554,14 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << std::endl; for(const Parameter_Obj& i : expression->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Parameter_Ptr expression = Cast(node); + Parameter* expression = Cast(node); std::cerr << ind << "Parameter " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [name: " << expression->name() << "] "; std::cerr << " [default: " << expression->default_value().ptr() << "] "; std::cerr << " [rest: " << expression->is_rest_parameter() << "] " << std::endl; } else if (Cast(node)) { - Unary_Expression_Ptr expression = Cast(node); + Unary_Expression* expression = Cast(node); std::cerr << ind << "Unary_Expression " << expression; std::cerr << " [interpolant: " << expression->is_interpolant() << "] "; std::cerr << " [delayed: " << expression->is_delayed() << "] "; @@ -569,7 +569,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << " [" << expression->type() << "]" << std::endl; debug_ast(expression->operand(), ind + " operand: ", env); } else if (Cast(node)) { - Binary_Expression_Ptr expression = Cast(node); + Binary_Expression* expression = Cast(node); std::cerr << ind << "Binary_Expression " << expression; if (expression->is_interpolant()) std::cerr << " [is interpolant] "; if (expression->is_left_interpolant()) std::cerr << " [left interpolant] "; @@ -582,7 +582,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(expression->left(), ind + " left: ", env); debug_ast(expression->right(), ind + " right: ", env); } else if (Cast(node)) { - Map_Ptr expression = Cast(node); + Map* expression = Cast(node); std::cerr << ind << "Map " << expression; std::cerr << " [interpolant: " << expression->is_interpolant() << "] "; std::cerr << " (" << pstate_source_position(node) << ")"; @@ -592,7 +592,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) debug_ast(i.second, ind + " val: "); } } else if (Cast(node)) { - List_Ptr expression = Cast(node); + List* expression = Cast(node); std::cerr << ind << "List " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " (" << expression->length() << ") " << @@ -607,13 +607,13 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::endl; for(const auto& i : expression->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Boolean_Ptr expression = Cast(node); + Boolean* expression = Cast(node); std::cerr << ind << "Boolean " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [interpolant: " << expression->is_interpolant() << "] "; std::cerr << " [" << expression->value() << "]" << std::endl; } else if (Cast(node)) { - Color_RGBA_Ptr expression = Cast(node); + Color_RGBA* expression = Cast(node); std::cerr << ind << "Color " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [name: " << expression->disp() << "] "; @@ -621,7 +621,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << " [interpolant: " << expression->is_interpolant() << "] "; std::cerr << " rgba[" << expression->r() << ":" << expression->g() << ":" << expression->b() << "@" << expression->a() << "]" << std::endl; } else if (Cast(node)) { - Color_HSLA_Ptr expression = Cast(node); + Color_HSLA* expression = Cast(node); std::cerr << ind << "Color " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [name: " << expression->disp() << "] "; @@ -629,7 +629,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << " [interpolant: " << expression->is_interpolant() << "] "; std::cerr << " hsla[" << expression->h() << ":" << expression->s() << ":" << expression->l() << "@" << expression->a() << "]" << std::endl; } else if (Cast(node)) { - Number_Ptr expression = Cast(node); + Number* expression = Cast(node); std::cerr << ind << "Number " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [delayed: " << expression->is_delayed() << "] "; @@ -638,14 +638,14 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) " [hash: " << expression->hash() << "] " << std::endl; } else if (Cast(node)) { - Null_Ptr expression = Cast(node); + Null* expression = Cast(node); std::cerr << ind << "Null " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [interpolant: " << expression->is_interpolant() << "] " // " [hash: " << expression->hash() << "] " << std::endl; } else if (Cast(node)) { - String_Quoted_Ptr expression = Cast(node); + String_Quoted* expression = Cast(node); std::cerr << ind << "String_Quoted " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " [" << prettyprint(expression->value()) << "]"; @@ -654,7 +654,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) if (expression->quote_mark()) std::cerr << " [quote_mark: " << expression->quote_mark() << "]"; std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl; } else if (Cast(node)) { - String_Constant_Ptr expression = Cast(node); + String_Constant* expression = Cast(node); std::cerr << ind << "String_Constant " << expression; if (expression->concrete_type()) { std::cerr << " " << expression->concrete_type(); @@ -665,7 +665,7 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) if (expression->is_interpolant()) std::cerr << " [interpolant]"; std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl; } else if (Cast(node)) { - String_Schema_Ptr expression = Cast(node); + String_Schema* expression = Cast(node); std::cerr << ind << "String_Schema " << expression; std::cerr << " (" << pstate_source_position(expression) << ")"; std::cerr << " " << expression->concrete_type(); @@ -679,14 +679,14 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl; for(const auto& i : expression->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - String_Ptr expression = Cast(node); + String* expression = Cast(node); std::cerr << ind << "String " << expression; std::cerr << " " << expression->concrete_type(); std::cerr << " (" << pstate_source_position(node) << ")"; if (expression->is_interpolant()) std::cerr << " [interpolant]"; std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl; } else if (Cast(node)) { - Expression_Ptr expression = Cast(node); + Expression* expression = Cast(node); std::cerr << ind << "Expression " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; switch (expression->concrete_type()) { @@ -709,13 +709,13 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) } std::cerr << std::endl; } else if (Cast(node)) { - Has_Block_Ptr has_block = Cast(node); + Has_Block* has_block = Cast(node); std::cerr << ind << "Has_Block " << has_block; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << has_block->tabs() << std::endl; if (has_block->block()) for(const Statement_Obj& i : has_block->block()->elements()) { debug_ast(i, ind + " ", env); } } else if (Cast(node)) { - Statement_Ptr statement = Cast(node); + Statement* statement = Cast(node); std::cerr << ind << "Statement " << statement; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " " << statement->tabs() << std::endl; @@ -774,9 +774,9 @@ inline void debug_node(Node* node, std::string ind = "") } /* -inline void debug_ast(const AST_Node_Ptr node, std::string ind = "", Env* env = 0) +inline void debug_ast(const AST_Node* node, std::string ind = "", Env* env = 0) { - debug_ast(const_cast(node), ind, env); + debug_ast(const_cast(node), ind, env); } */ inline void debug_node(const Node* node, std::string ind = "") diff --git a/src/emitter.cpp b/src/emitter.cpp index 581ae6ac2..c1add350d 100644 --- a/src/emitter.cpp +++ b/src/emitter.cpp @@ -47,11 +47,11 @@ namespace Sass { void Emitter::set_filename(const std::string& str) { wbuf.smap.file = str; } - void Emitter::schedule_mapping(AST_Node_Ptr_Const node) + void Emitter::schedule_mapping(const AST_Node* node) { scheduled_mapping = node; } - void Emitter::add_open_mapping(AST_Node_Ptr_Const node) + void Emitter::add_open_mapping(const AST_Node* node) { wbuf.smap.add_open_mapping(node); } - void Emitter::add_close_mapping(AST_Node_Ptr_Const node) + void Emitter::add_close_mapping(const AST_Node* node) { wbuf.smap.add_close_mapping(node); } ParserState Emitter::remap(const ParserState& pstate) { return wbuf.smap.remap(pstate); } @@ -161,7 +161,7 @@ namespace Sass { // append some text or token to the buffer // this adds source-mappings for node start and end - void Emitter::append_token(const std::string& text, const AST_Node_Ptr node) + void Emitter::append_token(const std::string& text, const AST_Node* node) { flush_schedules(); add_open_mapping(node); @@ -263,7 +263,7 @@ namespace Sass { } } - void Emitter::append_scope_opener(AST_Node_Ptr node) + void Emitter::append_scope_opener(AST_Node* node) { scheduled_linefeed = 0; append_optional_space(); @@ -274,7 +274,7 @@ namespace Sass { // append_optional_space(); ++ indentation; } - void Emitter::append_scope_closer(AST_Node_Ptr node) + void Emitter::append_scope_closer(AST_Node* node) { -- indentation; scheduled_linefeed = 0; diff --git a/src/emitter.hpp b/src/emitter.hpp index 92e77fda5..8b22de80b 100644 --- a/src/emitter.hpp +++ b/src/emitter.hpp @@ -29,9 +29,9 @@ namespace Sass { // proxy methods for source maps void add_source_index(size_t idx); void set_filename(const std::string& str); - void add_open_mapping(AST_Node_Ptr_Const node); - void add_close_mapping(AST_Node_Ptr_Const node); - void schedule_mapping(AST_Node_Ptr_Const node); + void add_open_mapping(const AST_Node* node); + void add_close_mapping(const AST_Node* node); + void schedule_mapping(const AST_Node* node); std::string render_srcmap(Context &ctx); ParserState remap(const ParserState& pstate); @@ -41,8 +41,8 @@ namespace Sass { size_t scheduled_space; size_t scheduled_linefeed; bool scheduled_delimiter; - AST_Node_Ptr_Const scheduled_crutch; - AST_Node_Ptr_Const scheduled_mapping; + const AST_Node* scheduled_crutch; + const AST_Node* scheduled_mapping; public: // output strings different in custom css properties @@ -79,7 +79,7 @@ namespace Sass { void append_wspace(const std::string& text); // append some text or token to the buffer // this adds source-mappings for node start and end - void append_token(const std::string& text, const AST_Node_Ptr node); + void append_token(const std::string& text, const AST_Node* node); // query last appended character char last_char(); @@ -90,8 +90,8 @@ namespace Sass { void append_special_linefeed(void); void append_optional_linefeed(void); void append_mandatory_linefeed(void); - void append_scope_opener(AST_Node_Ptr node = 0); - void append_scope_closer(AST_Node_Ptr node = 0); + void append_scope_opener(AST_Node* node = 0); + void append_scope_closer(AST_Node* node = 0); void append_comma_separator(void); void append_colon_separator(void); void append_delimiter(void); diff --git a/src/environment.cpp b/src/environment.cpp index dccda1de8..a3aecb30d 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -244,7 +244,7 @@ namespace Sass { for (typename environment_map::iterator i = local_frame_.begin(); i != local_frame_.end(); ++i) { if (!ends_with(i->first, "[f]") && !ends_with(i->first, "[f]4") && !ends_with(i->first, "[f]2")) { std::cerr << prefix << std::string(indent, ' ') << i->first << " " << i->second; - if (Value_Ptr val = Cast(i->second)) + if (Value* val = Cast(i->second)) { std::cerr << " : " << val->to_string(); } std::cerr << std::endl; } diff --git a/src/error_handling.cpp b/src/error_handling.cpp index efd2a9c6f..c0cf739eb 100644 --- a/src/error_handling.cpp +++ b/src/error_handling.cpp @@ -23,7 +23,7 @@ namespace Sass { { } - InvalidParent::InvalidParent(Selector_Ptr parent, Backtraces traces, Selector_Ptr selector) + InvalidParent::InvalidParent(Selector* parent, Backtraces traces, Selector* selector) : Base(selector->pstate(), def_msg, traces), parent(parent), selector(selector) { msg = "Invalid parent selector for " @@ -31,14 +31,14 @@ namespace Sass { "\"" + parent->to_string(Sass_Inspect_Options()) + "\""; } - InvalidVarKwdType::InvalidVarKwdType(ParserState pstate, Backtraces traces, std::string name, const Argument_Ptr arg) + InvalidVarKwdType::InvalidVarKwdType(ParserState pstate, Backtraces traces, std::string name, const Argument* arg) : Base(pstate, def_msg, traces), name(name), arg(arg) { msg = "Variable keyword argument map must have string keys.\n" + name + " is not a string in " + arg->to_string() + "."; } - InvalidArgumentType::InvalidArgumentType(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string type, const Value_Ptr value) + InvalidArgumentType::InvalidArgumentType(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string type, const Value* value) : Base(pstate, def_msg, traces), fn(fn), arg(arg), type(type), value(value) { msg = arg + ": \""; @@ -94,7 +94,7 @@ namespace Sass { msg = std::string("Incompatible units: '") + unit_to_string(rhs) + "' and '" + unit_to_string(lhs) + "'."; } - AlphaChannelsNotEqual::AlphaChannelsNotEqual(Expression_Ptr_Const lhs, Expression_Ptr_Const rhs, enum Sass_OP op) + AlphaChannelsNotEqual::AlphaChannelsNotEqual(const Expression* lhs, const Expression* rhs, enum Sass_OP op) : OperationError(), lhs(lhs), rhs(rhs), op(op) { msg = "Alpha channels must be equal: " + @@ -109,7 +109,7 @@ namespace Sass { msg = "divided by 0"; } - UndefinedOperation::UndefinedOperation(Expression_Ptr_Const lhs, Expression_Ptr_Const rhs, enum Sass_OP op) + UndefinedOperation::UndefinedOperation(const Expression* lhs, const Expression* rhs, enum Sass_OP op) : OperationError(), lhs(lhs), rhs(rhs), op(op) { msg = def_op_msg + ": \"" + @@ -119,7 +119,7 @@ namespace Sass { "\"."; } - InvalidNullOperation::InvalidNullOperation(Expression_Ptr_Const lhs, Expression_Ptr_Const rhs, enum Sass_OP op) + InvalidNullOperation::InvalidNullOperation(const Expression* lhs, const Expression* rhs, enum Sass_OP op) : UndefinedOperation(lhs, rhs, op) { msg = def_op_null_msg + ": \"" + lhs->inspect() + " " + sass_op_to_name(op) + " " + rhs->inspect() + "\"."; diff --git a/src/error_handling.hpp b/src/error_handling.hpp index 5ba036aaa..24fedec4c 100644 --- a/src/error_handling.hpp +++ b/src/error_handling.hpp @@ -55,10 +55,10 @@ namespace Sass { class InvalidParent : public Base { protected: - Selector_Ptr parent; - Selector_Ptr selector; + Selector* parent; + Selector* selector; public: - InvalidParent(Selector_Ptr parent, Backtraces traces, Selector_Ptr selector); + InvalidParent(Selector* parent, Backtraces traces, Selector* selector); virtual ~InvalidParent() throw() {}; }; @@ -77,18 +77,18 @@ namespace Sass { std::string fn; std::string arg; std::string type; - const Value_Ptr value; + const Value* value; public: - InvalidArgumentType(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string type, const Value_Ptr value = 0); + InvalidArgumentType(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string type, const Value* value = 0); virtual ~InvalidArgumentType() throw() {}; }; class InvalidVarKwdType : public Base { protected: std::string name; - const Argument_Ptr arg; + const Argument* arg; public: - InvalidVarKwdType(ParserState pstate, Backtraces traces, std::string name, const Argument_Ptr arg = 0); + InvalidVarKwdType(ParserState pstate, Backtraces traces, std::string name, const Argument* arg = 0); virtual ~InvalidVarKwdType() throw() {}; }; @@ -178,28 +178,28 @@ namespace Sass { class UndefinedOperation : public OperationError { protected: - Expression_Ptr_Const lhs; - Expression_Ptr_Const rhs; + const Expression* lhs; + const Expression* rhs; const Sass_OP op; public: - UndefinedOperation(Expression_Ptr_Const lhs, Expression_Ptr_Const rhs, enum Sass_OP op); + UndefinedOperation(const Expression* lhs, const Expression* rhs, enum Sass_OP op); // virtual const char* errtype() const { return "Error"; } virtual ~UndefinedOperation() throw() {}; }; class InvalidNullOperation : public UndefinedOperation { public: - InvalidNullOperation(Expression_Ptr_Const lhs, Expression_Ptr_Const rhs, enum Sass_OP op); + InvalidNullOperation(const Expression* lhs, const Expression* rhs, enum Sass_OP op); virtual ~InvalidNullOperation() throw() {}; }; class AlphaChannelsNotEqual : public OperationError { protected: - Expression_Ptr_Const lhs; - Expression_Ptr_Const rhs; + const Expression* lhs; + const Expression* rhs; const Sass_OP op; public: - AlphaChannelsNotEqual(Expression_Ptr_Const lhs, Expression_Ptr_Const rhs, enum Sass_OP op); + AlphaChannelsNotEqual(const Expression* lhs, const Expression* rhs, enum Sass_OP op); // virtual const char* errtype() const { return "Error"; } virtual ~AlphaChannelsNotEqual() throw() {}; }; diff --git a/src/eval.cpp b/src/eval.cpp index 75767a0ef..dd26e5db6 100644 --- a/src/eval.cpp +++ b/src/eval.cpp @@ -93,9 +93,9 @@ namespace Sass { } - Expression_Ptr Eval::operator()(Block_Ptr b) + Expression* Eval::operator()(Block* b) { - Expression_Ptr val = 0; + Expression* val = 0; for (size_t i = 0, L = b->length(); i < L; ++i) { val = b->at(i)->perform(this); if (val) return val; @@ -103,14 +103,14 @@ namespace Sass { return val; } - Expression_Ptr Eval::operator()(Assignment_Ptr a) + Expression* Eval::operator()(Assignment* a) { Env* env = environment(); std::string var(a->variable()); if (a->is_global()) { if (a->is_default()) { if (env->has_global(var)) { - Expression_Ptr e = Cast(env->get_global(var)); + Expression* e = Cast(env->get_global(var)); if (!e || e->concrete_type() == Expression::NULL_VAL) { env->set_global(var, a->value()->perform(this)); } @@ -129,7 +129,7 @@ namespace Sass { while (cur && cur->is_lexical()) { if (cur->has_local(var)) { if (AST_Node_Obj node = cur->get_local(var)) { - Expression_Ptr e = Cast(node); + Expression* e = Cast(node); if (!e || e->concrete_type() == Expression::NULL_VAL) { cur->set_local(var, a->value()->perform(this)); } @@ -145,7 +145,7 @@ namespace Sass { } else if (env->has_global(var)) { if (AST_Node_Obj node = env->get_global(var)) { - Expression_Ptr e = Cast(node); + Expression* e = Cast(node); if (!e || e->concrete_type() == Expression::NULL_VAL) { env->set_global(var, a->value()->perform(this)); } @@ -164,7 +164,7 @@ namespace Sass { return 0; } - Expression_Ptr Eval::operator()(If_Ptr i) + Expression* Eval::operator()(If* i) { Expression_Obj rv; Env env(environment()); @@ -183,7 +183,7 @@ namespace Sass { // For does not create a new env scope // But iteration vars are reset afterwards - Expression_Ptr Eval::operator()(For_Ptr f) + Expression* Eval::operator()(For* f) { std::string variable(f->variable()); Expression_Obj low = f->lower_bound()->perform(this); @@ -211,7 +211,7 @@ namespace Sass { Env env(environment(), true); env_stack().push_back(&env); Block_Obj body = f->block(); - Expression_Ptr val = 0; + Expression* val = 0; if (start < end) { if (f->is_inclusive()) ++end; for (double i = start; @@ -239,18 +239,18 @@ namespace Sass { // Eval does not create a new env scope // But iteration vars are reset afterwards - Expression_Ptr Eval::operator()(Each_Ptr e) + Expression* Eval::operator()(Each* e) { std::vector variables(e->variables()); Expression_Obj expr = e->list()->perform(this); Env env(environment(), true); env_stack().push_back(&env); List_Obj list; - Map_Ptr map = nullptr; + Map* map = nullptr; if (expr->concrete_type() == Expression::MAP) { map = Cast(expr); } - else if (Selector_List_Ptr ls = Cast(expr)) { + else if (Selector_List* ls = Cast(expr)) { Listize listize; Expression_Obj rv = ls->perform(&listize); list = Cast(rv); @@ -271,7 +271,7 @@ namespace Sass { Expression_Obj value = map->at(key); if (variables.size() == 1) { - List_Ptr variable = SASS_MEMORY_NEW(List, map->pstate(), 2, SASS_SPACE); + List* variable = SASS_MEMORY_NEW(List, map->pstate(), 2, SASS_SPACE); variable->append(key); variable->append(value); env.set_local(variables[0], variable); @@ -289,18 +289,18 @@ namespace Sass { list = Cast(list); } for (size_t i = 0, L = list->length(); i < L; ++i) { - Expression_Ptr item = list->at(i); + Expression* item = list->at(i); // unwrap value if the expression is an argument - if (Argument_Ptr arg = Cast(item)) item = arg->value(); + if (Argument* arg = Cast(item)) item = arg->value(); // check if we got passed a list of args (investigate) - if (List_Ptr scalars = Cast(item)) { + if (List* scalars = Cast(item)) { if (variables.size() == 1) { - Expression_Ptr var = scalars; + Expression* var = scalars; env.set_local(variables[0], var); } else { // XXX: this is never hit via spec tests for (size_t j = 0, K = variables.size(); j < K; ++j) { - Expression_Ptr res = j >= scalars->length() + Expression* res = j >= scalars->length() ? SASS_MEMORY_NEW(Null, expr->pstate()) : scalars->at(j); env.set_local(variables[j], res); @@ -311,7 +311,7 @@ namespace Sass { env.set_local(variables.at(0), item); for (size_t j = 1, K = variables.size(); j < K; ++j) { // XXX: this is never hit via spec tests - Expression_Ptr res = SASS_MEMORY_NEW(Null, expr->pstate()); + Expression* res = SASS_MEMORY_NEW(Null, expr->pstate()); env.set_local(variables[j], res); } } @@ -324,7 +324,7 @@ namespace Sass { return val.detach(); } - Expression_Ptr Eval::operator()(While_Ptr w) + Expression* Eval::operator()(While* w) { Expression_Obj pred = w->predicate(); Block_Obj body = w->block(); @@ -343,12 +343,12 @@ namespace Sass { return 0; } - Expression_Ptr Eval::operator()(Return_Ptr r) + Expression* Eval::operator()(Return* r) { return r->value()->perform(this); } - Expression_Ptr Eval::operator()(Warning_Ptr w) + Expression* Eval::operator()(Warning* w) { Sass_Output_Style outstyle = options().output_style; options().output_style = NESTED; @@ -368,7 +368,7 @@ namespace Sass { { env } }); - Definition_Ptr def = Cast((*env)["@warn[f]"]); + Definition* def = Cast((*env)["@warn[f]"]); // Block_Obj body = def->block(); // Native_Function func = def->native_function(); Sass_Function_Entry c_function = def->c_function(); @@ -396,7 +396,7 @@ namespace Sass { return 0; } - Expression_Ptr Eval::operator()(Error_Ptr e) + Expression* Eval::operator()(Error* e) { Sass_Output_Style outstyle = options().output_style; options().output_style = NESTED; @@ -416,7 +416,7 @@ namespace Sass { { env } }); - Definition_Ptr def = Cast((*env)["@error[f]"]); + Definition* def = Cast((*env)["@error[f]"]); // Block_Obj body = def->block(); // Native_Function func = def->native_function(); Sass_Function_Entry c_function = def->c_function(); @@ -440,7 +440,7 @@ namespace Sass { return 0; } - Expression_Ptr Eval::operator()(Debug_Ptr d) + Expression* Eval::operator()(Debug* d) { Sass_Output_Style outstyle = options().output_style; options().output_style = NESTED; @@ -460,7 +460,7 @@ namespace Sass { { env } }); - Definition_Ptr def = Cast((*env)["@debug[f]"]); + Definition* def = Cast((*env)["@debug[f]"]); // Block_Obj body = def->block(); // Native_Function func = def->native_function(); Sass_Function_Entry c_function = def->c_function(); @@ -489,7 +489,7 @@ namespace Sass { return 0; } - Expression_Ptr Eval::operator()(List_Ptr l) + Expression* Eval::operator()(List* l) { // special case for unevaluated map if (l->separator() == SASS_HASH) { @@ -530,7 +530,7 @@ namespace Sass { return ll.detach(); } - Expression_Ptr Eval::operator()(Map_Ptr m) + Expression* Eval::operator()(Map* m) { if (m->is_expanded()) return m; @@ -545,8 +545,8 @@ namespace Sass { m->pstate(), m->length()); for (auto key : m->keys()) { - Expression_Ptr ex_key = key->perform(this); - Expression_Ptr ex_val = m->at(key); + Expression* ex_key = key->perform(this); + Expression* ex_val = m->at(key); if (ex_val == NULL) continue; ex_val = ex_val->perform(this); *mm << std::make_pair(ex_key, ex_val); @@ -562,7 +562,7 @@ namespace Sass { return mm.detach(); } - Expression_Ptr Eval::operator()(Binary_Expression_Ptr b_in) + Expression* Eval::operator()(Binary_Expression* b_in) { Expression_Obj lhs = b_in->left(); @@ -583,21 +583,21 @@ namespace Sass { } // Evaluate variables as early o - while (Variable_Ptr l_v = Cast(lhs)) { + while (Variable* l_v = Cast(lhs)) { lhs = operator()(l_v); } - while (Variable_Ptr r_v = Cast(rhs)) { + while (Variable* r_v = Cast(rhs)) { rhs = operator()(r_v); } Binary_Expression_Obj b = b_in; // Evaluate sub-expressions early on - while (Binary_Expression_Ptr l_b = Cast(lhs)) { + while (Binary_Expression* l_b = Cast(lhs)) { if (!force && l_b->is_delayed()) break; lhs = operator()(l_b); } - while (Binary_Expression_Ptr r_b = Cast(rhs)) { + while (Binary_Expression* r_b = Cast(rhs)) { if (!force && r_b->is_delayed()) break; rhs = operator()(r_b); } @@ -611,9 +611,9 @@ namespace Sass { // specific types we know are final // handle them early to avoid overhead - if (Number_Ptr l_n = Cast(lhs)) { + if (Number* l_n = Cast(lhs)) { // lhs is number and rhs is number - if (Number_Ptr r_n = Cast(rhs)) { + if (Number* r_n = Cast(rhs)) { try { switch (op_type) { case Sass_OP::EQ: return *l_n == *r_n ? bool_true : bool_false; @@ -635,7 +635,7 @@ namespace Sass { } // lhs is number and rhs is color // Todo: allow to work with HSLA colors - else if (Color_Ptr r_col = Cast(rhs)) { + else if (Color* r_col = Cast(rhs)) { Color_RGBA_Obj r_c = r_col->toRGBA(); try { switch (op_type) { @@ -653,10 +653,10 @@ namespace Sass { } } } - else if (Color_Ptr l_col = Cast(lhs)) { + else if (Color* l_col = Cast(lhs)) { Color_RGBA_Obj l_c = l_col->toRGBA(); // lhs is color and rhs is color - if (Color_Ptr r_col = Cast(rhs)) { + if (Color* r_col = Cast(rhs)) { Color_RGBA_Obj r_c = r_col->toRGBA(); try { switch (op_type) { @@ -678,7 +678,7 @@ namespace Sass { } } // lhs is color and rhs is number - else if (Number_Ptr r_n = Cast(rhs)) { + else if (Number* r_n = Cast(rhs)) { try { switch (op_type) { case Sass_OP::EQ: return *l_c == *r_n ? bool_true : bool_false; @@ -699,7 +699,7 @@ namespace Sass { String_Schema_Obj ret_schema; // only the last item will be used to eval the binary expression - if (String_Schema_Ptr s_l = Cast(b->left())) { + if (String_Schema* s_l = Cast(b->left())) { if (!s_l->has_interpolant() && (!s_l->is_right_interpolant())) { ret_schema = SASS_MEMORY_NEW(String_Schema, b->pstate()); Binary_Expression_Obj bin_ex = SASS_MEMORY_NEW(Binary_Expression, b->pstate(), @@ -712,7 +712,7 @@ namespace Sass { return ret_schema->perform(this); } } - if (String_Schema_Ptr s_r = Cast(b->right())) { + if (String_Schema* s_r = Cast(b->right())) { if (!s_r->has_interpolant() && (!s_r->is_left_interpolant() || op_type == Sass_OP::DIV)) { ret_schema = SASS_MEMORY_NEW(String_Schema, b->pstate()); @@ -773,7 +773,7 @@ namespace Sass { if (op_type == Sass_OP::DIV || op_type == Sass_OP::MUL || op_type == Sass_OP::MOD || op_type == Sass_OP::ADD || op_type == Sass_OP::SUB || op_type == Sass_OP::EQ) { // If possible upgrade LHS to a number (for number to string compare) - if (String_Constant_Ptr str = Cast(lhs)) { + if (String_Constant* str = Cast(lhs)) { std::string value(str->value()); const char* start = value.c_str(); if (Prelexer::sequence < Prelexer::dimension, Prelexer::end_of_file >(start) != 0) { @@ -781,7 +781,7 @@ namespace Sass { } } // If possible upgrade RHS to a number (for string to number compare) - if (String_Constant_Ptr str = Cast(rhs)) { + if (String_Constant* str = Cast(rhs)) { std::string value(str->value()); const char* start = value.c_str(); if (Prelexer::sequence < Prelexer::dimension, Prelexer::number >(start) != 0) { @@ -801,7 +801,7 @@ namespace Sass { str += b->separator(); if (b->op().ws_after) str += " "; str += v_r->to_string(options()); - String_Constant_Ptr val = SASS_MEMORY_NEW(String_Constant, b->pstate(), str); + String_Constant* val = SASS_MEMORY_NEW(String_Constant, b->pstate(), str); val->is_interpolant(b->left()->has_interpolant()); return val; } @@ -834,19 +834,19 @@ namespace Sass { try { ParserState pstate(b->pstate()); if (l_type == Expression::NUMBER && r_type == Expression::NUMBER) { - Number_Ptr l_n = Cast(lhs); - Number_Ptr r_n = Cast(rhs); + Number* l_n = Cast(lhs); + Number* r_n = Cast(rhs); l_n->reduce(); r_n->reduce(); rv = Operators::op_numbers(op_type, *l_n, *r_n, options(), pstate); } else if (l_type == Expression::NUMBER && r_type == Expression::COLOR) { - Number_Ptr l_n = Cast(lhs); + Number* l_n = Cast(lhs); Color_RGBA_Obj r_c = Cast(rhs)->toRGBA(); rv = Operators::op_number_color(op_type, *l_n, *r_c, options(), pstate); } else if (l_type == Expression::COLOR && r_type == Expression::NUMBER) { Color_RGBA_Obj l_c = Cast(lhs)->toRGBA(); - Number_Ptr r_n = Cast(rhs); + Number* r_n = Cast(rhs); rv = Operators::op_color_number(op_type, *l_c, *r_n, options(), pstate); } else if (l_type == Expression::COLOR && r_type == Expression::COLOR) { @@ -873,15 +873,15 @@ namespace Sass { traces.push_back(Backtrace(v_r->pstate())); throw Exception::InvalidValue(traces, *v_r); } - Value_Ptr ex = Operators::op_strings(b->op(), *v_l, *v_r, options(), pstate, !interpolant); // pass true to compress - if (String_Constant_Ptr str = Cast(ex)) + Value* ex = Operators::op_strings(b->op(), *v_l, *v_r, options(), pstate, !interpolant); // pass true to compress + if (String_Constant* str = Cast(ex)) { if (str->concrete_type() == Expression::STRING) { - String_Constant_Ptr lstr = Cast(lhs); - String_Constant_Ptr rstr = Cast(rhs); + String_Constant* lstr = Cast(lhs); + String_Constant* rstr = Cast(rhs); if (op_type != Sass_OP::SUB) { - if (String_Constant_Ptr org = lstr ? lstr : rstr) + if (String_Constant* org = lstr ? lstr : rstr) { str->quote_mark(org->quote_mark()); } } } @@ -909,11 +909,11 @@ namespace Sass { } - Expression_Ptr Eval::operator()(Unary_Expression_Ptr u) + Expression* Eval::operator()(Unary_Expression* u) { Expression_Obj operand = u->operand()->perform(this); if (u->optype() == Unary_Expression::NOT) { - Boolean_Ptr result = SASS_MEMORY_NEW(Boolean, u->pstate(), (bool)*operand); + Boolean* result = SASS_MEMORY_NEW(Boolean, u->pstate(), (bool)*operand); result->value(!result->value()); return result; } @@ -938,7 +938,7 @@ namespace Sass { u->operand(SASS_MEMORY_NEW(String_Quoted, u->pstate(), "")); } // Never apply unary opertions on colors @see #2140 - else if (Color_Ptr color = Cast(operand)) { + else if (Color* color = Cast(operand)) { // Use the color name if this was eval with one if (color->disp().length() > 0) { operand = SASS_MEMORY_NEW(String_Constant, operand->pstate(), color->disp()); @@ -957,7 +957,7 @@ namespace Sass { return u; } - Expression_Ptr Eval::operator()(Function_Call_Ptr c) + Expression* Eval::operator()(Function_Call* c) { if (traces.size() > Constants::MaxCallStack) { // XXX: this is never hit via spec tests @@ -996,7 +996,7 @@ namespace Sass { if (args->has_named_arguments()) { error("Function " + c->name() + " doesn't support keyword arguments", c->pstate(), traces); } - String_Quoted_Ptr str = SASS_MEMORY_NEW(String_Quoted, + String_Quoted* str = SASS_MEMORY_NEW(String_Quoted, c->pstate(), lit->to_string(options())); str->is_interpolant(c->is_interpolant()); @@ -1014,7 +1014,7 @@ namespace Sass { if (full_name != "if[f]") { args = Cast(args->perform(this)); } - Definition_Ptr def = Cast((*env)[full_name]); + Definition* def = Cast((*env)[full_name]); if (c->func()) def = c->func()->definition(); @@ -1024,7 +1024,7 @@ namespace Sass { // account for rest arguments if (args->has_rest_argument() && args->length() > 0) { // get the rest arguments list - List_Ptr rest = Cast(args->last()->value()); + List* rest = Cast(args->last()->value()); // arguments before rest argument plus rest if (rest) L += rest->length() - 1; } @@ -1140,7 +1140,7 @@ namespace Sass { return result.detach(); } - Expression_Ptr Eval::operator()(Variable_Ptr v) + Expression* Eval::operator()(Variable* v) { Expression_Obj value; Env* env = environment(); @@ -1148,8 +1148,8 @@ namespace Sass { EnvResult rv(env->find(name)); if (rv.found) value = static_cast(rv.it->second.ptr()); else error("Undefined variable: \"" + v->name() + "\".", v->pstate(), traces); - if (Argument_Ptr arg = Cast(value)) value = arg->value(); - if (Number_Ptr nr = Cast(value)) nr->zero(true); // force flag + if (Argument* arg = Cast(value)) value = arg->value(); + if (Number* nr = Cast(value)) nr->zero(true); // force flag value->is_interpolant(v->is_interpolant()); if (force) value->is_expanded(false); value->set_delayed(false); // verified @@ -1158,22 +1158,22 @@ namespace Sass { return value.detach(); } - Expression_Ptr Eval::operator()(Color_RGBA_Ptr c) + Expression* Eval::operator()(Color_RGBA* c) { return c; } - Expression_Ptr Eval::operator()(Color_HSLA_Ptr c) + Expression* Eval::operator()(Color_HSLA* c) { return c; } - Expression_Ptr Eval::operator()(Number_Ptr n) + Expression* Eval::operator()(Number* n) { return n; } - Expression_Ptr Eval::operator()(Boolean_Ptr b) + Expression* Eval::operator()(Boolean* b) { return b; } @@ -1182,8 +1182,8 @@ namespace Sass { bool needs_closing_brace = false; - if (Arguments_Ptr args = Cast(ex)) { - List_Ptr ll = SASS_MEMORY_NEW(List, args->pstate(), 0, SASS_COMMA); + if (Arguments* args = Cast(ex)) { + List* ll = SASS_MEMORY_NEW(List, args->pstate(), 0, SASS_COMMA); for(auto arg : args->elements()) { ll->append(arg->value()); } @@ -1192,7 +1192,7 @@ namespace Sass { res += "("; ex = ll; } - if (Number_Ptr nr = Cast(ex)) { + if (Number* nr = Cast(ex)) { Number reduced(nr); reduced.reduce(); if (!reduced.is_valid_css_unit()) { @@ -1200,10 +1200,10 @@ namespace Sass { throw Exception::InvalidValue(traces, *nr); } } - if (Argument_Ptr arg = Cast(ex)) { + if (Argument* arg = Cast(ex)) { ex = arg->value(); } - if (String_Quoted_Ptr sq = Cast(ex)) { + if (String_Quoted* sq = Cast(ex)) { if (was_itpl) { bool was_interpolant = ex->is_interpolant(); ex = SASS_MEMORY_NEW(String_Constant, sq->pstate(), sq->value()); @@ -1224,7 +1224,7 @@ namespace Sass { ex = ex->perform(this); } - if (List_Ptr l = Cast(ex)) { + if (List* l = Cast(ex)) { List_Obj ll = SASS_MEMORY_NEW(List, l->pstate(), 0, l->separator()); // this fixes an issue with bourbon sample, not really sure why // if (l->size() && Cast((*l)[0])) { res += ""; } @@ -1270,14 +1270,14 @@ namespace Sass { } - Expression_Ptr Eval::operator()(String_Schema_Ptr s) + Expression* Eval::operator()(String_Schema* s) { size_t L = s->length(); bool into_quotes = false; if (L > 1) { if (!Cast((*s)[0]) && !Cast((*s)[L - 1])) { - if (String_Constant_Ptr l = Cast((*s)[0])) { - if (String_Constant_Ptr r = Cast((*s)[L - 1])) { + if (String_Constant* l = Cast((*s)[0])) { + if (String_Constant* r = Cast((*s)[L - 1])) { if (r->value().size() > 0) { if (l->value()[0] == '"' && r->value()[r->value().size() - 1] == '"') into_quotes = true; if (l->value()[0] == '\'' && r->value()[r->value().size() - 1] == '\'') into_quotes = true; @@ -1306,7 +1306,7 @@ namespace Sass { // string schema seems to have a special unquoting behavior (also handles "nested" quotes) String_Quoted_Obj str = SASS_MEMORY_NEW(String_Quoted, s->pstate(), res, 0, false, false, false, s->css()); // if (s->is_interpolant()) str->quote_mark(0); - // String_Constant_Ptr str = SASS_MEMORY_NEW(String_Constant, s->pstate(), res); + // String_Constant* str = SASS_MEMORY_NEW(String_Constant, s->pstate(), res); if (str->quote_mark()) str->quote_mark('*'); else if (!is_in_comment) str->value(string_to_output(str->value())); str->is_interpolant(s->is_interpolant()); @@ -1314,25 +1314,25 @@ namespace Sass { } - Expression_Ptr Eval::operator()(String_Constant_Ptr s) + Expression* Eval::operator()(String_Constant* s) { return s; } - Expression_Ptr Eval::operator()(String_Quoted_Ptr s) + Expression* Eval::operator()(String_Quoted* s) { - String_Quoted_Ptr str = SASS_MEMORY_NEW(String_Quoted, s->pstate(), ""); + String_Quoted* str = SASS_MEMORY_NEW(String_Quoted, s->pstate(), ""); str->value(s->value()); str->quote_mark(s->quote_mark()); str->is_interpolant(s->is_interpolant()); return str; } - Expression_Ptr Eval::operator()(Supports_Operator_Ptr c) + Expression* Eval::operator()(Supports_Operator* c) { - Expression_Ptr left = c->left()->perform(this); - Expression_Ptr right = c->right()->perform(this); - Supports_Operator_Ptr cc = SASS_MEMORY_NEW(Supports_Operator, + Expression* left = c->left()->perform(this); + Expression* right = c->right()->perform(this); + Supports_Operator* cc = SASS_MEMORY_NEW(Supports_Operator, c->pstate(), Cast(left), Cast(right), @@ -1340,52 +1340,52 @@ namespace Sass { return cc; } - Expression_Ptr Eval::operator()(Supports_Negation_Ptr c) + Expression* Eval::operator()(Supports_Negation* c) { - Expression_Ptr condition = c->condition()->perform(this); - Supports_Negation_Ptr cc = SASS_MEMORY_NEW(Supports_Negation, + Expression* condition = c->condition()->perform(this); + Supports_Negation* cc = SASS_MEMORY_NEW(Supports_Negation, c->pstate(), Cast(condition)); return cc; } - Expression_Ptr Eval::operator()(Supports_Declaration_Ptr c) + Expression* Eval::operator()(Supports_Declaration* c) { - Expression_Ptr feature = c->feature()->perform(this); - Expression_Ptr value = c->value()->perform(this); - Supports_Declaration_Ptr cc = SASS_MEMORY_NEW(Supports_Declaration, + Expression* feature = c->feature()->perform(this); + Expression* value = c->value()->perform(this); + Supports_Declaration* cc = SASS_MEMORY_NEW(Supports_Declaration, c->pstate(), feature, value); return cc; } - Expression_Ptr Eval::operator()(Supports_Interpolation_Ptr c) + Expression* Eval::operator()(Supports_Interpolation* c) { - Expression_Ptr value = c->value()->perform(this); - Supports_Interpolation_Ptr cc = SASS_MEMORY_NEW(Supports_Interpolation, + Expression* value = c->value()->perform(this); + Supports_Interpolation* cc = SASS_MEMORY_NEW(Supports_Interpolation, c->pstate(), value); return cc; } - Expression_Ptr Eval::operator()(At_Root_Query_Ptr e) + Expression* Eval::operator()(At_Root_Query* e) { Expression_Obj feature = e->feature(); feature = (feature ? feature->perform(this) : 0); Expression_Obj value = e->value(); value = (value ? value->perform(this) : 0); - Expression_Ptr ee = SASS_MEMORY_NEW(At_Root_Query, + Expression* ee = SASS_MEMORY_NEW(At_Root_Query, e->pstate(), Cast(feature), value); return ee; } - Media_Query_Ptr Eval::operator()(Media_Query_Ptr q) + Media_Query* Eval::operator()(Media_Query* q) { String_Obj t = q->media_type(); - t = static_cast(t.isNull() ? 0 : t->perform(this)); + t = static_cast(t.isNull() ? 0 : t->perform(this)); Media_Query_Obj qq = SASS_MEMORY_NEW(Media_Query, q->pstate(), t, @@ -1393,12 +1393,12 @@ namespace Sass { q->is_negated(), q->is_restricted()); for (size_t i = 0, L = q->length(); i < L; ++i) { - qq->append(static_cast((*q)[i]->perform(this))); + qq->append(static_cast((*q)[i]->perform(this))); } return qq.detach(); } - Expression_Ptr Eval::operator()(Media_Query_Expression_Ptr e) + Expression* Eval::operator()(Media_Query_Expression* e) { Expression_Obj feature = e->feature(); feature = (feature ? feature->perform(this) : 0); @@ -1422,12 +1422,12 @@ namespace Sass { e->is_interpolated()); } - Expression_Ptr Eval::operator()(Null_Ptr n) + Expression* Eval::operator()(Null* n) { return n; } - Expression_Ptr Eval::operator()(Argument_Ptr a) + Expression* Eval::operator()(Argument* a) { Expression_Obj val = a->value()->perform(this); bool is_rest_argument = a->is_rest_argument(); @@ -1456,13 +1456,13 @@ namespace Sass { is_keyword_argument); } - Expression_Ptr Eval::operator()(Arguments_Ptr a) + Expression* Eval::operator()(Arguments* a) { Arguments_Obj aa = SASS_MEMORY_NEW(Arguments, a->pstate()); if (a->length() == 0) return aa.detach(); for (size_t i = 0, L = a->length(); i < L; ++i) { Expression_Obj rv = (*a)[i]->perform(this); - Argument_Ptr arg = Cast(rv); + Argument* arg = Cast(rv); if (!(arg->is_rest_argument() || arg->is_keyword_argument())) { aa->append(arg); } @@ -1473,8 +1473,8 @@ namespace Sass { Expression_Obj splat = Cast(rest)->value()->perform(this); Sass_Separator separator = SASS_COMMA; - List_Ptr ls = Cast(splat); - Map_Ptr ms = Cast(splat); + List* ls = Cast(splat); + Map* ms = Cast(splat); List_Obj arglist = SASS_MEMORY_NEW(List, splat->pstate(), @@ -1498,7 +1498,7 @@ namespace Sass { if (a->has_keyword_argument()) { Expression_Obj rv = a->get_keyword_argument()->perform(this); - Argument_Ptr rvarg = Cast(rv); + Argument* rvarg = Cast(rv); Expression_Obj kwarg = rvarg->value()->perform(this); aa->append(SASS_MEMORY_NEW(Argument, kwarg->pstate(), kwarg, "", false, true)); @@ -1506,12 +1506,12 @@ namespace Sass { return aa.detach(); } - Expression_Ptr Eval::operator()(Comment_Ptr c) + Expression* Eval::operator()(Comment* c) { return 0; } - Selector_List_Ptr Eval::operator()(Selector_List_Ptr s) + Selector_List* Eval::operator()(Selector_List* s) { SelectorStack rv; Selector_List_Obj sl = SASS_MEMORY_NEW(Selector_List, s->pstate()); @@ -1544,14 +1544,14 @@ namespace Sass { } - Selector_List_Ptr Eval::operator()(Complex_Selector_Ptr s) + Selector_List* Eval::operator()(Complex_Selector* s) { bool implicit_parent = !exp.old_at_root_without_rule; if (is_in_selector_schema) exp.selector_stack.push_back({}); Selector_List_Obj resolved = s->resolve_parent_refs(exp.selector_stack, traces, implicit_parent); if (is_in_selector_schema) exp.selector_stack.pop_back(); for (size_t i = 0; i < resolved->length(); i++) { - Complex_Selector_Ptr is = resolved->at(i)->mutable_first(); + Complex_Selector* is = resolved->at(i)->mutable_first(); while (is) { if (is->head()) { is->head(operator()(is->head())); @@ -1562,10 +1562,10 @@ namespace Sass { return resolved.detach(); } - Compound_Selector_Ptr Eval::operator()(Compound_Selector_Ptr s) + Compound_Selector* Eval::operator()(Compound_Selector* s) { for (size_t i = 0; i < s->length(); i++) { - Simple_Selector_Ptr ss = s->at(i); + Simple_Selector* ss = s->at(i); // skip parents here (called via resolve_parent_refs) if (ss == NULL || Cast(ss)) continue; s->at(i) = Cast(ss->perform(this)); @@ -1573,7 +1573,7 @@ namespace Sass { return s; } - Selector_List_Ptr Eval::operator()(Selector_Schema_Ptr s) + Selector_List* Eval::operator()(Selector_Schema* s) { LOCAL_FLAG(is_in_selector_schema, true); // the parser will look for a brace to end the selector @@ -1606,7 +1606,7 @@ namespace Sass { return operator()(sl); } - Expression_Ptr Eval::operator()(Parent_Selector_Ptr p) + Expression* Eval::operator()(Parent_Selector* p) { if (Selector_List_Obj pr = selector()) { exp.selector_stack.pop_back(); @@ -1618,7 +1618,7 @@ namespace Sass { } } - Expression_Ptr Eval::operator()(Parent_Reference_Ptr p) + Expression* Eval::operator()(Parent_Reference* p) { if (Selector_List_Obj pr = selector()) { exp.selector_stack.pop_back(); @@ -1630,7 +1630,7 @@ namespace Sass { } } - Simple_Selector_Ptr Eval::operator()(Simple_Selector_Ptr s) + Simple_Selector* Eval::operator()(Simple_Selector* s) { return s; } @@ -1640,13 +1640,13 @@ namespace Sass { // be fixed by implement superselector correctly for `:not` // first use of "find" (ATM only implemented for selectors) bool hasNotSelector(AST_Node_Obj obj) { - if (Wrapped_Selector_Ptr w = Cast(obj)) { + if (Wrapped_Selector* w = Cast(obj)) { return w->name() == ":not"; } return false; } - Wrapped_Selector_Ptr Eval::operator()(Wrapped_Selector_Ptr s) + Wrapped_Selector* Eval::operator()(Wrapped_Selector* s) { if (s->name() == ":not") { @@ -1656,7 +1656,7 @@ namespace Sass { s->name(" "); } else { for (size_t i = 0; i < s->selector()->length(); ++i) { - Complex_Selector_Ptr cs = s->selector()->at(i); + Complex_Selector* cs = s->selector()->at(i); if (cs->tail()) { s->selector()->clear(); s->name(" "); diff --git a/src/eval.hpp b/src/eval.hpp index 61ed1e2fc..dcaf14aa2 100644 --- a/src/eval.hpp +++ b/src/eval.hpp @@ -12,7 +12,7 @@ namespace Sass { class Expand; class Context; - class Eval : public Operation_CRTP { + class Eval : public Operation_CRTP { public: Expand& exp; @@ -40,66 +40,66 @@ namespace Sass { struct Sass_Compiler* compiler(); // for evaluating function bodies - Expression_Ptr operator()(Block_Ptr); - Expression_Ptr operator()(Assignment_Ptr); - Expression_Ptr operator()(If_Ptr); - Expression_Ptr operator()(For_Ptr); - Expression_Ptr operator()(Each_Ptr); - Expression_Ptr operator()(While_Ptr); - Expression_Ptr operator()(Return_Ptr); - Expression_Ptr operator()(Warning_Ptr); - Expression_Ptr operator()(Error_Ptr); - Expression_Ptr operator()(Debug_Ptr); - - Expression_Ptr operator()(List_Ptr); - Expression_Ptr operator()(Map_Ptr); - Expression_Ptr operator()(Binary_Expression_Ptr); - Expression_Ptr operator()(Unary_Expression_Ptr); - Expression_Ptr operator()(Function_Call_Ptr); - Expression_Ptr operator()(Variable_Ptr); - Expression_Ptr operator()(Number_Ptr); - Expression_Ptr operator()(Color_RGBA_Ptr); - Expression_Ptr operator()(Color_HSLA_Ptr); - Expression_Ptr operator()(Boolean_Ptr); - Expression_Ptr operator()(String_Schema_Ptr); - Expression_Ptr operator()(String_Quoted_Ptr); - Expression_Ptr operator()(String_Constant_Ptr); - // Expression_Ptr operator()(Selector_List_Ptr); - Media_Query_Ptr operator()(Media_Query_Ptr); - Expression_Ptr operator()(Media_Query_Expression_Ptr); - Expression_Ptr operator()(At_Root_Query_Ptr); - Expression_Ptr operator()(Supports_Operator_Ptr); - Expression_Ptr operator()(Supports_Negation_Ptr); - Expression_Ptr operator()(Supports_Declaration_Ptr); - Expression_Ptr operator()(Supports_Interpolation_Ptr); - Expression_Ptr operator()(Null_Ptr); - Expression_Ptr operator()(Argument_Ptr); - Expression_Ptr operator()(Arguments_Ptr); - Expression_Ptr operator()(Comment_Ptr); + Expression* operator()(Block*); + Expression* operator()(Assignment*); + Expression* operator()(If*); + Expression* operator()(For*); + Expression* operator()(Each*); + Expression* operator()(While*); + Expression* operator()(Return*); + Expression* operator()(Warning*); + Expression* operator()(Error*); + Expression* operator()(Debug*); + + Expression* operator()(List*); + Expression* operator()(Map*); + Expression* operator()(Binary_Expression*); + Expression* operator()(Unary_Expression*); + Expression* operator()(Function_Call*); + Expression* operator()(Variable*); + Expression* operator()(Number*); + Expression* operator()(Color_RGBA*); + Expression* operator()(Color_HSLA*); + Expression* operator()(Boolean*); + Expression* operator()(String_Schema*); + Expression* operator()(String_Quoted*); + Expression* operator()(String_Constant*); + // Expression* operator()(Selector_List*); + Media_Query* operator()(Media_Query*); + Expression* operator()(Media_Query_Expression*); + Expression* operator()(At_Root_Query*); + Expression* operator()(Supports_Operator*); + Expression* operator()(Supports_Negation*); + Expression* operator()(Supports_Declaration*); + Expression* operator()(Supports_Interpolation*); + Expression* operator()(Null*); + Expression* operator()(Argument*); + Expression* operator()(Arguments*); + Expression* operator()(Comment*); // these will return selectors - Selector_List_Ptr operator()(Selector_List_Ptr); - Selector_List_Ptr operator()(Complex_Selector_Ptr); - Compound_Selector_Ptr operator()(Compound_Selector_Ptr); - Simple_Selector_Ptr operator()(Simple_Selector_Ptr s); - Wrapped_Selector_Ptr operator()(Wrapped_Selector_Ptr s); + Selector_List* operator()(Selector_List*); + Selector_List* operator()(Complex_Selector*); + Compound_Selector* operator()(Compound_Selector*); + Simple_Selector* operator()(Simple_Selector* s); + Wrapped_Selector* operator()(Wrapped_Selector* s); // they don't have any specific implementation (yet) - Id_Selector_Ptr operator()(Id_Selector_Ptr s) { return s; }; - Class_Selector_Ptr operator()(Class_Selector_Ptr s) { return s; }; - Pseudo_Selector_Ptr operator()(Pseudo_Selector_Ptr s) { return s; }; - Type_Selector_Ptr operator()(Type_Selector_Ptr s) { return s; }; - Attribute_Selector_Ptr operator()(Attribute_Selector_Ptr s) { return s; }; - Placeholder_Selector_Ptr operator()(Placeholder_Selector_Ptr s) { return s; }; + Id_Selector* operator()(Id_Selector* s) { return s; }; + Class_Selector* operator()(Class_Selector* s) { return s; }; + Pseudo_Selector* operator()(Pseudo_Selector* s) { return s; }; + Type_Selector* operator()(Type_Selector* s) { return s; }; + Attribute_Selector* operator()(Attribute_Selector* s) { return s; }; + Placeholder_Selector* operator()(Placeholder_Selector* s) { return s; }; // actual evaluated selectors - Selector_List_Ptr operator()(Selector_Schema_Ptr); - Expression_Ptr operator()(Parent_Selector_Ptr); - Expression_Ptr operator()(Parent_Reference_Ptr); + Selector_List* operator()(Selector_Schema*); + Expression* operator()(Parent_Selector*); + Expression* operator()(Parent_Reference*); // generic fallback template - Expression_Ptr fallback(U x) + Expression* fallback(U x) { return Cast(x); } private: diff --git a/src/expand.cpp b/src/expand.cpp index 587f6e2d3..0a40410ed 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -57,7 +57,7 @@ namespace Sass { } // blocks create new variable scopes - Block_Ptr Expand::operator()(Block_Ptr b) + Block* Expand::operator()(Block* b) { // create new local environment // set the current env as parent @@ -80,15 +80,15 @@ namespace Sass { return bb.detach(); } - Statement_Ptr Expand::operator()(Ruleset_Ptr r) + Statement* Expand::operator()(Ruleset* r) { LOCAL_FLAG(old_at_root_without_rule, at_root_without_rule); if (in_keyframes) { - Block_Ptr bb = operator()(r->block()); + Block* bb = operator()(r->block()); Keyframe_Rule_Obj k = SASS_MEMORY_NEW(Keyframe_Rule, r->pstate(), bb); if (r->selector()) { - if (Selector_List_Ptr s = r->selector()) { + if (Selector_List* s = r->selector()) { selector_stack.push_back({}); k->name(s->eval(eval)); selector_stack.pop_back(); @@ -112,12 +112,12 @@ namespace Sass { // check for parent selectors in base level rules if (r->is_root() || (block_stack.back() && block_stack.back()->is_root())) { - if (Selector_List_Ptr selector_list = Cast(r->selector())) { + if (Selector_List* selector_list = Cast(r->selector())) { for (Complex_Selector_Obj complex_selector : selector_list->elements()) { - Complex_Selector_Ptr tail = complex_selector; + Complex_Selector* tail = complex_selector; while (tail) { if (tail->head()) for (Simple_Selector_Obj header : tail->head()->elements()) { - Parent_Selector_Ptr ptr = Cast(header); + Parent_Selector* ptr = Cast(header); if (ptr == NULL || (!ptr->real() || has_parent_selector)) continue; std::string sel_str(complex_selector->to_string(ctx.c_options)); error("Base-level rules cannot contain the parent-selector-referencing character '&'.", header->pstate(), traces); @@ -145,7 +145,7 @@ namespace Sass { sel->set_media_block(media_stack.back()); Block_Obj blk; if (r->block()) blk = operator()(r->block()); - Ruleset_Ptr rr = SASS_MEMORY_NEW(Ruleset, + Ruleset* rr = SASS_MEMORY_NEW(Ruleset, r->pstate(), sel, blk); @@ -160,7 +160,7 @@ namespace Sass { return rr; } - Statement_Ptr Expand::operator()(Supports_Block_Ptr f) + Statement* Expand::operator()(Supports_Block* f) { Expression_Obj condition = f->condition()->perform(&eval); Supports_Block_Obj ff = SASS_MEMORY_NEW(Supports_Block, @@ -170,7 +170,7 @@ namespace Sass { return ff.detach(); } - Statement_Ptr Expand::operator()(Media_Block_Ptr m) + Statement* Expand::operator()(Media_Block* m) { Media_Block_Obj cpy = SASS_MEMORY_COPY(m); // Media_Blocks are prone to have circular references @@ -188,7 +188,7 @@ namespace Sass { cpy->media_queries(mq); media_stack.push_back(cpy); Block_Obj blk = operator()(m->block()); - Media_Block_Ptr mm = SASS_MEMORY_NEW(Media_Block, + Media_Block* mm = SASS_MEMORY_NEW(Media_Block, m->pstate(), mq, blk); @@ -197,7 +197,7 @@ namespace Sass { return mm; } - Statement_Ptr Expand::operator()(At_Root_Block_Ptr a) + Statement* Expand::operator()(At_Root_Block* a) { Block_Obj ab = a->block(); Expression_Obj ae = a->expression(); @@ -218,18 +218,18 @@ namespace Sass { return aa.detach(); } - Statement_Ptr Expand::operator()(Directive_Ptr a) + Statement* Expand::operator()(Directive* a) { LOCAL_FLAG(in_keyframes, a->is_keyframes()); - Block_Ptr ab = a->block(); - Selector_List_Ptr as = a->selector(); - Expression_Ptr av = a->value(); + Block* ab = a->block(); + Selector_List* as = a->selector(); + Expression* av = a->value(); selector_stack.push_back({}); if (av) av = av->perform(&eval); if (as) as = eval(as); selector_stack.pop_back(); - Block_Ptr bb = ab ? operator()(ab) : NULL; - Directive_Ptr aa = SASS_MEMORY_NEW(Directive, + Block* bb = ab ? operator()(ab) : NULL; + Directive* aa = SASS_MEMORY_NEW(Directive, a->pstate(), a->keyword(), as, @@ -238,7 +238,7 @@ namespace Sass { return aa; } - Statement_Ptr Expand::operator()(Declaration_Ptr d) + Statement* Expand::operator()(Declaration* d) { Block_Obj ab = d->block(); String_Obj old_p = d->property(); @@ -255,7 +255,7 @@ namespace Sass { if (!bb) { if (!value || (value->is_invisible() && !d->is_important())) return 0; } - Declaration_Ptr decl = SASS_MEMORY_NEW(Declaration, + Declaration* decl = SASS_MEMORY_NEW(Declaration, d->pstate(), new_p, value, @@ -266,7 +266,7 @@ namespace Sass { return decl; } - Statement_Ptr Expand::operator()(Assignment_Ptr a) + Statement* Expand::operator()(Assignment* a) { Env* env = environment(); const std::string& var(a->variable()); @@ -327,7 +327,7 @@ namespace Sass { return 0; } - Statement_Ptr Expand::operator()(Import_Ptr imp) + Statement* Expand::operator()(Import* imp) { Import_Obj result = SASS_MEMORY_NEW(Import, imp->pstate()); if (imp->import_queries() && imp->import_queries()->size()) { @@ -342,7 +342,7 @@ namespace Sass { return result.detach(); } - Statement_Ptr Expand::operator()(Import_Stub_Ptr i) + Statement* Expand::operator()(Import_Stub* i) { traces.push_back(Backtrace(i->pstate())); // get parent node from call stack @@ -372,28 +372,28 @@ namespace Sass { return 0; } - Statement_Ptr Expand::operator()(Warning_Ptr w) + Statement* Expand::operator()(Warning* w) { // eval handles this too, because warnings may occur in functions w->perform(&eval); return 0; } - Statement_Ptr Expand::operator()(Error_Ptr e) + Statement* Expand::operator()(Error* e) { // eval handles this too, because errors may occur in functions e->perform(&eval); return 0; } - Statement_Ptr Expand::operator()(Debug_Ptr d) + Statement* Expand::operator()(Debug* d) { // eval handles this too, because warnings may occur in functions d->perform(&eval); return 0; } - Statement_Ptr Expand::operator()(Comment_Ptr c) + Statement* Expand::operator()(Comment* c) { if (ctx.output_style() == COMPRESSED) { // comments should not be evaluated in compact @@ -401,13 +401,13 @@ namespace Sass { if (!c->is_important()) return NULL; } eval.is_in_comment = true; - Comment_Ptr rv = SASS_MEMORY_NEW(Comment, c->pstate(), Cast(c->text()->perform(&eval)), c->is_important()); + Comment* rv = SASS_MEMORY_NEW(Comment, c->pstate(), Cast(c->text()->perform(&eval)), c->is_important()); eval.is_in_comment = false; // TODO: eval the text, once we're parsing/storing it as a String_Schema return rv; } - Statement_Ptr Expand::operator()(If_Ptr i) + Statement* Expand::operator()(If* i) { Env env(environment(), true); env_stack.push_back(&env); @@ -417,7 +417,7 @@ namespace Sass { append_block(i->block()); } else { - Block_Ptr alt = i->alternative(); + Block* alt = i->alternative(); if (alt) append_block(alt); } call_stack.pop_back(); @@ -427,7 +427,7 @@ namespace Sass { // For does not create a new env scope // But iteration vars are reset afterwards - Statement_Ptr Expand::operator()(For_Ptr f) + Statement* Expand::operator()(For* f) { std::string variable(f->variable()); Expression_Obj low = f->lower_bound()->perform(&eval); @@ -455,7 +455,7 @@ namespace Sass { Env env(environment(), true); env_stack.push_back(&env); call_stack.push_back(f); - Block_Ptr body = f->block(); + Block* body = f->block(); if (start < end) { if (f->is_inclusive()) ++end; for (double i = start; @@ -482,7 +482,7 @@ namespace Sass { // Eval does not create a new env scope // But iteration vars are reset afterwards - Statement_Ptr Expand::operator()(Each_Ptr e) + Statement* Expand::operator()(Each* e) { std::vector variables(e->variables()); Expression_Obj expr = e->list()->perform(&eval); @@ -491,7 +491,7 @@ namespace Sass { if (expr->concrete_type() == Expression::MAP) { map = Cast(expr); } - else if (Selector_List_Ptr ls = Cast(expr)) { + else if (Selector_List* ls = Cast(expr)) { Listize listize; Expression_Obj rv = ls->perform(&listize); list = Cast(rv); @@ -507,7 +507,7 @@ namespace Sass { Env env(environment(), true); env_stack.push_back(&env); call_stack.push_back(e); - Block_Ptr body = e->block(); + Block* body = e->block(); if (map) { for (auto key : map->keys()) { @@ -566,10 +566,10 @@ namespace Sass { return 0; } - Statement_Ptr Expand::operator()(While_Ptr w) + Statement* Expand::operator()(While* w) { Expression_Obj pred = w->predicate(); - Block_Ptr body = w->block(); + Block* body = w->block(); Env env(environment(), true); env_stack.push_back(&env); call_stack.push_back(w); @@ -583,7 +583,7 @@ namespace Sass { return 0; } - Statement_Ptr Expand::operator()(Return_Ptr r) + Statement* Expand::operator()(Return* r) { error("@return may only be used within a function", r->pstate(), traces); return 0; @@ -641,13 +641,13 @@ namespace Sass { } - Statement* Expand::operator()(Extension_Ptr e) + Statement* Expand::operator()(Extension* e) { if (Selector_List_Obj extender = selector()) { - Selector_List_Ptr sl = e->selector(); + Selector_List* sl = e->selector(); // abort on invalid selector if (sl == NULL) return NULL; - if (Selector_Schema_Ptr schema = sl->schema()) { + if (Selector_Schema* schema = sl->schema()) { if (schema->has_real_parent_ref()) { // put root block on stack again (ignore parents) // selector schema must not connect in eval! @@ -672,7 +672,7 @@ namespace Sass { return 0; } - Statement_Ptr Expand::operator()(Definition_Ptr d) + Statement* Expand::operator()(Definition* d) { Env* env = environment(); Definition_Obj dd = SASS_MEMORY_COPY(d); @@ -697,7 +697,7 @@ namespace Sass { return 0; } - Statement_Ptr Expand::operator()(Mixin_Call_Ptr c) + Statement* Expand::operator()(Mixin_Call* c) { if (recursions > maxRecursion) { throw Exception::StackError(traces, *c); @@ -752,12 +752,12 @@ namespace Sass { Trace_Obj trace = SASS_MEMORY_NEW(Trace, c->pstate(), c->name(), trace_block); env->set_global("is_in_mixin", bool_true); - if (Block_Ptr pr = block_stack.back()) { + if (Block* pr = block_stack.back()) { trace_block->is_root(pr->is_root()); } block_stack.push_back(trace_block); for (auto bb : body->elements()) { - if (Ruleset_Ptr r = Cast(bb)) { + if (Ruleset* r = Cast(bb)) { r->is_root(trace_block->is_root()); } Statement_Obj ith = bb->perform(this); @@ -774,7 +774,7 @@ namespace Sass { return trace.detach(); } - Statement_Ptr Expand::operator()(Content_Ptr c) + Statement* Expand::operator()(Content* c) { Env* env = environment(); // convert @content directives into mixin calls to the underlying thunk @@ -802,11 +802,11 @@ namespace Sass { } // process and add to last block on stack - inline void Expand::append_block(Block_Ptr b) + inline void Expand::append_block(Block* b) { if (b->is_root()) call_stack.push_back(b); for (size_t i = 0, L = b->length(); i < L; ++i) { - Statement_Ptr stm = b->at(i); + Statement* stm = b->at(i); Statement_Obj ith = stm->perform(this); if (ith) block_stack.back()->append(ith); } diff --git a/src/expand.hpp b/src/expand.hpp index 1c494194e..34ddb8961 100644 --- a/src/expand.hpp +++ b/src/expand.hpp @@ -15,7 +15,7 @@ namespace Sass { class Eval; struct Backtrace; - class Expand : public Operation_CRTP { + class Expand : public Operation_CRTP { public: Env* environment(); @@ -45,31 +45,31 @@ namespace Sass { Expand(Context&, Env*, SelectorStack* stack = NULL); ~Expand() { } - Block_Ptr operator()(Block_Ptr); - Statement_Ptr operator()(Ruleset_Ptr); - Statement_Ptr operator()(Media_Block_Ptr); - Statement_Ptr operator()(Supports_Block_Ptr); - Statement_Ptr operator()(At_Root_Block_Ptr); - Statement_Ptr operator()(Directive_Ptr); - Statement_Ptr operator()(Declaration_Ptr); - Statement_Ptr operator()(Assignment_Ptr); - Statement_Ptr operator()(Import_Ptr); - Statement_Ptr operator()(Import_Stub_Ptr); - Statement_Ptr operator()(Warning_Ptr); - Statement_Ptr operator()(Error_Ptr); - Statement_Ptr operator()(Debug_Ptr); - Statement_Ptr operator()(Comment_Ptr); - Statement_Ptr operator()(If_Ptr); - Statement_Ptr operator()(For_Ptr); - Statement_Ptr operator()(Each_Ptr); - Statement_Ptr operator()(While_Ptr); - Statement_Ptr operator()(Return_Ptr); - Statement_Ptr operator()(Extension_Ptr); - Statement_Ptr operator()(Definition_Ptr); - Statement_Ptr operator()(Mixin_Call_Ptr); - Statement_Ptr operator()(Content_Ptr); - - void append_block(Block_Ptr); + Block* operator()(Block*); + Statement* operator()(Ruleset*); + Statement* operator()(Media_Block*); + Statement* operator()(Supports_Block*); + Statement* operator()(At_Root_Block*); + Statement* operator()(Directive*); + Statement* operator()(Declaration*); + Statement* operator()(Assignment*); + Statement* operator()(Import*); + Statement* operator()(Import_Stub*); + Statement* operator()(Warning*); + Statement* operator()(Error*); + Statement* operator()(Debug*); + Statement* operator()(Comment*); + Statement* operator()(If*); + Statement* operator()(For*); + Statement* operator()(Each*); + Statement* operator()(While*); + Statement* operator()(Return*); + Statement* operator()(Extension*); + Statement* operator()(Definition*); + Statement* operator()(Mixin_Call*); + Statement* operator()(Content*); + + void append_block(Block*); }; diff --git a/src/extend.cpp b/src/extend.cpp index 4e6f9a1fd..3470dc93a 100644 --- a/src/extend.cpp +++ b/src/extend.cpp @@ -114,7 +114,7 @@ namespace Sass { } // Print a string representation of a Compound_Selector - static void printCompoundSelector(Compound_Selector_Ptr pCompoundSelector, const char* message=NULL, bool newline=true) { + static void printCompoundSelector(Compound_Selector* pCompoundSelector, const char* message=NULL, bool newline=true) { if (message) { std::cerr << message; @@ -135,7 +135,7 @@ namespace Sass { std::ostream& operator<<(std::ostream& os, Complex_Selector& complexSelector) { os << "["; - Complex_Selector_Ptr pIter = &complexSelector; + Complex_Selector* pIter = &complexSelector; bool first = true; while (pIter) { if (pIter->combinator() != Complex_Selector::ANCESTOR_OF) { @@ -166,7 +166,7 @@ namespace Sass { // Print a string representation of a Complex_Selector - static void printComplexSelector(Complex_Selector_Ptr pComplexSelector, const char* message=NULL, bool newline=true) { + static void printComplexSelector(Complex_Selector* pComplexSelector, const char* message=NULL, bool newline=true) { if (message) { std::cerr << message; @@ -197,8 +197,8 @@ namespace Sass { std::cerr << ", "; } std::cerr << "["; - Compound_Selector_Ptr pSels = pair.first; - Complex_Selector_Ptr pNewSelector = pair.second; + Compound_Selector* pSels = pair.first; + Complex_Selector* pNewSelector = pair.second; std::cerr << "[" << *pSels << "], "; printComplexSelector(pNewSelector, NULL, false); } @@ -221,7 +221,7 @@ namespace Sass { typedef std::deque SourceStrings; SourceStrings sourceStrings; for (ComplexSelectorSet::iterator iterator = sources.begin(), iteratorEnd = sources.end(); iterator != iteratorEnd; ++iterator) { - Complex_Selector_Ptr pSource = *iterator; + Complex_Selector* pSource = *iterator; std::stringstream sstream; sstream << complexSelectorToNode(pSource); sourceStrings.push_back(sstream.str()); @@ -283,7 +283,7 @@ namespace Sass { } #endif - static bool parentSuperselector(Complex_Selector_Ptr pOne, Complex_Selector_Ptr pTwo) { + static bool parentSuperselector(Complex_Selector* pOne, Complex_Selector* pTwo) { // TODO: figure out a better way to create a Complex_Selector from scratch // TODO: There's got to be a better way. This got ugly quick... Type_Selector_Obj fakeParent = SASS_MEMORY_NEW(Type_Selector, ParserState("[FAKE]"), "temp"); @@ -980,7 +980,7 @@ namespace Sass { Complex_Selector_Obj pMergedWrapper = SASS_MEMORY_CLONE(sel1.selector()); // Clone the Complex_Selector to get back to something we can transform to a node once we replace the head with the unification result // TODO: does subject matter? Ruby: return unless merged = sel1.unify(sel2.members, sel2.subject?) - Compound_Selector_Ptr pMerged = sel1.selector()->head()->unify_with(sel2.selector()->head()); + Compound_Selector* pMerged = sel1.selector()->head()->unify_with(sel2.selector()->head()); pMergedWrapper->head(pMerged); DEBUG_EXEC(ALL, printCompoundSelector(pMerged, "MERGED: ")) @@ -1037,7 +1037,7 @@ namespace Sass { Complex_Selector_Obj pMergedWrapper = SASS_MEMORY_CLONE(plusSel.selector()); // Clone the Complex_Selector to get back to something we can transform to a node once we replace the head with the unification result // TODO: does subject matter? Ruby: merged = plus_sel.unify(tilde_sel.members, tilde_sel.subject?) - Compound_Selector_Ptr pMerged = plusSel.selector()->head()->unify_with(tildeSel.selector()->head()); + Compound_Selector* pMerged = plusSel.selector()->head()->unify_with(tildeSel.selector()->head()); pMergedWrapper->head(pMerged); DEBUG_EXEC(ALL, printCompoundSelector(pMerged, "MERGED: ")) @@ -1086,7 +1086,7 @@ namespace Sass { Complex_Selector_Obj pMergedWrapper = SASS_MEMORY_CLONE(sel1.selector()); // Clone the Complex_Selector to get back to something we can transform to a node once we replace the head with the unification result // TODO: does subject matter? Ruby: return unless merged = sel1.unify(sel2.members, sel2.subject?) - Compound_Selector_Ptr pMerged = sel1.selector()->head()->unify_with(sel2.selector()->head()); + Compound_Selector* pMerged = sel1.selector()->head()->unify_with(sel2.selector()->head()); pMergedWrapper->head(pMerged); DEBUG_EXEC(ALL, printCompoundSelector(pMerged, "MERGED: ")) @@ -1520,7 +1520,7 @@ namespace Sass { return pSelector; } }; - Node Extend::extendCompoundSelector(Compound_Selector_Ptr pSelector, CompoundSelectorSet& seen, bool isReplace) { + Node Extend::extendCompoundSelector(Compound_Selector* pSelector, CompoundSelectorSet& seen, bool isReplace) { /* this turned out to be too much overhead probably due to holding a "Node" object @@ -1564,7 +1564,7 @@ namespace Sass { DEBUG_EXEC(EXTEND_COMPOUND, printCompoundSelector(pSels, "SELS: ")) // The selector up to where the @extend is (ie, the thing to merge) - Complex_Selector_Ptr pExtComplexSelector = seq; + Complex_Selector* pExtComplexSelector = seq; // TODO: This can return a Compound_Selector with no elements. Should that just be returning NULL? // RUBY: self_without_sel = Sass::Util.array_minus(members, sels) @@ -1688,7 +1688,7 @@ namespace Sass { // check if selector has something to be extended by subset_map - bool Extend::complexSelectorHasExtension(Complex_Selector_Ptr selector, CompoundSelectorSet& seen) { + bool Extend::complexSelectorHasExtension(Complex_Selector* selector, CompoundSelectorSet& seen) { bool hasExtension = false; @@ -1744,7 +1744,7 @@ namespace Sass { the combinator and compound selector are one unit next [[sseq_or_op]] unless sseq_or_op.is_a?(SimpleSequence) */ - Node Extend::extendComplexSelector(Complex_Selector_Ptr selector, CompoundSelectorSet& seen, bool isReplace, bool isOriginal) { + Node Extend::extendComplexSelector(Complex_Selector* selector, CompoundSelectorSet& seen, bool isReplace, bool isOriginal) { // check if we already extended this selector // we can do this since subset_map is "static" @@ -1870,7 +1870,7 @@ namespace Sass { */ // We get a selector list with has something to extend and a subset_map with // all extenders. Pick the ones that match our selectors in the list. - Selector_List_Ptr Extend::extendSelectorList(Selector_List_Obj pSelectorList, bool isReplace, bool& extendedSomething, CompoundSelectorSet& seen) { + Selector_List* Extend::extendSelectorList(Selector_List_Obj pSelectorList, bool isReplace, bool& extendedSomething, CompoundSelectorSet& seen) { Selector_List_Obj pNewSelectors = SASS_MEMORY_NEW(Selector_List, pSelectorList->pstate(), pSelectorList->length()); @@ -2042,7 +2042,7 @@ namespace Sass { // was is @extend that matches our selector. If we find one, we will go further // and call the extend magic for our selector. The subset_map contains all blocks // where @extend was found. Pick the ones that match our selector! - void Extend::extendObjectWithSelectorAndBlock(Ruleset_Ptr pObject) { + void Extend::extendObjectWithSelectorAndBlock(Ruleset* pObject) { DEBUG_PRINTLN(EXTEND_OBJECT, "FOUND SELECTOR: " << Cast(pObject->selector())->to_string()) @@ -2077,7 +2077,7 @@ namespace Sass { eval = &e; } - void Extend::operator()(Block_Ptr b) + void Extend::operator()(Block* b) { for (size_t i = 0, L = b->length(); i < L; ++i) { Statement_Obj stm = b->at(i); @@ -2088,8 +2088,8 @@ namespace Sass { if (b->is_root()) { // debug_subset_map(subset_map); for(auto const &it : subset_map.values()) { - Complex_Selector_Ptr_Const sel = nullptr; - Compound_Selector_Ptr_Const ext = nullptr; + const Complex_Selector* sel = nullptr; + const Compound_Selector* ext = nullptr; if (it.first) sel = it.first->first(); if (it.second) ext = it.second; if (ext && (ext->extended() || ext->is_optional())) continue; @@ -2106,25 +2106,25 @@ namespace Sass { } - void Extend::operator()(Ruleset_Ptr pRuleset) + void Extend::operator()(Ruleset* pRuleset) { extendObjectWithSelectorAndBlock( pRuleset ); pRuleset->block()->perform(this); } - void Extend::operator()(Supports_Block_Ptr pFeatureBlock) + void Extend::operator()(Supports_Block* pFeatureBlock) { pFeatureBlock->block()->perform(this); } - void Extend::operator()(Media_Block_Ptr pMediaBlock) + void Extend::operator()(Media_Block* pMediaBlock) { pMediaBlock->block()->perform(this); } - void Extend::operator()(Directive_Ptr a) + void Extend::operator()(Directive* a) { - // Selector_List_Ptr ls = Cast(a->selector()); + // Selector_List* ls = Cast(a->selector()); // selector_stack.push_back(ls); if (a->block()) a->block()->perform(this); // exp.selector_stack.pop_back(); diff --git a/src/extend.hpp b/src/extend.hpp index e222359e3..fdff61abb 100644 --- a/src/extend.hpp +++ b/src/extend.hpp @@ -46,22 +46,22 @@ namespace Sass { > memoizeCompound; */ - void extendObjectWithSelectorAndBlock(Ruleset_Ptr pObject); - Node extendComplexSelector(Complex_Selector_Ptr sel, CompoundSelectorSet& seen, bool isReplace, bool isOriginal); - Node extendCompoundSelector(Compound_Selector_Ptr sel, CompoundSelectorSet& seen, bool isReplace); - bool complexSelectorHasExtension(Complex_Selector_Ptr selector, CompoundSelectorSet& seen); + void extendObjectWithSelectorAndBlock(Ruleset* pObject); + Node extendComplexSelector(Complex_Selector* sel, CompoundSelectorSet& seen, bool isReplace, bool isOriginal); + Node extendCompoundSelector(Compound_Selector* sel, CompoundSelectorSet& seen, bool isReplace); + bool complexSelectorHasExtension(Complex_Selector* selector, CompoundSelectorSet& seen); Node trim(Node& seqses, bool isReplace); Node weave(Node& path); public: void setEval(Eval& eval); - Selector_List_Ptr extendSelectorList(Selector_List_Obj pSelectorList, bool isReplace, bool& extendedSomething, CompoundSelectorSet& seen); - Selector_List_Ptr extendSelectorList(Selector_List_Obj pSelectorList, bool isReplace = false) { + Selector_List* extendSelectorList(Selector_List_Obj pSelectorList, bool isReplace, bool& extendedSomething, CompoundSelectorSet& seen); + Selector_List* extendSelectorList(Selector_List_Obj pSelectorList, bool isReplace = false) { bool extendedSomething = false; CompoundSelectorSet seen; return extendSelectorList(pSelectorList, isReplace, extendedSomething, seen); } - Selector_List_Ptr extendSelectorList(Selector_List_Obj pSelectorList, CompoundSelectorSet& seen) { + Selector_List* extendSelectorList(Selector_List_Obj pSelectorList, CompoundSelectorSet& seen) { bool isReplace = false; bool extendedSomething = false; return extendSelectorList(pSelectorList, isReplace, extendedSomething, seen); @@ -69,11 +69,11 @@ namespace Sass { Extend(Subset_Map&); ~Extend() { } - void operator()(Block_Ptr); - void operator()(Ruleset_Ptr); - void operator()(Supports_Block_Ptr); - void operator()(Media_Block_Ptr); - void operator()(Directive_Ptr); + void operator()(Block*); + void operator()(Ruleset*); + void operator()(Supports_Block*); + void operator()(Media_Block*); + void operator()(Directive*); // ignore missed types template diff --git a/src/fn_colors.cpp b/src/fn_colors.cpp index a3d86bfff..0e0cb8c7f 100644 --- a/src/fn_colors.cpp +++ b/src/fn_colors.cpp @@ -14,7 +14,7 @@ namespace Sass { namespace Functions { bool string_argument(AST_Node_Obj obj) { - String_Constant_Ptr s = Cast(obj); + String_Constant* s = Cast(obj); if (s == nullptr) return false; const std::string& str = s->value(); return starts_with(str, "calc(") || @@ -225,7 +225,7 @@ namespace Sass { ); } - Number_Ptr alpha = ARG("$alpha", Number); + Number* alpha = ARG("$alpha", Number); if (alpha && alpha->unit() == "%") { Number_Obj val = SASS_MEMORY_COPY(alpha); val->numerators.clear(); // convert @@ -275,7 +275,7 @@ namespace Sass { Signature adjust_hue_sig = "adjust-hue($color, $degrees)"; BUILT_IN(adjust_hue) { - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); double degrees = ARGVAL("$degrees"); Color_HSLA_Obj copy = col->copyAsHSLA(); copy->h(absmod(copy->h() + degrees, 360.0)); @@ -285,7 +285,7 @@ namespace Sass { Signature lighten_sig = "lighten($color, $amount)"; BUILT_IN(lighten) { - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); double amount = DARG_U_PRCT("$amount"); Color_HSLA_Obj copy = col->copyAsHSLA(); copy->l(clip(copy->l() + amount, 0.0, 100.0)); @@ -296,7 +296,7 @@ namespace Sass { Signature darken_sig = "darken($color, $amount)"; BUILT_IN(darken) { - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); double amount = DARG_U_PRCT("$amount"); Color_HSLA_Obj copy = col->copyAsHSLA(); copy->l(clip(copy->l() - amount, 0.0, 100.0)); @@ -311,7 +311,7 @@ namespace Sass { return SASS_MEMORY_NEW(String_Quoted, pstate, "saturate(" + env["$color"]->to_string(ctx.c_options) + ")"); } - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); double amount = DARG_U_PRCT("$amount"); Color_HSLA_Obj copy = col->copyAsHSLA(); copy->s(clip(copy->s() + amount, 0.0, 100.0)); @@ -321,7 +321,7 @@ namespace Sass { Signature desaturate_sig = "desaturate($color, $amount)"; BUILT_IN(desaturate) { - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); double amount = DARG_U_PRCT("$amount"); Color_HSLA_Obj copy = col->copyAsHSLA(); copy->s(clip(copy->s() - amount, 0.0, 100.0)); @@ -332,12 +332,12 @@ namespace Sass { BUILT_IN(grayscale) { // CSS3 filter function overload: pass literal through directly - Number_Ptr amount = Cast(env["$color"]); + Number* amount = Cast(env["$color"]); if (amount) { return SASS_MEMORY_NEW(String_Quoted, pstate, "grayscale(" + amount->to_string(ctx.c_options) + ")"); } - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); Color_HSLA_Obj copy = col->copyAsHSLA(); copy->s(0.0); // just reset saturation return copy.detach(); @@ -350,7 +350,7 @@ namespace Sass { Signature complement_sig = "complement($color)"; BUILT_IN(complement) { - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); Color_HSLA_Obj copy = col->copyAsHSLA(); copy->h(absmod(copy->h() - 180.0, 360.0)); return copy.detach(); @@ -360,12 +360,12 @@ namespace Sass { BUILT_IN(invert) { // CSS3 filter function overload: pass literal through directly - Number_Ptr amount = Cast(env["$color"]); + Number* amount = Cast(env["$color"]); if (amount) { return SASS_MEMORY_NEW(String_Quoted, pstate, "invert(" + amount->to_string(ctx.c_options) + ")"); } - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); double weight = DARG_U_PRCT("$weight"); Color_RGBA_Obj inv = col->copyAsRGBA(); inv->r(clip(255.0 - inv->r(), 0.0, 255.0)); @@ -382,13 +382,13 @@ namespace Sass { Signature opacity_sig = "opacity($color)"; BUILT_IN(alpha) { - String_Constant_Ptr ie_kwd = Cast(env["$color"]); + String_Constant* ie_kwd = Cast(env["$color"]); if (ie_kwd) { return SASS_MEMORY_NEW(String_Quoted, pstate, "alpha(" + ie_kwd->value() + ")"); } // CSS3 filter function overload: pass literal through directly - Number_Ptr amount = Cast(env["$color"]); + Number* amount = Cast(env["$color"]); if (amount) { return SASS_MEMORY_NEW(String_Quoted, pstate, "opacity(" + amount->to_string(ctx.c_options) + ")"); } @@ -400,7 +400,7 @@ namespace Sass { Signature fade_in_sig = "fade-in($color, $amount)"; BUILT_IN(opacify) { - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); double amount = DARG_U_FACT("$amount"); Color_Obj copy = SASS_MEMORY_COPY(col); copy->a(clip(col->a() + amount, 0.0, 1.0)); @@ -411,7 +411,7 @@ namespace Sass { Signature fade_out_sig = "fade-out($color, $amount)"; BUILT_IN(transparentize) { - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); double amount = DARG_U_FACT("$amount"); Color_Obj copy = SASS_MEMORY_COPY(col); copy->a(std::max(col->a() - amount, 0.0)); @@ -425,14 +425,14 @@ namespace Sass { Signature adjust_color_sig = "adjust-color($color, $red: false, $green: false, $blue: false, $hue: false, $saturation: false, $lightness: false, $alpha: false)"; BUILT_IN(adjust_color) { - Color_Ptr col = ARG("$color", Color); - Number_Ptr r = Cast(env["$red"]); - Number_Ptr g = Cast(env["$green"]); - Number_Ptr b = Cast(env["$blue"]); - Number_Ptr h = Cast(env["$hue"]); - Number_Ptr s = Cast(env["$saturation"]); - Number_Ptr l = Cast(env["$lightness"]); - Number_Ptr a = Cast(env["$alpha"]); + Color* col = ARG("$color", Color); + Number* r = Cast(env["$red"]); + Number* g = Cast(env["$green"]); + Number* b = Cast(env["$blue"]); + Number* h = Cast(env["$hue"]); + Number* s = Cast(env["$saturation"]); + Number* l = Cast(env["$lightness"]); + Number* a = Cast(env["$alpha"]); bool rgb = r || g || b; bool hsl = h || s || l; @@ -470,14 +470,14 @@ namespace Sass { Signature scale_color_sig = "scale-color($color, $red: false, $green: false, $blue: false, $hue: false, $saturation: false, $lightness: false, $alpha: false)"; BUILT_IN(scale_color) { - Color_Ptr col = ARG("$color", Color); - Number_Ptr r = Cast(env["$red"]); - Number_Ptr g = Cast(env["$green"]); - Number_Ptr b = Cast(env["$blue"]); - Number_Ptr h = Cast(env["$hue"]); - Number_Ptr s = Cast(env["$saturation"]); - Number_Ptr l = Cast(env["$lightness"]); - Number_Ptr a = Cast(env["$alpha"]); + Color* col = ARG("$color", Color); + Number* r = Cast(env["$red"]); + Number* g = Cast(env["$green"]); + Number* b = Cast(env["$blue"]); + Number* h = Cast(env["$hue"]); + Number* s = Cast(env["$saturation"]); + Number* l = Cast(env["$lightness"]); + Number* a = Cast(env["$alpha"]); bool rgb = r || g || b; bool hsl = h || s || l; @@ -524,14 +524,14 @@ namespace Sass { Signature change_color_sig = "change-color($color, $red: false, $green: false, $blue: false, $hue: false, $saturation: false, $lightness: false, $alpha: false)"; BUILT_IN(change_color) { - Color_Ptr col = ARG("$color", Color); - Number_Ptr r = Cast(env["$red"]); - Number_Ptr g = Cast(env["$green"]); - Number_Ptr b = Cast(env["$blue"]); - Number_Ptr h = Cast(env["$hue"]); - Number_Ptr s = Cast(env["$saturation"]); - Number_Ptr l = Cast(env["$lightness"]); - Number_Ptr a = Cast(env["$alpha"]); + Color* col = ARG("$color", Color); + Number* r = Cast(env["$red"]); + Number* g = Cast(env["$green"]); + Number* b = Cast(env["$blue"]); + Number* h = Cast(env["$hue"]); + Number* s = Cast(env["$saturation"]); + Number* l = Cast(env["$lightness"]); + Number* a = Cast(env["$alpha"]); bool rgb = r || g || b; bool hsl = h || s || l; @@ -568,7 +568,7 @@ namespace Sass { Signature ie_hex_str_sig = "ie-hex-str($color)"; BUILT_IN(ie_hex_str) { - Color_Ptr col = ARG("$color", Color); + Color* col = ARG("$color", Color); Color_RGBA_Obj c = col->toRGBA(); double r = clip(c->r(), 0.0, 255.0); double g = clip(c->g(), 0.0, 255.0); diff --git a/src/fn_lists.cpp b/src/fn_lists.cpp index 2b5f2a147..a8d4600b3 100644 --- a/src/fn_lists.cpp +++ b/src/fn_lists.cpp @@ -18,7 +18,7 @@ namespace Sass { Map_Obj result = SASS_MEMORY_NEW(Map, pstate, 1); for (size_t i = arglist->size(), L = arglist->length(); i < L; ++i) { Expression_Obj obj = arglist->at(i); - Argument_Obj arg = (Argument_Ptr) obj.ptr(); // XXX + Argument_Obj arg = (Argument*) obj.ptr(); // XXX std::string name = std::string(arg->name()); name = name.erase(0, 1); // sanitize name (remove dollar sign) *result << std::make_pair(SASS_MEMORY_NEW(String_Quoted, @@ -31,25 +31,25 @@ namespace Sass { Signature length_sig = "length($list)"; BUILT_IN(length) { - if (Selector_List_Ptr sl = Cast(env["$list"])) { + if (Selector_List* sl = Cast(env["$list"])) { return SASS_MEMORY_NEW(Number, pstate, (double)sl->length()); } - Expression_Ptr v = ARG("$list", Expression); + Expression* v = ARG("$list", Expression); if (v->concrete_type() == Expression::MAP) { - Map_Ptr map = Cast(env["$list"]); + Map* map = Cast(env["$list"]); return SASS_MEMORY_NEW(Number, pstate, (double)(map ? map->length() : 1)); } if (v->concrete_type() == Expression::SELECTOR) { - if (Compound_Selector_Ptr h = Cast(v)) { + if (Compound_Selector* h = Cast(v)) { return SASS_MEMORY_NEW(Number, pstate, (double)h->length()); - } else if (Selector_List_Ptr ls = Cast(v)) { + } else if (Selector_List* ls = Cast(v)) { return SASS_MEMORY_NEW(Number, pstate, (double)ls->length()); } else { return SASS_MEMORY_NEW(Number, pstate, 1); } } - List_Ptr list = Cast(env["$list"]); + List* list = Cast(env["$list"]); return SASS_MEMORY_NEW(Number, pstate, (double)(list ? list->size() : 1)); @@ -59,8 +59,8 @@ namespace Sass { BUILT_IN(nth) { double nr = ARGVAL("$n"); - Map_Ptr m = Cast(env["$list"]); - if (Selector_List_Ptr sl = Cast(env["$list"])) { + Map* m = Cast(env["$list"]); + if (Selector_List* sl = Cast(env["$list"])) { size_t len = m ? m->length() : sl->length(); bool empty = m ? m->empty() : sl->empty(); if (empty) error("argument `$list` of `" + std::string(sig) + "` must not be empty", pstate, traces); @@ -113,7 +113,7 @@ namespace Sass { if (l->empty()) error("argument `$list` of `" + std::string(sig) + "` must not be empty", pstate, traces); double index = std::floor(n->value() < 0 ? l->length() + n->value() : n->value() - 1); if (index < 0 || index > l->length() - 1) error("index out of bounds for `" + std::string(sig) + "`", pstate, traces); - List_Ptr result = SASS_MEMORY_NEW(List, pstate, l->length(), l->separator(), false, l->is_bracketed()); + List* result = SASS_MEMORY_NEW(List, pstate, l->length(), l->separator(), false, l->is_bracketed()); for (size_t i = 0, L = l->length(); i < L; ++i) { result->append(((i == index) ? v : (*l)[i])); } @@ -189,7 +189,7 @@ namespace Sass { Map_Obj m = Cast(env["$list"]); List_Obj l = Cast(env["$list"]); Expression_Obj v = ARG("$val", Expression); - if (Selector_List_Ptr sl = Cast(env["$list"])) { + if (Selector_List* sl = Cast(env["$list"])) { Listize listize; l = Cast(sl->perform(&listize)); } @@ -201,7 +201,7 @@ namespace Sass { if (m) { l = m->to_list(pstate); } - List_Ptr result = SASS_MEMORY_COPY(l); + List* result = SASS_MEMORY_COPY(l); std::string sep_str(unquote(sep->value())); if (sep_str != "auto") { // check default first if (sep_str == "space") result->separator(SASS_SPACE); @@ -238,7 +238,7 @@ namespace Sass { ith->append(arglist->value_at_index(i)); } if (arglist->is_arglist()) { - Argument_Obj arg = (Argument_Ptr)(arglist->at(i).ptr()); // XXX + Argument_Obj arg = (Argument*)(arglist->at(i).ptr()); // XXX arg->value(ith); } else { (*arglist)[i] = ith; @@ -246,10 +246,10 @@ namespace Sass { } shortest = (i ? std::min(shortest, ith->length()) : ith->length()); } - List_Ptr zippers = SASS_MEMORY_NEW(List, pstate, shortest, SASS_COMMA); + List* zippers = SASS_MEMORY_NEW(List, pstate, shortest, SASS_COMMA); size_t L = arglist->length(); for (size_t i = 0; i < shortest; ++i) { - List_Ptr zipper = SASS_MEMORY_NEW(List, pstate, L); + List* zipper = SASS_MEMORY_NEW(List, pstate, L); for (size_t j = 0; j < L; ++j) { zipper->append(Cast(arglist->value_at_index(j))->at(i)); } diff --git a/src/fn_maps.cpp b/src/fn_maps.cpp index 54a659433..ae54783e2 100644 --- a/src/fn_maps.cpp +++ b/src/fn_maps.cpp @@ -40,7 +40,7 @@ namespace Sass { BUILT_IN(map_keys) { Map_Obj m = ARGM("$map", Map); - List_Ptr result = SASS_MEMORY_NEW(List, pstate, m->length(), SASS_COMMA); + List* result = SASS_MEMORY_NEW(List, pstate, m->length(), SASS_COMMA); for ( auto key : m->keys()) { result->append(key); } @@ -51,7 +51,7 @@ namespace Sass { BUILT_IN(map_values) { Map_Obj m = ARGM("$map", Map); - List_Ptr result = SASS_MEMORY_NEW(List, pstate, m->length(), SASS_COMMA); + List* result = SASS_MEMORY_NEW(List, pstate, m->length(), SASS_COMMA); for ( auto key : m->keys()) { result->append(m->at(key)); } @@ -65,7 +65,7 @@ namespace Sass { Map_Obj m2 = ARGM("$map2", Map); size_t len = m1->length() + m2->length(); - Map_Ptr result = SASS_MEMORY_NEW(Map, pstate, len); + Map* result = SASS_MEMORY_NEW(Map, pstate, len); // concat not implemented for maps *result += m1; *result += m2; @@ -78,7 +78,7 @@ namespace Sass { bool remove; Map_Obj m = ARGM("$map", Map); List_Obj arglist = ARG("$keys", List); - Map_Ptr result = SASS_MEMORY_NEW(Map, pstate, 1); + Map* result = SASS_MEMORY_NEW(Map, pstate, 1); for (auto key : m->keys()) { remove = false; for (size_t j = 0, K = arglist->length(); j < K && !remove; ++j) { diff --git a/src/fn_miscs.cpp b/src/fn_miscs.cpp index 7b5d3ddc4..dbfd9c4d5 100644 --- a/src/fn_miscs.cpp +++ b/src/fn_miscs.cpp @@ -23,7 +23,7 @@ namespace Sass { Signature type_of_sig = "type-of($value)"; BUILT_IN(type_of) { - Expression_Ptr v = ARG("$value", Expression); + Expression* v = ARG("$value", Expression); return SASS_MEMORY_NEW(String_Quoted, pstate, v->type()); } @@ -56,7 +56,7 @@ namespace Sass { Signature function_exists_sig = "function-exists($name)"; BUILT_IN(function_exists) { - String_Constant_Ptr ss = Cast(env["$name"]); + String_Constant* ss = Cast(env["$name"]); if (!ss) { error("$name: " + (env["$name"]->to_string()) + " is not a string for `function-exists'", pstate, traces); } @@ -101,8 +101,8 @@ namespace Sass { BUILT_IN(call) { std::string name; - Function_Ptr ff = Cast(env["$name"]); - String_Constant_Ptr ss = Cast(env["$name"]); + Function* ff = Cast(env["$name"]); + String_Constant* ss = Cast(env["$name"]); if (ss) { name = Util::normalize_underscores(unquote(ss->value())); @@ -118,19 +118,19 @@ namespace Sass { Arguments_Obj args = SASS_MEMORY_NEW(Arguments, pstate); // std::string full_name(name + "[f]"); - // Definition_Ptr def = d_env.has(full_name) ? Cast((d_env)[full_name]) : 0; - // Parameters_Ptr params = def ? def->parameters() : 0; + // Definition* def = d_env.has(full_name) ? Cast((d_env)[full_name]) : 0; + // Parameters* params = def ? def->parameters() : 0; // size_t param_size = params ? params->length() : 0; for (size_t i = 0, L = arglist->length(); i < L; ++i) { Expression_Obj expr = arglist->value_at_index(i); // if (params && params->has_rest_parameter()) { // Parameter_Obj p = param_size > i ? (*params)[i] : 0; - // List_Ptr list = Cast(expr); + // List* list = Cast(expr); // if (list && p && !p->is_rest_parameter()) expr = (*list)[0]; // } if (arglist->is_arglist()) { Expression_Obj obj = arglist->at(i); - Argument_Obj arg = (Argument_Ptr) obj.ptr(); // XXX + Argument_Obj arg = (Argument*) obj.ptr(); // XXX args->append(SASS_MEMORY_NEW(Argument, pstate, expr, @@ -183,7 +183,7 @@ namespace Sass { Signature inspect_sig = "inspect($value)"; BUILT_IN(inspect) { - Expression_Ptr v = ARG("$value", Expression); + Expression* v = ARG("$value", Expression); if (v->concrete_type() == Expression::NULL_VAL) { return SASS_MEMORY_NEW(String_Quoted, pstate, "null"); } else if (v->concrete_type() == Expression::BOOLEAN && v->is_false()) { @@ -217,7 +217,7 @@ namespace Sass { Signature get_function_sig = "get-function($name, $css: false)"; BUILT_IN(get_function) { - String_Constant_Ptr ss = Cast(env["$name"]); + String_Constant* ss = Cast(env["$name"]); if (!ss) { error("$name: " + (env["$name"]->to_string()) + " is not a string for `get-function'", pstate, traces); } @@ -227,7 +227,7 @@ namespace Sass { Boolean_Obj css = ARG("$css", Boolean); if (!css->is_false()) { - Definition_Ptr def = SASS_MEMORY_NEW(Definition, + Definition* def = SASS_MEMORY_NEW(Definition, pstate, name, SASS_MEMORY_NEW(Parameters, pstate), @@ -241,7 +241,7 @@ namespace Sass { error("Function not found: " + name, pstate, traces); } - Definition_Ptr def = Cast(d_env[full_name]); + Definition* def = Cast(d_env[full_name]); return SASS_MEMORY_NEW(Function, pstate, def, false); } diff --git a/src/fn_numbers.cpp b/src/fn_numbers.cpp index 11084ee9f..28befb5ac 100644 --- a/src/fn_numbers.cpp +++ b/src/fn_numbers.cpp @@ -104,7 +104,7 @@ namespace Sass { Signature min_sig = "min($numbers...)"; BUILT_IN(min) { - List_Ptr arglist = ARG("$numbers", List); + List* arglist = ARG("$numbers", List); Number_Obj least; for (size_t i = 0, L = arglist->length(); i < L; ++i) { Expression_Obj val = arglist->value_at_index(i); @@ -122,7 +122,7 @@ namespace Sass { Signature max_sig = "max($numbers...)"; BUILT_IN(max) { - List_Ptr arglist = ARG("$numbers", List); + List* arglist = ARG("$numbers", List); Number_Obj greatest; for (size_t i = 0, L = arglist->length(); i < L; ++i) { Expression_Obj val = arglist->value_at_index(i); @@ -141,9 +141,9 @@ namespace Sass { BUILT_IN(random) { AST_Node_Obj arg = env["$limit"]; - Value_Ptr v = Cast(arg); - Number_Ptr l = Cast(arg); - Boolean_Ptr b = Cast(arg); + Value* v = Cast(arg); + Number* l = Cast(arg); + Boolean* b = Cast(arg); if (l) { double lv = l->value(); if (lv < 1) { diff --git a/src/fn_selectors.cpp b/src/fn_selectors.cpp index b9d27910e..b64973ffd 100644 --- a/src/fn_selectors.cpp +++ b/src/fn_selectors.cpp @@ -10,7 +10,7 @@ namespace Sass { Signature selector_nest_sig = "selector-nest($selectors...)"; BUILT_IN(selector_nest) { - List_Ptr arglist = ARG("$selectors", List); + List* arglist = ARG("$selectors", List); // Not enough parameters if( arglist->length() == 0 ) @@ -63,7 +63,7 @@ namespace Sass { Signature selector_append_sig = "selector-append($selectors...)"; BUILT_IN(selector_append) { - List_Ptr arglist = ARG("$selectors", List); + List* arglist = ARG("$selectors", List); // Not enough parameters if( arglist->length() == 0 ) @@ -79,7 +79,7 @@ namespace Sass { msg << "a list of strings, or a list of lists of strings for 'selector-append'"; error(msg.str(), pstate, traces); } - if (String_Constant_Ptr str = Cast(exp)) { + if (String_Constant* str = Cast(exp)) { str->quote_mark(0); } std::string exp_src = exp->to_string(); @@ -132,7 +132,7 @@ namespace Sass { // TODO: Add check for namespace stuff - Complex_Selector_Ptr lastComponent = parentSeqClone->mutable_last(); + Complex_Selector* lastComponent = parentSeqClone->mutable_last(); if (lastComponent->head() == nullptr) { std::string msg = "Parent \"" + parentSeqClone->to_string() + "\" is incompatible with \"" + base->to_string() + "\""; error(msg, pstate, traces); @@ -167,7 +167,7 @@ namespace Sass { { Compound_Selector_Obj sel = ARGSEL("$selector"); - List_Ptr l = SASS_MEMORY_NEW(List, sel->pstate(), sel->length(), SASS_COMMA); + List* l = SASS_MEMORY_NEW(List, sel->pstate(), sel->length(), SASS_COMMA); for (size_t i = 0, L = sel->length(); i < L; ++i) { Simple_Selector_Obj ss = (*sel)[i]; diff --git a/src/fn_strings.cpp b/src/fn_strings.cpp index 450f1e4f8..1b0ef38a8 100644 --- a/src/fn_strings.cpp +++ b/src/fn_strings.cpp @@ -40,16 +40,16 @@ namespace Sass { BUILT_IN(sass_unquote) { AST_Node_Obj arg = env["$string"]; - if (String_Quoted_Ptr string_quoted = Cast(arg)) { - String_Constant_Ptr result = SASS_MEMORY_NEW(String_Constant, pstate, string_quoted->value()); + if (String_Quoted* string_quoted = Cast(arg)) { + String_Constant* result = SASS_MEMORY_NEW(String_Constant, pstate, string_quoted->value()); // remember if the string was quoted (color tokens) result->is_delayed(true); // delay colors return result; } - else if (String_Constant_Ptr str = Cast(arg)) { + else if (String_Constant* str = Cast(arg)) { return str; } - else if (Value_Ptr ex = Cast(arg)) { + else if (Value* ex = Cast(arg)) { Sass_Output_Style oldstyle = ctx.c_options.output_style; ctx.c_options.output_style = SASS_STYLE_NESTED; std::string val(arg->to_string(ctx.c_options)); @@ -67,13 +67,13 @@ namespace Sass { { AST_Node_Obj arg = env["$string"]; // only set quote mark to true if already a string - if (String_Quoted_Ptr qstr = Cast(arg)) { + if (String_Quoted* qstr = Cast(arg)) { qstr->quote_mark('*'); return qstr; } // all other nodes must be converted to a string node std::string str(quote(arg->to_string(ctx.c_options), '"')); - String_Quoted_Ptr result = SASS_MEMORY_NEW(String_Quoted, pstate, str); + String_Quoted* result = SASS_MEMORY_NEW(String_Quoted, pstate, str); result->quote_mark('*'); return result; } @@ -84,7 +84,7 @@ namespace Sass { { size_t len = std::string::npos; try { - String_Constant_Ptr s = ARG("$string", String_Constant); + String_Constant* s = ARG("$string", String_Constant); len = UTF_8::code_point_count(s->value(), 0, s->value().size()); } @@ -100,10 +100,10 @@ namespace Sass { { std::string str; try { - String_Constant_Ptr s = ARG("$string", String_Constant); + String_Constant* s = ARG("$string", String_Constant); str = s->value(); str = unquote(str); - String_Constant_Ptr i = ARG("$insert", String_Constant); + String_Constant* i = ARG("$insert", String_Constant); std::string ins = i->value(); ins = unquote(ins); double index = ARGVAL("$index"); @@ -130,7 +130,7 @@ namespace Sass { str = ins + str; } - if (String_Quoted_Ptr ss = Cast(s)) { + if (String_Quoted* ss = Cast(s)) { if (ss->quote_mark()) str = quote(str); } } @@ -145,8 +145,8 @@ namespace Sass { { size_t index = std::string::npos; try { - String_Constant_Ptr s = ARG("$string", String_Constant); - String_Constant_Ptr t = ARG("$substring", String_Constant); + String_Constant* s = ARG("$string", String_Constant); + String_Constant* t = ARG("$substring", String_Constant); std::string str = s->value(); str = unquote(str); std::string substr = t->value(); @@ -170,10 +170,10 @@ namespace Sass { { std::string newstr; try { - String_Constant_Ptr s = ARG("$string", String_Constant); + String_Constant* s = ARG("$string", String_Constant); double start_at = ARGVAL("$start-at"); double end_at = ARGVAL("$end-at"); - String_Quoted_Ptr ss = Cast(s); + String_Quoted* ss = Cast(s); std::string str = unquote(s->value()); @@ -220,7 +220,7 @@ namespace Sass { Signature to_upper_case_sig = "to-upper-case($string)"; BUILT_IN(to_upper_case) { - String_Constant_Ptr s = ARG("$string", String_Constant); + String_Constant* s = ARG("$string", String_Constant); std::string str = s->value(); for (size_t i = 0, L = str.length(); i < L; ++i) { @@ -229,8 +229,8 @@ namespace Sass { } } - if (String_Quoted_Ptr ss = Cast(s)) { - String_Quoted_Ptr cpy = SASS_MEMORY_COPY(ss); + if (String_Quoted* ss = Cast(s)) { + String_Quoted* cpy = SASS_MEMORY_COPY(ss); cpy->value(str); return cpy; } else { @@ -241,7 +241,7 @@ namespace Sass { Signature to_lower_case_sig = "to-lower-case($string)"; BUILT_IN(to_lower_case) { - String_Constant_Ptr s = ARG("$string", String_Constant); + String_Constant* s = ARG("$string", String_Constant); std::string str = s->value(); for (size_t i = 0, L = str.length(); i < L; ++i) { @@ -250,8 +250,8 @@ namespace Sass { } } - if (String_Quoted_Ptr ss = Cast(s)) { - String_Quoted_Ptr cpy = SASS_MEMORY_COPY(ss); + if (String_Quoted* ss = Cast(s)) { + String_Quoted* cpy = SASS_MEMORY_COPY(ss); cpy->value(str); return cpy; } else { diff --git a/src/fn_utils.cpp b/src/fn_utils.cpp index 46b644132..5c8dc3a6e 100644 --- a/src/fn_utils.cpp +++ b/src/fn_utils.cpp @@ -7,7 +7,7 @@ namespace Sass { - Definition_Ptr make_native_function(Signature sig, Native_Function func, Context& ctx) + Definition* make_native_function(Signature sig, Native_Function func, Context& ctx) { Parser sig_parser = Parser::from_c_str(sig, ctx, ctx.traces, ParserState("[built-in function]")); sig_parser.lex(); @@ -22,7 +22,7 @@ namespace Sass { false); } - Definition_Ptr make_c_function(Sass_Function_Entry c_func, Context& ctx) + Definition* make_c_function(Sass_Function_Entry c_func, Context& ctx) { using namespace Prelexer; @@ -52,11 +52,11 @@ namespace Sass { return str.substr(0, str.find('(')); } - Map_Ptr get_arg_m(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces) + Map* get_arg_m(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces) { - AST_Node_Ptr value = env[argname]; - if (Map_Ptr map = Cast(value)) return map; - List_Ptr list = Cast(value); + AST_Node* value = env[argname]; + if (Map* map = Cast(value)) return map; + List* list = Cast(value); if (list && list->length() == 0) { return SASS_MEMORY_NEW(Map, pstate, 0); } @@ -65,7 +65,7 @@ namespace Sass { double get_arg_r(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces, double lo, double hi) { - Number_Ptr val = get_arg(argname, env, sig, pstate, traces); + Number* val = get_arg(argname, env, sig, pstate, traces); Number tmpnr(val); tmpnr.reduce(); double v = tmpnr.value(); @@ -78,9 +78,9 @@ namespace Sass { return v; } - Number_Ptr get_arg_n(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces) + Number* get_arg_n(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces) { - Number_Ptr val = get_arg(argname, env, sig, pstate, traces); + Number* val = get_arg(argname, env, sig, pstate, traces); val = SASS_MEMORY_COPY(val); val->reduce(); return val; @@ -88,7 +88,7 @@ namespace Sass { double get_arg_val(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces) { - Number_Ptr val = get_arg(argname, env, sig, pstate, traces); + Number* val = get_arg(argname, env, sig, pstate, traces); Number tmpnr(val); tmpnr.reduce(); return tmpnr.value(); @@ -96,7 +96,7 @@ namespace Sass { double color_num(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces) { - Number_Ptr val = get_arg(argname, env, sig, pstate, traces); + Number* val = get_arg(argname, env, sig, pstate, traces); Number tmpnr(val); tmpnr.reduce(); if (tmpnr.unit() == "%") { @@ -107,7 +107,7 @@ namespace Sass { } double alpha_num(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces) { - Number_Ptr val = get_arg(argname, env, sig, pstate, traces); + Number* val = get_arg(argname, env, sig, pstate, traces); Number tmpnr(val); tmpnr.reduce(); if (tmpnr.unit() == "%") { @@ -125,7 +125,7 @@ namespace Sass { msg << "a list of strings, or a list of lists of strings for `" << function_name(sig) << "'"; error(msg.str(), exp->pstate(), traces); } - if (String_Constant_Ptr str = Cast(exp)) { + if (String_Constant* str = Cast(exp)) { str->quote_mark(0); } std::string exp_src = exp->to_string(ctx.c_options); @@ -139,7 +139,7 @@ namespace Sass { msg << argname << ": null is not a string for `" << function_name(sig) << "'"; error(msg.str(), exp->pstate(), traces); } - if (String_Constant_Ptr str = Cast(exp)) { + if (String_Constant* str = Cast(exp)) { str->quote_mark(0); } std::string exp_src = exp->to_string(ctx.c_options); diff --git a/src/fn_utils.hpp b/src/fn_utils.hpp index c765284a9..834efe71a 100644 --- a/src/fn_utils.hpp +++ b/src/fn_utils.hpp @@ -18,15 +18,15 @@ namespace Sass { SelectorStack& selector_stack typedef const char* Signature; - typedef PreValue_Ptr (*Native_Function)(FN_PROTOTYPE); - #define BUILT_IN(name) PreValue_Ptr name(FN_PROTOTYPE) + typedef PreValue* (*Native_Function)(FN_PROTOTYPE); + #define BUILT_IN(name) PreValue* name(FN_PROTOTYPE) #define ARG(argname, argtype) get_arg(argname, env, sig, pstate, traces) // special function for weird hsla percent (10px == 10% == 10 != 0.1) #define ARGVAL(argname) get_arg_val(argname, env, sig, pstate, traces) // double - Definition_Ptr make_native_function(Signature, Native_Function, Context& ctx); - Definition_Ptr make_c_function(Sass_Function_Entry c_func, Context& ctx); + Definition* make_native_function(Signature, Native_Function, Context& ctx); + Definition* make_c_function(Sass_Function_Entry c_func, Context& ctx); namespace Functions { @@ -40,8 +40,8 @@ namespace Sass { return val; } - Map_Ptr get_arg_m(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces); // maps only - Number_Ptr get_arg_n(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces); // numbers only + Map* get_arg_m(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces); // maps only + Number* get_arg_n(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces); // numbers only double alpha_num(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces); // colors only double color_num(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces); // colors only double get_arg_r(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces, double lo, double hi); // colors only diff --git a/src/inspect.cpp b/src/inspect.cpp index 8797bee05..b0e3ab8cd 100644 --- a/src/inspect.cpp +++ b/src/inspect.cpp @@ -24,7 +24,7 @@ namespace Sass { Inspect::~Inspect() { } // statements - void Inspect::operator()(Block_Ptr block) + void Inspect::operator()(Block* block) { if (!block->is_root()) { add_open_mapping(block); @@ -42,7 +42,7 @@ namespace Sass { } - void Inspect::operator()(Ruleset_Ptr ruleset) + void Inspect::operator()(Ruleset* ruleset) { if (ruleset->selector()) { ruleset->selector()->perform(this); @@ -52,13 +52,13 @@ namespace Sass { } } - void Inspect::operator()(Keyframe_Rule_Ptr rule) + void Inspect::operator()(Keyframe_Rule* rule) { if (rule->name()) rule->name()->perform(this); if (rule->block()) rule->block()->perform(this); } - void Inspect::operator()(Bubble_Ptr bubble) + void Inspect::operator()(Bubble* bubble) { append_indentation(); append_token("::BUBBLE", bubble); @@ -67,7 +67,7 @@ namespace Sass { append_scope_closer(); } - void Inspect::operator()(Media_Block_Ptr media_block) + void Inspect::operator()(Media_Block* media_block) { append_indentation(); append_token("@media", media_block); @@ -78,7 +78,7 @@ namespace Sass { media_block->block()->perform(this); } - void Inspect::operator()(Supports_Block_Ptr feature_block) + void Inspect::operator()(Supports_Block* feature_block) { append_indentation(); append_token("@supports", feature_block); @@ -87,7 +87,7 @@ namespace Sass { feature_block->block()->perform(this); } - void Inspect::operator()(At_Root_Block_Ptr at_root_block) + void Inspect::operator()(At_Root_Block* at_root_block) { append_indentation(); append_token("@at-root ", at_root_block); @@ -96,7 +96,7 @@ namespace Sass { if(at_root_block->block()) at_root_block->block()->perform(this); } - void Inspect::operator()(Directive_Ptr at_rule) + void Inspect::operator()(Directive* at_rule) { append_indentation(); append_token(at_rule->keyword(), at_rule); @@ -119,7 +119,7 @@ namespace Sass { } } - void Inspect::operator()(Declaration_Ptr dec) + void Inspect::operator()(Declaration* dec) { if (dec->value()->concrete_type() == Expression::NULL_VAL) return; bool was_decl = in_declaration; @@ -151,7 +151,7 @@ namespace Sass { in_declaration = was_decl; } - void Inspect::operator()(Assignment_Ptr assn) + void Inspect::operator()(Assignment* assn) { append_token(assn->variable(), assn); append_colon_separator(); @@ -163,7 +163,7 @@ namespace Sass { append_delimiter(); } - void Inspect::operator()(Import_Ptr import) + void Inspect::operator()(Import* import) { if (!import->urls().empty()) { append_token("@import", import); @@ -194,7 +194,7 @@ namespace Sass { } } - void Inspect::operator()(Import_Stub_Ptr import) + void Inspect::operator()(Import_Stub* import) { append_indentation(); append_token("@import", import); @@ -203,7 +203,7 @@ namespace Sass { append_delimiter(); } - void Inspect::operator()(Warning_Ptr warning) + void Inspect::operator()(Warning* warning) { append_indentation(); append_token("@warn", warning); @@ -212,7 +212,7 @@ namespace Sass { append_delimiter(); } - void Inspect::operator()(Error_Ptr error) + void Inspect::operator()(Error* error) { append_indentation(); append_token("@error", error); @@ -221,7 +221,7 @@ namespace Sass { append_delimiter(); } - void Inspect::operator()(Debug_Ptr debug) + void Inspect::operator()(Debug* debug) { append_indentation(); append_token("@debug", debug); @@ -230,14 +230,14 @@ namespace Sass { append_delimiter(); } - void Inspect::operator()(Comment_Ptr comment) + void Inspect::operator()(Comment* comment) { in_comment = true; comment->text()->perform(this); in_comment = false; } - void Inspect::operator()(If_Ptr cond) + void Inspect::operator()(If* cond) { append_indentation(); append_token("@if", cond); @@ -252,7 +252,7 @@ namespace Sass { } } - void Inspect::operator()(For_Ptr loop) + void Inspect::operator()(For* loop) { append_indentation(); append_token("@for", loop); @@ -265,7 +265,7 @@ namespace Sass { loop->block()->perform(this); } - void Inspect::operator()(Each_Ptr loop) + void Inspect::operator()(Each* loop) { append_indentation(); append_token("@each", loop); @@ -280,7 +280,7 @@ namespace Sass { loop->block()->perform(this); } - void Inspect::operator()(While_Ptr loop) + void Inspect::operator()(While* loop) { append_indentation(); append_token("@while", loop); @@ -289,7 +289,7 @@ namespace Sass { loop->block()->perform(this); } - void Inspect::operator()(Return_Ptr ret) + void Inspect::operator()(Return* ret) { append_indentation(); append_token("@return", ret); @@ -298,7 +298,7 @@ namespace Sass { append_delimiter(); } - void Inspect::operator()(Extension_Ptr extend) + void Inspect::operator()(Extension* extend) { append_indentation(); append_token("@extend", extend); @@ -307,7 +307,7 @@ namespace Sass { append_delimiter(); } - void Inspect::operator()(Definition_Ptr def) + void Inspect::operator()(Definition* def) { append_indentation(); if (def->type() == Definition::MIXIN) { @@ -322,7 +322,7 @@ namespace Sass { def->block()->perform(this); } - void Inspect::operator()(Mixin_Call_Ptr call) + void Inspect::operator()(Mixin_Call* call) { append_indentation(); append_token("@include", call); @@ -338,14 +338,14 @@ namespace Sass { if (!call->block()) append_delimiter(); } - void Inspect::operator()(Content_Ptr content) + void Inspect::operator()(Content* content) { append_indentation(); append_token("@content", content); append_delimiter(); } - void Inspect::operator()(Map_Ptr map) + void Inspect::operator()(Map* map) { if (output_style() == TO_SASS && map->empty()) { append_string("()"); @@ -367,15 +367,15 @@ namespace Sass { append_string(")"); } - std::string Inspect::lbracket(List_Ptr list) { + std::string Inspect::lbracket(List* list) { return list->is_bracketed() ? "[" : "("; } - std::string Inspect::rbracket(List_Ptr list) { + std::string Inspect::rbracket(List* list) { return list->is_bracketed() ? "]" : ")"; } - void Inspect::operator()(List_Ptr list) + void Inspect::operator()(List* list) { if (list->empty() && (output_style() == TO_SASS || list->is_bracketed())) { append_string(lbracket(list)); @@ -463,7 +463,7 @@ namespace Sass { } - void Inspect::operator()(Binary_Expression_Ptr expr) + void Inspect::operator()(Binary_Expression* expr) { expr->left()->perform(this); if ( in_media_block || @@ -500,7 +500,7 @@ namespace Sass { expr->right()->perform(this); } - void Inspect::operator()(Unary_Expression_Ptr expr) + void Inspect::operator()(Unary_Expression* expr) { if (expr->optype() == Unary_Expression::PLUS) append_string("+"); else if (expr->optype() == Unary_Expression::SLASH) append_string("/"); @@ -508,18 +508,18 @@ namespace Sass { expr->operand()->perform(this); } - void Inspect::operator()(Function_Call_Ptr call) + void Inspect::operator()(Function_Call* call) { append_token(call->name(), call); call->arguments()->perform(this); } - void Inspect::operator()(Variable_Ptr var) + void Inspect::operator()(Variable* var) { append_token(var->name(), var); } - void Inspect::operator()(Number_Ptr n) + void Inspect::operator()(Number* n) { // reduce units @@ -574,7 +574,7 @@ namespace Sass { else return c; } - void Inspect::operator()(Color_RGBA_Ptr c) + void Inspect::operator()(Color_RGBA* c) { // output the final token std::stringstream ss; @@ -593,7 +593,7 @@ namespace Sass { // get color from given name (if one was given at all) if (name != "" && name_to_color(name)) { - Color_RGBA_Ptr_Const n = name_to_color(name); + const Color_RGBA* n = name_to_color(name); r = Sass::round(cap_channel<0xff>(n->r()), opt.precision); g = Sass::round(cap_channel<0xff>(n->g()), opt.precision); b = Sass::round(cap_channel<0xff>(n->b()), opt.precision); @@ -660,19 +660,19 @@ namespace Sass { } - void Inspect::operator()(Color_HSLA_Ptr c) + void Inspect::operator()(Color_HSLA* c) { Color_RGBA_Obj rgba = c->toRGBA(); operator()(rgba); } - void Inspect::operator()(Boolean_Ptr b) + void Inspect::operator()(Boolean* b) { // output the final token append_token(b->value() ? "true" : "false", b); } - void Inspect::operator()(String_Schema_Ptr ss) + void Inspect::operator()(String_Schema* ss) { // Evaluation should turn these into String_Constants, // so this method is only for inspection purposes. @@ -683,12 +683,12 @@ namespace Sass { } } - void Inspect::operator()(String_Constant_Ptr s) + void Inspect::operator()(String_Constant* s) { append_token(s->value(), s); } - void Inspect::operator()(String_Quoted_Ptr s) + void Inspect::operator()(String_Quoted* s) { if (const char q = s->quote_mark()) { append_token(quote(s->value(), q), s); @@ -697,17 +697,17 @@ namespace Sass { } } - void Inspect::operator()(Custom_Error_Ptr e) + void Inspect::operator()(Custom_Error* e) { append_token(e->message(), e); } - void Inspect::operator()(Custom_Warning_Ptr w) + void Inspect::operator()(Custom_Warning* w) { append_token(w->message(), w); } - void Inspect::operator()(Supports_Operator_Ptr so) + void Inspect::operator()(Supports_Operator* so) { if (so->needs_parens(so->left())) append_string("("); @@ -729,7 +729,7 @@ namespace Sass { if (so->needs_parens(so->right())) append_string(")"); } - void Inspect::operator()(Supports_Negation_Ptr sn) + void Inspect::operator()(Supports_Negation* sn) { append_token("not", sn); append_mandatory_space(); @@ -738,7 +738,7 @@ namespace Sass { if (sn->needs_parens(sn->condition())) append_string(")"); } - void Inspect::operator()(Supports_Declaration_Ptr sd) + void Inspect::operator()(Supports_Declaration* sd) { append_string("("); sd->feature()->perform(this); @@ -747,12 +747,12 @@ namespace Sass { append_string(")"); } - void Inspect::operator()(Supports_Interpolation_Ptr sd) + void Inspect::operator()(Supports_Interpolation* sd) { sd->value()->perform(this); } - void Inspect::operator()(Media_Query_Ptr mq) + void Inspect::operator()(Media_Query* mq) { size_t i = 0; if (mq->media_type()) { @@ -769,7 +769,7 @@ namespace Sass { } } - void Inspect::operator()(Media_Query_Expression_Ptr mqe) + void Inspect::operator()(Media_Query_Expression* mqe) { if (mqe->is_interpolated()) { mqe->feature()->perform(this); @@ -785,7 +785,7 @@ namespace Sass { } } - void Inspect::operator()(At_Root_Query_Ptr ae) + void Inspect::operator()(At_Root_Query* ae) { if (ae->feature()) { append_string("("); @@ -798,7 +798,7 @@ namespace Sass { } } - void Inspect::operator()(Function_Ptr f) + void Inspect::operator()(Function* f) { append_token("get-function", f); append_string("("); @@ -806,14 +806,14 @@ namespace Sass { append_string(")"); } - void Inspect::operator()(Null_Ptr n) + void Inspect::operator()(Null* n) { // output the final token append_token("null", n); } // parameters and arguments - void Inspect::operator()(Parameter_Ptr p) + void Inspect::operator()(Parameter* p) { append_token(p->name(), p); if (p->default_value()) { @@ -825,7 +825,7 @@ namespace Sass { } } - void Inspect::operator()(Parameters_Ptr p) + void Inspect::operator()(Parameters* p) { append_string("("); if (!p->empty()) { @@ -838,7 +838,7 @@ namespace Sass { append_string(")"); } - void Inspect::operator()(Argument_Ptr a) + void Inspect::operator()(Argument* a) { if (!a->name().empty()) { append_token(a->name(), a); @@ -850,7 +850,7 @@ namespace Sass { return; } if (a->value()->concrete_type() == Expression::STRING) { - String_Constant_Ptr s = Cast(a->value()); + String_Constant* s = Cast(a->value()); if (s) s->perform(this); } else { a->value()->perform(this); @@ -860,7 +860,7 @@ namespace Sass { } } - void Inspect::operator()(Arguments_Ptr a) + void Inspect::operator()(Arguments* a) { append_string("("); if (!a->empty()) { @@ -874,17 +874,17 @@ namespace Sass { append_string(")"); } - void Inspect::operator()(Selector_Schema_Ptr s) + void Inspect::operator()(Selector_Schema* s) { s->contents()->perform(this); } - void Inspect::operator()(Parent_Selector_Ptr p) + void Inspect::operator()(Parent_Selector* p) { if (p->real()) append_string("&"); } - void Inspect::operator()(Placeholder_Selector_Ptr s) + void Inspect::operator()(Placeholder_Selector* s) { append_token(s->name(), s); if (s->has_line_break()) append_optional_linefeed(); @@ -892,26 +892,26 @@ namespace Sass { } - void Inspect::operator()(Type_Selector_Ptr s) + void Inspect::operator()(Type_Selector* s) { append_token(s->ns_name(), s); } - void Inspect::operator()(Class_Selector_Ptr s) + void Inspect::operator()(Class_Selector* s) { append_token(s->ns_name(), s); if (s->has_line_break()) append_optional_linefeed(); if (s->has_line_break()) append_indentation(); } - void Inspect::operator()(Id_Selector_Ptr s) + void Inspect::operator()(Id_Selector* s) { append_token(s->ns_name(), s); if (s->has_line_break()) append_optional_linefeed(); if (s->has_line_break()) append_indentation(); } - void Inspect::operator()(Attribute_Selector_Ptr s) + void Inspect::operator()(Attribute_Selector* s) { append_string("["); add_open_mapping(s); @@ -930,7 +930,7 @@ namespace Sass { append_string("]"); } - void Inspect::operator()(Pseudo_Selector_Ptr s) + void Inspect::operator()(Pseudo_Selector* s) { append_token(s->ns_name(), s); if (s->expression()) { @@ -940,7 +940,7 @@ namespace Sass { } } - void Inspect::operator()(Wrapped_Selector_Ptr s) + void Inspect::operator()(Wrapped_Selector* s) { if (s->name() == " ") { append_string(""); @@ -958,7 +958,7 @@ namespace Sass { } } - void Inspect::operator()(Compound_Selector_Ptr s) + void Inspect::operator()(Compound_Selector* s) { for (size_t i = 0, L = s->length(); i < L; ++i) { (*s)[i]->perform(this); @@ -970,7 +970,7 @@ namespace Sass { } } - void Inspect::operator()(Complex_Selector_Ptr c) + void Inspect::operator()(Complex_Selector* c) { Compound_Selector_Obj head = c->head(); Complex_Selector_Obj tail = c->tail(); @@ -1034,7 +1034,7 @@ namespace Sass { } } - void Inspect::operator()(Selector_List_Ptr g) + void Inspect::operator()(Selector_List* g) { if (g->empty()) { diff --git a/src/inspect.hpp b/src/inspect.hpp index cda9234a8..cf2967d2c 100644 --- a/src/inspect.hpp +++ b/src/inspect.hpp @@ -19,79 +19,79 @@ namespace Sass { virtual ~Inspect(); // statements - virtual void operator()(Block_Ptr); - virtual void operator()(Ruleset_Ptr); - virtual void operator()(Bubble_Ptr); - virtual void operator()(Supports_Block_Ptr); - virtual void operator()(Media_Block_Ptr); - virtual void operator()(At_Root_Block_Ptr); - virtual void operator()(Directive_Ptr); - virtual void operator()(Keyframe_Rule_Ptr); - virtual void operator()(Declaration_Ptr); - virtual void operator()(Assignment_Ptr); - virtual void operator()(Import_Ptr); - virtual void operator()(Import_Stub_Ptr); - virtual void operator()(Warning_Ptr); - virtual void operator()(Error_Ptr); - virtual void operator()(Debug_Ptr); - virtual void operator()(Comment_Ptr); - virtual void operator()(If_Ptr); - virtual void operator()(For_Ptr); - virtual void operator()(Each_Ptr); - virtual void operator()(While_Ptr); - virtual void operator()(Return_Ptr); - virtual void operator()(Extension_Ptr); - virtual void operator()(Definition_Ptr); - virtual void operator()(Mixin_Call_Ptr); - virtual void operator()(Content_Ptr); + virtual void operator()(Block*); + virtual void operator()(Ruleset*); + virtual void operator()(Bubble*); + virtual void operator()(Supports_Block*); + virtual void operator()(Media_Block*); + virtual void operator()(At_Root_Block*); + virtual void operator()(Directive*); + virtual void operator()(Keyframe_Rule*); + virtual void operator()(Declaration*); + virtual void operator()(Assignment*); + virtual void operator()(Import*); + virtual void operator()(Import_Stub*); + virtual void operator()(Warning*); + virtual void operator()(Error*); + virtual void operator()(Debug*); + virtual void operator()(Comment*); + virtual void operator()(If*); + virtual void operator()(For*); + virtual void operator()(Each*); + virtual void operator()(While*); + virtual void operator()(Return*); + virtual void operator()(Extension*); + virtual void operator()(Definition*); + virtual void operator()(Mixin_Call*); + virtual void operator()(Content*); // expressions - virtual void operator()(Map_Ptr); - virtual void operator()(Function_Ptr); - virtual void operator()(List_Ptr); - virtual void operator()(Binary_Expression_Ptr); - virtual void operator()(Unary_Expression_Ptr); - virtual void operator()(Function_Call_Ptr); - // virtual void operator()(Custom_Warning_Ptr); - // virtual void operator()(Custom_Error_Ptr); - virtual void operator()(Variable_Ptr); - virtual void operator()(Number_Ptr); - virtual void operator()(Color_RGBA_Ptr); - virtual void operator()(Color_HSLA_Ptr); - virtual void operator()(Boolean_Ptr); - virtual void operator()(String_Schema_Ptr); - virtual void operator()(String_Constant_Ptr); - virtual void operator()(String_Quoted_Ptr); - virtual void operator()(Custom_Error_Ptr); - virtual void operator()(Custom_Warning_Ptr); - virtual void operator()(Supports_Operator_Ptr); - virtual void operator()(Supports_Negation_Ptr); - virtual void operator()(Supports_Declaration_Ptr); - virtual void operator()(Supports_Interpolation_Ptr); - virtual void operator()(Media_Query_Ptr); - virtual void operator()(Media_Query_Expression_Ptr); - virtual void operator()(At_Root_Query_Ptr); - virtual void operator()(Null_Ptr); - virtual void operator()(Parent_Selector_Ptr p); + virtual void operator()(Map*); + virtual void operator()(Function*); + virtual void operator()(List*); + virtual void operator()(Binary_Expression*); + virtual void operator()(Unary_Expression*); + virtual void operator()(Function_Call*); + // virtual void operator()(Custom_Warning*); + // virtual void operator()(Custom_Error*); + virtual void operator()(Variable*); + virtual void operator()(Number*); + virtual void operator()(Color_RGBA*); + virtual void operator()(Color_HSLA*); + virtual void operator()(Boolean*); + virtual void operator()(String_Schema*); + virtual void operator()(String_Constant*); + virtual void operator()(String_Quoted*); + virtual void operator()(Custom_Error*); + virtual void operator()(Custom_Warning*); + virtual void operator()(Supports_Operator*); + virtual void operator()(Supports_Negation*); + virtual void operator()(Supports_Declaration*); + virtual void operator()(Supports_Interpolation*); + virtual void operator()(Media_Query*); + virtual void operator()(Media_Query_Expression*); + virtual void operator()(At_Root_Query*); + virtual void operator()(Null*); + virtual void operator()(Parent_Selector* p); // parameters and arguments - virtual void operator()(Parameter_Ptr); - virtual void operator()(Parameters_Ptr); - virtual void operator()(Argument_Ptr); - virtual void operator()(Arguments_Ptr); + virtual void operator()(Parameter*); + virtual void operator()(Parameters*); + virtual void operator()(Argument*); + virtual void operator()(Arguments*); // selectors - virtual void operator()(Selector_Schema_Ptr); - virtual void operator()(Placeholder_Selector_Ptr); - virtual void operator()(Type_Selector_Ptr); - virtual void operator()(Class_Selector_Ptr); - virtual void operator()(Id_Selector_Ptr); - virtual void operator()(Attribute_Selector_Ptr); - virtual void operator()(Pseudo_Selector_Ptr); - virtual void operator()(Wrapped_Selector_Ptr); - virtual void operator()(Compound_Selector_Ptr); - virtual void operator()(Complex_Selector_Ptr); - virtual void operator()(Selector_List_Ptr); + virtual void operator()(Selector_Schema*); + virtual void operator()(Placeholder_Selector*); + virtual void operator()(Type_Selector*); + virtual void operator()(Class_Selector*); + virtual void operator()(Id_Selector*); + virtual void operator()(Attribute_Selector*); + virtual void operator()(Pseudo_Selector*); + virtual void operator()(Wrapped_Selector*); + virtual void operator()(Compound_Selector*); + virtual void operator()(Complex_Selector*); + virtual void operator()(Selector_List*); - virtual std::string lbracket(List_Ptr); - virtual std::string rbracket(List_Ptr); + virtual std::string lbracket(List*); + virtual std::string rbracket(List*); }; diff --git a/src/listize.cpp b/src/listize.cpp index 0dda066e4..c2dfa517e 100644 --- a/src/listize.cpp +++ b/src/listize.cpp @@ -16,7 +16,7 @@ namespace Sass { Listize::Listize() { } - Expression_Ptr Listize::operator()(Selector_List_Ptr sel) + Expression* Listize::operator()(Selector_List* sel) { List_Obj l = SASS_MEMORY_NEW(List, sel->pstate(), sel->length(), SASS_COMMA); l->from_selector(true); @@ -28,24 +28,24 @@ namespace Sass { return SASS_MEMORY_NEW(Null, l->pstate()); } - Expression_Ptr Listize::operator()(Compound_Selector_Ptr sel) + Expression* Listize::operator()(Compound_Selector* sel) { std::string str; for (size_t i = 0, L = sel->length(); i < L; ++i) { - Expression_Ptr e = (*sel)[i]->perform(this); + Expression* e = (*sel)[i]->perform(this); if (e) str += e->to_string(); } return SASS_MEMORY_NEW(String_Quoted, sel->pstate(), str); } - Expression_Ptr Listize::operator()(Complex_Selector_Ptr sel) + Expression* Listize::operator()(Complex_Selector* sel) { List_Obj l = SASS_MEMORY_NEW(List, sel->pstate(), 2); l->from_selector(true); Compound_Selector_Obj head = sel->head(); if (head && !head->is_empty_reference()) { - Expression_Ptr hh = head->perform(this); + Expression* hh = head->perform(this); if (hh) l->append(hh); } @@ -74,7 +74,7 @@ namespace Sass { if (tail) { Expression_Obj tt = tail->perform(this); - if (List_Ptr ls = Cast(tt)) + if (List* ls = Cast(tt)) { l->concat(ls); } } if (l->length() == 0) return 0; diff --git a/src/listize.hpp b/src/listize.hpp index 0d9ce8a28..708b93c82 100644 --- a/src/listize.hpp +++ b/src/listize.hpp @@ -17,19 +17,19 @@ namespace Sass { struct Backtrace; - class Listize : public Operation_CRTP { + class Listize : public Operation_CRTP { public: Listize(); ~Listize() { } - Expression_Ptr operator()(Selector_List_Ptr); - Expression_Ptr operator()(Complex_Selector_Ptr); - Expression_Ptr operator()(Compound_Selector_Ptr); + Expression* operator()(Selector_List*); + Expression* operator()(Complex_Selector*); + Expression* operator()(Compound_Selector*); // generic fallback template - Expression_Ptr fallback(U x) + Expression* fallback(U x) { return Cast(x); } }; diff --git a/src/memory/SharedPtr.cpp b/src/memory/SharedPtr.cpp index b6c5f93c0..db0ff1d41 100644 --- a/src/memory/SharedPtr.cpp +++ b/src/memory/SharedPtr.cpp @@ -18,7 +18,7 @@ namespace Sass { std::cerr << "# REPORTING MISSING DEALLOCATIONS #\n"; std::cerr << "###################################\n"; for (SharedObj* var : all) { - if (AST_Node_Ptr ast = dynamic_cast(var)) { + if (AST_Node* ast = dynamic_cast(var)) { debug_ast(ast); } else { std::cerr << "LEAKED " << var << "\n"; diff --git a/src/node.cpp b/src/node.cpp index e9e3c0209..f02295484 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -20,7 +20,7 @@ namespace Sass { Node Node::createSelector(const Complex_Selector& pSelector) { NodeDequePtr null; - Complex_Selector_Ptr pStripped = SASS_MEMORY_COPY(&pSelector); + Complex_Selector* pStripped = SASS_MEMORY_COPY(&pSelector); pStripped->tail({}); pStripped->combinator(Complex_Selector::ANCESTOR_OF); @@ -48,7 +48,7 @@ namespace Sass { } - Node::Node(const TYPE& type, Complex_Selector::Combinator combinator, Complex_Selector_Ptr pSelector, NodeDequePtr& pCollection) + Node::Node(const TYPE& type, Complex_Selector::Combinator combinator, Complex_Selector* pSelector, NodeDequePtr& pCollection) : got_line_feed(false), mType(type), mCombinator(combinator), mpSelector(pSelector), mpCollection(pCollection) { if (pSelector) got_line_feed = pSelector->has_line_feed(); } @@ -175,7 +175,7 @@ namespace Sass { #endif - Node complexSelectorToNode(Complex_Selector_Ptr pToConvert) { + Node complexSelectorToNode(Complex_Selector* pToConvert) { if (pToConvert == NULL) { return Node::createNil(); } @@ -223,14 +223,14 @@ namespace Sass { } - Complex_Selector_Ptr nodeToComplexSelector(const Node& toConvert) { + Complex_Selector* nodeToComplexSelector(const Node& toConvert) { if (toConvert.isNil()) { return NULL; } if (!toConvert.isCollection()) { - throw "The node to convert to a Complex_Selector_Ptr must be a collection type or nil."; + throw "The node to convert to a Complex_Selector* must be a collection type or nil."; } @@ -273,8 +273,8 @@ namespace Sass { } // Put the dummy Compound_Selector in the first position, for consistency with the rest of libsass - Compound_Selector_Ptr fakeHead = SASS_MEMORY_NEW(Compound_Selector, ParserState("[NODE]"), 1); - Parent_Selector_Ptr selectorRef = SASS_MEMORY_NEW(Parent_Selector, ParserState("[NODE]")); + Compound_Selector* fakeHead = SASS_MEMORY_NEW(Compound_Selector, ParserState("[NODE]"), 1); + Parent_Selector* selectorRef = SASS_MEMORY_NEW(Parent_Selector, ParserState("[NODE]")); fakeHead->elements().push_back(selectorRef); if (toConvert.got_line_feed) pFirst->has_line_feed(toConvert.got_line_feed); // pFirst->has_line_feed(pFirst->has_line_feed() || pFirst->tail()->has_line_feed() || toConvert.got_line_feed); diff --git a/src/node.hpp b/src/node.hpp index 23ba360c3..a19870972 100644 --- a/src/node.hpp +++ b/src/node.hpp @@ -97,7 +97,7 @@ namespace Sass { // Private constructor; Use the static methods (like createCombinator and createSelector) // to instantiate this object. This is more expressive, and it allows us to break apart each // case into separate functions. - Node(const TYPE& type, Complex_Selector::Combinator combinator, Complex_Selector_Ptr pSelector, NodeDequePtr& pCollection); + Node(const TYPE& type, Complex_Selector::Combinator combinator, Complex_Selector* pSelector, NodeDequePtr& pCollection); TYPE mType; @@ -110,8 +110,8 @@ namespace Sass { #ifdef DEBUG std::ostream& operator<<(std::ostream& os, const Node& node); #endif - Node complexSelectorToNode(Complex_Selector_Ptr pToConvert); - Complex_Selector_Ptr nodeToComplexSelector(const Node& toConvert); + Node complexSelectorToNode(Complex_Selector* pToConvert); + Complex_Selector* nodeToComplexSelector(const Node& toConvert); } diff --git a/src/operation.hpp b/src/operation.hpp index 47285aa2f..87e0c2f9d 100644 --- a/src/operation.hpp +++ b/src/operation.hpp @@ -13,14 +13,14 @@ namespace Sass { #define ATTACH_ABSTRACT_CRTP_PERFORM_METHODS()\ virtual void perform(Operation* op) = 0; \ - virtual Value_Ptr perform(Operation* op) = 0; \ + virtual Value* perform(Operation* op) = 0; \ virtual std::string perform(Operation* op) = 0; \ - virtual AST_Node_Ptr perform(Operation* op) = 0; \ - virtual Selector_Ptr perform(Operation* op) = 0; \ - virtual Statement_Ptr perform(Operation* op) = 0; \ - virtual Expression_Ptr perform(Operation* op) = 0; \ + virtual AST_Node* perform(Operation* op) = 0; \ + virtual Selector* perform(Operation* op) = 0; \ + virtual Statement* perform(Operation* op) = 0; \ + virtual Expression* perform(Operation* op) = 0; \ virtual union Sass_Value* perform(Operation* op) = 0; \ - virtual Supports_Condition_Ptr perform(Operation* op) = 0; \ + virtual Supports_Condition* perform(Operation* op) = 0; \ // you must add operators to every class // ensures `this` of actual instance type @@ -28,175 +28,175 @@ namespace Sass { // they are virtual so most specific is used #define ATTACH_CRTP_PERFORM_METHODS()\ virtual void perform(Operation* op) override { return (*op)(this); } \ - virtual Value_Ptr perform(Operation* op) override { return (*op)(this); } \ + virtual Value* perform(Operation* op) override { return (*op)(this); } \ virtual std::string perform(Operation* op) override { return (*op)(this); } \ - virtual AST_Node_Ptr perform(Operation* op) override { return (*op)(this); } \ - virtual Selector_Ptr perform(Operation* op) override { return (*op)(this); } \ - virtual Statement_Ptr perform(Operation* op) override { return (*op)(this); } \ - virtual Expression_Ptr perform(Operation* op) override { return (*op)(this); } \ + virtual AST_Node* perform(Operation* op) override { return (*op)(this); } \ + virtual Selector* perform(Operation* op) override { return (*op)(this); } \ + virtual Statement* perform(Operation* op) override { return (*op)(this); } \ + virtual Expression* perform(Operation* op) override { return (*op)(this); } \ virtual union Sass_Value* perform(Operation* op) override { return (*op)(this); } \ - virtual Supports_Condition_Ptr perform(Operation* op) override { return (*op)(this); } \ + virtual Supports_Condition* perform(Operation* op) override { return (*op)(this); } \ template class Operation { public: - virtual T operator()(AST_Node_Ptr x) = 0; + virtual T operator()(AST_Node* x) = 0; // statements - virtual T operator()(Block_Ptr x) = 0; - virtual T operator()(Ruleset_Ptr x) = 0; - virtual T operator()(Bubble_Ptr x) = 0; - virtual T operator()(Trace_Ptr x) = 0; - virtual T operator()(Supports_Block_Ptr x) = 0; - virtual T operator()(Media_Block_Ptr x) = 0; - virtual T operator()(At_Root_Block_Ptr x) = 0; - virtual T operator()(Directive_Ptr x) = 0; - virtual T operator()(Keyframe_Rule_Ptr x) = 0; - virtual T operator()(Declaration_Ptr x) = 0; - virtual T operator()(Assignment_Ptr x) = 0; - virtual T operator()(Import_Ptr x) = 0; - virtual T operator()(Import_Stub_Ptr x) = 0; - virtual T operator()(Warning_Ptr x) = 0; - virtual T operator()(Error_Ptr x) = 0; - virtual T operator()(Debug_Ptr x) = 0; - virtual T operator()(Comment_Ptr x) = 0; - virtual T operator()(If_Ptr x) = 0; - virtual T operator()(For_Ptr x) = 0; - virtual T operator()(Each_Ptr x) = 0; - virtual T operator()(While_Ptr x) = 0; - virtual T operator()(Return_Ptr x) = 0; - virtual T operator()(Content_Ptr x) = 0; - virtual T operator()(Extension_Ptr x) = 0; - virtual T operator()(Definition_Ptr x) = 0; - virtual T operator()(Mixin_Call_Ptr x) = 0; + virtual T operator()(Block* x) = 0; + virtual T operator()(Ruleset* x) = 0; + virtual T operator()(Bubble* x) = 0; + virtual T operator()(Trace* x) = 0; + virtual T operator()(Supports_Block* x) = 0; + virtual T operator()(Media_Block* x) = 0; + virtual T operator()(At_Root_Block* x) = 0; + virtual T operator()(Directive* x) = 0; + virtual T operator()(Keyframe_Rule* x) = 0; + virtual T operator()(Declaration* x) = 0; + virtual T operator()(Assignment* x) = 0; + virtual T operator()(Import* x) = 0; + virtual T operator()(Import_Stub* x) = 0; + virtual T operator()(Warning* x) = 0; + virtual T operator()(Error* x) = 0; + virtual T operator()(Debug* x) = 0; + virtual T operator()(Comment* x) = 0; + virtual T operator()(If* x) = 0; + virtual T operator()(For* x) = 0; + virtual T operator()(Each* x) = 0; + virtual T operator()(While* x) = 0; + virtual T operator()(Return* x) = 0; + virtual T operator()(Content* x) = 0; + virtual T operator()(Extension* x) = 0; + virtual T operator()(Definition* x) = 0; + virtual T operator()(Mixin_Call* x) = 0; // expressions - virtual T operator()(Null_Ptr x) = 0; - virtual T operator()(List_Ptr x) = 0; - virtual T operator()(Map_Ptr x) = 0; - virtual T operator()(Function_Ptr x) = 0; - virtual T operator()(Binary_Expression_Ptr x) = 0; - virtual T operator()(Unary_Expression_Ptr x) = 0; - virtual T operator()(Function_Call_Ptr x) = 0; - virtual T operator()(Custom_Warning_Ptr x) = 0; - virtual T operator()(Custom_Error_Ptr x) = 0; - virtual T operator()(Variable_Ptr x) = 0; - virtual T operator()(Number_Ptr x) = 0; - virtual T operator()(Color_Ptr x) = 0; - virtual T operator()(Color_RGBA_Ptr x) = 0; - virtual T operator()(Color_HSLA_Ptr x) = 0; - virtual T operator()(Boolean_Ptr x) = 0; - virtual T operator()(String_Schema_Ptr x) = 0; - virtual T operator()(String_Quoted_Ptr x) = 0; - virtual T operator()(String_Constant_Ptr x) = 0; - virtual T operator()(Supports_Condition_Ptr x) = 0; - virtual T operator()(Supports_Operator_Ptr x) = 0; - virtual T operator()(Supports_Negation_Ptr x) = 0; - virtual T operator()(Supports_Declaration_Ptr x) = 0; - virtual T operator()(Supports_Interpolation_Ptr x) = 0; - virtual T operator()(Media_Query_Ptr x) = 0; - virtual T operator()(Media_Query_Expression_Ptr x) = 0; - virtual T operator()(At_Root_Query_Ptr x) = 0; - virtual T operator()(Parent_Selector_Ptr x) = 0; - virtual T operator()(Parent_Reference_Ptr x) = 0; + virtual T operator()(Null* x) = 0; + virtual T operator()(List* x) = 0; + virtual T operator()(Map* x) = 0; + virtual T operator()(Function* x) = 0; + virtual T operator()(Binary_Expression* x) = 0; + virtual T operator()(Unary_Expression* x) = 0; + virtual T operator()(Function_Call* x) = 0; + virtual T operator()(Custom_Warning* x) = 0; + virtual T operator()(Custom_Error* x) = 0; + virtual T operator()(Variable* x) = 0; + virtual T operator()(Number* x) = 0; + virtual T operator()(Color* x) = 0; + virtual T operator()(Color_RGBA* x) = 0; + virtual T operator()(Color_HSLA* x) = 0; + virtual T operator()(Boolean* x) = 0; + virtual T operator()(String_Schema* x) = 0; + virtual T operator()(String_Quoted* x) = 0; + virtual T operator()(String_Constant* x) = 0; + virtual T operator()(Supports_Condition* x) = 0; + virtual T operator()(Supports_Operator* x) = 0; + virtual T operator()(Supports_Negation* x) = 0; + virtual T operator()(Supports_Declaration* x) = 0; + virtual T operator()(Supports_Interpolation* x) = 0; + virtual T operator()(Media_Query* x) = 0; + virtual T operator()(Media_Query_Expression* x) = 0; + virtual T operator()(At_Root_Query* x) = 0; + virtual T operator()(Parent_Selector* x) = 0; + virtual T operator()(Parent_Reference* x) = 0; // parameters and arguments - virtual T operator()(Parameter_Ptr x) = 0; - virtual T operator()(Parameters_Ptr x) = 0; - virtual T operator()(Argument_Ptr x) = 0; - virtual T operator()(Arguments_Ptr x) = 0; + virtual T operator()(Parameter* x) = 0; + virtual T operator()(Parameters* x) = 0; + virtual T operator()(Argument* x) = 0; + virtual T operator()(Arguments* x) = 0; // selectors - virtual T operator()(Selector_Schema_Ptr x) = 0; - virtual T operator()(Placeholder_Selector_Ptr x) = 0; - virtual T operator()(Type_Selector_Ptr x) = 0; - virtual T operator()(Class_Selector_Ptr x) = 0; - virtual T operator()(Id_Selector_Ptr x) = 0; - virtual T operator()(Attribute_Selector_Ptr x) = 0; - virtual T operator()(Pseudo_Selector_Ptr x) = 0; - virtual T operator()(Wrapped_Selector_Ptr x) = 0; - virtual T operator()(Compound_Selector_Ptr x)= 0; - virtual T operator()(Complex_Selector_Ptr x) = 0; - virtual T operator()(Selector_List_Ptr x) = 0; + virtual T operator()(Selector_Schema* x) = 0; + virtual T operator()(Placeholder_Selector* x) = 0; + virtual T operator()(Type_Selector* x) = 0; + virtual T operator()(Class_Selector* x) = 0; + virtual T operator()(Id_Selector* x) = 0; + virtual T operator()(Attribute_Selector* x) = 0; + virtual T operator()(Pseudo_Selector* x) = 0; + virtual T operator()(Wrapped_Selector* x) = 0; + virtual T operator()(Compound_Selector* x)= 0; + virtual T operator()(Complex_Selector* x) = 0; + virtual T operator()(Selector_List* x) = 0; }; - // example: Operation_CRTP + // example: Operation_CRTP // T is the base return type of all visitors // D is the class derived visitor class // normaly you want to implement all operators template class Operation_CRTP : public Operation { public: - T operator()(AST_Node_Ptr x) { return static_cast(this)->fallback(x); } + T operator()(AST_Node* x) { return static_cast(this)->fallback(x); } // statements - T operator()(Block_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Ruleset_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Bubble_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Trace_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Supports_Block_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Media_Block_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(At_Root_Block_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Directive_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Keyframe_Rule_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Declaration_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Assignment_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Import_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Import_Stub_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Warning_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Error_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Debug_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Comment_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(If_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(For_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Each_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(While_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Return_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Content_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Extension_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Definition_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Mixin_Call_Ptr x) { return static_cast(this)->fallback(x); } + T operator()(Block* x) { return static_cast(this)->fallback(x); } + T operator()(Ruleset* x) { return static_cast(this)->fallback(x); } + T operator()(Bubble* x) { return static_cast(this)->fallback(x); } + T operator()(Trace* x) { return static_cast(this)->fallback(x); } + T operator()(Supports_Block* x) { return static_cast(this)->fallback(x); } + T operator()(Media_Block* x) { return static_cast(this)->fallback(x); } + T operator()(At_Root_Block* x) { return static_cast(this)->fallback(x); } + T operator()(Directive* x) { return static_cast(this)->fallback(x); } + T operator()(Keyframe_Rule* x) { return static_cast(this)->fallback(x); } + T operator()(Declaration* x) { return static_cast(this)->fallback(x); } + T operator()(Assignment* x) { return static_cast(this)->fallback(x); } + T operator()(Import* x) { return static_cast(this)->fallback(x); } + T operator()(Import_Stub* x) { return static_cast(this)->fallback(x); } + T operator()(Warning* x) { return static_cast(this)->fallback(x); } + T operator()(Error* x) { return static_cast(this)->fallback(x); } + T operator()(Debug* x) { return static_cast(this)->fallback(x); } + T operator()(Comment* x) { return static_cast(this)->fallback(x); } + T operator()(If* x) { return static_cast(this)->fallback(x); } + T operator()(For* x) { return static_cast(this)->fallback(x); } + T operator()(Each* x) { return static_cast(this)->fallback(x); } + T operator()(While* x) { return static_cast(this)->fallback(x); } + T operator()(Return* x) { return static_cast(this)->fallback(x); } + T operator()(Content* x) { return static_cast(this)->fallback(x); } + T operator()(Extension* x) { return static_cast(this)->fallback(x); } + T operator()(Definition* x) { return static_cast(this)->fallback(x); } + T operator()(Mixin_Call* x) { return static_cast(this)->fallback(x); } // expressions - T operator()(Null_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(List_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Map_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Function_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Binary_Expression_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Unary_Expression_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Function_Call_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Custom_Warning_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Custom_Error_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Variable_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Number_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Color_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Color_RGBA_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Color_HSLA_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Boolean_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(String_Schema_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(String_Constant_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(String_Quoted_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Supports_Condition_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Supports_Operator_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Supports_Negation_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Supports_Declaration_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Supports_Interpolation_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Media_Query_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Media_Query_Expression_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(At_Root_Query_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Parent_Selector_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Parent_Reference_Ptr x) { return static_cast(this)->fallback(x); } + T operator()(Null* x) { return static_cast(this)->fallback(x); } + T operator()(List* x) { return static_cast(this)->fallback(x); } + T operator()(Map* x) { return static_cast(this)->fallback(x); } + T operator()(Function* x) { return static_cast(this)->fallback(x); } + T operator()(Binary_Expression* x) { return static_cast(this)->fallback(x); } + T operator()(Unary_Expression* x) { return static_cast(this)->fallback(x); } + T operator()(Function_Call* x) { return static_cast(this)->fallback(x); } + T operator()(Custom_Warning* x) { return static_cast(this)->fallback(x); } + T operator()(Custom_Error* x) { return static_cast(this)->fallback(x); } + T operator()(Variable* x) { return static_cast(this)->fallback(x); } + T operator()(Number* x) { return static_cast(this)->fallback(x); } + T operator()(Color* x) { return static_cast(this)->fallback(x); } + T operator()(Color_RGBA* x) { return static_cast(this)->fallback(x); } + T operator()(Color_HSLA* x) { return static_cast(this)->fallback(x); } + T operator()(Boolean* x) { return static_cast(this)->fallback(x); } + T operator()(String_Schema* x) { return static_cast(this)->fallback(x); } + T operator()(String_Constant* x) { return static_cast(this)->fallback(x); } + T operator()(String_Quoted* x) { return static_cast(this)->fallback(x); } + T operator()(Supports_Condition* x) { return static_cast(this)->fallback(x); } + T operator()(Supports_Operator* x) { return static_cast(this)->fallback(x); } + T operator()(Supports_Negation* x) { return static_cast(this)->fallback(x); } + T operator()(Supports_Declaration* x) { return static_cast(this)->fallback(x); } + T operator()(Supports_Interpolation* x) { return static_cast(this)->fallback(x); } + T operator()(Media_Query* x) { return static_cast(this)->fallback(x); } + T operator()(Media_Query_Expression* x) { return static_cast(this)->fallback(x); } + T operator()(At_Root_Query* x) { return static_cast(this)->fallback(x); } + T operator()(Parent_Selector* x) { return static_cast(this)->fallback(x); } + T operator()(Parent_Reference* x) { return static_cast(this)->fallback(x); } // parameters and arguments - T operator()(Parameter_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Parameters_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Argument_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Arguments_Ptr x) { return static_cast(this)->fallback(x); } + T operator()(Parameter* x) { return static_cast(this)->fallback(x); } + T operator()(Parameters* x) { return static_cast(this)->fallback(x); } + T operator()(Argument* x) { return static_cast(this)->fallback(x); } + T operator()(Arguments* x) { return static_cast(this)->fallback(x); } // selectors - T operator()(Selector_Schema_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Placeholder_Selector_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Type_Selector_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Class_Selector_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Id_Selector_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Attribute_Selector_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Pseudo_Selector_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Wrapped_Selector_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Compound_Selector_Ptr x){ return static_cast(this)->fallback(x); } - T operator()(Complex_Selector_Ptr x) { return static_cast(this)->fallback(x); } - T operator()(Selector_List_Ptr x) { return static_cast(this)->fallback(x); } + T operator()(Selector_Schema* x) { return static_cast(this)->fallback(x); } + T operator()(Placeholder_Selector* x) { return static_cast(this)->fallback(x); } + T operator()(Type_Selector* x) { return static_cast(this)->fallback(x); } + T operator()(Class_Selector* x) { return static_cast(this)->fallback(x); } + T operator()(Id_Selector* x) { return static_cast(this)->fallback(x); } + T operator()(Attribute_Selector* x) { return static_cast(this)->fallback(x); } + T operator()(Pseudo_Selector* x) { return static_cast(this)->fallback(x); } + T operator()(Wrapped_Selector* x) { return static_cast(this)->fallback(x); } + T operator()(Compound_Selector* x){ return static_cast(this)->fallback(x); } + T operator()(Complex_Selector* x) { return static_cast(this)->fallback(x); } + T operator()(Selector_List* x) { return static_cast(this)->fallback(x); } // fallback with specific type U // will be called if not overloaded diff --git a/src/operators.cpp b/src/operators.cpp index 57ce56449..bf312b8f3 100644 --- a/src/operators.cpp +++ b/src/operators.cpp @@ -69,12 +69,12 @@ namespace Sass { } /* static function, throws OperationError, has no traces but optional pstate for returned value */ - Value_Ptr op_strings(Sass::Operand operand, Value& lhs, Value& rhs, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed) + Value* op_strings(Sass::Operand operand, Value& lhs, Value& rhs, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed) { enum Sass_OP op = operand.operand; - String_Quoted_Ptr lqstr = Cast(&lhs); - String_Quoted_Ptr rqstr = Cast(&rhs); + String_Quoted* lqstr = Cast(&lhs); + String_Quoted* rqstr = Cast(&rhs); std::string lstr(lqstr ? lqstr->value() : lhs.to_string(opt)); std::string rstr(rqstr ? rqstr->value() : rhs.to_string(opt)); @@ -120,7 +120,7 @@ namespace Sass { /* ToDo: allow to operate also with hsla colors */ /* static function, throws OperationError, has no traces but optional pstate for returned value */ - Value_Ptr op_colors(enum Sass_OP op, const Color_RGBA& lhs, const Color_RGBA& rhs, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed) + Value* op_colors(enum Sass_OP op, const Color_RGBA& lhs, const Color_RGBA& rhs, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed) { if (lhs.a() != rhs.a()) { @@ -141,7 +141,7 @@ namespace Sass { } /* static function, throws OperationError, has no traces but optional pstate for returned value */ - Value_Ptr op_numbers(enum Sass_OP op, const Number& lhs, const Number& rhs, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed) + Value* op_numbers(enum Sass_OP op, const Number& lhs, const Number& rhs, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed) { double lval = lhs.value(); double rval = rhs.value(); @@ -164,7 +164,7 @@ namespace Sass { if (l_n_units + l_d_units <= 1 && r_n_units + r_d_units <= 1) { if (lhs.numerators == rhs.numerators) { if (lhs.denominators == rhs.denominators) { - Number_Ptr v = SASS_MEMORY_COPY(&lhs); + Number* v = SASS_MEMORY_COPY(&lhs); v->value(ops[op](lval, rval)); return v; } @@ -211,7 +211,7 @@ namespace Sass { } /* static function, throws OperationError, has no traces but optional pstate for returned value */ - Value_Ptr op_number_color(enum Sass_OP op, const Number& lhs, const Color_RGBA& rhs, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed) + Value* op_number_color(enum Sass_OP op, const Number& lhs, const Color_RGBA& rhs, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed) { double lval = lhs.value(); @@ -242,7 +242,7 @@ namespace Sass { } /* static function, throws OperationError, has no traces but optional pstate for returned value */ - Value_Ptr op_color_number(enum Sass_OP op, const Color_RGBA& lhs, const Number& rhs, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed) + Value* op_color_number(enum Sass_OP op, const Color_RGBA& lhs, const Number& rhs, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed) { double rval = rhs.value(); diff --git a/src/operators.hpp b/src/operators.hpp index 82387d266..edf09a107 100644 --- a/src/operators.hpp +++ b/src/operators.hpp @@ -17,11 +17,11 @@ namespace Sass { bool lte(Expression_Obj, Expression_Obj); bool gte(Expression_Obj, Expression_Obj); // arithmetic for all the combinations that matter - Value_Ptr op_strings(Sass::Operand, Value&, Value&, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed = false); - Value_Ptr op_colors(enum Sass_OP, const Color_RGBA&, const Color_RGBA&, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed = false); - Value_Ptr op_numbers(enum Sass_OP, const Number&, const Number&, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed = false); - Value_Ptr op_number_color(enum Sass_OP, const Number&, const Color_RGBA&, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed = false); - Value_Ptr op_color_number(enum Sass_OP, const Color_RGBA&, const Number&, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed = false); + Value* op_strings(Sass::Operand, Value&, Value&, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed = false); + Value* op_colors(enum Sass_OP, const Color_RGBA&, const Color_RGBA&, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed = false); + Value* op_numbers(enum Sass_OP, const Number&, const Number&, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed = false); + Value* op_number_color(enum Sass_OP, const Number&, const Color_RGBA&, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed = false); + Value* op_color_number(enum Sass_OP, const Color_RGBA&, const Number&, struct Sass_Inspect_Options opt, const ParserState& pstate, bool delayed = false); }; diff --git a/src/output.cpp b/src/output.cpp index 0d5ec7481..ebfe8c5a2 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -16,12 +16,12 @@ namespace Sass { Output::~Output() { } - void Output::fallback_impl(AST_Node_Ptr n) + void Output::fallback_impl(AST_Node* n) { return n->perform(this); } - void Output::operator()(Number_Ptr n) + void Output::operator()(Number* n) { // check for a valid unit here // includes result for reporting @@ -35,12 +35,12 @@ namespace Sass { append_token(res, n); } - void Output::operator()(Import_Ptr imp) + void Output::operator()(Import* imp) { top_nodes.push_back(imp); } - void Output::operator()(Map_Ptr m) + void Output::operator()(Map* m) { // should be handle in check_expression throw Exception::InvalidValue({}, *m); @@ -90,7 +90,7 @@ namespace Sass { } - void Output::operator()(Comment_Ptr c) + void Output::operator()(Comment* c) { std::string txt = c->text()->to_string(opt); // if (indentation && txt == "/**/") return; @@ -112,7 +112,7 @@ namespace Sass { } } - void Output::operator()(Ruleset_Ptr r) + void Output::operator()(Ruleset* r) { Selector_Obj s = r->selector(); Block_Obj b = r->block(); @@ -146,19 +146,19 @@ namespace Sass { Statement_Obj stm = b->at(i); bool bPrintExpression = true; // Check print conditions - if (Declaration_Ptr dec = Cast(stm)) { - if (String_Constant_Ptr valConst = Cast(dec->value())) { + if (Declaration* dec = Cast(stm)) { + if (String_Constant* valConst = Cast(dec->value())) { std::string val(valConst->value()); - if (String_Quoted_Ptr qstr = Cast(valConst)) { + if (String_Quoted* qstr = Cast(valConst)) { if (!qstr->quote_mark() && val.empty()) { bPrintExpression = false; } } } - else if (List_Ptr list = Cast(dec->value())) { + else if (List* list = Cast(dec->value())) { bool all_invisible = true; for (size_t list_i = 0, list_L = list->length(); list_i < list_L; ++list_i) { - Expression_Ptr item = list->at(list_i); + Expression* item = list->at(list_i); if (!item->is_invisible()) all_invisible = false; } if (all_invisible && !list->is_bracketed()) bPrintExpression = false; @@ -173,7 +173,7 @@ namespace Sass { append_scope_closer(b); } - void Output::operator()(Keyframe_Rule_Ptr r) + void Output::operator()(Keyframe_Rule* r) { Block_Obj b = r->block(); Selector_Obj v = r->name(); @@ -196,7 +196,7 @@ namespace Sass { append_scope_closer(); } - void Output::operator()(Supports_Block_Ptr f) + void Output::operator()(Supports_Block* f) { if (f->is_invisible()) return; @@ -233,7 +233,7 @@ namespace Sass { } - void Output::operator()(Media_Block_Ptr m) + void Output::operator()(Media_Block* m) { if (m->is_invisible()) return; @@ -270,7 +270,7 @@ namespace Sass { append_scope_closer(); } - void Output::operator()(Directive_Ptr a) + void Output::operator()(Directive* a) { std::string kwd = a->keyword(); Selector_Obj s = a->selector(); @@ -313,7 +313,7 @@ namespace Sass { append_scope_closer(); } - void Output::operator()(String_Quoted_Ptr s) + void Output::operator()(String_Quoted* s) { if (s->quote_mark()) { append_token(quote(s->value(), s->quote_mark()), s); @@ -324,7 +324,7 @@ namespace Sass { } } - void Output::operator()(String_Constant_Ptr s) + void Output::operator()(String_Constant* s) { std::string value(s->value()); if (s->can_compress_whitespace() && output_style() == COMPRESSED) { diff --git a/src/output.hpp b/src/output.hpp index 25c6d2b78..df9ad1e2e 100644 --- a/src/output.hpp +++ b/src/output.hpp @@ -21,24 +21,24 @@ namespace Sass { protected: std::string charset; - std::vector top_nodes; + std::vector top_nodes; public: OutputBuffer get_buffer(void); - virtual void operator()(Map_Ptr); - virtual void operator()(Ruleset_Ptr); - virtual void operator()(Supports_Block_Ptr); - virtual void operator()(Media_Block_Ptr); - virtual void operator()(Directive_Ptr); - virtual void operator()(Keyframe_Rule_Ptr); - virtual void operator()(Import_Ptr); - virtual void operator()(Comment_Ptr); - virtual void operator()(Number_Ptr); - virtual void operator()(String_Quoted_Ptr); - virtual void operator()(String_Constant_Ptr); - - void fallback_impl(AST_Node_Ptr n); + virtual void operator()(Map*); + virtual void operator()(Ruleset*); + virtual void operator()(Supports_Block*); + virtual void operator()(Media_Block*); + virtual void operator()(Directive*); + virtual void operator()(Keyframe_Rule*); + virtual void operator()(Import*); + virtual void operator()(Comment*); + virtual void operator()(Number*); + virtual void operator()(String_Quoted*); + virtual void operator()(String_Constant*); + + void fallback_impl(AST_Node* n); }; diff --git a/src/parser.cpp b/src/parser.cpp index c74e15f48..e624bda4a 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -481,7 +481,7 @@ namespace Sass { bool is_arglist = false; bool is_keyword = false; Expression_Obj val = parse_space_list(); - List_Ptr l = Cast(val); + List* l = Cast(val); if (lex_css< exactly< ellipsis > >()) { if (val->concrete_type() == Expression::MAP || ( (l != NULL && l->separator() == SASS_HASH) @@ -558,7 +558,7 @@ namespace Sass { lex< optional_spaces >(); const char* i = position; // selector schema re-uses string schema implementation - String_Schema_Ptr schema = SASS_MEMORY_NEW(String_Schema, pstate); + String_Schema* schema = SASS_MEMORY_NEW(String_Schema, pstate); // the selector schema is pretty much just a wrapper for the string schema Selector_Schema_Obj selector_schema = SASS_MEMORY_NEW(Selector_Schema, pstate, schema); selector_schema->connect_parent(chroot == false); @@ -787,7 +787,7 @@ namespace Sass { if (!sel->has_parent_ref() && !chroot) { // create the objects to wrap parent selector reference Compound_Selector_Obj head = SASS_MEMORY_NEW(Compound_Selector, pstate); - Parent_Selector_Ptr parent = SASS_MEMORY_NEW(Parent_Selector, pstate, false); + Parent_Selector* parent = SASS_MEMORY_NEW(Parent_Selector, pstate, false); parent->media_block(last_media_block); head->media_block(last_media_block); // add simple selector @@ -904,7 +904,7 @@ namespace Sass { return parse_attribute_selector(); } else if (lex< placeholder >()) { - Placeholder_Selector_Ptr sel = SASS_MEMORY_NEW(Placeholder_Selector, pstate, lexed); + Placeholder_Selector* sel = SASS_MEMORY_NEW(Placeholder_Selector, pstate, lexed); sel->media_block(last_media_block); return sel; } @@ -1089,7 +1089,7 @@ namespace Sass { } else { value = parse_list(DELAYED); - if (List_Ptr list = Cast(value)) { + if (List* list = Cast(value)) { if (!list->is_bracketed() && list->length() == 0 && !peek< exactly <'{'> >()) { css_error("Invalid CSS", " after ", ": expected expression (e.g. 1px, bold), was "); } @@ -1495,7 +1495,7 @@ namespace Sass { } else if (lex< identifier_schema >()) { String_Obj string = parse_identifier_schema(); - if (String_Schema_Ptr schema = Cast(string)) { + if (String_Schema* schema = Cast(string)) { if (lex < exactly < '(' > >()) { schema->append(parse_list()); lex < exactly < ')' > >(); @@ -1510,29 +1510,29 @@ namespace Sass { return parse_function_call(); } else if (lex< exactly<'+'> >()) { - Unary_Expression_Ptr ex = SASS_MEMORY_NEW(Unary_Expression, pstate, Unary_Expression::PLUS, parse_factor()); + Unary_Expression* ex = SASS_MEMORY_NEW(Unary_Expression, pstate, Unary_Expression::PLUS, parse_factor()); if (ex && ex->operand()) ex->is_delayed(ex->operand()->is_delayed()); return ex; } else if (lex< exactly<'-'> >()) { - Unary_Expression_Ptr ex = SASS_MEMORY_NEW(Unary_Expression, pstate, Unary_Expression::MINUS, parse_factor()); + Unary_Expression* ex = SASS_MEMORY_NEW(Unary_Expression, pstate, Unary_Expression::MINUS, parse_factor()); if (ex && ex->operand()) ex->is_delayed(ex->operand()->is_delayed()); return ex; } else if (lex< exactly<'/'> >()) { - Unary_Expression_Ptr ex = SASS_MEMORY_NEW(Unary_Expression, pstate, Unary_Expression::SLASH, parse_factor()); + Unary_Expression* ex = SASS_MEMORY_NEW(Unary_Expression, pstate, Unary_Expression::SLASH, parse_factor()); if (ex && ex->operand()) ex->is_delayed(ex->operand()->is_delayed()); return ex; } else if (lex< sequence< kwd_not > >()) { - Unary_Expression_Ptr ex = SASS_MEMORY_NEW(Unary_Expression, pstate, Unary_Expression::NOT, parse_factor()); + Unary_Expression* ex = SASS_MEMORY_NEW(Unary_Expression, pstate, Unary_Expression::NOT, parse_factor()); if (ex && ex->operand()) ex->is_delayed(ex->operand()->is_delayed()); return ex; } // this whole branch is never hit via spec tests else if (peek < sequence < one_plus < alternatives < css_whitespace, exactly<'-'>, exactly<'+'> > >, number > >()) { if (parse_number_prefix()) return parse_value(); // prefix is positive - Unary_Expression_Ptr ex = SASS_MEMORY_NEW(Unary_Expression, pstate, Unary_Expression::MINUS, parse_value()); + Unary_Expression* ex = SASS_MEMORY_NEW(Unary_Expression, pstate, Unary_Expression::MINUS, parse_value()); if (ex->operand()) ex->is_delayed(ex->operand()->is_delayed()); return ex; } @@ -1550,9 +1550,9 @@ namespace Sass { (L > 2 && parsed.substr(0, 3) == "-0.") ); } - Number_Ptr Parser::lexed_number(const ParserState& pstate, const std::string& parsed) + Number* Parser::lexed_number(const ParserState& pstate, const std::string& parsed) { - Number_Ptr nr = SASS_MEMORY_NEW(Number, + Number* nr = SASS_MEMORY_NEW(Number, pstate, sass_strtod(parsed.c_str()), "", @@ -1562,9 +1562,9 @@ namespace Sass { return nr; } - Number_Ptr Parser::lexed_percentage(const ParserState& pstate, const std::string& parsed) + Number* Parser::lexed_percentage(const ParserState& pstate, const std::string& parsed) { - Number_Ptr nr = SASS_MEMORY_NEW(Number, + Number* nr = SASS_MEMORY_NEW(Number, pstate, sass_strtod(parsed.c_str()), "%", @@ -1574,7 +1574,7 @@ namespace Sass { return nr; } - Number_Ptr Parser::lexed_dimension(const ParserState& pstate, const std::string& parsed) + Number* Parser::lexed_dimension(const ParserState& pstate, const std::string& parsed) { size_t L = parsed.length(); size_t num_pos = parsed.find_first_not_of(" \n\r\t"); @@ -1585,7 +1585,7 @@ namespace Sass { } if (unit_pos == std::string::npos) unit_pos = L; const std::string& num = parsed.substr(num_pos, unit_pos - num_pos); - Number_Ptr nr = SASS_MEMORY_NEW(Number, + Number* nr = SASS_MEMORY_NEW(Number, pstate, sass_strtod(num.c_str()), Token(number(parsed.c_str())), @@ -1595,9 +1595,9 @@ namespace Sass { return nr; } - Value_Ptr Parser::lexed_hex_color(const ParserState& pstate, const std::string& parsed) + Value* Parser::lexed_hex_color(const ParserState& pstate, const std::string& parsed) { - Color_RGBA_Ptr color = NULL; + Color_RGBA* color = NULL; if (parsed[0] != '#') { return SASS_MEMORY_NEW(String_Quoted, pstate, parsed); } @@ -1658,7 +1658,7 @@ namespace Sass { return color; } - Value_Ptr Parser::color_or_string(const std::string& lexed) const + Value* Parser::color_or_string(const std::string& lexed) const { if (auto color = name_to_color(lexed)) { auto c = SASS_MEMORY_NEW(Color_RGBA, color); @@ -1759,7 +1759,7 @@ namespace Sass { find_first_in_interval< exactly, block_comment >(i, chunk.end); if (!p) { - String_Quoted_Ptr str_quoted = SASS_MEMORY_NEW(String_Quoted, pstate, std::string(i, chunk.end), 0, false, false, true, css); + String_Quoted* str_quoted = SASS_MEMORY_NEW(String_Quoted, pstate, std::string(i, chunk.end), 0, false, false, true, css); if (!constant && str_quoted->quote_mark()) str_quoted->quote_mark('*'); return str_quoted; } @@ -1830,7 +1830,7 @@ namespace Sass { schema->append(SASS_MEMORY_NEW(String_Constant, pstate, str)); } else if (Expression_Obj tok = lex_interpolation()) { - if (String_Schema_Ptr s = Cast(tok)) { + if (String_Schema* s = Cast(tok)) { schema->concat(s); } else { schema->append(tok); @@ -1838,7 +1838,7 @@ namespace Sass { } else if (lex< quoted_string >()) { Expression_Obj tok = parse_string(); - if (String_Schema_Ptr s = Cast(tok)) { + if (String_Schema* s = Cast(tok)) { schema->concat(s); } else { schema->append(tok); @@ -1900,7 +1900,7 @@ namespace Sass { return SASS_MEMORY_NEW(String_Quoted, pstate, std::string(str.begin, str.end)); } - String_Schema_Ptr schema = SASS_MEMORY_NEW(String_Schema, pstate); + String_Schema* schema = SASS_MEMORY_NEW(String_Schema, pstate); while (i < str.end) { p = find_first_in_interval< exactly, block_comment >(i, str.end); if (p) { @@ -2156,7 +2156,7 @@ namespace Sass { uri = url_string->to_string({ NESTED, 5 }); } - if (String_Schema_Ptr schema = Cast(url_string)) { + if (String_Schema* schema = Cast(url_string)) { String_Schema_Obj res = SASS_MEMORY_NEW(String_Schema, pstate); res->append(SASS_MEMORY_NEW(String_Constant, pstate, prefix)); res->append(schema); @@ -2359,7 +2359,7 @@ namespace Sass { return queries.detach(); } - // Expression_Ptr Parser::parse_media_query() + // Expression* Parser::parse_media_query() Media_Query_Obj Parser::parse_media_query() { advanceToNextToken(); @@ -2373,7 +2373,7 @@ namespace Sass { while (lex_css < kwd_and >()) media_query->append(parse_media_expression()); if (lex < identifier_schema >()) { - String_Schema_Ptr schema = SASS_MEMORY_NEW(String_Schema, pstate); + String_Schema* schema = SASS_MEMORY_NEW(String_Schema, pstate); schema->append(media_query->media_type()); schema->append(SASS_MEMORY_NEW(String_Constant, pstate, " ")); schema->append(parse_identifier_schema()); @@ -2459,7 +2459,7 @@ namespace Sass { lex < css_whitespace >(); Supports_Condition_Obj right = parse_supports_condition_in_parens(); - // Supports_Condition_Ptr cc = SASS_MEMORY_NEW(Supports_Condition, *static_cast(cond)); + // Supports_Condition* cc = SASS_MEMORY_NEW(Supports_Condition, *static_cast(cond)); cond = SASS_MEMORY_NEW(Supports_Operator, pstate, cond, right, op); } return cond; @@ -2479,7 +2479,7 @@ namespace Sass { // look like declarations their semantics differ significantly Supports_Condition_Obj Parser::parse_supports_declaration() { - Supports_Condition_Ptr cond; + Supports_Condition* cond; // parse something declaration like Expression_Obj feature = parse_expression(); Expression_Obj expression; @@ -2573,7 +2573,7 @@ namespace Sass { // this whole branch is never hit via spec tests - Directive_Ptr at_rule = SASS_MEMORY_NEW(Directive, pstate, kwd); + Directive* at_rule = SASS_MEMORY_NEW(Directive, pstate, kwd); Lookahead lookahead = lookahead_for_include(position); if (lookahead.found && !lookahead.has_interpolants) { at_rule->selector(parse_selector_list(false)); @@ -3017,7 +3017,7 @@ namespace Sass { Expression_Obj Parser::fold_operands(Expression_Obj base, std::vector& operands, std::vector& ops, size_t i) { - if (String_Schema_Ptr schema = Cast(base)) { + if (String_Schema* schema = Cast(base)) { // return schema; if (schema->has_interpolants()) { if (i + 1 < operands.size() && ( @@ -3040,7 +3040,7 @@ namespace Sass { } for (size_t S = operands.size(); i < S; ++i) { - if (String_Schema_Ptr schema = Cast(operands[i])) { + if (String_Schema* schema = Cast(operands[i])) { if (schema->has_interpolants()) { if (i + 1 < S) { // this whole branch is never hit via spec tests @@ -3057,13 +3057,13 @@ namespace Sass { } else { base = SASS_MEMORY_NEW(Binary_Expression, base->pstate(), ops[i], base, operands[i]); } - Binary_Expression_Ptr b = Cast(base.ptr()); + Binary_Expression* b = Cast(base.ptr()); if (b && ops[i].operand == Sass_OP::DIV && b->left()->is_delayed() && b->right()->is_delayed()) { base->is_delayed(true); } } // nested binary expression are never to be delayed - if (Binary_Expression_Ptr b = Cast(base)) { + if (Binary_Expression* b = Cast(base)) { if (Cast(b->left())) base->set_delayed(false); if (Cast(b->right())) base->set_delayed(false); } diff --git a/src/parser.hpp b/src/parser.hpp index 536cbaa51..33f51175d 100644 --- a/src/parser.hpp +++ b/src/parser.hpp @@ -40,7 +40,7 @@ namespace Sass { Context& ctx; std::vector block_stack; std::vector stack; - Media_Block_Ptr last_media_block; + Media_Block* last_media_block; const char* source; const char* position; const char* end; @@ -328,7 +328,7 @@ namespace Sass { Error_Obj parse_error(); Debug_Obj parse_debug(); - Value_Ptr color_or_string(const std::string& lexed) const; + Value* color_or_string(const std::string& lexed) const; // be more like ruby sass Expression_Obj lex_almost_any_value_token(); @@ -382,15 +382,15 @@ namespace Sass { } public: - static Number_Ptr lexed_number(const ParserState& pstate, const std::string& parsed); - static Number_Ptr lexed_dimension(const ParserState& pstate, const std::string& parsed); - static Number_Ptr lexed_percentage(const ParserState& pstate, const std::string& parsed); - static Value_Ptr lexed_hex_color(const ParserState& pstate, const std::string& parsed); + static Number* lexed_number(const ParserState& pstate, const std::string& parsed); + static Number* lexed_dimension(const ParserState& pstate, const std::string& parsed); + static Number* lexed_percentage(const ParserState& pstate, const std::string& parsed); + static Value* lexed_hex_color(const ParserState& pstate, const std::string& parsed); private: - Number_Ptr lexed_number(const std::string& parsed) { return lexed_number(pstate, parsed); }; - Number_Ptr lexed_dimension(const std::string& parsed) { return lexed_dimension(pstate, parsed); }; - Number_Ptr lexed_percentage(const std::string& parsed) { return lexed_percentage(pstate, parsed); }; - Value_Ptr lexed_hex_color(const std::string& parsed) { return lexed_hex_color(pstate, parsed); }; + Number* lexed_number(const std::string& parsed) { return lexed_number(pstate, parsed); }; + Number* lexed_dimension(const std::string& parsed) { return lexed_dimension(pstate, parsed); }; + Number* lexed_percentage(const std::string& parsed) { return lexed_percentage(pstate, parsed); }; + Value* lexed_hex_color(const std::string& parsed) { return lexed_hex_color(pstate, parsed); }; static const char* re_attr_sensitive_close(const char* src); static const char* re_attr_insensitive_close(const char* src); diff --git a/src/remove_placeholders.cpp b/src/remove_placeholders.cpp index d36462fae..b9e57420f 100644 --- a/src/remove_placeholders.cpp +++ b/src/remove_placeholders.cpp @@ -12,16 +12,16 @@ namespace Sass { Remove_Placeholders::Remove_Placeholders() { } - void Remove_Placeholders::operator()(Block_Ptr b) { + void Remove_Placeholders::operator()(Block* b) { for (size_t i = 0, L = b->length(); i < L; ++i) { - Statement_Ptr st = b->at(i); + Statement* st = b->at(i); st->perform(this); } } - Selector_List_Ptr Remove_Placeholders::remove_placeholders(Selector_List_Ptr sl) + Selector_List* Remove_Placeholders::remove_placeholders(Selector_List* sl) { - Selector_List_Ptr new_sl = SASS_MEMORY_NEW(Selector_List, sl->pstate()); + Selector_List* new_sl = SASS_MEMORY_NEW(Selector_List, sl->pstate()); for (size_t i = 0, L = sl->length(); i < L; ++i) { if (!sl->at(i)->contains_placeholder()) { @@ -34,7 +34,7 @@ namespace Sass { } - void Remove_Placeholders::operator()(Ruleset_Ptr r) { + void Remove_Placeholders::operator()(Ruleset* r) { // Create a new selector group without placeholders Selector_List_Obj sl = Cast(r->selector()); @@ -46,9 +46,9 @@ namespace Sass { while (cs) { if (cs->head()) { for (Simple_Selector_Obj& ss : cs->head()->elements()) { - if (Wrapped_Selector_Ptr ws = Cast(ss)) { - if (Selector_List_Ptr wsl = Cast(ws->selector())) { - Selector_List_Ptr clean = remove_placeholders(wsl); + if (Wrapped_Selector* ws = Cast(ss)) { + if (Selector_List* wsl = Cast(ws->selector())) { + Selector_List* clean = remove_placeholders(wsl); // also clean superflous parent selectors // probably not really the correct place clean->remove_parent_selectors(); @@ -73,14 +73,14 @@ namespace Sass { } } - void Remove_Placeholders::operator()(Media_Block_Ptr m) { + void Remove_Placeholders::operator()(Media_Block* m) { operator()(m->block()); } - void Remove_Placeholders::operator()(Supports_Block_Ptr m) { + void Remove_Placeholders::operator()(Supports_Block* m) { operator()(m->block()); } - void Remove_Placeholders::operator()(Directive_Ptr a) { + void Remove_Placeholders::operator()(Directive* a) { if (a->block()) a->block()->perform(this); } diff --git a/src/remove_placeholders.hpp b/src/remove_placeholders.hpp index 690b0f3eb..67f4cffcb 100644 --- a/src/remove_placeholders.hpp +++ b/src/remove_placeholders.hpp @@ -12,17 +12,17 @@ namespace Sass { class Remove_Placeholders : public Operation_CRTP { public: - Selector_List_Ptr remove_placeholders(Selector_List_Ptr); + Selector_List* remove_placeholders(Selector_List*); public: Remove_Placeholders(); ~Remove_Placeholders() { } - void operator()(Block_Ptr); - void operator()(Ruleset_Ptr); - void operator()(Media_Block_Ptr); - void operator()(Supports_Block_Ptr); - void operator()(Directive_Ptr); + void operator()(Block*); + void operator()(Ruleset*); + void operator()(Media_Block*); + void operator()(Supports_Block*); + void operator()(Directive*); // ignore missed types template diff --git a/src/sass_functions.cpp b/src/sass_functions.cpp index 0c1e4064a..5459e5d1f 100644 --- a/src/sass_functions.cpp +++ b/src/sass_functions.cpp @@ -170,21 +170,21 @@ extern "C" { // Getters and Setters for environments (lexical, local and global) union Sass_Value* ADDCALL sass_env_get_lexical (Sass_Env_Frame env, const char* name) { - Expression_Ptr ex = Cast((*env->frame)[name]); + Expression* ex = Cast((*env->frame)[name]); return ex != NULL ? ast_node_to_sass_value(ex) : NULL; } void ADDCALL sass_env_set_lexical (Sass_Env_Frame env, const char* name, union Sass_Value* val) { (*env->frame)[name] = sass_value_to_ast_node(val); } union Sass_Value* ADDCALL sass_env_get_local (Sass_Env_Frame env, const char* name) { - Expression_Ptr ex = Cast(env->frame->get_local(name)); + Expression* ex = Cast(env->frame->get_local(name)); return ex != NULL ? ast_node_to_sass_value(ex) : NULL; } void ADDCALL sass_env_set_local (Sass_Env_Frame env, const char* name, union Sass_Value* val) { env->frame->set_local(name, sass_value_to_ast_node(val)); } union Sass_Value* ADDCALL sass_env_get_global (Sass_Env_Frame env, const char* name) { - Expression_Ptr ex = Cast(env->frame->get_global(name)); + Expression* ex = Cast(env->frame->get_global(name)); return ex != NULL ? ast_node_to_sass_value(ex) : NULL; } void ADDCALL sass_env_set_global (Sass_Env_Frame env, const char* name, union Sass_Value* val) { diff --git a/src/sass_values.cpp b/src/sass_values.cpp index c82e50078..4e6bd2dd5 100644 --- a/src/sass_values.cpp +++ b/src/sass_values.cpp @@ -315,12 +315,12 @@ extern "C" { } if (sass_value_is_number(a) && sass_value_is_number(b)) { - Number_Ptr_Const l_n = Cast(lhs); - Number_Ptr_Const r_n = Cast(rhs); + const Number* l_n = Cast(lhs); + const Number* r_n = Cast(rhs); rv = Operators::op_numbers(op, *l_n, *r_n, options, l_n->pstate()); } else if (sass_value_is_number(a) && sass_value_is_color(a)) { - Number_Ptr_Const l_n = Cast(lhs); + const Number* l_n = Cast(lhs); // Direct HSLA operations are not supported // All color maths will be deprecated anyway Color_RGBA_Obj r_c = Cast(rhs)->toRGBA(); @@ -330,7 +330,7 @@ extern "C" { // Direct HSLA operations are not supported // All color maths will be deprecated anyway Color_RGBA_Obj l_c = Cast(lhs)->toRGBA(); - Number_Ptr_Const r_n = Cast(rhs); + const Number* r_n = Cast(rhs); rv = Operators::op_color_number(op, *l_c, *r_n, options, l_c->pstate()); } else if (sass_value_is_color(a) && sass_value_is_color(b)) { @@ -341,8 +341,8 @@ extern "C" { rv = Operators::op_colors(op, *l_c, *r_c, options, l_c->pstate()); } else /* convert other stuff to string and apply operation */ { - Value_Ptr l_v = Cast(lhs); - Value_Ptr r_v = Cast(rhs); + Value* l_v = Cast(lhs); + Value* r_v = Cast(rhs); rv = Operators::op_strings(op, *l_v, *r_v, options, l_v->pstate()); } diff --git a/src/source_map.cpp b/src/source_map.cpp index 966dbbb74..74f929bdb 100644 --- a/src/source_map.cpp +++ b/src/source_map.cpp @@ -173,12 +173,12 @@ namespace Sass { current_position += offset; } - void SourceMap::add_open_mapping(AST_Node_Ptr_Const node) + void SourceMap::add_open_mapping(const AST_Node* node) { mappings.push_back(Mapping(node->pstate(), current_position)); } - void SourceMap::add_close_mapping(AST_Node_Ptr_Const node) + void SourceMap::add_close_mapping(const AST_Node* node) { mappings.push_back(Mapping(node->pstate() + node->pstate().offset, current_position)); } diff --git a/src/source_map.hpp b/src/source_map.hpp index 8eef32591..d6379aa0d 100644 --- a/src/source_map.hpp +++ b/src/source_map.hpp @@ -28,8 +28,8 @@ namespace Sass { void prepend(const Offset& offset); void append(const OutputBuffer& out); void prepend(const OutputBuffer& out); - void add_open_mapping(AST_Node_Ptr_Const node); - void add_close_mapping(AST_Node_Ptr_Const node); + void add_open_mapping(const AST_Node* node); + void add_close_mapping(const AST_Node* node); std::string render_srcmap(Context &ctx); ParserState remap(const ParserState& pstate); diff --git a/src/to_value.cpp b/src/to_value.cpp index affd8dd67..e20f5e83f 100644 --- a/src/to_value.cpp +++ b/src/to_value.cpp @@ -8,55 +8,55 @@ namespace Sass { // Custom_Error is a valid value - Value_Ptr To_Value::operator()(Custom_Error_Ptr e) + Value* To_Value::operator()(Custom_Error* e) { return e; } // Custom_Warning is a valid value - Value_Ptr To_Value::operator()(Custom_Warning_Ptr w) + Value* To_Value::operator()(Custom_Warning* w) { return w; } // Boolean is a valid value - Value_Ptr To_Value::operator()(Boolean_Ptr b) + Value* To_Value::operator()(Boolean* b) { return b; } // Number is a valid value - Value_Ptr To_Value::operator()(Number_Ptr n) + Value* To_Value::operator()(Number* n) { return n; } // Color is a valid value - Value_Ptr To_Value::operator()(Color_RGBA_Ptr c) + Value* To_Value::operator()(Color_RGBA* c) { return c; } // Color is a valid value - Value_Ptr To_Value::operator()(Color_HSLA_Ptr c) + Value* To_Value::operator()(Color_HSLA* c) { return c; } // String_Constant is a valid value - Value_Ptr To_Value::operator()(String_Constant_Ptr s) + Value* To_Value::operator()(String_Constant* s) { return s; } // String_Quoted is a valid value - Value_Ptr To_Value::operator()(String_Quoted_Ptr s) + Value* To_Value::operator()(String_Quoted* s) { return s; } // List is a valid value - Value_Ptr To_Value::operator()(List_Ptr l) + Value* To_Value::operator()(List* l) { List_Obj ll = SASS_MEMORY_NEW(List, l->pstate(), @@ -71,32 +71,32 @@ namespace Sass { } // Map is a valid value - Value_Ptr To_Value::operator()(Map_Ptr m) + Value* To_Value::operator()(Map* m) { return m; } // Null is a valid value - Value_Ptr To_Value::operator()(Null_Ptr n) + Value* To_Value::operator()(Null* n) { return n; } // Function is a valid value - Value_Ptr To_Value::operator()(Function_Ptr n) + Value* To_Value::operator()(Function* n) { return n; } // Argument returns its value - Value_Ptr To_Value::operator()(Argument_Ptr arg) + Value* To_Value::operator()(Argument* arg) { if (!arg->name().empty()) return 0; return arg->value()->perform(this); } // Selector_List is converted to a string - Value_Ptr To_Value::operator()(Selector_List_Ptr s) + Value* To_Value::operator()(Selector_List* s) { return SASS_MEMORY_NEW(String_Quoted, s->pstate(), @@ -104,7 +104,7 @@ namespace Sass { } // Binary_Expression is converted to a string - Value_Ptr To_Value::operator()(Binary_Expression_Ptr s) + Value* To_Value::operator()(Binary_Expression* s) { return SASS_MEMORY_NEW(String_Quoted, s->pstate(), diff --git a/src/to_value.hpp b/src/to_value.hpp index 625a6052e..32f33b1b1 100644 --- a/src/to_value.hpp +++ b/src/to_value.hpp @@ -7,7 +7,7 @@ namespace Sass { - class To_Value : public Operation_CRTP { + class To_Value : public Operation_CRTP { private: @@ -19,25 +19,25 @@ namespace Sass { : ctx(ctx) { } ~To_Value() { } - using Operation::operator(); - - Value_Ptr operator()(Argument_Ptr); - Value_Ptr operator()(Boolean_Ptr); - Value_Ptr operator()(Number_Ptr); - Value_Ptr operator()(Color_RGBA_Ptr); - Value_Ptr operator()(Color_HSLA_Ptr); - Value_Ptr operator()(String_Constant_Ptr); - Value_Ptr operator()(String_Quoted_Ptr); - Value_Ptr operator()(Custom_Warning_Ptr); - Value_Ptr operator()(Custom_Error_Ptr); - Value_Ptr operator()(List_Ptr); - Value_Ptr operator()(Map_Ptr); - Value_Ptr operator()(Null_Ptr); - Value_Ptr operator()(Function_Ptr); + using Operation::operator(); + + Value* operator()(Argument*); + Value* operator()(Boolean*); + Value* operator()(Number*); + Value* operator()(Color_RGBA*); + Value* operator()(Color_HSLA*); + Value* operator()(String_Constant*); + Value* operator()(String_Quoted*); + Value* operator()(Custom_Warning*); + Value* operator()(Custom_Error*); + Value* operator()(List*); + Value* operator()(Map*); + Value* operator()(Null*); + Value* operator()(Function*); // convert to string via `To_String` - Value_Ptr operator()(Selector_List_Ptr); - Value_Ptr operator()(Binary_Expression_Ptr); + Value* operator()(Selector_List*); + Value* operator()(Binary_Expression*); }; diff --git a/src/util.cpp b/src/util.cpp index 60f69ab76..e1f394e81 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -536,14 +536,14 @@ namespace Sass { return normalized[0] == '.' ? normalized.insert(0, prefix) : normalized; } - bool isPrintable(Ruleset_Ptr r, Sass_Output_Style style) { + bool isPrintable(Ruleset* r, Sass_Output_Style style) { if (r == NULL) { return false; } Block_Obj b = r->block(); - Selector_List_Ptr sl = Cast(r->selector()); + Selector_List* sl = Cast(r->selector()); bool hasSelectors = sl ? sl->length() > 0 : false; if (!hasSelectors) { @@ -556,14 +556,14 @@ namespace Sass { Statement_Obj stm = b->at(i); if (Cast(stm)) { return true; - } else if (Declaration_Ptr d = Cast(stm)) { + } else if (Declaration* d = Cast(stm)) { return isPrintable(d, style); - } else if (Has_Block_Ptr p = Cast(stm)) { + } else if (Has_Block* p = Cast(stm)) { Block_Obj pChildBlock = p->block(); if (isPrintable(pChildBlock, style)) { hasPrintableChildBlocks = true; } - } else if (Comment_Ptr c = Cast(stm)) { + } else if (Comment* c = Cast(stm)) { // keep for uncompressed if (style != COMPRESSED) { hasDeclarations = true; @@ -584,17 +584,17 @@ namespace Sass { return false; } - bool isPrintable(String_Constant_Ptr s, Sass_Output_Style style) + bool isPrintable(String_Constant* s, Sass_Output_Style style) { return ! s->value().empty(); } - bool isPrintable(String_Quoted_Ptr s, Sass_Output_Style style) + bool isPrintable(String_Quoted* s, Sass_Output_Style style) { return true; } - bool isPrintable(Declaration_Ptr d, Sass_Output_Style style) + bool isPrintable(Declaration* d, Sass_Output_Style style) { Expression_Obj val = d->value(); if (String_Quoted_Obj sq = Cast(val)) return isPrintable(sq.ptr(), style); @@ -602,7 +602,7 @@ namespace Sass { return true; } - bool isPrintable(Supports_Block_Ptr f, Sass_Output_Style style) { + bool isPrintable(Supports_Block* f, Sass_Output_Style style) { if (f == NULL) { return false; } @@ -616,7 +616,7 @@ namespace Sass { if (Cast(stm) || Cast(stm)) { hasDeclarations = true; } - else if (Has_Block_Ptr b = Cast(stm)) { + else if (Has_Block* b = Cast(stm)) { Block_Obj pChildBlock = b->block(); if (!b->is_invisible()) { if (isPrintable(pChildBlock, style)) { @@ -633,7 +633,7 @@ namespace Sass { return false; } - bool isPrintable(Media_Block_Ptr m, Sass_Output_Style style) + bool isPrintable(Media_Block* m, Sass_Output_Style style) { if (m == 0) return false; Block_Obj b = m->block(); @@ -642,27 +642,27 @@ namespace Sass { Statement_Obj stm = b->at(i); if (Cast(stm)) return true; else if (Cast(stm)) return true; - else if (Comment_Ptr c = Cast(stm)) { + else if (Comment* c = Cast(stm)) { if (isPrintable(c, style)) { return true; } } - else if (Ruleset_Ptr r = Cast(stm)) { + else if (Ruleset* r = Cast(stm)) { if (isPrintable(r, style)) { return true; } } - else if (Supports_Block_Ptr f = Cast(stm)) { + else if (Supports_Block* f = Cast(stm)) { if (isPrintable(f, style)) { return true; } } - else if (Media_Block_Ptr mb = Cast(stm)) { + else if (Media_Block* mb = Cast(stm)) { if (isPrintable(mb, style)) { return true; } } - else if (Has_Block_Ptr b = Cast(stm)) { + else if (Has_Block* b = Cast(stm)) { if (isPrintable(b->block(), style)) { return true; } @@ -671,7 +671,7 @@ namespace Sass { return false; } - bool isPrintable(Comment_Ptr c, Sass_Output_Style style) + bool isPrintable(Comment* c, Sass_Output_Style style) { // keep for uncompressed if (style != COMPRESSED) { @@ -695,27 +695,27 @@ namespace Sass { if (Cast(stm) || Cast(stm)) { return true; } - else if (Comment_Ptr c = Cast(stm)) { + else if (Comment* c = Cast(stm)) { if (isPrintable(c, style)) { return true; } } - else if (Ruleset_Ptr r = Cast(stm)) { + else if (Ruleset* r = Cast(stm)) { if (isPrintable(r, style)) { return true; } } - else if (Supports_Block_Ptr f = Cast(stm)) { + else if (Supports_Block* f = Cast(stm)) { if (isPrintable(f, style)) { return true; } } - else if (Media_Block_Ptr m = Cast(stm)) { + else if (Media_Block* m = Cast(stm)) { if (isPrintable(m, style)) { return true; } } - else if (Has_Block_Ptr b = Cast(stm)) { + else if (Has_Block* b = Cast(stm)) { if (isPrintable(b->block(), style)) { return true; } diff --git a/src/util.hpp b/src/util.hpp index 1bc6f1f0d..d1866a51b 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -96,14 +96,14 @@ namespace Sass { std::string normalize_underscores(const std::string& str); std::string normalize_decimals(const std::string& str); - bool isPrintable(Ruleset_Ptr r, Sass_Output_Style style = NESTED); - bool isPrintable(Supports_Block_Ptr r, Sass_Output_Style style = NESTED); - bool isPrintable(Media_Block_Ptr r, Sass_Output_Style style = NESTED); - bool isPrintable(Comment_Ptr b, Sass_Output_Style style = NESTED); + bool isPrintable(Ruleset* r, Sass_Output_Style style = NESTED); + bool isPrintable(Supports_Block* r, Sass_Output_Style style = NESTED); + bool isPrintable(Media_Block* r, Sass_Output_Style style = NESTED); + bool isPrintable(Comment* b, Sass_Output_Style style = NESTED); bool isPrintable(Block_Obj b, Sass_Output_Style style = NESTED); - bool isPrintable(String_Constant_Ptr s, Sass_Output_Style style = NESTED); - bool isPrintable(String_Quoted_Ptr s, Sass_Output_Style style = NESTED); - bool isPrintable(Declaration_Ptr d, Sass_Output_Style style = NESTED); + bool isPrintable(String_Constant* s, Sass_Output_Style style = NESTED); + bool isPrintable(String_Quoted* s, Sass_Output_Style style = NESTED); + bool isPrintable(Declaration* d, Sass_Output_Style style = NESTED); bool isAscii(const char chr); } diff --git a/src/values.cpp b/src/values.cpp index 2f7b44da8..c9a53d80f 100644 --- a/src/values.cpp +++ b/src/values.cpp @@ -10,16 +10,16 @@ namespace Sass { // convert value from C++ side to C-API - union Sass_Value* ast_node_to_sass_value (Expression_Ptr_Const val) + union Sass_Value* ast_node_to_sass_value (const Expression* val) { if (val->concrete_type() == Expression::NUMBER) { - Number_Ptr_Const res = Cast(val); + const Number* res = Cast(val); return sass_make_number(res->value(), res->unit().c_str()); } else if (val->concrete_type() == Expression::COLOR) { - if (Color_RGBA_Ptr_Const rgba = Cast(val)) { + if (const Color_RGBA* rgba = Cast(val)) { return sass_make_color(rgba->r(), rgba->g(), rgba->b(), rgba->a()); } else { // ToDo: allow to also use HSLA colors!! @@ -29,7 +29,7 @@ namespace Sass { } else if (val->concrete_type() == Expression::LIST) { - List_Ptr_Const l = Cast(val); + const List* l = Cast(val); union Sass_Value* list = sass_make_list(l->size(), l->separator(), l->is_bracketed()); for (size_t i = 0, L = l->length(); i < L; ++i) { Expression_Obj obj = l->at(i); @@ -40,7 +40,7 @@ namespace Sass { } else if (val->concrete_type() == Expression::MAP) { - Map_Ptr_Const m = Cast(val); + const Map* m = Cast(val); union Sass_Value* map = sass_make_map(m->length()); size_t i = 0; for (Expression_Obj key : m->keys()) { sass_map_set_key(map, i, ast_node_to_sass_value(key)); @@ -55,16 +55,16 @@ namespace Sass { } else if (val->concrete_type() == Expression::BOOLEAN) { - Boolean_Ptr_Const res = Cast(val); + const Boolean* res = Cast(val); return sass_make_boolean(res->value()); } else if (val->concrete_type() == Expression::STRING) { - if (String_Quoted_Ptr_Const qstr = Cast(val)) + if (const String_Quoted* qstr = Cast(val)) { return sass_make_qstring(qstr->value().c_str()); } - else if (String_Constant_Ptr_Const cstr = Cast(val)) + else if (const String_Constant* cstr = Cast(val)) { return sass_make_string(cstr->value().c_str()); } @@ -73,7 +73,7 @@ namespace Sass { } // convert value from C-API to C++ side - Value_Ptr sass_value_to_ast_node (const union Sass_Value* val) + Value* sass_value_to_ast_node (const union Sass_Value* val) { switch (sass_value_get_tag(val)) { case SASS_NUMBER: @@ -103,7 +103,7 @@ namespace Sass { ParserState("[C-VALUE]"), sass_string_get_value(val)); case SASS_LIST: { - List_Ptr l = SASS_MEMORY_NEW(List, + List* l = SASS_MEMORY_NEW(List, ParserState("[C-VALUE]"), sass_list_get_length(val), sass_list_get_separator(val)); @@ -114,7 +114,7 @@ namespace Sass { return l; } case SASS_MAP: { - Map_Ptr m = SASS_MEMORY_NEW(Map, ParserState("[C-VALUE]")); + Map* m = SASS_MEMORY_NEW(Map, ParserState("[C-VALUE]")); for (size_t i = 0, L = sass_map_get_length(val); i < L; ++i) { *m << std::make_pair( sass_value_to_ast_node(sass_map_get_key(val, i)), diff --git a/src/values.hpp b/src/values.hpp index 03cead4da..3c4c687b0 100644 --- a/src/values.hpp +++ b/src/values.hpp @@ -5,8 +5,8 @@ namespace Sass { - union Sass_Value* ast_node_to_sass_value (Expression_Ptr_Const val); - Value_Ptr sass_value_to_ast_node (const union Sass_Value* val); + union Sass_Value* ast_node_to_sass_value (const Expression* val); + Value* sass_value_to_ast_node (const union Sass_Value* val); } #endif