Skip to content

Commit

Permalink
Merge pull request #3025 from mgreter/feature/prepare-for-refactor
Browse files Browse the repository at this point in the history
Preparations for backport and refactoring
  • Loading branch information
mgreter authored Nov 12, 2019
2 parents d911058 + ec125db commit 97be6a3
Show file tree
Hide file tree
Showing 95 changed files with 2,481 additions and 2,471 deletions.
2 changes: 1 addition & 1 deletion docs/api-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ with the short description:
* 1: normal errors like parsing or `eval` errors
* 2: bad allocation error (memory error)
* 3: "untranslated" C++ exception (`throw std::exception`)
* 4: legacy string exceptions ( `throw const char*` or `std::string` )
* 4: legacy string exceptions ( `throw const char*` or `sass::string` )
* 5: Some other unknown exception

Although for the API consumer, error codes do not offer much value except
Expand Down
232 changes: 116 additions & 116 deletions src/ast.cpp

Large diffs are not rendered by default.

312 changes: 156 additions & 156 deletions src/ast.hpp

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/ast_def_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ public: \
#ifdef DEBUG_SHARED_PTR

#define ATTACH_ABSTRACT_AST_OPERATIONS(klass) \
virtual klass* copy(std::string, size_t) const = 0; \
virtual klass* clone(std::string, size_t) const = 0; \
virtual klass* copy(sass::string, size_t) const = 0; \
virtual klass* clone(sass::string, size_t) const = 0; \

#define ATTACH_VIRTUAL_AST_OPERATIONS(klass) \
klass(const klass* ptr); \
virtual klass* copy(std::string, size_t) const override = 0; \
virtual klass* clone(std::string, size_t) const override = 0; \
virtual klass* copy(sass::string, size_t) const override = 0; \
virtual klass* clone(sass::string, size_t) const override = 0; \

#define ATTACH_AST_OPERATIONS(klass) \
klass(const klass* ptr); \
virtual klass* copy(std::string, size_t) const override; \
virtual klass* clone(std::string, size_t) const override; \
virtual klass* copy(sass::string, size_t) const override; \
virtual klass* clone(sass::string, size_t) const override; \

#else

Expand Down Expand Up @@ -112,12 +112,12 @@ public: \
#ifdef DEBUG_SHARED_PTR

