diff --git a/src/ast.hpp b/src/ast.hpp index 697924c4b..4cf99d502 100644 --- a/src/ast.hpp +++ b/src/ast.hpp @@ -131,7 +131,7 @@ namespace Sass { ////////////////////////////////////////////////////////////////////// class Expression : public AST_Node { public: - enum Concrete_Type { + enum Type { NONE, BOOLEAN, NUMBER, @@ -153,10 +153,10 @@ namespace Sass { ADD_PROPERTY(bool, is_delayed) ADD_PROPERTY(bool, is_expanded) ADD_PROPERTY(bool, is_interpolant) - ADD_PROPERTY(Concrete_Type, concrete_type) + ADD_PROPERTY(Type, concrete_type) public: Expression(ParserState pstate, - bool d = false, bool e = false, bool i = false, Concrete_Type ct = NONE) + bool d = false, bool e = false, bool i = false, Type ct = NONE) : AST_Node(pstate), is_delayed_(d), is_expanded_(e), @@ -359,7 +359,7 @@ namespace Sass { ///////////////////////////////////////////////////////////////////////// class Statement : public AST_Node { public: - enum Statement_Type { + enum Type { NONE, RULESET, MEDIA, @@ -385,11 +385,11 @@ namespace Sass { IF }; private: - ADD_PROPERTY(Statement_Type, statement_type) + ADD_PROPERTY(Type, statement_type) ADD_PROPERTY(size_t, tabs) ADD_PROPERTY(bool, group_end) public: - Statement(ParserState pstate, Statement_Type st = NONE, size_t t = 0) + Statement(ParserState pstate, Type st = NONE, size_t t = 0) : AST_Node(pstate), statement_type_(st), tabs_(t), group_end_(false) { } Statement(const Statement* ptr) diff --git a/src/ast_fwd_decl.hpp b/src/ast_fwd_decl.hpp index e43cfbe9e..6fb30dff7 100644 --- a/src/ast_fwd_decl.hpp +++ b/src/ast_fwd_decl.hpp @@ -239,9 +239,9 @@ namespace Sass { class Placeholder_Selector; typedef Placeholder_Selector* Placeholder_Selector_Ptr; typedef Placeholder_Selector const* Placeholder_Selector_Ptr_Const; - class Element_Selector; - typedef Element_Selector* Element_Selector_Ptr; - typedef Element_Selector const* Element_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; @@ -345,7 +345,7 @@ namespace Sass { IMPL_MEM_OBJ(Selector_Schema); IMPL_MEM_OBJ(Simple_Selector); IMPL_MEM_OBJ(Placeholder_Selector); - IMPL_MEM_OBJ(Element_Selector); + IMPL_MEM_OBJ(Type_Selector); IMPL_MEM_OBJ(Class_Selector); IMPL_MEM_OBJ(Id_Selector); IMPL_MEM_OBJ(Attribute_Selector); diff --git a/src/ast_sel_cmp.cpp b/src/ast_sel_cmp.cpp index f09b4178f..658dcc696 100644 --- a/src/ast_sel_cmp.cpp +++ b/src/ast_sel_cmp.cpp @@ -535,7 +535,7 @@ namespace Sass { { switch (simple_type()) { case ID_SEL: return (const Id_Selector&) *this == rhs; break; - case TYPE_SEL: return (const Element_Selector&) *this == rhs; break; + case TYPE_SEL: return (const Type_Selector&) *this == rhs; break; case CLASS_SEL: return (const Class_Selector&) *this == rhs; break; case PARENT_SEL: return (const Parent_Selector&) *this == rhs; break; case PSEUDO_SEL: return (const Pseudo_Selector&) *this == rhs; break; @@ -555,9 +555,9 @@ namespace Sass { return sel ? *this == *sel : false; } - bool Element_Selector::operator== (const Simple_Selector& rhs) const + bool Type_Selector::operator== (const Simple_Selector& rhs) const { - auto sel = Cast(&rhs); + auto sel = Cast(&rhs); return sel ? *this == *sel : false; } @@ -606,7 +606,7 @@ namespace Sass { return name() == rhs.name(); } - bool Element_Selector::operator== (const Element_Selector& rhs) const + bool Type_Selector::operator== (const Type_Selector& rhs) const { return is_ns_eq(rhs) && name() == rhs.name(); } @@ -688,7 +688,7 @@ namespace Sass { { switch (simple_type()) { case ID_SEL: return (const Id_Selector&) *this < rhs; break; - case TYPE_SEL: return (const Element_Selector&) *this < rhs; break; + case TYPE_SEL: return (const Type_Selector&) *this < rhs; break; case CLASS_SEL: return (const Class_Selector&) *this < rhs; break; case PARENT_SEL: return (const Parent_Selector&) *this < rhs; break; case PSEUDO_SEL: return (const Pseudo_Selector&) *this < rhs; break; @@ -719,7 +719,7 @@ namespace Sass { return *this < sel; } - bool Element_Selector::operator< (const Simple_Selector& rhs) const + bool Type_Selector::operator< (const Simple_Selector& rhs) const { switch (rhs.simple_type()) { case ID_SEL: return 'e' < '#'; break; @@ -731,8 +731,8 @@ namespace Sass { case PLACEHOLDER_SEL: return 'e' < '%'; break; case TYPE_SEL: /* let if fall through */ break; } - const Element_Selector& sel = - (const Element_Selector&) rhs; + const Type_Selector& sel = + (const Type_Selector&) rhs; return *this < sel; } @@ -847,7 +847,7 @@ namespace Sass { return name() < rhs.name(); } - bool Element_Selector::operator< (const Element_Selector& rhs) const + bool Type_Selector::operator< (const Type_Selector& rhs) const { if (is_ns_eq(rhs)) { diff --git a/src/ast_sel_unify.cpp b/src/ast_sel_unify.cpp index 30e1b6e06..de6a62150 100644 --- a/src/ast_sel_unify.cpp +++ b/src/ast_sel_unify.cpp @@ -43,8 +43,7 @@ namespace Sass { return rhs; } - - Simple_Selector_Ptr Element_Selector::unify_with(Simple_Selector_Ptr rhs) + Simple_Selector_Ptr Type_Selector::unify_with(Simple_Selector_Ptr rhs) { // check if ns can be extended // true for no ns or universal @@ -75,7 +74,7 @@ namespace Sass { return this; } - Compound_Selector_Ptr Element_Selector::unify_with(Compound_Selector_Ptr rhs) + Compound_Selector_Ptr Type_Selector::unify_with(Compound_Selector_Ptr rhs) { // TODO: handle namespaces @@ -89,10 +88,10 @@ namespace Sass { // otherwise, this is a tag name if (name() == "*") { - if (typeid(*rhs_0) == typeid(Element_Selector)) + if (typeid(*rhs_0) == typeid(Type_Selector)) { // if rhs is universal, just return this tagname + rhs's qualifiers - Element_Selector_Ptr ts = Cast(rhs_0); + Type_Selector_Ptr ts = Cast(rhs_0); rhs->at(0) = this->unify_with(ts); return rhs; } @@ -107,7 +106,7 @@ namespace Sass { return rhs; } - if (typeid(*rhs_0) == typeid(Element_Selector)) + if (typeid(*rhs_0) == typeid(Type_Selector)) { // if rhs is universal, just return this tagname + rhs's qualifiers if (rhs_0->name() != "*" && rhs_0->ns() != "*" && rhs_0->name() != name()) return 0; diff --git a/src/ast_selectors.cpp b/src/ast_selectors.cpp index b1b7840ee..fcb8fc2cb 100644 --- a/src/ast_selectors.cpp +++ b/src/ast_selectors.cpp @@ -361,7 +361,7 @@ namespace Sass { Compound_Selector_Obj rh = last()->head(); size_t i; size_t L = h->length(); - if (Cast(h->first())) { + if (Cast(h->first())) { if (Class_Selector_Ptr cs = Cast(rh->last())) { Class_Selector_Ptr sqs = SASS_MEMORY_COPY(cs); sqs->name(sqs->name() + (*h)[0]->name()); @@ -376,8 +376,8 @@ namespace Sass { (*rh)[rh->length()-1] = sqs; rh->pstate(h->pstate()); for (i = 1; i < L; ++i) rh->append((*h)[i]); - } else if (Element_Selector_Ptr ts = Cast(rh->last())) { - Element_Selector_Ptr tss = SASS_MEMORY_COPY(ts); + } else if (Type_Selector_Ptr ts = Cast(rh->last())) { + Type_Selector_Ptr tss = SASS_MEMORY_COPY(ts); tss->name(tss->name() + (*h)[0]->name()); tss->pstate((*h)[0]->pstate()); (*rh)[rh->length()-1] = tss; @@ -899,7 +899,7 @@ namespace Sass { IMPLEMENT_AST_OPERATORS(Attribute_Selector); IMPLEMENT_AST_OPERATORS(Compound_Selector); IMPLEMENT_AST_OPERATORS(Complex_Selector); - IMPLEMENT_AST_OPERATORS(Element_Selector); + IMPLEMENT_AST_OPERATORS(Type_Selector); IMPLEMENT_AST_OPERATORS(Class_Selector); IMPLEMENT_AST_OPERATORS(Id_Selector); IMPLEMENT_AST_OPERATORS(Pseudo_Selector); diff --git a/src/ast_selectors.hpp b/src/ast_selectors.hpp index 9e520c3b9..a81a697a7 100644 --- a/src/ast_selectors.hpp +++ b/src/ast_selectors.hpp @@ -319,14 +319,14 @@ namespace Sass { }; ///////////////////////////////////////////////////////////////////// - // Element selectors (and the universal selector) -- e.g., div, span, *. + // Type selectors (and the universal selector) -- e.g., div, span, *. ///////////////////////////////////////////////////////////////////// - class Element_Selector final : public Simple_Selector { + class Type_Selector final : public Simple_Selector { public: - Element_Selector(ParserState pstate, std::string n) + Type_Selector(ParserState pstate, std::string n) : Simple_Selector(pstate, n) { simple_type(TYPE_SEL); } - Element_Selector(const Element_Selector* ptr) + Type_Selector(const Type_Selector* ptr) : Simple_Selector(ptr) { simple_type(TYPE_SEL); } unsigned long specificity() const override @@ -342,9 +342,9 @@ namespace Sass { Compound_Selector_Ptr unify_with(Compound_Selector_Ptr) override; bool operator<(const Simple_Selector& rhs) const final override; bool operator==(const Simple_Selector& rhs) const final override; - bool operator<(const Element_Selector& rhs) const; - bool operator==(const Element_Selector& rhs) const; - ATTACH_AST_OPERATIONS(Element_Selector) + bool operator<(const Type_Selector& rhs) const; + bool operator==(const Type_Selector& rhs) const; + ATTACH_AST_OPERATIONS(Type_Selector) ATTACH_CRTP_PERFORM_METHODS() }; @@ -599,7 +599,7 @@ namespace Sass { Simple_Selector_Ptr base() const { if (length() == 0) return 0; // ToDo: why is this needed? - if (Cast((*this)[0])) + if (Cast((*this)[0])) return (*this)[0]; return 0; } diff --git a/src/ast_values.hpp b/src/ast_values.hpp index 21285c3c0..2c029a268 100644 --- a/src/ast_values.hpp +++ b/src/ast_values.hpp @@ -39,7 +39,7 @@ namespace Sass { class PreValue : public Expression { public: PreValue(ParserState pstate, - bool d = false, bool e = false, bool i = false, Concrete_Type ct = NONE) + bool d = false, bool e = false, bool i = false, Type ct = NONE) : Expression(pstate, d, e, i, ct) { } PreValue(const PreValue* ptr) @@ -55,7 +55,7 @@ namespace Sass { class Value : public PreValue { public: Value(ParserState pstate, - bool d = false, bool e = false, bool i = false, Concrete_Type ct = NONE) + bool d = false, bool e = false, bool i = false, Type ct = NONE) : PreValue(pstate, d, e, i, ct) { } Value(const Value* ptr) @@ -530,7 +530,7 @@ namespace Sass { static std::string type_name() { return "string"; } virtual ~String() = 0; virtual void rtrim() = 0; - virtual bool operator<(const Expression& rhs) const { + virtual bool operator<(const Expression& rhs) const override { return this->to_string() < rhs.to_string(); }; ATTACH_VIRTUAL_AST_OPERATIONS(String); diff --git a/src/debugger.hpp b/src/debugger.hpp index d1af42639..ec774bcda 100644 --- a/src/debugger.hpp +++ b/src/debugger.hpp @@ -235,9 +235,9 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << (selector->has_line_break() ? " [line-break]": " -"); std::cerr << (selector->has_line_feed() ? " [line-feed]": " -"); std::cerr << std::endl; - } else if (Cast(node)) { - Element_Selector_Ptr selector = Cast(node); - std::cerr << ind << "Element_Selector " << selector; + } else if (Cast(node)) { + Type_Selector_Ptr selector = Cast(node); + std::cerr << ind << "Type_Selector " << selector; std::cerr << " (" << pstate_source_position(node) << ")"; std::cerr << " <" << selector->hash() << ">"; std::cerr << " <<" << selector->ns_name() << ">>"; @@ -682,21 +682,21 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env) std::cerr << ind << "Expression " << expression; std::cerr << " (" << pstate_source_position(node) << ")"; switch (expression->concrete_type()) { - case Expression::Concrete_Type::NONE: std::cerr << " [NONE]"; break; - case Expression::Concrete_Type::BOOLEAN: std::cerr << " [BOOLEAN]"; break; - case Expression::Concrete_Type::NUMBER: std::cerr << " [NUMBER]"; break; - case Expression::Concrete_Type::COLOR: std::cerr << " [COLOR]"; break; - case Expression::Concrete_Type::STRING: std::cerr << " [STRING]"; break; - case Expression::Concrete_Type::LIST: std::cerr << " [LIST]"; break; - case Expression::Concrete_Type::MAP: std::cerr << " [MAP]"; break; - case Expression::Concrete_Type::SELECTOR: std::cerr << " [SELECTOR]"; break; - case Expression::Concrete_Type::NULL_VAL: std::cerr << " [NULL_VAL]"; break; - case Expression::Concrete_Type::C_WARNING: std::cerr << " [C_WARNING]"; break; - case Expression::Concrete_Type::C_ERROR: std::cerr << " [C_ERROR]"; break; - case Expression::Concrete_Type::FUNCTION: std::cerr << " [FUNCTION]"; break; - case Expression::Concrete_Type::NUM_TYPES: std::cerr << " [NUM_TYPES]"; break; - case Expression::Concrete_Type::VARIABLE: std::cerr << " [VARIABLE]"; break; - case Expression::Concrete_Type::FUNCTION_VAL: std::cerr << " [FUNCTION_VAL]"; break; + case Expression::Type::NONE: std::cerr << " [NONE]"; break; + case Expression::Type::BOOLEAN: std::cerr << " [BOOLEAN]"; break; + case Expression::Type::NUMBER: std::cerr << " [NUMBER]"; break; + case Expression::Type::COLOR: std::cerr << " [COLOR]"; break; + case Expression::Type::STRING: std::cerr << " [STRING]"; break; + case Expression::Type::LIST: std::cerr << " [LIST]"; break; + case Expression::Type::MAP: std::cerr << " [MAP]"; break; + case Expression::Type::SELECTOR: std::cerr << " [SELECTOR]"; break; + case Expression::Type::NULL_VAL: std::cerr << " [NULL_VAL]"; break; + case Expression::Type::C_WARNING: std::cerr << " [C_WARNING]"; break; + case Expression::Type::C_ERROR: std::cerr << " [C_ERROR]"; break; + case Expression::Type::FUNCTION: std::cerr << " [FUNCTION]"; break; + case Expression::Type::NUM_TYPES: std::cerr << " [NUM_TYPES]"; break; + case Expression::Type::VARIABLE: std::cerr << " [VARIABLE]"; break; + case Expression::Type::FUNCTION_VAL: std::cerr << " [FUNCTION_VAL]"; break; case Expression::Type::PARENT: std::cerr << " [PARENT]"; break; } std::cerr << std::endl; diff --git a/src/eval.cpp b/src/eval.cpp index 306088f06..44e0e49e1 100644 --- a/src/eval.cpp +++ b/src/eval.cpp @@ -745,8 +745,8 @@ namespace Sass { AST_Node_Obj lu = lhs; AST_Node_Obj ru = rhs; - Expression::Concrete_Type l_type; - Expression::Concrete_Type r_type; + Expression::Type l_type; + Expression::Type r_type; // Is one of the operands an interpolant? String_Schema_Obj s1 = Cast(b->left()); diff --git a/src/eval.hpp b/src/eval.hpp index 741472e81..3ba431a85 100644 --- a/src/eval.hpp +++ b/src/eval.hpp @@ -87,7 +87,7 @@ namespace Sass { 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; }; - Element_Selector_Ptr operator()(Element_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; }; diff --git a/src/extend.cpp b/src/extend.cpp index e2a1309db..86c201aa4 100644 --- a/src/extend.cpp +++ b/src/extend.cpp @@ -283,7 +283,7 @@ namespace Sass { static bool parentSuperselector(Complex_Selector_Ptr pOne, Complex_Selector_Ptr 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... - Element_Selector_Obj fakeParent = SASS_MEMORY_NEW(Element_Selector, ParserState("[FAKE]"), "temp"); + Type_Selector_Obj fakeParent = SASS_MEMORY_NEW(Type_Selector, ParserState("[FAKE]"), "temp"); Compound_Selector_Obj fakeHead = SASS_MEMORY_NEW(Compound_Selector, ParserState("[FAKE]"), 1 /*size*/); fakeHead->elements().push_back(fakeParent); Complex_Selector_Obj fakeParentContainer = SASS_MEMORY_NEW(Complex_Selector, ParserState("[FAKE]"), Complex_Selector::ANCESTOR_OF, fakeHead /*head*/, {} /*tail*/); @@ -643,7 +643,7 @@ namespace Sass { static bool parentSuperselector(const Node& one, const Node& two) { // 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... - Element_Selector_Obj fakeParent = SASS_MEMORY_NEW(Element_Selector, ParserState("[FAKE]"), "temp"); + Type_Selector_Obj fakeParent = SASS_MEMORY_NEW(Type_Selector, ParserState("[FAKE]"), "temp"); Compound_Selector_Obj fakeHead = SASS_MEMORY_NEW(Compound_Selector, ParserState("[FAKE]"), 1 /*size*/); fakeHead->elements().push_back(fakeParent); Complex_Selector_Obj fakeParentContainer = SASS_MEMORY_NEW(Complex_Selector, ParserState("[FAKE]"), Complex_Selector::ANCESTOR_OF, fakeHead /*head*/, {} /*tail*/); @@ -1943,7 +1943,7 @@ namespace Sass { // special case for ruby ass if (sl->empty()) { // this seems inconsistent but it is how ruby sass seems to remove parentheses - cpy_head->append(SASS_MEMORY_NEW(Element_Selector, hs->pstate(), ws->name())); + cpy_head->append(SASS_MEMORY_NEW(Type_Selector, hs->pstate(), ws->name())); } // has wrapped not selectors else if (ws->name() == ":not") { diff --git a/src/fn_selectors.cpp b/src/fn_selectors.cpp index 31388612a..37663a40c 100644 --- a/src/fn_selectors.cpp +++ b/src/fn_selectors.cpp @@ -128,7 +128,7 @@ namespace Sass { } // Cannot be a Universal selector - Element_Selector_Obj pType = Cast(childSeq->head()->first()); + Type_Selector_Obj pType = Cast(childSeq->head()->first()); if(pType && pType->name() == "*") { std::string msg("Can't append \""); msg += childSeq->to_string(); diff --git a/src/inspect.cpp b/src/inspect.cpp index b56fd89aa..2fb04a78c 100644 --- a/src/inspect.cpp +++ b/src/inspect.cpp @@ -924,7 +924,7 @@ namespace Sass { } - void Inspect::operator()(Element_Selector_Ptr s) + void Inspect::operator()(Type_Selector_Ptr s) { append_token(s->ns_name(), s); } diff --git a/src/inspect.hpp b/src/inspect.hpp index 774290d3f..223be17ce 100644 --- a/src/inspect.hpp +++ b/src/inspect.hpp @@ -79,7 +79,7 @@ namespace Sass { // selectors virtual void operator()(Selector_Schema_Ptr); virtual void operator()(Placeholder_Selector_Ptr); - virtual void operator()(Element_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); diff --git a/src/operation.hpp b/src/operation.hpp index 977a5d1c5..71e13dcf9 100644 --- a/src/operation.hpp +++ b/src/operation.hpp @@ -103,7 +103,7 @@ namespace Sass { // selectors virtual T operator()(Selector_Schema_Ptr x) = 0; virtual T operator()(Placeholder_Selector_Ptr x) = 0; - virtual T operator()(Element_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; @@ -184,7 +184,7 @@ namespace Sass { // 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()(Element_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); } diff --git a/src/parser.cpp b/src/parser.cpp index 3cdf0a99e..04937034a 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -851,7 +851,7 @@ namespace Sass { // parse type selector else if (lex< re_type_selector >(false)) { - seq->append(SASS_MEMORY_NEW(Element_Selector, pstate, lexed)); + seq->append(SASS_MEMORY_NEW(Type_Selector, pstate, lexed)); } // peek for abort conditions else if (peek< spaces >()) break; @@ -886,7 +886,7 @@ namespace Sass { return SASS_MEMORY_NEW(Id_Selector, pstate, lexed); } else if (lex< alternatives < variable, number, static_reference_combinator > >()) { - return SASS_MEMORY_NEW(Element_Selector, pstate, lexed); + return SASS_MEMORY_NEW(Type_Selector, pstate, lexed); } else if (peek< pseudo_not >()) { return parse_negated_selector();