sassc 1.7.1 → 1.8.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/ext/libsass/.gitignore +10 -6
- data/ext/libsass/.travis.yml +4 -1
- data/ext/libsass/GNUmakefile.am +88 -0
- data/ext/libsass/Makefile +157 -76
- data/ext/libsass/Makefile.conf +47 -0
- data/ext/libsass/Readme.md +13 -14
- data/ext/libsass/appveyor.yml +25 -41
- data/ext/libsass/configure.ac +20 -7
- data/ext/libsass/contrib/plugin.cpp +1 -1
- data/ext/libsass/include/sass.h +15 -0
- data/ext/libsass/{sass.h → include/sass/base.h} +17 -9
- data/ext/libsass/{sass_context.h → include/sass/context.h} +3 -1
- data/ext/libsass/{sass_functions.h → include/sass/functions.h} +4 -4
- data/ext/libsass/{sass_interface.h → include/sass/interface.h} +5 -2
- data/ext/libsass/{sass_values.h → include/sass/values.h} +15 -1
- data/ext/libsass/{sass_version.h → include/sass/version.h} +0 -0
- data/ext/libsass/{sass_version.h.in → include/sass/version.h.in} +0 -0
- data/ext/libsass/{sass2scss.h → include/sass2scss.h} +6 -7
- data/ext/libsass/m4/m4-ax_cxx_compile_stdcxx_11.m4 +167 -0
- data/ext/libsass/script/ci-build-libsass +67 -23
- data/ext/libsass/src/GNUmakefile.am +54 -0
- data/ext/libsass/src/ast.cpp +2029 -0
- data/ext/libsass/{ast.hpp → src/ast.hpp} +832 -660
- data/ext/libsass/src/ast_def_macros.hpp +47 -0
- data/ext/libsass/src/ast_factory.hpp +93 -0
- data/ext/libsass/{ast_fwd_decl.hpp → src/ast_fwd_decl.hpp} +9 -4
- data/ext/libsass/{b64 → src/b64}/cencode.h +1 -1
- data/ext/libsass/{b64 → src/b64}/encode.h +0 -0
- data/ext/libsass/{backtrace.hpp → src/backtrace.hpp} +9 -10
- data/ext/libsass/{base64vlq.cpp → src/base64vlq.cpp} +2 -2
- data/ext/libsass/{base64vlq.hpp → src/base64vlq.hpp} +1 -2
- data/ext/libsass/{bind.cpp → src/bind.cpp} +96 -59
- data/ext/libsass/{bind.hpp → src/bind.hpp} +1 -1
- data/ext/libsass/src/c99func.c +54 -0
- data/ext/libsass/{cencode.c → src/cencode.c} +5 -5
- data/ext/libsass/src/color_maps.cpp +643 -0
- data/ext/libsass/src/color_maps.hpp +333 -0
- data/ext/libsass/{constants.cpp → src/constants.cpp} +10 -1
- data/ext/libsass/{constants.hpp → src/constants.hpp} +7 -0
- data/ext/libsass/{context.cpp → src/context.cpp} +152 -122
- data/ext/libsass/src/context.hpp +150 -0
- data/ext/libsass/{cssize.cpp → src/cssize.cpp} +123 -109
- data/ext/libsass/{cssize.hpp → src/cssize.hpp} +9 -13
- data/ext/libsass/{debug.hpp → src/debug.hpp} +9 -9
- data/ext/libsass/src/debugger.hpp +683 -0
- data/ext/libsass/{emitter.cpp → src/emitter.cpp} +13 -13
- data/ext/libsass/{emitter.hpp → src/emitter.hpp} +10 -11
- data/ext/libsass/src/environment.cpp +184 -0
- data/ext/libsass/src/environment.hpp +92 -0
- data/ext/libsass/src/error_handling.cpp +46 -0
- data/ext/libsass/src/error_handling.hpp +34 -0
- data/ext/libsass/src/eval.cpp +1462 -0
- data/ext/libsass/src/eval.hpp +107 -0
- data/ext/libsass/src/expand.cpp +653 -0
- data/ext/libsass/{expand.hpp → src/expand.hpp} +17 -16
- data/ext/libsass/{extend.cpp → src/extend.cpp} +198 -139
- data/ext/libsass/{extend.hpp → src/extend.hpp} +7 -8
- data/ext/libsass/{file.cpp → src/file.cpp} +103 -57
- data/ext/libsass/{file.hpp → src/file.hpp} +23 -14
- data/ext/libsass/{functions.cpp → src/functions.cpp} +642 -333
- data/ext/libsass/{functions.hpp → src/functions.hpp} +17 -4
- data/ext/libsass/{inspect.cpp → src/inspect.cpp} +147 -260
- data/ext/libsass/{inspect.hpp → src/inspect.hpp} +7 -7
- data/ext/libsass/{json.cpp → src/json.cpp} +33 -43
- data/ext/libsass/{json.hpp → src/json.hpp} +1 -1
- data/ext/libsass/{kwd_arg_macros.hpp → src/kwd_arg_macros.hpp} +0 -0
- data/ext/libsass/{lexer.cpp → src/lexer.cpp} +28 -0
- data/ext/libsass/{lexer.hpp → src/lexer.hpp} +25 -10
- data/ext/libsass/{listize.cpp → src/listize.cpp} +17 -13
- data/ext/libsass/{listize.hpp → src/listize.hpp} +0 -2
- data/ext/libsass/{mapping.hpp → src/mapping.hpp} +0 -0
- data/ext/libsass/src/memory_manager.cpp +76 -0
- data/ext/libsass/src/memory_manager.hpp +48 -0
- data/ext/libsass/{node.cpp → src/node.cpp} +89 -18
- data/ext/libsass/{node.hpp → src/node.hpp} +5 -6
- data/ext/libsass/{operation.hpp → src/operation.hpp} +18 -12
- data/ext/libsass/{output.cpp → src/output.cpp} +47 -55
- data/ext/libsass/{output.hpp → src/output.hpp} +5 -4
- data/ext/libsass/src/parser.cpp +2529 -0
- data/ext/libsass/{parser.hpp → src/parser.hpp} +84 -60
- data/ext/libsass/{paths.hpp → src/paths.hpp} +10 -13
- data/ext/libsass/{plugins.cpp → src/plugins.cpp} +14 -17
- data/ext/libsass/{plugins.hpp → src/plugins.hpp} +10 -11
- data/ext/libsass/{position.cpp → src/position.cpp} +5 -6
- data/ext/libsass/{position.hpp → src/position.hpp} +19 -22
- data/ext/libsass/{prelexer.cpp → src/prelexer.cpp} +401 -53
- data/ext/libsass/{prelexer.hpp → src/prelexer.hpp} +50 -10
- data/ext/libsass/{remove_placeholders.cpp → src/remove_placeholders.cpp} +12 -16
- data/ext/libsass/{remove_placeholders.hpp → src/remove_placeholders.hpp} +1 -7
- data/ext/libsass/{sass.cpp → src/sass.cpp} +3 -5
- data/ext/libsass/{sass2scss.cpp → src/sass2scss.cpp} +51 -46
- data/ext/libsass/{sass_context.cpp → src/sass_context.cpp} +114 -112
- data/ext/libsass/{sass_functions.cpp → src/sass_functions.cpp} +11 -18
- data/ext/libsass/{sass_interface.cpp → src/sass_interface.cpp} +44 -81
- data/ext/libsass/{sass_util.cpp → src/sass_util.cpp} +26 -8
- data/ext/libsass/{sass_util.hpp → src/sass_util.hpp} +14 -18
- data/ext/libsass/{sass_values.cpp → src/sass_values.cpp} +91 -20
- data/ext/libsass/{source_map.cpp → src/source_map.cpp} +13 -13
- data/ext/libsass/{source_map.hpp → src/source_map.hpp} +9 -9
- data/ext/libsass/{subset_map.hpp → src/subset_map.hpp} +29 -31
- data/ext/libsass/{support → src/support}/libsass.pc.in +0 -0
- data/ext/libsass/src/to_c.cpp +73 -0
- data/ext/libsass/src/to_c.hpp +41 -0
- data/ext/libsass/src/to_string.cpp +47 -0
- data/ext/libsass/{to_string.hpp → src/to_string.hpp} +9 -7
- data/ext/libsass/src/to_value.cpp +109 -0
- data/ext/libsass/src/to_value.hpp +50 -0
- data/ext/libsass/{units.cpp → src/units.cpp} +56 -51
- data/ext/libsass/{units.hpp → src/units.hpp} +8 -9
- data/ext/libsass/{utf8.h → src/utf8.h} +0 -0
- data/ext/libsass/{utf8 → src/utf8}/checked.h +0 -0
- data/ext/libsass/{utf8 → src/utf8}/core.h +12 -12
- data/ext/libsass/{utf8 → src/utf8}/unchecked.h +0 -0
- data/ext/libsass/{utf8_string.cpp → src/utf8_string.cpp} +0 -0
- data/ext/libsass/{utf8_string.hpp → src/utf8_string.hpp} +6 -6
- data/ext/libsass/{util.cpp → src/util.cpp} +144 -86
- data/ext/libsass/src/util.hpp +59 -0
- data/ext/libsass/src/values.cpp +137 -0
- data/ext/libsass/src/values.hpp +12 -0
- data/ext/libsass/test/test_node.cpp +33 -33
- data/ext/libsass/test/test_paths.cpp +5 -6
- data/ext/libsass/test/test_selector_difference.cpp +4 -5
- data/ext/libsass/test/test_specificity.cpp +4 -5
- data/ext/libsass/test/test_subset_map.cpp +91 -91
- data/ext/libsass/test/test_superselector.cpp +11 -11
- data/ext/libsass/test/test_unification.cpp +4 -4
- data/ext/libsass/win/libsass.targets +101 -0
- data/ext/libsass/win/libsass.vcxproj +45 -127
- data/ext/libsass/win/libsass.vcxproj.filters +303 -0
- data/lib/sassc/import_handler.rb +1 -1
- data/lib/sassc/native/native_functions_api.rb +3 -3
- data/lib/sassc/version.rb +1 -1
- data/test/custom_importer_test.rb +1 -4
- data/test/functions_test.rb +3 -2
- data/test/native_test.rb +4 -3
- metadata +117 -110
- data/ext/libsass/Makefile.am +0 -146
- data/ext/libsass/ast.cpp +0 -945
- data/ext/libsass/ast_def_macros.hpp +0 -21
- data/ext/libsass/ast_factory.hpp +0 -92
- data/ext/libsass/color_names.hpp +0 -327
- data/ext/libsass/context.hpp +0 -157
- data/ext/libsass/contextualize.cpp +0 -148
- data/ext/libsass/contextualize.hpp +0 -46
- data/ext/libsass/contextualize_eval.cpp +0 -93
- data/ext/libsass/contextualize_eval.hpp +0 -44
- data/ext/libsass/debugger.hpp +0 -558
- data/ext/libsass/environment.hpp +0 -163
- data/ext/libsass/error_handling.cpp +0 -35
- data/ext/libsass/error_handling.hpp +0 -32
- data/ext/libsass/eval.cpp +0 -1392
- data/ext/libsass/eval.hpp +0 -88
- data/ext/libsass/expand.cpp +0 -575
- data/ext/libsass/memory_manager.hpp +0 -57
- data/ext/libsass/parser.cpp +0 -2403
- data/ext/libsass/posix/getopt.c +0 -562
- data/ext/libsass/posix/getopt.h +0 -95
- data/ext/libsass/to_c.cpp +0 -61
- data/ext/libsass/to_c.hpp +0 -44
- data/ext/libsass/to_string.cpp +0 -34
- data/ext/libsass/util.hpp +0 -54
- data/ext/libsass/win/libsass.filters +0 -312
@@ -1,148 +0,0 @@
|
|
1
|
-
#include "contextualize.hpp"
|
2
|
-
#include "ast.hpp"
|
3
|
-
#include "eval.hpp"
|
4
|
-
#include "backtrace.hpp"
|
5
|
-
#include "to_string.hpp"
|
6
|
-
#include "parser.hpp"
|
7
|
-
|
8
|
-
namespace Sass {
|
9
|
-
|
10
|
-
Contextualize::Contextualize(Context& ctx, Env* env, Backtrace* bt, Selector* placeholder, Selector* extender)
|
11
|
-
: ctx(ctx), env(env), backtrace(bt), parent(0), placeholder(placeholder), extender(extender)
|
12
|
-
{ }
|
13
|
-
|
14
|
-
Contextualize::~Contextualize() { }
|
15
|
-
|
16
|
-
Selector* Contextualize::fallback_impl(AST_Node* n)
|
17
|
-
{ return parent; }
|
18
|
-
|
19
|
-
Contextualize* Contextualize::with(Selector* s, Env* e, Backtrace* bt, Selector* p, Selector* ex)
|
20
|
-
{
|
21
|
-
parent = s;
|
22
|
-
env = e;
|
23
|
-
backtrace = bt;
|
24
|
-
placeholder = p;
|
25
|
-
extender = ex;
|
26
|
-
return this;
|
27
|
-
}
|
28
|
-
|
29
|
-
Selector* Contextualize::operator()(Selector_List* s)
|
30
|
-
{
|
31
|
-
Selector_List* p = static_cast<Selector_List*>(parent);
|
32
|
-
Selector_List* ss = 0;
|
33
|
-
if (p) {
|
34
|
-
ss = new (ctx.mem) Selector_List(s->pstate(), p->length() * s->length());
|
35
|
-
if (s->length() == 0) {
|
36
|
-
Complex_Selector* comb = static_cast<Complex_Selector*>(parent->perform(this));
|
37
|
-
if (parent->has_line_feed()) comb->has_line_feed(true);
|
38
|
-
if (comb) *ss << comb;
|
39
|
-
else cerr << "Warning: contextualize returned null" << endl;
|
40
|
-
}
|
41
|
-
for (size_t i = 0, L = p->length(); i < L; ++i) {
|
42
|
-
for (size_t j = 0, L = s->length(); j < L; ++j) {
|
43
|
-
parent = (*p)[i];
|
44
|
-
Complex_Selector* comb = static_cast<Complex_Selector*>((*s)[j]->perform(this));
|
45
|
-
if (parent->has_line_feed()) comb->has_line_feed(true);
|
46
|
-
if (comb) *ss << comb;
|
47
|
-
else cerr << "Warning: contextualize returned null" << endl;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
}
|
51
|
-
else {
|
52
|
-
ss = new (ctx.mem) Selector_List(s->pstate(), s->length());
|
53
|
-
for (size_t j = 0, L = s->length(); j < L; ++j) {
|
54
|
-
Complex_Selector* comb = static_cast<Complex_Selector*>((*s)[j]->perform(this));
|
55
|
-
if (comb) *ss << comb;
|
56
|
-
}
|
57
|
-
}
|
58
|
-
return ss->length() ? ss : 0;
|
59
|
-
}
|
60
|
-
|
61
|
-
Selector* Contextualize::operator()(Complex_Selector* s)
|
62
|
-
{
|
63
|
-
To_String to_string(&ctx);
|
64
|
-
Complex_Selector* ss = new (ctx.mem) Complex_Selector(*s);
|
65
|
-
// ss->last_block(s->last_block());
|
66
|
-
// ss->media_block(s->media_block());
|
67
|
-
Compound_Selector* new_head = 0;
|
68
|
-
Complex_Selector* new_tail = 0;
|
69
|
-
if (ss->head()) {
|
70
|
-
new_head = static_cast<Compound_Selector*>(s->head()->perform(this));
|
71
|
-
ss->head(new_head);
|
72
|
-
}
|
73
|
-
if (ss->tail()) {
|
74
|
-
new_tail = static_cast<Complex_Selector*>(s->tail()->perform(this));
|
75
|
-
// new_tail->last_block(s->last_block());
|
76
|
-
// new_tail->media_block(s->media_block());
|
77
|
-
ss->tail(new_tail);
|
78
|
-
}
|
79
|
-
if ((new_head && new_head->has_placeholder()) || (new_tail && new_tail->has_placeholder())) {
|
80
|
-
ss->has_placeholder(true);
|
81
|
-
}
|
82
|
-
else {
|
83
|
-
ss->has_placeholder(false);
|
84
|
-
}
|
85
|
-
if (!ss->head() && ss->combinator() == Complex_Selector::ANCESTOR_OF) {
|
86
|
-
return ss->tail();
|
87
|
-
}
|
88
|
-
else {
|
89
|
-
return ss;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
Selector* Contextualize::operator()(Compound_Selector* s)
|
94
|
-
{
|
95
|
-
To_String to_string(&ctx);
|
96
|
-
if (placeholder && extender && s->perform(&to_string) == placeholder->perform(&to_string)) {
|
97
|
-
return extender;
|
98
|
-
}
|
99
|
-
Compound_Selector* ss = new (ctx.mem) Compound_Selector(s->pstate(), s->length());
|
100
|
-
ss->last_block(s->last_block());
|
101
|
-
ss->media_block(s->media_block());
|
102
|
-
ss->has_line_break(s->has_line_break());
|
103
|
-
for (size_t i = 0, L = s->length(); i < L; ++i) {
|
104
|
-
Simple_Selector* simp = static_cast<Simple_Selector*>((*s)[i]->perform(this));
|
105
|
-
if (simp) *ss << simp;
|
106
|
-
}
|
107
|
-
return ss->length() ? ss : 0;
|
108
|
-
}
|
109
|
-
|
110
|
-
Selector* Contextualize::operator()(Wrapped_Selector* s)
|
111
|
-
{
|
112
|
-
Selector* old_parent = parent;
|
113
|
-
parent = 0;
|
114
|
-
Wrapped_Selector* neg = new (ctx.mem) Wrapped_Selector(s->pstate(),
|
115
|
-
s->name(),
|
116
|
-
s->selector()->perform(this));
|
117
|
-
parent = old_parent;
|
118
|
-
return neg;
|
119
|
-
}
|
120
|
-
|
121
|
-
Selector* Contextualize::operator()(Pseudo_Selector* s)
|
122
|
-
{ return s; }
|
123
|
-
|
124
|
-
Selector* Contextualize::operator()(Selector_Qualifier* s)
|
125
|
-
{ return s; }
|
126
|
-
|
127
|
-
Selector* Contextualize::operator()(Type_Selector* s)
|
128
|
-
{ return s; }
|
129
|
-
|
130
|
-
Selector* Contextualize::operator()(Selector_Placeholder* p)
|
131
|
-
{
|
132
|
-
To_String to_string(&ctx);
|
133
|
-
if (placeholder && extender && p->perform(&to_string) == placeholder->perform(&to_string)) {
|
134
|
-
return extender;
|
135
|
-
}
|
136
|
-
else {
|
137
|
-
return p;
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
Selector* Contextualize::operator()(Selector_Reference* s)
|
142
|
-
{
|
143
|
-
if (!parent) return 0;
|
144
|
-
Selector_Reference* ss = new (ctx.mem) Selector_Reference(*s);
|
145
|
-
ss->selector(parent);
|
146
|
-
return ss;
|
147
|
-
}
|
148
|
-
}
|
@@ -1,46 +0,0 @@
|
|
1
|
-
#ifndef SASS_CONTEXTUALIZE_H
|
2
|
-
#define SASS_CONTEXTUALIZE_H
|
3
|
-
|
4
|
-
#include "context.hpp"
|
5
|
-
#include "operation.hpp"
|
6
|
-
#include "environment.hpp"
|
7
|
-
#include "ast_fwd_decl.hpp"
|
8
|
-
|
9
|
-
namespace Sass {
|
10
|
-
struct Backtrace;
|
11
|
-
|
12
|
-
typedef Environment<AST_Node*> Env;
|
13
|
-
|
14
|
-
class Contextualize : public Operation_CRTP<Selector*, Contextualize> {
|
15
|
-
|
16
|
-
|
17
|
-
public:
|
18
|
-
Context& ctx;
|
19
|
-
Env* env;
|
20
|
-
Backtrace* backtrace;
|
21
|
-
Selector* parent;
|
22
|
-
Selector* placeholder;
|
23
|
-
Selector* extender;
|
24
|
-
|
25
|
-
Selector* fallback_impl(AST_Node* n);
|
26
|
-
Contextualize(Context&, Env*, Backtrace*, Selector* placeholder = 0, Selector* extender = 0);
|
27
|
-
virtual ~Contextualize();
|
28
|
-
Contextualize* with(Selector*, Env*, Backtrace*, Selector* placeholder = 0, Selector* extender = 0);
|
29
|
-
using Operation<Selector*>::operator();
|
30
|
-
|
31
|
-
Selector* operator()(Selector_List*);
|
32
|
-
Selector* operator()(Complex_Selector*);
|
33
|
-
Selector* operator()(Compound_Selector*);
|
34
|
-
Selector* operator()(Wrapped_Selector*);
|
35
|
-
Selector* operator()(Pseudo_Selector*);
|
36
|
-
Selector* operator()(Selector_Qualifier*);
|
37
|
-
Selector* operator()(Type_Selector*);
|
38
|
-
Selector* operator()(Selector_Placeholder*);
|
39
|
-
Selector* operator()(Selector_Reference*);
|
40
|
-
|
41
|
-
template <typename U>
|
42
|
-
Selector* fallback(U x) { return fallback_impl(x); }
|
43
|
-
};
|
44
|
-
}
|
45
|
-
|
46
|
-
#endif
|
@@ -1,93 +0,0 @@
|
|
1
|
-
#include "contextualize_eval.hpp"
|
2
|
-
#include "ast.hpp"
|
3
|
-
#include "eval.hpp"
|
4
|
-
#include "backtrace.hpp"
|
5
|
-
#include "to_string.hpp"
|
6
|
-
#include "parser.hpp"
|
7
|
-
|
8
|
-
namespace Sass {
|
9
|
-
|
10
|
-
Contextualize_Eval::Contextualize_Eval(Context& ctx, Eval* eval, Env* env, Backtrace* bt)
|
11
|
-
: Contextualize(ctx, env, bt), eval(eval)
|
12
|
-
{ }
|
13
|
-
|
14
|
-
Contextualize_Eval::~Contextualize_Eval() { }
|
15
|
-
|
16
|
-
Selector* Contextualize_Eval::fallback_impl(AST_Node* n)
|
17
|
-
{
|
18
|
-
return Contextualize::fallback_impl(n);
|
19
|
-
}
|
20
|
-
|
21
|
-
Contextualize_Eval* Contextualize_Eval::with(Selector* s, Env* e, Backtrace* bt, Selector* p, Selector* ex)
|
22
|
-
{
|
23
|
-
Contextualize::with(s, e, bt, p, ex);
|
24
|
-
eval = eval->with(s, e, bt, p, ex);
|
25
|
-
return this;
|
26
|
-
}
|
27
|
-
|
28
|
-
Selector* Contextualize_Eval::operator()(Selector_Schema* s)
|
29
|
-
{
|
30
|
-
To_String to_string;
|
31
|
-
string result_str(s->contents()->perform(eval)->perform(&to_string));
|
32
|
-
result_str += '{'; // the parser looks for a brace to end the selector
|
33
|
-
Selector* result_sel = Parser::from_c_str(result_str.c_str(), ctx, s->pstate()).parse_selector_group();
|
34
|
-
return result_sel->perform(this);
|
35
|
-
}
|
36
|
-
|
37
|
-
Selector* Contextualize_Eval::operator()(Selector_List* s)
|
38
|
-
{
|
39
|
-
return Contextualize::operator ()(s);
|
40
|
-
}
|
41
|
-
|
42
|
-
Selector* Contextualize_Eval::operator()(Complex_Selector* s)
|
43
|
-
{
|
44
|
-
return Contextualize::operator ()(s);
|
45
|
-
}
|
46
|
-
|
47
|
-
Selector* Contextualize_Eval::operator()(Compound_Selector* s)
|
48
|
-
{
|
49
|
-
return Contextualize::operator ()(s);
|
50
|
-
}
|
51
|
-
|
52
|
-
Selector* Contextualize_Eval::operator()(Wrapped_Selector* s)
|
53
|
-
{
|
54
|
-
return Contextualize::operator ()(s);
|
55
|
-
}
|
56
|
-
|
57
|
-
Selector* Contextualize_Eval::operator()(Pseudo_Selector* s)
|
58
|
-
{
|
59
|
-
return Contextualize::operator ()(s);
|
60
|
-
}
|
61
|
-
|
62
|
-
Selector* Contextualize_Eval::operator()(Attribute_Selector* s)
|
63
|
-
{
|
64
|
-
// the value might be interpolated; evaluate it
|
65
|
-
String* v = s->value();
|
66
|
-
if (v && eval) {
|
67
|
-
Eval* eval_with = eval->with(parent, env, backtrace);
|
68
|
-
v = static_cast<String*>(v->perform(eval_with));
|
69
|
-
}
|
70
|
-
To_String toString;
|
71
|
-
Attribute_Selector* ss = new (ctx.mem) Attribute_Selector(*s);
|
72
|
-
ss->value(v);
|
73
|
-
return ss;
|
74
|
-
}
|
75
|
-
|
76
|
-
Selector* Contextualize_Eval::operator()(Selector_Qualifier* s)
|
77
|
-
{ return Contextualize::operator ()(s);
|
78
|
-
}
|
79
|
-
|
80
|
-
Selector* Contextualize_Eval::operator()(Type_Selector* s)
|
81
|
-
{ return Contextualize::operator ()(s);
|
82
|
-
}
|
83
|
-
|
84
|
-
Selector* Contextualize_Eval::operator()(Selector_Placeholder* p)
|
85
|
-
{
|
86
|
-
return Contextualize::operator ()(p);
|
87
|
-
}
|
88
|
-
|
89
|
-
Selector* Contextualize_Eval::operator()(Selector_Reference* s)
|
90
|
-
{
|
91
|
-
return Contextualize::operator ()(s);
|
92
|
-
}
|
93
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
#ifndef SASS_CONTEXTUALIZE_EVAL_H
|
2
|
-
#define SASS_CONTEXTUALIZE_EVAL_H
|
3
|
-
|
4
|
-
#include "eval.hpp"
|
5
|
-
#include "context.hpp"
|
6
|
-
#include "operation.hpp"
|
7
|
-
#include "environment.hpp"
|
8
|
-
#include "ast_fwd_decl.hpp"
|
9
|
-
|
10
|
-
namespace Sass {
|
11
|
-
struct Backtrace;
|
12
|
-
|
13
|
-
typedef Environment<AST_Node*> Env;
|
14
|
-
|
15
|
-
class Contextualize_Eval : public Contextualize {
|
16
|
-
|
17
|
-
Eval* eval;
|
18
|
-
|
19
|
-
Selector* fallback_impl(AST_Node* n);
|
20
|
-
|
21
|
-
public:
|
22
|
-
Contextualize_Eval(Context&, Eval*, Env*, Backtrace*);
|
23
|
-
virtual ~Contextualize_Eval();
|
24
|
-
Contextualize_Eval* with(Selector*, Env*, Backtrace*, Selector* placeholder = 0, Selector* extender = 0);
|
25
|
-
using Operation<Selector*>::operator();
|
26
|
-
|
27
|
-
Selector* operator()(Selector_Schema*);
|
28
|
-
Selector* operator()(Selector_List*);
|
29
|
-
Selector* operator()(Complex_Selector*);
|
30
|
-
Selector* operator()(Compound_Selector*);
|
31
|
-
Selector* operator()(Wrapped_Selector*);
|
32
|
-
Selector* operator()(Pseudo_Selector*);
|
33
|
-
Selector* operator()(Attribute_Selector*);
|
34
|
-
Selector* operator()(Selector_Qualifier*);
|
35
|
-
Selector* operator()(Type_Selector*);
|
36
|
-
Selector* operator()(Selector_Placeholder*);
|
37
|
-
Selector* operator()(Selector_Reference*);
|
38
|
-
|
39
|
-
template <typename U>
|
40
|
-
Selector* fallback(U x) { return fallback_impl(x); }
|
41
|
-
};
|
42
|
-
}
|
43
|
-
|
44
|
-
#endif
|
data/ext/libsass/debugger.hpp
DELETED
@@ -1,558 +0,0 @@
|
|
1
|
-
#ifndef SASS_DEBUGGER_H
|
2
|
-
#define SASS_DEBUGGER_H
|
3
|
-
|
4
|
-
#include <string>
|
5
|
-
#include <sstream>
|
6
|
-
#include "ast_fwd_decl.hpp"
|
7
|
-
|
8
|
-
using namespace std;
|
9
|
-
using namespace Sass;
|
10
|
-
|
11
|
-
inline string str_replace(std::string str, const std::string& oldStr, const std::string& newStr)
|
12
|
-
{
|
13
|
-
size_t pos = 0;
|
14
|
-
while((pos = str.find(oldStr, pos)) != std::string::npos)
|
15
|
-
{
|
16
|
-
str.replace(pos, oldStr.length(), newStr);
|
17
|
-
pos += newStr.length();
|
18
|
-
}
|
19
|
-
return str;
|
20
|
-
}
|
21
|
-
|
22
|
-
inline string prettyprint(const string& str) {
|
23
|
-
string clean = str_replace(str, "\n", "\\n");
|
24
|
-
clean = str_replace(clean, " ", "\\t");
|
25
|
-
clean = str_replace(clean, "\r", "\\r");
|
26
|
-
return clean;
|
27
|
-
}
|
28
|
-
|
29
|
-
inline string longToHex(long long t) {
|
30
|
-
std::stringstream is;
|
31
|
-
is << std::hex << t;
|
32
|
-
return is.str();
|
33
|
-
}
|
34
|
-
|
35
|
-
inline string pstate_source_position(AST_Node* node)
|
36
|
-
{
|
37
|
-
stringstream str;
|
38
|
-
Position start(node->pstate());
|
39
|
-
Position end(start + node->pstate().offset);
|
40
|
-
str << (start.file == string::npos ? -1 : start.file)
|
41
|
-
<< "@[" << start.line << ":" << start.column << "]"
|
42
|
-
<< "-[" << end.line << ":" << end.column << "]";
|
43
|
-
return str.str();
|
44
|
-
}
|
45
|
-
|
46
|
-
inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
|
47
|
-
{
|
48
|
-
if (node == 0) return;
|
49
|
-
if (ind == "") cerr << "####################################################################\n";
|
50
|
-
if (dynamic_cast<Bubble*>(node)) {
|
51
|
-
Bubble* bubble = dynamic_cast<Bubble*>(node);
|
52
|
-
cerr << ind << "Bubble " << bubble;
|
53
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
54
|
-
cerr << " " << bubble->tabs();
|
55
|
-
cerr << endl;
|
56
|
-
} else if (dynamic_cast<At_Root_Block*>(node)) {
|
57
|
-
At_Root_Block* root_block = dynamic_cast<At_Root_Block*>(node);
|
58
|
-
cerr << ind << "At_Root_Block " << root_block;
|
59
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
60
|
-
cerr << " " << root_block->tabs();
|
61
|
-
cerr << endl;
|
62
|
-
if (root_block->block()) for(auto i : root_block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
63
|
-
} else if (dynamic_cast<Selector_List*>(node)) {
|
64
|
-
Selector_List* selector = dynamic_cast<Selector_List*>(node);
|
65
|
-
cerr << ind << "Selector_List " << selector;
|
66
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
67
|
-
cerr << " [block:" << selector->last_block() << "]";
|
68
|
-
cerr << (selector->last_block() && selector->last_block()->is_root() ? " [root]" : "");
|
69
|
-
cerr << " [@media:" << selector->media_block() << "]";
|
70
|
-
cerr << (selector->is_optional() ? " [is_optional]": " -");
|
71
|
-
cerr << (selector->has_line_break() ? " [line-break]": " -");
|
72
|
-
cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
73
|
-
cerr << endl;
|
74
|
-
|
75
|
-
for(auto i : selector->elements()) { debug_ast(i, ind + " ", env); }
|
76
|
-
|
77
|
-
// } else if (dynamic_cast<Expression*>(node)) {
|
78
|
-
// Expression* expression = dynamic_cast<Expression*>(node);
|
79
|
-
// cerr << ind << "Expression " << expression << " " << expression->concrete_type() << endl;
|
80
|
-
|
81
|
-
} else if (dynamic_cast<Parent_Selector*>(node)) {
|
82
|
-
Parent_Selector* selector = dynamic_cast<Parent_Selector*>(node);
|
83
|
-
cerr << ind << "Parent_Selector " << selector;
|
84
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
85
|
-
cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << endl;
|
86
|
-
debug_ast(selector->selector(), ind + "->", env);
|
87
|
-
|
88
|
-
} else if (dynamic_cast<Complex_Selector*>(node)) {
|
89
|
-
Complex_Selector* selector = dynamic_cast<Complex_Selector*>(node);
|
90
|
-
cerr << ind << "Complex_Selector " << selector
|
91
|
-
<< " (" << pstate_source_position(node) << ")"
|
92
|
-
<< " [block:" << selector->last_block() << "]"
|
93
|
-
<< " [weight:" << longToHex(selector->specificity()) << "]"
|
94
|
-
<< (selector->last_block() && selector->last_block()->is_root() ? " [root]" : "")
|
95
|
-
<< " [@media:" << selector->media_block() << "]"
|
96
|
-
<< (selector->is_optional() ? " [is_optional]": " -")
|
97
|
-
<< (selector->has_line_break() ? " [line-break]": " -")
|
98
|
-
<< (selector->has_line_feed() ? " [line-feed]": " -") << " -> ";
|
99
|
-
switch (selector->combinator()) {
|
100
|
-
case Complex_Selector::PARENT_OF: cerr << "{>}"; break;
|
101
|
-
case Complex_Selector::PRECEDES: cerr << "{~}"; break;
|
102
|
-
case Complex_Selector::ADJACENT_TO: cerr << "{+}"; break;
|
103
|
-
case Complex_Selector::ANCESTOR_OF: cerr << "{ }"; break;
|
104
|
-
}
|
105
|
-
cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << endl;
|
106
|
-
debug_ast(selector->head(), ind + " ", env);
|
107
|
-
debug_ast(selector->tail(), ind + "-", env);
|
108
|
-
} else if (dynamic_cast<Compound_Selector*>(node)) {
|
109
|
-
Compound_Selector* selector = dynamic_cast<Compound_Selector*>(node);
|
110
|
-
cerr << ind << "Compound_Selector " << selector;
|
111
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
112
|
-
cerr << " [block:" << selector->last_block() << "]";
|
113
|
-
cerr << " [weight:" << longToHex(selector->specificity()) << "]";
|
114
|
-
// cerr << (selector->last_block() && selector->last_block()->is_root() ? " [root]" : "");
|
115
|
-
cerr << " [@media:" << selector->media_block() << "]";
|
116
|
-
cerr << (selector->is_optional() ? " [is_optional]": " -");
|
117
|
-
cerr << (selector->has_line_break() ? " [line-break]": " -");
|
118
|
-
cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
119
|
-
cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << endl;
|
120
|
-
for(auto i : selector->elements()) { debug_ast(i, ind + " ", env); }
|
121
|
-
} else if (dynamic_cast<Propset*>(node)) {
|
122
|
-
Propset* selector = dynamic_cast<Propset*>(node);
|
123
|
-
cerr << ind << "Propset " << selector;
|
124
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
125
|
-
cerr << " " << selector->tabs() << endl;
|
126
|
-
if (selector->block()) for(auto i : selector->block()->elements()) { debug_ast(i, ind + " ", env); }
|
127
|
-
} else if (dynamic_cast<Wrapped_Selector*>(node)) {
|
128
|
-
Wrapped_Selector* selector = dynamic_cast<Wrapped_Selector*>(node);
|
129
|
-
cerr << ind << "Wrapped_Selector " << selector;
|
130
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
131
|
-
cerr << " <<" << selector->name() << ">>" << (selector->has_line_break() ? " [line-break]": " -") << (selector->has_line_feed() ? " [line-feed]": " -") << endl;
|
132
|
-
debug_ast(selector->selector(), ind + " () ", env);
|
133
|
-
} else if (dynamic_cast<Pseudo_Selector*>(node)) {
|
134
|
-
Pseudo_Selector* selector = dynamic_cast<Pseudo_Selector*>(node);
|
135
|
-
cerr << ind << "Pseudo_Selector " << selector;
|
136
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
137
|
-
cerr << " <<" << selector->name() << ">>" << (selector->has_line_break() ? " [line-break]": " -") << (selector->has_line_feed() ? " [line-feed]": " -") << endl;
|
138
|
-
debug_ast(selector->expression(), ind + " <= ", env);
|
139
|
-
} else if (dynamic_cast<Attribute_Selector*>(node)) {
|
140
|
-
Attribute_Selector* selector = dynamic_cast<Attribute_Selector*>(node);
|
141
|
-
cerr << ind << "Attribute_Selector " << selector;
|
142
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
143
|
-
cerr << " <<" << selector->name() << ">>" << (selector->has_line_break() ? " [line-break]": " -") << (selector->has_line_feed() ? " [line-feed]": " -") << endl;
|
144
|
-
debug_ast(selector->value(), ind + "[" + selector->matcher() + "] ", env);
|
145
|
-
} else if (dynamic_cast<Selector_Qualifier*>(node)) {
|
146
|
-
Selector_Qualifier* selector = dynamic_cast<Selector_Qualifier*>(node);
|
147
|
-
cerr << ind << "Selector_Qualifier " << selector;
|
148
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
149
|
-
cerr << " <<" << selector->name() << ">>" << (selector->has_line_break() ? " [line-break]": " -") << (selector->has_line_feed() ? " [line-feed]": " -") << endl;
|
150
|
-
} else if (dynamic_cast<Type_Selector*>(node)) {
|
151
|
-
Type_Selector* selector = dynamic_cast<Type_Selector*>(node);
|
152
|
-
cerr << ind << "Type_Selector " << selector;
|
153
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
154
|
-
cerr << " <<" << selector->name() << ">>" << (selector->has_line_break() ? " [line-break]": " -") <<
|
155
|
-
" <" << prettyprint(selector->pstate().token.ws_before()) << ">" << endl;
|
156
|
-
} else if (dynamic_cast<Selector_Placeholder*>(node)) {
|
157
|
-
|
158
|
-
Selector_Placeholder* selector = dynamic_cast<Selector_Placeholder*>(node);
|
159
|
-
cerr << ind << "Selector_Placeholder [" << selector->name() << "] " << selector
|
160
|
-
<< " [block:" << selector->last_block() << "]"
|
161
|
-
<< " [@media:" << selector->media_block() << "]"
|
162
|
-
<< (selector->is_optional() ? " [is_optional]": " -")
|
163
|
-
<< (selector->has_line_break() ? " [line-break]": " -")
|
164
|
-
<< (selector->has_line_feed() ? " [line-feed]": " -")
|
165
|
-
<< endl;
|
166
|
-
|
167
|
-
} else if (dynamic_cast<Selector_Reference*>(node)) {
|
168
|
-
Selector_Reference* selector = dynamic_cast<Selector_Reference*>(node);
|
169
|
-
cerr << ind << "Selector_Reference " << selector;
|
170
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
171
|
-
cerr << " @ref " << selector->selector() << endl;
|
172
|
-
} else if (dynamic_cast<Simple_Selector*>(node)) {
|
173
|
-
Simple_Selector* selector = dynamic_cast<Simple_Selector*>(node);
|
174
|
-
cerr << ind << "Simple_Selector " << selector;
|
175
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
176
|
-
cerr << (selector->has_line_break() ? " [line-break]": " -") << (selector->has_line_feed() ? " [line-feed]": " -") << endl;
|
177
|
-
|
178
|
-
} else if (dynamic_cast<Selector_Schema*>(node)) {
|
179
|
-
Selector_Schema* selector = dynamic_cast<Selector_Schema*>(node);
|
180
|
-
cerr << ind << "Selector_Schema " << selector;
|
181
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
182
|
-
cerr << " [block:" << selector->last_block() << "]"
|
183
|
-
<< (selector->last_block() && selector->last_block()->is_root() ? " [root]" : "")
|
184
|
-
<< " [@media:" << selector->media_block() << "]"
|
185
|
-
<< (selector->has_line_break() ? " [line-break]": " -")
|
186
|
-
<< (selector->has_line_feed() ? " [line-feed]": " -")
|
187
|
-
<< endl;
|
188
|
-
|
189
|
-
debug_ast(selector->contents(), ind + " ");
|
190
|
-
// for(auto i : selector->elements()) { debug_ast(i, ind + " ", env); }
|
191
|
-
|
192
|
-
} else if (dynamic_cast<Selector*>(node)) {
|
193
|
-
Selector* selector = dynamic_cast<Selector*>(node);
|
194
|
-
cerr << ind << "Selector " << selector;
|
195
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
196
|
-
cerr << (selector->has_line_break() ? " [line-break]": " -")
|
197
|
-
<< (selector->has_line_feed() ? " [line-feed]": " -")
|
198
|
-
<< endl;
|
199
|
-
|
200
|
-
} else if (dynamic_cast<Media_Query_Expression*>(node)) {
|
201
|
-
Media_Query_Expression* block = dynamic_cast<Media_Query_Expression*>(node);
|
202
|
-
cerr << ind << "Media_Query_Expression " << block;
|
203
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
204
|
-
cerr << (block->is_interpolated() ? " [is_interpolated]": " -")
|
205
|
-
<< endl;
|
206
|
-
debug_ast(block->feature(), ind + " feature) ");
|
207
|
-
debug_ast(block->value(), ind + " value) ");
|
208
|
-
|
209
|
-
} else if (dynamic_cast<Media_Query*>(node)) {
|
210
|
-
Media_Query* block = dynamic_cast<Media_Query*>(node);
|
211
|
-
cerr << ind << "Media_Query " << block;
|
212
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
213
|
-
cerr << (block->is_negated() ? " [is_negated]": " -")
|
214
|
-
<< (block->is_restricted() ? " [is_restricted]": " -")
|
215
|
-
<< endl;
|
216
|
-
debug_ast(block->media_type(), ind + " ");
|
217
|
-
for(auto i : block->elements()) { debug_ast(i, ind + " ", env); }
|
218
|
-
|
219
|
-
} else if (dynamic_cast<Media_Block*>(node)) {
|
220
|
-
Media_Block* block = dynamic_cast<Media_Block*>(node);
|
221
|
-
cerr << ind << "Media_Block " << block;
|
222
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
223
|
-
cerr << " " << block->tabs() << endl;
|
224
|
-
debug_ast(block->media_queries(), ind + " =@ ");
|
225
|
-
debug_ast(block->selector(), ind + " -@ ");
|
226
|
-
if (block->block()) for(auto i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
227
|
-
} else if (dynamic_cast<Feature_Block*>(node)) {
|
228
|
-
Feature_Block* block = dynamic_cast<Feature_Block*>(node);
|
229
|
-
cerr << ind << "Feature_Block " << block;
|
230
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
231
|
-
cerr << " " << block->tabs() << endl;
|
232
|
-
if (block->block()) for(auto i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
233
|
-
} else if (dynamic_cast<Block*>(node)) {
|
234
|
-
Block* root_block = dynamic_cast<Block*>(node);
|
235
|
-
cerr << ind << "Block " << root_block;
|
236
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
237
|
-
if (root_block->is_root()) cerr << " [root]";
|
238
|
-
cerr << " " << root_block->tabs() << endl;
|
239
|
-
if (root_block->block()) for(auto i : root_block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
240
|
-
} else if (dynamic_cast<Warning*>(node)) {
|
241
|
-
Warning* block = dynamic_cast<Warning*>(node);
|
242
|
-
cerr << ind << "Warning " << block;
|
243
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
244
|
-
cerr << " " << block->tabs() << endl;
|
245
|
-
} else if (dynamic_cast<Error*>(node)) {
|
246
|
-
Error* block = dynamic_cast<Error*>(node);
|
247
|
-
cerr << ind << "Error " << block;
|
248
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
249
|
-
cerr << " " << block->tabs() << endl;
|
250
|
-
} else if (dynamic_cast<Debug*>(node)) {
|
251
|
-
Debug* block = dynamic_cast<Debug*>(node);
|
252
|
-
cerr << ind << "Debug " << block;
|
253
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
254
|
-
cerr << " " << block->tabs() << endl;
|
255
|
-
} else if (dynamic_cast<Comment*>(node)) {
|
256
|
-
Comment* block = dynamic_cast<Comment*>(node);
|
257
|
-
cerr << ind << "Comment " << block;
|
258
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
259
|
-
cerr << " " << block->tabs() <<
|
260
|
-
" <" << prettyprint(block->pstate().token.ws_before()) << ">" << endl;
|
261
|
-
debug_ast(block->text(), ind + "// ", env);
|
262
|
-
} else if (dynamic_cast<If*>(node)) {
|
263
|
-
If* block = dynamic_cast<If*>(node);
|
264
|
-
cerr << ind << "If " << block;
|
265
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
266
|
-
cerr << " " << block->tabs() << endl;
|
267
|
-
debug_ast(block->predicate(), ind + " = ");
|
268
|
-
debug_ast(block->consequent(), ind + " <>");
|
269
|
-
debug_ast(block->alternative(), ind + " ><");
|
270
|
-
} else if (dynamic_cast<Return*>(node)) {
|
271
|
-
Return* block = dynamic_cast<Return*>(node);
|
272
|
-
cerr << ind << "Return " << block;
|
273
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
274
|
-
cerr << " " << block->tabs() << endl;
|
275
|
-
} else if (dynamic_cast<Extension*>(node)) {
|
276
|
-
Extension* block = dynamic_cast<Extension*>(node);
|
277
|
-
cerr << ind << "Extension " << block;
|
278
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
279
|
-
cerr << " " << block->tabs() << endl;
|
280
|
-
debug_ast(block->selector(), ind + "-> ", env);
|
281
|
-
} else if (dynamic_cast<Content*>(node)) {
|
282
|
-
Content* block = dynamic_cast<Content*>(node);
|
283
|
-
cerr << ind << "Content " << block;
|
284
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
285
|
-
cerr << " " << block->tabs() << endl;
|
286
|
-
} else if (dynamic_cast<Import_Stub*>(node)) {
|
287
|
-
Import_Stub* block = dynamic_cast<Import_Stub*>(node);
|
288
|
-
cerr << ind << "Import_Stub " << block;
|
289
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
290
|
-
cerr << " " << block->tabs() << endl;
|
291
|
-
} else if (dynamic_cast<Import*>(node)) {
|
292
|
-
Import* block = dynamic_cast<Import*>(node);
|
293
|
-
cerr << ind << "Import " << block;
|
294
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
295
|
-
cerr << " " << block->tabs() << endl;
|
296
|
-
// debug_ast(block->media_queries(), ind + " @ ");
|
297
|
-
// vector<string> files_;
|
298
|
-
for (auto imp : block->urls()) debug_ast(imp, "@ ", env);
|
299
|
-
} else if (dynamic_cast<Assignment*>(node)) {
|
300
|
-
Assignment* block = dynamic_cast<Assignment*>(node);
|
301
|
-
cerr << ind << "Assignment " << block;
|
302
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
303
|
-
cerr << " <<" << block->variable() << ">> " << block->tabs() << endl;
|
304
|
-
debug_ast(block->value(), ind + "=", env);
|
305
|
-
} else if (dynamic_cast<Declaration*>(node)) {
|
306
|
-
Declaration* block = dynamic_cast<Declaration*>(node);
|
307
|
-
cerr << ind << "Declaration " << block;
|
308
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
309
|
-
cerr << " " << block->tabs() << endl;
|
310
|
-
debug_ast(block->property(), ind + " prop: ", env);
|
311
|
-
debug_ast(block->value(), ind + " value: ", env);
|
312
|
-
} else if (dynamic_cast<Keyframe_Rule*>(node)) {
|
313
|
-
Keyframe_Rule* has_block = dynamic_cast<Keyframe_Rule*>(node);
|
314
|
-
cerr << ind << "Keyframe_Rule " << has_block;
|
315
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
316
|
-
cerr << " " << has_block->tabs() << endl;
|
317
|
-
if (has_block->selector()) debug_ast(has_block->selector(), ind + "@");
|
318
|
-
if (has_block->block()) for(auto i : has_block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
319
|
-
} else if (dynamic_cast<At_Rule*>(node)) {
|
320
|
-
At_Rule* block = dynamic_cast<At_Rule*>(node);
|
321
|
-
cerr << ind << "At_Rule " << block;
|
322
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
323
|
-
cerr << " [" << block->keyword() << "] " << block->tabs() << endl;
|
324
|
-
debug_ast(block->value(), ind + "+", env);
|
325
|
-
debug_ast(block->selector(), ind + "~", env);
|
326
|
-
if (block->block()) for(auto i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
327
|
-
} else if (dynamic_cast<Each*>(node)) {
|
328
|
-
Each* block = dynamic_cast<Each*>(node);
|
329
|
-
cerr << ind << "Each " << block;
|
330
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
331
|
-
cerr << " " << block->tabs() << endl;
|
332
|
-
if (block->block()) for(auto i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
333
|
-
} else if (dynamic_cast<For*>(node)) {
|
334
|
-
For* block = dynamic_cast<For*>(node);
|
335
|
-
cerr << ind << "For " << block;
|
336
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
337
|
-
cerr << " " << block->tabs() << endl;
|
338
|
-
if (block->block()) for(auto i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
339
|
-
} else if (dynamic_cast<While*>(node)) {
|
340
|
-
While* block = dynamic_cast<While*>(node);
|
341
|
-
cerr << ind << "While " << block;
|
342
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
343
|
-
cerr << " " << block->tabs() << endl;
|
344
|
-
if (block->block()) for(auto i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
345
|
-
} else if (dynamic_cast<Definition*>(node)) {
|
346
|
-
Definition* block = dynamic_cast<Definition*>(node);
|
347
|
-
cerr << ind << "Definition " << block;
|
348
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
349
|
-
cerr << " [name: " << block->name() << "] ";
|
350
|
-
cerr << " [type: " << (block->type() == Sass::Definition::Type::MIXIN ? "Mixin " : "Function ") << "] ";
|
351
|
-
// this seems to lead to segfaults some times?
|
352
|
-
// cerr << " [signature: " << block->signature() << "] ";
|
353
|
-
cerr << " [native: " << block->native_function() << "] ";
|
354
|
-
cerr << " " << block->tabs() << endl;
|
355
|
-
debug_ast(block->parameters(), ind + " params: ", env);
|
356
|
-
if (block->block()) for(auto i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
357
|
-
} else if (dynamic_cast<Mixin_Call*>(node)) {
|
358
|
-
Mixin_Call* block = dynamic_cast<Mixin_Call*>(node);
|
359
|
-
cerr << ind << "Mixin_Call " << block << " " << block->tabs();
|
360
|
-
cerr << " [" << block->name() << "]" << endl;
|
361
|
-
debug_ast(block->arguments(), ind + " args: ");
|
362
|
-
if (block->block()) for(auto i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
363
|
-
} else if (dynamic_cast<Ruleset*>(node)) {
|
364
|
-
Ruleset* ruleset = dynamic_cast<Ruleset*>(node);
|
365
|
-
cerr << ind << "Ruleset " << ruleset;
|
366
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
367
|
-
cerr << " " << ruleset->tabs() << endl;
|
368
|
-
debug_ast(ruleset->selector(), ind + " ");
|
369
|
-
if (ruleset->block()) for(auto i : ruleset->block()->elements()) { debug_ast(i, ind + " ", env); }
|
370
|
-
} else if (dynamic_cast<Block*>(node)) {
|
371
|
-
Block* block = dynamic_cast<Block*>(node);
|
372
|
-
cerr << ind << "Block " << block;
|
373
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
374
|
-
cerr << " " << block->tabs() << endl;
|
375
|
-
for(auto i : block->elements()) { debug_ast(i, ind + " ", env); }
|
376
|
-
} else if (dynamic_cast<Textual*>(node)) {
|
377
|
-
Textual* expression = dynamic_cast<Textual*>(node);
|
378
|
-
cerr << ind << "Textual ";
|
379
|
-
if (expression->type() == Textual::NUMBER) cerr << " [NUMBER]";
|
380
|
-
else if (expression->type() == Textual::PERCENTAGE) cerr << " [PERCENTAGE]";
|
381
|
-
else if (expression->type() == Textual::DIMENSION) cerr << " [DIMENSION]";
|
382
|
-
else if (expression->type() == Textual::HEX) cerr << " [HEX]";
|
383
|
-
cerr << expression << " [" << expression->value() << "]";
|
384
|
-
if (expression->is_delayed()) cerr << " [delayed]";
|
385
|
-
cerr << endl;
|
386
|
-
} else if (dynamic_cast<Variable*>(node)) {
|
387
|
-
Variable* expression = dynamic_cast<Variable*>(node);
|
388
|
-
cerr << ind << "Variable " << expression;
|
389
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
390
|
-
cerr << " [" << expression->name() << "]" << endl;
|
391
|
-
string name(expression->name());
|
392
|
-
if (env && env->has(name)) debug_ast(static_cast<Expression*>((*env)[name]), ind + " -> ", env);
|
393
|
-
} else if (dynamic_cast<Function_Call_Schema*>(node)) {
|
394
|
-
Function_Call_Schema* expression = dynamic_cast<Function_Call_Schema*>(node);
|
395
|
-
cerr << ind << "Function_Call_Schema " << expression;
|
396
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
397
|
-
cerr << "" << endl;
|
398
|
-
debug_ast(expression->name(), ind + "name: ", env);
|
399
|
-
debug_ast(expression->arguments(), ind + " args: ", env);
|
400
|
-
} else if (dynamic_cast<Function_Call*>(node)) {
|
401
|
-
Function_Call* expression = dynamic_cast<Function_Call*>(node);
|
402
|
-
cerr << ind << "Function_Call " << expression;
|
403
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
404
|
-
cerr << " [" << expression->name() << "]" << endl;
|
405
|
-
debug_ast(expression->arguments(), ind + " args: ", env);
|
406
|
-
} else if (dynamic_cast<Arguments*>(node)) {
|
407
|
-
Arguments* expression = dynamic_cast<Arguments*>(node);
|
408
|
-
cerr << ind << "Arguments " << expression;
|
409
|
-
if (expression->is_delayed()) cerr << " [delayed]";
|
410
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
411
|
-
cerr << endl;
|
412
|
-
for(auto i : expression->elements()) { debug_ast(i, ind + " ", env); }
|
413
|
-
} else if (dynamic_cast<Argument*>(node)) {
|
414
|
-
Argument* expression = dynamic_cast<Argument*>(node);
|
415
|
-
cerr << ind << "Argument " << expression;
|
416
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
417
|
-
cerr << " [" << expression->value() << "]";
|
418
|
-
cerr << " [name: " << expression->name() << "] ";
|
419
|
-
cerr << " [rest: " << expression->is_rest_argument() << "] ";
|
420
|
-
cerr << " [keyword: " << expression->is_keyword_argument() << "] " << endl;
|
421
|
-
debug_ast(expression->value(), ind + " value: ", env);
|
422
|
-
} else if (dynamic_cast<Parameters*>(node)) {
|
423
|
-
Parameters* expression = dynamic_cast<Parameters*>(node);
|
424
|
-
cerr << ind << "Parameters " << expression;
|
425
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
426
|
-
cerr << " [has_optional: " << expression->has_optional_parameters() << "] ";
|
427
|
-
cerr << " [has_rest: " << expression->has_rest_parameter() << "] ";
|
428
|
-
cerr << endl;
|
429
|
-
for(auto i : expression->elements()) { debug_ast(i, ind + " ", env); }
|
430
|
-
} else if (dynamic_cast<Parameter*>(node)) {
|
431
|
-
Parameter* expression = dynamic_cast<Parameter*>(node);
|
432
|
-
cerr << ind << "Parameter " << expression;
|
433
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
434
|
-
cerr << " [name: " << expression->name() << "] ";
|
435
|
-
cerr << " [default: " << expression->default_value() << "] ";
|
436
|
-
cerr << " [rest: " << expression->is_rest_parameter() << "] " << endl;
|
437
|
-
} else if (dynamic_cast<Unary_Expression*>(node)) {
|
438
|
-
Unary_Expression* expression = dynamic_cast<Unary_Expression*>(node);
|
439
|
-
cerr << ind << "Unary_Expression " << expression;
|
440
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
441
|
-
cerr << " [" << expression->type() << "]" << endl;
|
442
|
-
debug_ast(expression->operand(), ind + " operand: ", env);
|
443
|
-
} else if (dynamic_cast<Binary_Expression*>(node)) {
|
444
|
-
Binary_Expression* expression = dynamic_cast<Binary_Expression*>(node);
|
445
|
-
cerr << ind << "Binary_Expression " << expression;
|
446
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
447
|
-
cerr << " [" << expression->type_name() << "]" << endl;
|
448
|
-
debug_ast(expression->left(), ind + " left: ", env);
|
449
|
-
debug_ast(expression->right(), ind + " right: ", env);
|
450
|
-
} else if (dynamic_cast<Map*>(node)) {
|
451
|
-
Map* expression = dynamic_cast<Map*>(node);
|
452
|
-
cerr << ind << "Map " << expression;
|
453
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
454
|
-
cerr << " [Hashed]" << endl;
|
455
|
-
for (auto i : expression->elements()) {
|
456
|
-
debug_ast(i.first, ind + " key: ");
|
457
|
-
debug_ast(i.second, ind + " val: ");
|
458
|
-
}
|
459
|
-
} else if (dynamic_cast<List*>(node)) {
|
460
|
-
List* expression = dynamic_cast<List*>(node);
|
461
|
-
cerr << ind << "List " << expression;
|
462
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
463
|
-
cerr << " (" << expression->length() << ") " <<
|
464
|
-
(expression->separator() == Sass::List::Separator::COMMA ? "Comma " : "Space ") <<
|
465
|
-
" [delayed: " << expression->is_delayed() << "] " <<
|
466
|
-
" [interpolant: " << expression->is_interpolant() << "] " <<
|
467
|
-
" [arglist: " << expression->is_arglist() << "] " <<
|
468
|
-
endl;
|
469
|
-
for(auto i : expression->elements()) { debug_ast(i, ind + " ", env); }
|
470
|
-
} else if (dynamic_cast<Content*>(node)) {
|
471
|
-
Content* expression = dynamic_cast<Content*>(node);
|
472
|
-
cerr << ind << "Content " << expression;
|
473
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
474
|
-
cerr << " [Statement]" << endl;
|
475
|
-
} else if (dynamic_cast<Boolean*>(node)) {
|
476
|
-
Boolean* expression = dynamic_cast<Boolean*>(node);
|
477
|
-
cerr << ind << "Boolean " << expression;
|
478
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
479
|
-
cerr << " [" << expression->value() << "]" << endl;
|
480
|
-
} else if (dynamic_cast<Color*>(node)) {
|
481
|
-
Color* expression = dynamic_cast<Color*>(node);
|
482
|
-
cerr << ind << "Color " << expression;
|
483
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
484
|
-
cerr << " [" << expression->r() << ":" << expression->g() << ":" << expression->b() << "@" << expression->a() << "]" << endl;
|
485
|
-
} else if (dynamic_cast<Number*>(node)) {
|
486
|
-
Number* expression = dynamic_cast<Number*>(node);
|
487
|
-
cerr << ind << "Number " << expression;
|
488
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
489
|
-
cerr << " [" << expression->value() << expression->unit() << "]" << endl;
|
490
|
-
} else if (dynamic_cast<String_Quoted*>(node)) {
|
491
|
-
String_Quoted* expression = dynamic_cast<String_Quoted*>(node);
|
492
|
-
cerr << ind << "String_Quoted " << expression;
|
493
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
494
|
-
cerr << " [" << prettyprint(expression->value()) << "]";
|
495
|
-
if (expression->is_delayed()) cerr << " [delayed]";
|
496
|
-
if (expression->sass_fix_1291()) cerr << " [sass_fix_1291]";
|
497
|
-
if (expression->quote_mark()) cerr << " [quote_mark: " << expression->quote_mark() << "]";
|
498
|
-
cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << endl;
|
499
|
-
} else if (dynamic_cast<String_Constant*>(node)) {
|
500
|
-
String_Constant* expression = dynamic_cast<String_Constant*>(node);
|
501
|
-
cerr << ind << "String_Constant " << expression;
|
502
|
-
if (expression->concrete_type()) {
|
503
|
-
cerr << " " << expression->concrete_type();
|
504
|
-
}
|
505
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
506
|
-
cerr << " [" << prettyprint(expression->value()) << "]";
|
507
|
-
if (expression->is_delayed()) cerr << " [delayed]";
|
508
|
-
if (expression->sass_fix_1291()) cerr << " [sass_fix_1291]";
|
509
|
-
cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << endl;
|
510
|
-
} else if (dynamic_cast<String_Schema*>(node)) {
|
511
|
-
String_Schema* expression = dynamic_cast<String_Schema*>(node);
|
512
|
-
cerr << ind << "String_Schema " << expression;
|
513
|
-
cerr << " " << expression->concrete_type();
|
514
|
-
if (expression->is_delayed()) cerr << " [delayed]";
|
515
|
-
if (expression->has_interpolants()) cerr << " [has_interpolants]";
|
516
|
-
cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << endl;
|
517
|
-
for(auto i : expression->elements()) { debug_ast(i, ind + " ", env); }
|
518
|
-
} else if (dynamic_cast<String*>(node)) {
|
519
|
-
String* expression = dynamic_cast<String*>(node);
|
520
|
-
cerr << ind << "String " << expression;
|
521
|
-
cerr << " " << expression->concrete_type();
|
522
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
523
|
-
if (expression->sass_fix_1291()) cerr << " [sass_fix_1291]";
|
524
|
-
cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << endl;
|
525
|
-
} else if (dynamic_cast<Expression*>(node)) {
|
526
|
-
Expression* expression = dynamic_cast<Expression*>(node);
|
527
|
-
cerr << ind << "Expression " << expression;
|
528
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
529
|
-
switch (expression->concrete_type()) {
|
530
|
-
case Expression::Concrete_Type::NONE: cerr << " [NONE]"; break;
|
531
|
-
case Expression::Concrete_Type::BOOLEAN: cerr << " [BOOLEAN]"; break;
|
532
|
-
case Expression::Concrete_Type::NUMBER: cerr << " [NUMBER]"; break;
|
533
|
-
case Expression::Concrete_Type::COLOR: cerr << " [COLOR]"; break;
|
534
|
-
case Expression::Concrete_Type::STRING: cerr << " [STRING]"; break;
|
535
|
-
case Expression::Concrete_Type::LIST: cerr << " [LIST]"; break;
|
536
|
-
case Expression::Concrete_Type::MAP: cerr << " [MAP]"; break;
|
537
|
-
case Expression::Concrete_Type::SELECTOR: cerr << " [SELECTOR]"; break;
|
538
|
-
case Expression::Concrete_Type::NULL_VAL: cerr << " [NULL_VAL]"; break;
|
539
|
-
case Expression::Concrete_Type::NUM_TYPES: cerr << " [NUM_TYPES]"; break;
|
540
|
-
}
|
541
|
-
cerr << endl;
|
542
|
-
} else if (dynamic_cast<Has_Block*>(node)) {
|
543
|
-
Has_Block* has_block = dynamic_cast<Has_Block*>(node);
|
544
|
-
cerr << ind << "Has_Block " << has_block;
|
545
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
546
|
-
cerr << " " << has_block->tabs() << endl;
|
547
|
-
if (has_block->block()) for(auto i : has_block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
548
|
-
} else if (dynamic_cast<Statement*>(node)) {
|
549
|
-
Statement* statement = dynamic_cast<Statement*>(node);
|
550
|
-
cerr << ind << "Statement " << statement;
|
551
|
-
cerr << " (" << pstate_source_position(node) << ")";
|
552
|
-
cerr << " " << statement->tabs() << endl;
|
553
|
-
}
|
554
|
-
|
555
|
-
if (ind == "") cerr << "####################################################################\n";
|
556
|
-
}
|
557
|
-
|
558
|
-
#endif // SASS_DEBUGGER
|