#define IMPLEMENT_AST_OPERATORS(klass) \
klass* klass::copy(std::string file, size_t line) const { \
klass* klass::copy(sass::string file, size_t line) const { \
klass* cpy = new klass(this); \
cpy->trace(file, line); \
return cpy; \
} \
klass* klass::clone(std::string file, size_t line) const { \
klass* klass::clone(sass::string file, size_t line) const { \
klass* cpy = copy(file, line); \
cpy->cloneChildren(); \
return cpy; \
Expand Down
4 changes: 2 additions & 2 deletions src/ast_fwd_decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ namespace Sass {
IMPLEMENT_BASE_CAST(AST_Node)
IMPLEMENT_BASE_CAST(Expression)
IMPLEMENT_BASE_CAST(Statement)
IMPLEMENT_BASE_CAST(Has_Block)
IMPLEMENT_BASE_CAST(ParentStatement)
IMPLEMENT_BASE_CAST(PreValue)
IMPLEMENT_BASE_CAST(Value)
IMPLEMENT_BASE_CAST(Color)
IMPLEMENT_BASE_CAST(List)
IMPLEMENT_BASE_CAST(String)
IMPLEMENT_BASE_CAST(String_Constant)
IMPLEMENT_BASE_CAST(Supports_Condition)
IMPLEMENT_BASE_CAST(SupportsCondition)
IMPLEMENT_BASE_CAST(Selector)
IMPLEMENT_BASE_CAST(SelectorComponent)
IMPLEMENT_BASE_CAST(SimpleSelector)
Expand Down
100 changes: 50 additions & 50 deletions src/ast_fwd_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Sass {

class AST_Node;

class Has_Block;
class ParentStatement;

class SimpleSelector;

Expand All @@ -27,33 +27,33 @@ namespace Sass {
class Statement;
class Value;
class Declaration;
class Ruleset;
class StyleRule;
class Bubble;
class Trace;

class MediaRule;
class CssMediaRule;
class CssMediaQuery;

class Supports_Block;
class Directive;
class SupportsRule;
class AtRule;

class Keyframe_Rule;
class At_Root_Block;
class AtRootRule;
class Assignment;

class Import;
class Import_Stub;
class Warning;
class WarningRule;

class Error;
class Debug;
class ErrorRule;
class DebugRule;
class Comment;

class If;
class For;
class Each;
class While;
class ForRule;
class EachRule;
class WhileRule;
class Return;
class Content;
class ExtendRule;
Expand Down Expand Up @@ -85,10 +85,10 @@ namespace Sass {

class Media_Query;
class Media_Query_Expression;
class Supports_Condition;
class Supports_Operator;
class Supports_Negation;
class Supports_Declaration;
class SupportsCondition;
class SupportsOperation;
class SupportsNegation;
class SupportsDeclaration;
class Supports_Interpolation;

class At_Root_Query;
Expand All @@ -100,13 +100,13 @@ namespace Sass {


class Selector_Schema;
class Placeholder_Selector;
class Type_Selector;
class Class_Selector;
class Id_Selector;
class Attribute_Selector;
class PlaceholderSelector;
class TypeSelector;
class ClassSelector;
class IDSelector;
class AttributeSelector;

class Pseudo_Selector;
class PseudoSelector;

class SelectorComponent;
class SelectorCombinator;
Expand All @@ -131,30 +131,30 @@ namespace Sass {
IMPL_MEM_OBJ(AST_Node);
IMPL_MEM_OBJ(Statement);
IMPL_MEM_OBJ(Block);
IMPL_MEM_OBJ(Ruleset);
IMPL_MEM_OBJ(StyleRule);
IMPL_MEM_OBJ(Bubble);
IMPL_MEM_OBJ(Trace);
IMPL_MEM_OBJ(MediaRule);
IMPL_MEM_OBJ(CssMediaRule);
IMPL_MEM_OBJ(CssMediaQuery);
IMPL_MEM_OBJ(Supports_Block);
IMPL_MEM_OBJ(Directive);
IMPL_MEM_OBJ(SupportsRule);
IMPL_MEM_OBJ(AtRule);
IMPL_MEM_OBJ(Keyframe_Rule);
IMPL_MEM_OBJ(At_Root_Block);
IMPL_MEM_OBJ(AtRootRule);
IMPL_MEM_OBJ(Declaration);
IMPL_MEM_OBJ(Assignment);
IMPL_MEM_OBJ(Import);
IMPL_MEM_OBJ(Import_Stub);
IMPL_MEM_OBJ(Warning);
IMPL_MEM_OBJ(Error);
IMPL_MEM_OBJ(Debug);
IMPL_MEM_OBJ(WarningRule);
IMPL_MEM_OBJ(ErrorRule);
IMPL_MEM_OBJ(DebugRule);
IMPL_MEM_OBJ(Comment);
IMPL_MEM_OBJ(PreValue);
IMPL_MEM_OBJ(Has_Block);
IMPL_MEM_OBJ(ParentStatement);
IMPL_MEM_OBJ(If);
IMPL_MEM_OBJ(For);
IMPL_MEM_OBJ(Each);
IMPL_MEM_OBJ(While);
IMPL_MEM_OBJ(ForRule);
IMPL_MEM_OBJ(EachRule);
IMPL_MEM_OBJ(WhileRule);
IMPL_MEM_OBJ(Return);
IMPL_MEM_OBJ(Content);
IMPL_MEM_OBJ(ExtendRule);
Expand Down Expand Up @@ -182,10 +182,10 @@ namespace Sass {
IMPL_MEM_OBJ(String_Quoted);
IMPL_MEM_OBJ(Media_Query);
IMPL_MEM_OBJ(Media_Query_Expression);
IMPL_MEM_OBJ(Supports_Condition);
IMPL_MEM_OBJ(Supports_Operator);
IMPL_MEM_OBJ(Supports_Negation);
IMPL_MEM_OBJ(Supports_Declaration);
IMPL_MEM_OBJ(SupportsCondition);
IMPL_MEM_OBJ(SupportsOperation);
IMPL_MEM_OBJ(SupportsNegation);
IMPL_MEM_OBJ(SupportsDeclaration);
IMPL_MEM_OBJ(Supports_Interpolation);
IMPL_MEM_OBJ(At_Root_Query);
IMPL_MEM_OBJ(Null);
Expand All @@ -197,12 +197,12 @@ namespace Sass {
IMPL_MEM_OBJ(Selector);
IMPL_MEM_OBJ(Selector_Schema);
IMPL_MEM_OBJ(SimpleSelector);
IMPL_MEM_OBJ(Placeholder_Selector);
IMPL_MEM_OBJ(Type_Selector);
IMPL_MEM_OBJ(Class_Selector);
IMPL_MEM_OBJ(Id_Selector);
IMPL_MEM_OBJ(Attribute_Selector);
IMPL_MEM_OBJ(Pseudo_Selector);
IMPL_MEM_OBJ(PlaceholderSelector);
IMPL_MEM_OBJ(TypeSelector);
IMPL_MEM_OBJ(ClassSelector);
IMPL_MEM_OBJ(IDSelector);
IMPL_MEM_OBJ(AttributeSelector);
IMPL_MEM_OBJ(PseudoSelector);

IMPL_MEM_OBJ(SelectorComponent);
IMPL_MEM_OBJ(SelectorCombinator);
Expand All @@ -214,12 +214,12 @@ namespace Sass {
// some often used typedefs
// ###########################################################################

typedef std::vector<Block*> BlockStack;
typedef std::vector<Sass_Callee> CalleeStack;
typedef std::vector<AST_Node_Obj> CallStack;
typedef std::vector<CssMediaRuleObj> MediaStack;
typedef std::vector<SelectorListObj> SelectorStack;
typedef std::vector<Sass_Import_Entry> ImporterStack;
typedef sass::vector<Block*> BlockStack;
typedef sass::vector<Sass_Callee> CalleeStack;
typedef sass::vector<AST_Node_Obj> CallStack;
typedef sass::vector<CssMediaRuleObj> MediaStack;
typedef sass::vector<SelectorListObj> SelectorStack;
typedef sass::vector<Sass_Import_Entry> ImporterStack;

// only to switch implementations for testing
#define environment_map std::map
Expand Down Expand Up @@ -248,14 +248,14 @@ namespace Sass {
DECLARE_BASE_CAST(AST_Node)
DECLARE_BASE_CAST(Expression)
DECLARE_BASE_CAST(Statement)
DECLARE_BASE_CAST(Has_Block)
DECLARE_BASE_CAST(ParentStatement)
DECLARE_BASE_CAST(PreValue)
DECLARE_BASE_CAST(Value)
DECLARE_BASE_CAST(List)
DECLARE_BASE_CAST(Color)
DECLARE_BASE_CAST(String)
DECLARE_BASE_CAST(String_Constant)
DECLARE_BASE_CAST(Supports_Condition)
DECLARE_BASE_CAST(SupportsCondition)
DECLARE_BASE_CAST(Selector)
DECLARE_BASE_CAST(SimpleSelector)
DECLARE_BASE_CAST(SelectorComponent)
Expand Down
10 changes: 5 additions & 5 deletions src/ast_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ namespace Sass {
// that can be written with pseudo-class syntax (CSS2 vs CSS3):
// `:before`, `:after`, `:first-line`, or `:first-letter`
// ##########################################################################
inline bool isFakePseudoElement(const std::string& name)
inline bool isFakePseudoElement(const sass::string& name)
{
return Util::equalsLiteral("after", name)
|| Util::equalsLiteral("before", name)
Expand All @@ -241,7 +241,7 @@ namespace Sass {
// and that are subselectors of their arguments.
// For example, `.foo` is a superselector of `:matches(.foo)`.
// ##########################################################################
inline bool isSubselectorPseudo(const std::string& norm)
inline bool isSubselectorPseudo(const sass::string& norm)
{
return Util::equalsLiteral("any", norm)
|| Util::equalsLiteral("matches", norm)
Expand All @@ -253,7 +253,7 @@ namespace Sass {
// ###########################################################################
// Pseudo-class selectors that take unadorned selectors as arguments.
// ###########################################################################
inline bool isSelectorPseudoClass(const std::string& test)
inline bool isSelectorPseudoClass(const sass::string& test)
{
return Util::equalsLiteral("not", test)
|| Util::equalsLiteral("matches", test)
Expand All @@ -268,7 +268,7 @@ namespace Sass {
// ###########################################################################
// Pseudo-element selectors that take unadorned selectors as arguments.
// ###########################################################################
inline bool isSelectorPseudoElement(const std::string& test)
inline bool isSelectorPseudoElement(const sass::string& test)
{
return Util::equalsLiteral("slotted", test);
}
Expand All @@ -277,7 +277,7 @@ namespace Sass {
// ###########################################################################
// Pseudo-element selectors that has binominals
// ###########################################################################
inline bool isSelectorPseudoBinominal(const std::string& test)
inline bool isSelectorPseudoBinominal(const sass::string& test)
{
return Util::equalsLiteral("nth-child", test)
|| Util::equalsLiteral("nth-last-child", test);
Expand Down
Loading

0 comments on commit 97be6a3

Please sign in to comment.