sassc 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +5 -0
- data/ext/libsass/VERSION +1 -1
- data/ext/libsass/include/sass/context.h +3 -0
- data/ext/libsass/src/MurmurHash2.hpp +91 -0
- data/ext/libsass/src/ast.cpp +117 -117
- data/ext/libsass/src/ast.hpp +160 -162
- data/ext/libsass/src/ast_def_macros.hpp +10 -10
- data/ext/libsass/src/ast_fwd_decl.cpp +2 -2
- data/ext/libsass/src/ast_fwd_decl.hpp +61 -52
- data/ext/libsass/src/ast_helpers.hpp +5 -5
- data/ext/libsass/src/ast_sel_cmp.cpp +18 -18
- data/ext/libsass/src/ast_sel_super.cpp +52 -52
- data/ext/libsass/src/ast_sel_unify.cpp +16 -16
- data/ext/libsass/src/ast_sel_weave.cpp +62 -62
- data/ext/libsass/src/ast_selectors.cpp +87 -77
- data/ext/libsass/src/ast_selectors.hpp +72 -62
- data/ext/libsass/src/ast_supports.cpp +35 -35
- data/ext/libsass/src/ast_supports.hpp +29 -29
- data/ext/libsass/src/ast_values.cpp +58 -58
- data/ext/libsass/src/ast_values.hpp +75 -75
- data/ext/libsass/src/backtrace.cpp +9 -9
- data/ext/libsass/src/backtrace.hpp +5 -5
- data/ext/libsass/src/base64vlq.cpp +2 -2
- data/ext/libsass/src/base64vlq.hpp +1 -1
- data/ext/libsass/src/bind.cpp +17 -17
- data/ext/libsass/src/bind.hpp +1 -1
- data/ext/libsass/src/c2ast.cpp +3 -3
- data/ext/libsass/src/c2ast.hpp +1 -1
- data/ext/libsass/src/check_nesting.cpp +36 -36
- data/ext/libsass/src/check_nesting.hpp +2 -2
- data/ext/libsass/src/color_maps.cpp +5 -5
- data/ext/libsass/src/color_maps.hpp +1 -1
- data/ext/libsass/src/context.cpp +63 -60
- data/ext/libsass/src/context.hpp +33 -33
- data/ext/libsass/src/cssize.cpp +30 -29
- data/ext/libsass/src/cssize.hpp +13 -13
- data/ext/libsass/src/dart_helpers.hpp +5 -5
- data/ext/libsass/src/debugger.hpp +127 -128
- data/ext/libsass/src/emitter.cpp +12 -12
- data/ext/libsass/src/emitter.hpp +10 -10
- data/ext/libsass/src/environment.cpp +27 -27
- data/ext/libsass/src/environment.hpp +24 -24
- data/ext/libsass/src/error_handling.cpp +42 -42
- data/ext/libsass/src/error_handling.hpp +38 -50
- data/ext/libsass/src/eval.cpp +138 -132
- data/ext/libsass/src/eval.hpp +17 -17
- data/ext/libsass/src/eval_selectors.cpp +3 -3
- data/ext/libsass/src/expand.cpp +70 -64
- data/ext/libsass/src/expand.hpp +12 -12
- data/ext/libsass/src/extender.cpp +55 -53
- data/ext/libsass/src/extender.hpp +14 -14
- data/ext/libsass/src/file.cpp +66 -58
- data/ext/libsass/src/file.hpp +23 -25
- data/ext/libsass/src/fn_colors.cpp +9 -9
- data/ext/libsass/src/fn_lists.cpp +18 -18
- data/ext/libsass/src/fn_maps.cpp +3 -3
- data/ext/libsass/src/fn_miscs.cpp +15 -15
- data/ext/libsass/src/fn_numbers.cpp +7 -7
- data/ext/libsass/src/fn_selectors.cpp +8 -8
- data/ext/libsass/src/fn_strings.cpp +34 -22
- data/ext/libsass/src/fn_utils.cpp +29 -26
- data/ext/libsass/src/fn_utils.hpp +10 -10
- data/ext/libsass/src/inspect.cpp +35 -34
- data/ext/libsass/src/inspect.hpp +21 -21
- data/ext/libsass/src/lexer.cpp +3 -1
- data/ext/libsass/src/listize.cpp +2 -2
- data/ext/libsass/src/mapping.hpp +1 -0
- data/ext/libsass/src/memory.hpp +12 -0
- data/ext/libsass/src/memory/allocator.cpp +48 -0
- data/ext/libsass/src/memory/allocator.hpp +138 -0
- data/ext/libsass/src/memory/config.hpp +20 -0
- data/ext/libsass/src/memory/memory_pool.hpp +186 -0
- data/ext/libsass/src/memory/{SharedPtr.cpp → shared_ptr.cpp} +2 -2
- data/ext/libsass/src/memory/{SharedPtr.hpp → shared_ptr.hpp} +18 -6
- data/ext/libsass/src/operation.hpp +44 -44
- data/ext/libsass/src/operators.cpp +18 -18
- data/ext/libsass/src/operators.hpp +11 -11
- data/ext/libsass/src/ordered_map.hpp +18 -18
- data/ext/libsass/src/output.cpp +16 -16
- data/ext/libsass/src/output.hpp +5 -5
- data/ext/libsass/src/parser.cpp +327 -345
- data/ext/libsass/src/parser.hpp +77 -87
- data/ext/libsass/src/parser_selectors.cpp +6 -6
- data/ext/libsass/src/permutate.hpp +39 -15
- data/ext/libsass/src/plugins.cpp +7 -7
- data/ext/libsass/src/plugins.hpp +8 -8
- data/ext/libsass/src/position.cpp +7 -26
- data/ext/libsass/src/position.hpp +44 -21
- data/ext/libsass/src/remove_placeholders.cpp +4 -4
- data/ext/libsass/src/remove_placeholders.hpp +3 -3
- data/ext/libsass/src/sass.cpp +16 -15
- data/ext/libsass/src/sass.hpp +9 -5
- data/ext/libsass/src/sass_context.cpp +52 -34
- data/ext/libsass/src/sass_values.cpp +8 -10
- data/ext/libsass/src/settings.hpp +19 -0
- data/ext/libsass/src/source.cpp +69 -0
- data/ext/libsass/src/source.hpp +95 -0
- data/ext/libsass/src/source_data.hpp +32 -0
- data/ext/libsass/src/source_map.cpp +22 -18
- data/ext/libsass/src/source_map.hpp +12 -9
- data/ext/libsass/src/units.cpp +19 -19
- data/ext/libsass/src/units.hpp +8 -8
- data/ext/libsass/src/utf8_string.cpp +9 -10
- data/ext/libsass/src/utf8_string.hpp +7 -6
- data/ext/libsass/src/util.cpp +38 -38
- data/ext/libsass/src/util.hpp +18 -18
- data/ext/libsass/src/util_string.cpp +13 -13
- data/ext/libsass/src/util_string.hpp +9 -8
- data/ext/libsass/src/values.cpp +12 -12
- data/lib/sassc/native.rb +3 -5
- data/lib/sassc/version.rb +1 -1
- data/test/native_test.rb +4 -4
- metadata +14 -5
- data/lib/sassc/native/lib_c.rb +0 -21
data/ext/libsass/src/cssize.cpp
CHANGED
@@ -14,7 +14,7 @@ namespace Sass {
|
|
14
14
|
Cssize::Cssize(Context& ctx)
|
15
15
|
: traces(ctx.traces),
|
16
16
|
block_stack(BlockStack()),
|
17
|
-
p_stack(
|
17
|
+
p_stack(sass::vector<Statement*>())
|
18
18
|
{ }
|
19
19
|
|
20
20
|
Statement* Cssize::parent()
|
@@ -80,17 +80,17 @@ namespace Sass {
|
|
80
80
|
return 0;
|
81
81
|
}
|
82
82
|
|
83
|
-
Statement* Cssize::operator()(
|
83
|
+
Statement* Cssize::operator()(AtRule* r)
|
84
84
|
{
|
85
85
|
if (!r->block() || !r->block()->length()) return r;
|
86
86
|
|
87
87
|
if (parent()->statement_type() == Statement::RULESET)
|
88
88
|
{
|
89
|
-
return
|
89
|
+
return r->is_keyframes() ? SASS_MEMORY_NEW(Bubble, r->pstate(), r) : bubble(r);
|
90
90
|
}
|
91
91
|
|
92
92
|
p_stack.push_back(r);
|
93
|
-
|
93
|
+
AtRuleObj rr = SASS_MEMORY_NEW(AtRule,
|
94
94
|
r->pstate(),
|
95
95
|
r->keyword(),
|
96
96
|
r->selector(),
|
@@ -107,7 +107,7 @@ namespace Sass {
|
|
107
107
|
Bubble_Obj s_obj = Cast<Bubble>(s);
|
108
108
|
s = s_obj->node();
|
109
109
|
if (s->statement_type() != Statement::DIRECTIVE) directive_exists = false;
|
110
|
-
else directive_exists = (Cast<
|
110
|
+
else directive_exists = (Cast<AtRule>(s)->keyword() == rr->keyword());
|
111
111
|
}
|
112
112
|
|
113
113
|
}
|
@@ -115,7 +115,7 @@ namespace Sass {
|
|
115
115
|
Block* result = SASS_MEMORY_NEW(Block, rr->pstate());
|
116
116
|
if (!(directive_exists || rr->is_keyframes()))
|
117
117
|
{
|
118
|
-
|
118
|
+
AtRule* empty_node = Cast<AtRule>(rr);
|
119
119
|
empty_node->block(SASS_MEMORY_NEW(Block, rr->block() ? rr->block()->pstate() : rr->pstate()));
|
120
120
|
result->append(empty_node);
|
121
121
|
}
|
@@ -142,7 +142,7 @@ namespace Sass {
|
|
142
142
|
return debubble(rr->block(), rr);
|
143
143
|
}
|
144
144
|
|
145
|
-
Statement* Cssize::operator()(
|
145
|
+
Statement* Cssize::operator()(StyleRule* r)
|
146
146
|
{
|
147
147
|
p_stack.push_back(r);
|
148
148
|
// this can return a string schema
|
@@ -155,7 +155,7 @@ namespace Sass {
|
|
155
155
|
if (Cast<Statement>(bb) == NULL) {
|
156
156
|
error("Illegal nesting: Only properties may be nested beneath properties.", r->block()->pstate(), traces);
|
157
157
|
}
|
158
|
-
|
158
|
+
StyleRuleObj rr = SASS_MEMORY_NEW(StyleRule,
|
159
159
|
r->pstate(),
|
160
160
|
r->selector(),
|
161
161
|
bb);
|
@@ -238,7 +238,7 @@ namespace Sass {
|
|
238
238
|
return debubble(mm->block(), mm);
|
239
239
|
}
|
240
240
|
|
241
|
-
Statement* Cssize::operator()(
|
241
|
+
Statement* Cssize::operator()(SupportsRule* m)
|
242
242
|
{
|
243
243
|
if (!m->block()->length())
|
244
244
|
{ return m; }
|
@@ -248,7 +248,7 @@ namespace Sass {
|
|
248
248
|
|
249
249
|
p_stack.push_back(m);
|
250
250
|
|
251
|
-
|
251
|
+
SupportsRuleObj mm = SASS_MEMORY_NEW(SupportsRule,
|
252
252
|
m->pstate(),
|
253
253
|
m->condition(),
|
254
254
|
operator()(m->block()));
|
@@ -259,7 +259,7 @@ namespace Sass {
|
|
259
259
|
return debubble(mm->block(), mm);
|
260
260
|
}
|
261
261
|
|
262
|
-
Statement* Cssize::operator()(
|
262
|
+
Statement* Cssize::operator()(AtRootRule* m)
|
263
263
|
{
|
264
264
|
bool tmp = false;
|
265
265
|
for (size_t i = 0, L = p_stack.size(); i < L; ++i) {
|
@@ -287,17 +287,17 @@ namespace Sass {
|
|
287
287
|
return bubble(m);
|
288
288
|
}
|
289
289
|
|
290
|
-
Statement* Cssize::bubble(
|
290
|
+
Statement* Cssize::bubble(AtRule* m)
|
291
291
|
{
|
292
292
|
Block* bb = SASS_MEMORY_NEW(Block, this->parent()->pstate());
|
293
|
-
|
293
|
+
ParentStatementObj new_rule = Cast<ParentStatement>(SASS_MEMORY_COPY(this->parent()));
|
294
294
|
new_rule->block(bb);
|
295
295
|
new_rule->tabs(this->parent()->tabs());
|
296
296
|
new_rule->block()->concat(m->block());
|
297
297
|
|
298
298
|
Block_Obj wrapper_block = SASS_MEMORY_NEW(Block, m->block() ? m->block()->pstate() : m->pstate());
|
299
299
|
wrapper_block->append(new_rule);
|
300
|
-
|
300
|
+
AtRuleObj mm = SASS_MEMORY_NEW(AtRule,
|
301
301
|
m->pstate(),
|
302
302
|
m->keyword(),
|
303
303
|
m->selector(),
|
@@ -308,11 +308,11 @@ namespace Sass {
|
|
308
308
|
return bubble;
|
309
309
|
}
|
310
310
|
|
311
|
-
Statement* Cssize::bubble(
|
311
|
+
Statement* Cssize::bubble(AtRootRule* m)
|
312
312
|
{
|
313
313
|
if (!m || !m->block()) return NULL;
|
314
314
|
Block* bb = SASS_MEMORY_NEW(Block, this->parent()->pstate());
|
315
|
-
|
315
|
+
ParentStatementObj new_rule = Cast<ParentStatement>(SASS_MEMORY_COPY(this->parent()));
|
316
316
|
Block* wrapper_block = SASS_MEMORY_NEW(Block, m->block()->pstate());
|
317
317
|
if (new_rule) {
|
318
318
|
new_rule->block(bb);
|
@@ -321,7 +321,7 @@ namespace Sass {
|
|
321
321
|
wrapper_block->append(new_rule);
|
322
322
|
}
|
323
323
|
|
324
|
-
|
324
|
+
AtRootRule* mm = SASS_MEMORY_NEW(AtRootRule,
|
325
325
|
m->pstate(),
|
326
326
|
wrapper_block,
|
327
327
|
m->expression());
|
@@ -329,12 +329,12 @@ namespace Sass {
|
|
329
329
|
return bubble;
|
330
330
|
}
|
331
331
|
|
332
|
-
Statement* Cssize::bubble(
|
332
|
+
Statement* Cssize::bubble(SupportsRule* m)
|
333
333
|
{
|
334
|
-
|
334
|
+
StyleRuleObj parent = Cast<StyleRule>(SASS_MEMORY_COPY(this->parent()));
|
335
335
|
|
336
336
|
Block* bb = SASS_MEMORY_NEW(Block, parent->block()->pstate());
|
337
|
-
|
337
|
+
StyleRule* new_rule = SASS_MEMORY_NEW(StyleRule,
|
338
338
|
parent->pstate(),
|
339
339
|
parent->selector(),
|
340
340
|
bb);
|
@@ -343,7 +343,7 @@ namespace Sass {
|
|
343
343
|
|
344
344
|
Block* wrapper_block = SASS_MEMORY_NEW(Block, m->block()->pstate());
|
345
345
|
wrapper_block->append(new_rule);
|
346
|
-
|
346
|
+
SupportsRule* mm = SASS_MEMORY_NEW(SupportsRule,
|
347
347
|
m->pstate(),
|
348
348
|
m->condition(),
|
349
349
|
wrapper_block);
|
@@ -356,10 +356,10 @@ namespace Sass {
|
|
356
356
|
|
357
357
|
Statement* Cssize::bubble(CssMediaRule* m)
|
358
358
|
{
|
359
|
-
|
359
|
+
StyleRuleObj parent = Cast<StyleRule>(SASS_MEMORY_COPY(this->parent()));
|
360
360
|
|
361
361
|
Block* bb = SASS_MEMORY_NEW(Block, parent->block()->pstate());
|
362
|
-
|
362
|
+
StyleRule* new_rule = SASS_MEMORY_NEW(StyleRule,
|
363
363
|
parent->pstate(),
|
364
364
|
parent->selector(),
|
365
365
|
bb);
|
@@ -380,7 +380,7 @@ namespace Sass {
|
|
380
380
|
|
381
381
|
bool Cssize::bubblable(Statement* s)
|
382
382
|
{
|
383
|
-
return Cast<
|
383
|
+
return Cast<StyleRule>(s) || (s && s->bubbles());
|
384
384
|
}
|
385
385
|
|
386
386
|
Block* Cssize::flatten(const Block* b)
|
@@ -401,9 +401,9 @@ namespace Sass {
|
|
401
401
|
return result;
|
402
402
|
}
|
403
403
|
|
404
|
-
|
404
|
+
sass::vector<std::pair<bool, Block_Obj>> Cssize::slice_by_bubble(Block* b)
|
405
405
|
{
|
406
|
-
|
406
|
+
sass::vector<std::pair<bool, Block_Obj>> results;
|
407
407
|
|
408
408
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
409
409
|
Statement_Obj value = b->at(i);
|
@@ -426,8 +426,8 @@ namespace Sass {
|
|
426
426
|
|
427
427
|
Block* Cssize::debubble(Block* children, Statement* parent)
|
428
428
|
{
|
429
|
-
|
430
|
-
|
429
|
+
ParentStatementObj previous_parent;
|
430
|
+
sass::vector<std::pair<bool, Block_Obj>> baz = slice_by_bubble(children);
|
431
431
|
Block_Obj result = SASS_MEMORY_NEW(Block, children->pstate());
|
432
432
|
|
433
433
|
for (size_t i = 0, L = baz.size(); i < L; ++i) {
|
@@ -479,7 +479,8 @@ namespace Sass {
|
|
479
479
|
children->pstate(),
|
480
480
|
children->length(),
|
481
481
|
children->is_root());
|
482
|
-
|
482
|
+
auto evaled = ss->perform(this);
|
483
|
+
if (evaled) bb->append(evaled);
|
483
484
|
|
484
485
|
Block_Obj wrapper_block = SASS_MEMORY_NEW(Block,
|
485
486
|
children->pstate(),
|
data/ext/libsass/src/cssize.hpp
CHANGED
@@ -14,32 +14,32 @@ namespace Sass {
|
|
14
14
|
|
15
15
|
Backtraces& traces;
|
16
16
|
BlockStack block_stack;
|
17
|
-
|
17
|
+
sass::vector<Statement*> p_stack;
|
18
18
|
|
19
19
|
public:
|
20
20
|
Cssize(Context&);
|
21
21
|
~Cssize() { }
|
22
22
|
|
23
23
|
Block* operator()(Block*);
|
24
|
-
Statement* operator()(
|
24
|
+
Statement* operator()(StyleRule*);
|
25
25
|
// Statement* operator()(Bubble*);
|
26
26
|
Statement* operator()(CssMediaRule*);
|
27
|
-
Statement* operator()(
|
28
|
-
Statement* operator()(
|
29
|
-
Statement* operator()(
|
27
|
+
Statement* operator()(SupportsRule*);
|
28
|
+
Statement* operator()(AtRootRule*);
|
29
|
+
Statement* operator()(AtRule*);
|
30
30
|
Statement* operator()(Keyframe_Rule*);
|
31
31
|
Statement* operator()(Trace*);
|
32
32
|
Statement* operator()(Declaration*);
|
33
33
|
// Statement* operator()(Assignment*);
|
34
34
|
// Statement* operator()(Import*);
|
35
35
|
// Statement* operator()(Import_Stub*);
|
36
|
-
// Statement* operator()(
|
36
|
+
// Statement* operator()(WarningRule*);
|
37
37
|
// Statement* operator()(Error*);
|
38
38
|
// Statement* operator()(Comment*);
|
39
39
|
// Statement* operator()(If*);
|
40
|
-
// Statement* operator()(
|
41
|
-
// Statement* operator()(
|
42
|
-
// Statement* operator()(
|
40
|
+
// Statement* operator()(ForRule*);
|
41
|
+
// Statement* operator()(EachRule*);
|
42
|
+
// Statement* operator()(WhileRule*);
|
43
43
|
// Statement* operator()(Return*);
|
44
44
|
// Statement* operator()(ExtendRule*);
|
45
45
|
// Statement* operator()(Definition*);
|
@@ -48,11 +48,11 @@ namespace Sass {
|
|
48
48
|
Statement* operator()(Null*);
|
49
49
|
|
50
50
|
Statement* parent();
|
51
|
-
|
52
|
-
Statement* bubble(
|
53
|
-
Statement* bubble(
|
51
|
+
sass::vector<std::pair<bool, Block_Obj>> slice_by_bubble(Block*);
|
52
|
+
Statement* bubble(AtRule*);
|
53
|
+
Statement* bubble(AtRootRule*);
|
54
54
|
Statement* bubble(CssMediaRule*);
|
55
|
-
Statement* bubble(
|
55
|
+
Statement* bubble(SupportsRule*);
|
56
56
|
|
57
57
|
Block* debubble(Block* children, Statement* parent = 0);
|
58
58
|
Block* flatten(const Block*);
|
@@ -12,7 +12,7 @@ namespace Sass {
|
|
12
12
|
// Flatten `vector<vector<T>>` to `vector<T>`
|
13
13
|
// ##########################################################################
|
14
14
|
template <class T>
|
15
|
-
T flatten(const
|
15
|
+
T flatten(const sass::vector<T>& all)
|
16
16
|
{
|
17
17
|
T flattened;
|
18
18
|
for (const auto& sub : all) {
|
@@ -42,7 +42,7 @@ namespace Sass {
|
|
42
42
|
// ##########################################################################
|
43
43
|
// ##########################################################################
|
44
44
|
template <class T>
|
45
|
-
T flattenInner(const
|
45
|
+
T flattenInner(const sass::vector<T>& vec)
|
46
46
|
{
|
47
47
|
T outer;
|
48
48
|
for (const auto& sub : vec) {
|
@@ -102,8 +102,8 @@ namespace Sass {
|
|
102
102
|
// Longest common subsequence with predicate
|
103
103
|
// ##########################################################################
|
104
104
|
template <class T>
|
105
|
-
|
106
|
-
const
|
105
|
+
sass::vector<T> lcs(
|
106
|
+
const sass::vector<T>& X, const sass::vector<T>& Y,
|
107
107
|
bool(*select)(const T&, const T&, T&) = lcsIdentityCmp<T>)
|
108
108
|
{
|
109
109
|
|
@@ -142,7 +142,7 @@ namespace Sass {
|
|
142
142
|
}
|
143
143
|
|
144
144
|
// Following code is used to print LCS
|
145
|
-
|
145
|
+
sass::vector<T> lcs;
|
146
146
|
std::size_t index = LEN(m, n);
|
147
147
|
lcs.reserve(index);
|
148
148
|
|
@@ -17,15 +17,15 @@
|
|
17
17
|
|
18
18
|
using namespace Sass;
|
19
19
|
|
20
|
-
inline void debug_ast(AST_Node* node,
|
20
|
+
inline void debug_ast(AST_Node* node, sass::string ind = "", Env* env = 0);
|
21
21
|
|
22
|
-
inline
|
22
|
+
inline sass::string debug_vec(const AST_Node* node) {
|
23
23
|
if (node == NULL) return "null";
|
24
24
|
else return node->to_string();
|
25
25
|
}
|
26
26
|
|
27
|
-
inline
|
28
|
-
|
27
|
+
inline sass::string debug_dude(sass::vector<sass::vector<int>> vec) {
|
28
|
+
sass::sstream out;
|
29
29
|
out << "{";
|
30
30
|
bool joinOut = false;
|
31
31
|
for (auto ct : vec) {
|
@@ -44,12 +44,12 @@ inline std::string debug_dude(std::vector
|
|
44
44
|
return out.str();
|
45
45
|
}
|
46
46
|
|
47
|
-
inline
|
47
|
+
inline sass::string debug_vec(sass::string& str) {
|
48
48
|
return str;
|
49
49
|
}
|
50
50
|
|
51
|
-
inline
|
52
|
-
|
51
|
+
inline sass::string debug_vec(Extension& ext) {
|
52
|
+
sass::sstream out;
|
53
53
|
out << debug_vec(ext.extender);
|
54
54
|
out << " {@extend ";
|
55
55
|
out << debug_vec(ext.target);
|
@@ -61,8 +61,8 @@ inline std::string debug_vec(Extension& ext) {
|
|
61
61
|
}
|
62
62
|
|
63
63
|
template <class T>
|
64
|
-
inline
|
65
|
-
|
64
|
+
inline sass::string debug_vec(sass::vector<T> vec) {
|
65
|
+
sass::sstream out;
|
66
66
|
out << "[";
|
67
67
|
for (size_t i = 0; i < vec.size(); i += 1) {
|
68
68
|
if (i > 0) out << ", ";
|
@@ -73,8 +73,8 @@ inline std::string debug_vec(std::vector
|
|
73
73
|
}
|
74
74
|
|
75
75
|
template <class T>
|
76
|
-
inline
|
77
|
-
|
76
|
+
inline sass::string debug_vec(std::queue<T> vec) {
|
77
|
+
sass::sstream out;
|
78
78
|
out << "{";
|
79
79
|
for (size_t i = 0; i < vec.size(); i += 1) {
|
80
80
|
if (i > 0) out << ", ";
|
@@ -85,8 +85,8 @@ inline std::string debug_vec(std::queue
|
|
85
85
|
}
|
86
86
|
|
87
87
|
template <class T, class U, class O>
|
88
|
-
inline
|
89
|
-
|
88
|
+
inline sass::string debug_vec(std::map<T, U, O> vec) {
|
89
|
+
sass::sstream out;
|
90
90
|
out << "{";
|
91
91
|
bool joinit = false;
|
92
92
|
for (auto it = vec.begin(); it != vec.end(); it++)
|
@@ -102,8 +102,8 @@ inline std::string debug_vec(std::map
|
|
102
102
|
}
|
103
103
|
|
104
104
|
template <class T, class U, class O, class V>
|
105
|
-
inline
|
106
|
-
|
105
|
+
inline sass::string debug_vec(const ordered_map<T, U, O, V>& vec) {
|
106
|
+
sass::sstream out;
|
107
107
|
out << "{";
|
108
108
|
bool joinit = false;
|
109
109
|
for (auto it = vec.begin(); it != vec.end(); it++)
|
@@ -118,8 +118,8 @@ inline std::string debug_vec(const ordered_map
|
|
118
118
|
}
|
119
119
|
|
120
120
|
template <class T, class U, class O, class V>
|
121
|
-
inline
|
122
|
-
|
121
|
+
inline sass::string debug_vec(std::unordered_map<T, U, O, V> vec) {
|
122
|
+
sass::sstream out;
|
123
123
|
out << "{";
|
124
124
|
bool joinit = false;
|
125
125
|
for (auto it = vec.begin(); it != vec.end(); it++)
|
@@ -135,8 +135,8 @@ inline std::string debug_vec(std::unordered_map
|
|
135
135
|
}
|
136
136
|
|
137
137
|
template <class T, class U, class O, class V>
|
138
|
-
inline
|
139
|
-
|
138
|
+
inline sass::string debug_keys(std::unordered_map<T, U, O, V> vec) {
|
139
|
+
sass::sstream out;
|
140
140
|
out << "{";
|
141
141
|
bool joinit = false;
|
142
142
|
for (auto it = vec.begin(); it != vec.end(); it++)
|
@@ -149,8 +149,8 @@ inline std::string debug_keys(std::unordered_map
|
|
149
149
|
return out.str();
|
150
150
|
}
|
151
151
|
|
152
|
-
inline
|
153
|
-
|
152
|
+
inline sass::string debug_vec(ExtListSelSet& vec) {
|
153
|
+
sass::sstream out;
|
154
154
|
out << "{";
|
155
155
|
bool joinit = false;
|
156
156
|
for (auto it = vec.begin(); it != vec.end(); it++)
|
@@ -165,8 +165,8 @@ inline std::string debug_vec(ExtListSelSet& vec) {
|
|
165
165
|
|
166
166
|
/*
|
167
167
|
template <class T, class U, class O, class V>
|
168
|
-
inline
|
169
|
-
|
168
|
+
inline sass::string debug_values(tsl::ordered_map<T, U, O, V> vec) {
|
169
|
+
sass::sstream out;
|
170
170
|
out << "{";
|
171
171
|
bool joinit = false;
|
172
172
|
for (auto it = vec.begin(); it != vec.end(); it++)
|
@@ -180,8 +180,8 @@ inline std::string debug_values(tsl::ordered_map
|
|
180
180
|
}
|
181
181
|
|
182
182
|
template <class T, class U, class O, class V>
|
183
|
-
inline
|
184
|
-
|
183
|
+
inline sass::string debug_vec(tsl::ordered_map<T, U, O, V> vec) {
|
184
|
+
sass::sstream out;
|
185
185
|
out << "{";
|
186
186
|
bool joinit = false;
|
187
187
|
for (auto it = vec.begin(); it != vec.end(); it++)
|
@@ -197,8 +197,8 @@ inline std::string debug_vec(tsl::ordered_map
|
|
197
197
|
}
|
198
198
|
|
199
199
|
template <class T, class U, class O, class V>
|
200
|
-
inline
|
201
|
-
|
200
|
+
inline sass::string debug_vals(tsl::ordered_map<T, U, O, V> vec) {
|
201
|
+
sass::sstream out;
|
202
202
|
out << "{";
|
203
203
|
bool joinit = false;
|
204
204
|
for (auto it = vec.begin(); it != vec.end(); it++)
|
@@ -212,8 +212,8 @@ inline std::string debug_vals(tsl::ordered_map
|
|
212
212
|
}
|
213
213
|
|
214
214
|
template <class T, class U, class O, class V>
|
215
|
-
inline
|
216
|
-
|
215
|
+
inline sass::string debug_keys(tsl::ordered_map<T, U, O, V> vec) {
|
216
|
+
sass::sstream out;
|
217
217
|
out << "{";
|
218
218
|
bool joinit = false;
|
219
219
|
for (auto it = vec.begin(); it != vec.end(); it++)
|
@@ -228,8 +228,8 @@ inline std::string debug_keys(tsl::ordered_map
|
|
228
228
|
*/
|
229
229
|
|
230
230
|
template <class T, class U>
|
231
|
-
inline
|
232
|
-
|
231
|
+
inline sass::string debug_vec(std::set<T, U> vec) {
|
232
|
+
sass::sstream out;
|
233
233
|
out << "{";
|
234
234
|
bool joinit = false;
|
235
235
|
for (auto item : vec) {
|
@@ -243,8 +243,8 @@ inline std::string debug_vec(std::set
|
|
243
243
|
|
244
244
|
/*
|
245
245
|
template <class T, class U, class O, class V>
|
246
|
-
inline
|
247
|
-
|
246
|
+
inline sass::string debug_vec(tsl::ordered_set<T, U, O, V> vec) {
|
247
|
+
sass::sstream out;
|
248
248
|
out << "{";
|
249
249
|
bool joinit = false;
|
250
250
|
for (auto item : vec) {
|
@@ -258,8 +258,8 @@ inline std::string debug_vec(tsl::ordered_set
|
|
258
258
|
*/
|
259
259
|
|
260
260
|
template <class T, class U, class O, class V>
|
261
|
-
inline
|
262
|
-
|
261
|
+
inline sass::string debug_vec(std::unordered_set<T, U, O, V> vec) {
|
262
|
+
sass::sstream out;
|
263
263
|
out << "{";
|
264
264
|
bool joinit = false;
|
265
265
|
for (auto item : vec) {
|
@@ -271,22 +271,22 @@ inline std::string debug_vec(std::unordered_set
|
|
271
271
|
return out.str();
|
272
272
|
}
|
273
273
|
|
274
|
-
inline
|
274
|
+
inline sass::string debug_bool(bool val) {
|
275
275
|
return val ? "true" : "false";
|
276
276
|
}
|
277
|
-
inline
|
277
|
+
inline sass::string debug_vec(ExtSmplSelSet* node) {
|
278
278
|
if (node == NULL) return "null";
|
279
279
|
else return debug_vec(*node);
|
280
280
|
}
|
281
281
|
|
282
|
-
inline void debug_ast(const AST_Node* node,
|
282
|
+
inline void debug_ast(const AST_Node* node, sass::string ind = "", Env* env = 0) {
|
283
283
|
debug_ast(const_cast<AST_Node*>(node), ind, env);
|
284
284
|
}
|
285
285
|
|
286
|
-
inline
|
286
|
+
inline sass::string str_replace(sass::string str, const sass::string& oldStr, const sass::string& newStr)
|
287
287
|
{
|
288
288
|
size_t pos = 0;
|
289
|
-
while((pos = str.find(oldStr, pos)) !=
|
289
|
+
while((pos = str.find(oldStr, pos)) != sass::string::npos)
|
290
290
|
{
|
291
291
|
str.replace(pos, oldStr.length(), newStr);
|
292
292
|
pos += newStr.length();
|
@@ -294,25 +294,26 @@ inline std::string str_replace(std::string str, const std::string& oldStr, const
|
|
294
294
|
return str;
|
295
295
|
}
|
296
296
|
|
297
|
-
inline
|
298
|
-
|
297
|
+
inline sass::string prettyprint(const sass::string& str) {
|
298
|
+
sass::string clean = str_replace(str, "\n", "\\n");
|
299
299
|
clean = str_replace(clean, " ", "\\t");
|
300
300
|
clean = str_replace(clean, "\r", "\\r");
|
301
301
|
return clean;
|
302
302
|
}
|
303
303
|
|
304
|
-
inline
|
305
|
-
|
304
|
+
inline sass::string longToHex(long long t) {
|
305
|
+
sass::sstream is;
|
306
306
|
is << std::hex << t;
|
307
307
|
return is.str();
|
308
308
|
}
|
309
309
|
|
310
|
-
inline
|
310
|
+
inline sass::string pstate_source_position(AST_Node* node)
|
311
311
|
{
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
312
|
+
sass::sstream str;
|
313
|
+
Offset start(node->pstate().position);
|
314
|
+
Offset end(start + node->pstate().offset);
|
315
|
+
size_t file = node->pstate().getSrcId();
|
316
|
+
str << (file == sass::string::npos ? 99999999 : file)
|
316
317
|
<< "@[" << start.line << ":" << start.column << "]"
|
317
318
|
<< "-[" << end.line << ":" << end.column << "]";
|
318
319
|
#ifdef DEBUG_SHARED_PTR
|
@@ -323,7 +324,7 @@ inline std::string pstate_source_position(AST_Node* node)
|
|
323
324
|
return str.str();
|
324
325
|
}
|
325
326
|
|
326
|
-
inline void debug_ast(AST_Node* node,
|
327
|
+
inline void debug_ast(AST_Node* node, sass::string ind, Env* env)
|
327
328
|
{
|
328
329
|
if (node == 0) return;
|
329
330
|
if (ind == "") std::cerr << "####################################################################\n";
|
@@ -341,9 +342,9 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
341
342
|
<< " [name:" << trace->name() << ", type: " << trace->type() << "]"
|
342
343
|
<< std::endl;
|
343
344
|
debug_ast(trace->block(), ind + " ", env);
|
344
|
-
} else if (Cast<
|
345
|
-
|
346
|
-
std::cerr << ind << "
|
345
|
+
} else if (Cast<AtRootRule>(node)) {
|
346
|
+
AtRootRule* root_block = Cast<AtRootRule>(node);
|
347
|
+
std::cerr << ind << "AtRootRule " << root_block;
|
347
348
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
348
349
|
std::cerr << " " << root_block->tabs();
|
349
350
|
std::cerr << std::endl;
|
@@ -392,7 +393,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
392
393
|
<< (selector->has_real_parent_ref() ? " [real parent]": " -")
|
393
394
|
<< " -- ";
|
394
395
|
|
395
|
-
|
396
|
+
sass::string del;
|
396
397
|
switch (selector->combinator()) {
|
397
398
|
case SelectorCombinator::CHILD: del = ">"; break;
|
398
399
|
case SelectorCombinator::GENERAL: del = "~"; break;
|
@@ -419,11 +420,11 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
419
420
|
std::cerr << ind << "Parent_Reference " << selector;
|
420
421
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
421
422
|
std::cerr << " <" << selector->hash() << ">";
|
422
|
-
std::cerr <<
|
423
|
+
std::cerr << std::endl;
|
423
424
|
|
424
|
-
} else if (Cast<
|
425
|
-
|
426
|
-
std::cerr << ind << "
|
425
|
+
} else if (Cast<PseudoSelector>(node)) {
|
426
|
+
PseudoSelector* selector = Cast<PseudoSelector>(node);
|
427
|
+
std::cerr << ind << "PseudoSelector " << selector;
|
427
428
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
428
429
|
std::cerr << " <" << selector->hash() << ">";
|
429
430
|
std::cerr << " <<" << selector->ns_name() << ">>";
|
@@ -432,40 +433,39 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
432
433
|
std::cerr << std::endl;
|
433
434
|
debug_ast(selector->argument(), ind + " <= ", env);
|
434
435
|
debug_ast(selector->selector(), ind + " || ", env);
|
435
|
-
} else if (Cast<
|
436
|
-
|
437
|
-
std::cerr << ind << "
|
436
|
+
} else if (Cast<AttributeSelector>(node)) {
|
437
|
+
AttributeSelector* selector = Cast<AttributeSelector>(node);
|
438
|
+
std::cerr << ind << "AttributeSelector " << selector;
|
438
439
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
439
440
|
std::cerr << " <" << selector->hash() << ">";
|
440
441
|
std::cerr << " <<" << selector->ns_name() << ">>";
|
441
442
|
std::cerr << std::endl;
|
442
443
|
debug_ast(selector->value(), ind + "[" + selector->matcher() + "] ", env);
|
443
|
-
} else if (Cast<
|
444
|
-
|
445
|
-
std::cerr << ind << "
|
444
|
+
} else if (Cast<ClassSelector>(node)) {
|
445
|
+
ClassSelector* selector = Cast<ClassSelector>(node);
|
446
|
+
std::cerr << ind << "ClassSelector " << selector;
|
446
447
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
447
448
|
std::cerr << " <" << selector->hash() << ">";
|
448
449
|
std::cerr << " <<" << selector->ns_name() << ">>";
|
449
450
|
std::cerr << std::endl;
|
450
|
-
} else if (Cast<
|
451
|
-
|
452
|
-
std::cerr << ind << "
|
451
|
+
} else if (Cast<IDSelector>(node)) {
|
452
|
+
IDSelector* selector = Cast<IDSelector>(node);
|
453
|
+
std::cerr << ind << "IDSelector " << selector;
|
453
454
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
454
455
|
std::cerr << " <" << selector->hash() << ">";
|
455
456
|
std::cerr << " <<" << selector->ns_name() << ">>";
|
456
457
|
std::cerr << std::endl;
|
457
|
-
} else if (Cast<
|
458
|
-
|
459
|
-
std::cerr << ind << "
|
458
|
+
} else if (Cast<TypeSelector>(node)) {
|
459
|
+
TypeSelector* selector = Cast<TypeSelector>(node);
|
460
|
+
std::cerr << ind << "TypeSelector " << selector;
|
460
461
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
461
462
|
std::cerr << " <" << selector->hash() << ">";
|
462
463
|
std::cerr << " <<" << selector->ns_name() << ">>";
|
463
|
-
std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">";
|
464
464
|
std::cerr << std::endl;
|
465
|
-
} else if (Cast<
|
465
|
+
} else if (Cast<PlaceholderSelector>(node)) {
|
466
466
|
|
467
|
-
|
468
|
-
std::cerr << ind << "
|
467
|
+
PlaceholderSelector* selector = Cast<PlaceholderSelector>(node);
|
468
|
+
std::cerr << ind << "PlaceholderSelector [" << selector->ns_name() << "] " << selector;
|
469
469
|
std::cerr << " (" << pstate_source_position(selector) << ")"
|
470
470
|
<< " <" << selector->hash() << ">"
|
471
471
|
<< (selector->isInvisible() ? " [isInvisible]" : " -")
|
@@ -537,23 +537,23 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
537
537
|
std::cerr << " [" << (query->type()) << "] ";
|
538
538
|
std::cerr << " " << debug_vec(query->features());
|
539
539
|
std::cerr << std::endl;
|
540
|
-
} else if (Cast<
|
541
|
-
|
542
|
-
std::cerr << ind << "
|
540
|
+
} else if (Cast<SupportsRule>(node)) {
|
541
|
+
SupportsRule* block = Cast<SupportsRule>(node);
|
542
|
+
std::cerr << ind << "SupportsRule " << block;
|
543
543
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
544
544
|
std::cerr << " " << block->tabs() << std::endl;
|
545
545
|
debug_ast(block->condition(), ind + " =@ ");
|
546
546
|
debug_ast(block->block(), ind + " <>");
|
547
|
-
} else if (Cast<
|
548
|
-
|
549
|
-
std::cerr << ind << "
|
547
|
+
} else if (Cast<SupportsOperation>(node)) {
|
548
|
+
SupportsOperation* block = Cast<SupportsOperation>(node);
|
549
|
+
std::cerr << ind << "SupportsOperation " << block;
|
550
550
|
std::cerr << " (" << pstate_source_position(node) << ")"
|
551
551
|
<< std::endl;
|
552
552
|
debug_ast(block->left(), ind + " left) ");
|
553
553
|
debug_ast(block->right(), ind + " right) ");
|
554
|
-
} else if (Cast<
|
555
|
-
|
556
|
-
std::cerr << ind << "
|
554
|
+
} else if (Cast<SupportsNegation>(node)) {
|
555
|
+
SupportsNegation* block = Cast<SupportsNegation>(node);
|
556
|
+
std::cerr << ind << "SupportsNegation " << block;
|
557
557
|
std::cerr << " (" << pstate_source_position(node) << ")"
|
558
558
|
<< std::endl;
|
559
559
|
debug_ast(block->condition(), ind + " condition) ");
|
@@ -564,9 +564,9 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
564
564
|
<< std::endl;
|
565
565
|
debug_ast(block->feature(), ind + " feature) ");
|
566
566
|
debug_ast(block->value(), ind + " value) ");
|
567
|
-
} else if (Cast<
|
568
|
-
|
569
|
-
std::cerr << ind << "
|
567
|
+
} else if (Cast<SupportsDeclaration>(node)) {
|
568
|
+
SupportsDeclaration* block = Cast<SupportsDeclaration>(node);
|
569
|
+
std::cerr << ind << "SupportsDeclaration " << block;
|
570
570
|
std::cerr << " (" << pstate_source_position(node) << ")"
|
571
571
|
<< std::endl;
|
572
572
|
debug_ast(block->feature(), ind + " feature) ");
|
@@ -579,20 +579,20 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
579
579
|
if (root_block->isInvisible()) std::cerr << " [isInvisible]";
|
580
580
|
std::cerr << " " << root_block->tabs() << std::endl;
|
581
581
|
for(const Statement_Obj& i : root_block->elements()) { debug_ast(i, ind + " ", env); }
|
582
|
-
} else if (Cast<
|
583
|
-
|
584
|
-
std::cerr << ind << "
|
582
|
+
} else if (Cast<WarningRule>(node)) {
|
583
|
+
WarningRule* block = Cast<WarningRule>(node);
|
584
|
+
std::cerr << ind << "WarningRule " << block;
|
585
585
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
586
586
|
std::cerr << " " << block->tabs() << std::endl;
|
587
587
|
debug_ast(block->message(), ind + " : ");
|
588
|
-
} else if (Cast<
|
589
|
-
|
590
|
-
std::cerr << ind << "
|
588
|
+
} else if (Cast<ErrorRule>(node)) {
|
589
|
+
ErrorRule* block = Cast<ErrorRule>(node);
|
590
|
+
std::cerr << ind << "ErrorRule " << block;
|
591
591
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
592
592
|
std::cerr << " " << block->tabs() << std::endl;
|
593
|
-
} else if (Cast<
|
594
|
-
|
595
|
-
std::cerr << ind << "
|
593
|
+
} else if (Cast<DebugRule>(node)) {
|
594
|
+
DebugRule* block = Cast<DebugRule>(node);
|
595
|
+
std::cerr << ind << "DebugRule " << block;
|
596
596
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
597
597
|
std::cerr << " " << block->tabs() << std::endl;
|
598
598
|
debug_ast(block->value(), ind + " ");
|
@@ -600,8 +600,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
600
600
|
Comment* block = Cast<Comment>(node);
|
601
601
|
std::cerr << ind << "Comment " << block;
|
602
602
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
603
|
-
std::cerr << " " << block->tabs() <<
|
604
|
-
" <" << prettyprint(block->pstate().token.ws_before()) << ">" << std::endl;
|
603
|
+
std::cerr << " " << block->tabs() << std::endl;
|
605
604
|
debug_ast(block->text(), ind + "// ", env);
|
606
605
|
} else if (Cast<If>(node)) {
|
607
606
|
If* block = Cast<If>(node);
|
@@ -640,7 +639,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
640
639
|
std::cerr << ind << "Import " << block;
|
641
640
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
642
641
|
std::cerr << " " << block->tabs() << std::endl;
|
643
|
-
//
|
642
|
+
// sass::vector<sass::string> files_;
|
644
643
|
for (auto imp : block->urls()) debug_ast(imp, ind + "@: ", env);
|
645
644
|
debug_ast(block->import_queries(), ind + "@@ ");
|
646
645
|
} else if (Cast<Assignment>(node)) {
|
@@ -659,35 +658,35 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
659
658
|
debug_ast(block->value(), ind + " value: ", env);
|
660
659
|
debug_ast(block->block(), ind + " ", env);
|
661
660
|
} else if (Cast<Keyframe_Rule>(node)) {
|
662
|
-
Keyframe_Rule*
|
663
|
-
std::cerr << ind << "Keyframe_Rule " <<
|
661
|
+
Keyframe_Rule* ParentStatement = Cast<Keyframe_Rule>(node);
|
662
|
+
std::cerr << ind << "Keyframe_Rule " << ParentStatement;
|
664
663
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
665
|
-
std::cerr << " " <<
|
666
|
-
if (
|
667
|
-
if (
|
668
|
-
} else if (Cast<
|
669
|
-
|
670
|
-
std::cerr << ind << "
|
664
|
+
std::cerr << " " << ParentStatement->tabs() << std::endl;
|
665
|
+
if (ParentStatement->name()) debug_ast(ParentStatement->name(), ind + "@");
|
666
|
+
if (ParentStatement->block()) for(const Statement_Obj& i : ParentStatement->block()->elements()) { debug_ast(i, ind + " ", env); }
|
667
|
+
} else if (Cast<AtRule>(node)) {
|
668
|
+
AtRule* block = Cast<AtRule>(node);
|
669
|
+
std::cerr << ind << "AtRule " << block;
|
671
670
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
672
671
|
std::cerr << " [" << block->keyword() << "] " << block->tabs() << std::endl;
|
673
672
|
debug_ast(block->selector(), ind + "~", env);
|
674
673
|
debug_ast(block->value(), ind + "+", env);
|
675
674
|
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
676
|
-
} else if (Cast<
|
677
|
-
|
678
|
-
std::cerr << ind << "
|
675
|
+
} else if (Cast<EachRule>(node)) {
|
676
|
+
EachRule* block = Cast<EachRule>(node);
|
677
|
+
std::cerr << ind << "EachRule " << block;
|
679
678
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
680
679
|
std::cerr << " " << block->tabs() << std::endl;
|
681
680
|
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
682
|
-
} else if (Cast<
|
683
|
-
|
684
|
-
std::cerr << ind << "
|
681
|
+
} else if (Cast<ForRule>(node)) {
|
682
|
+
ForRule* block = Cast<ForRule>(node);
|
683
|
+
std::cerr << ind << "ForRule " << block;
|
685
684
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
686
685
|
std::cerr << " " << block->tabs() << std::endl;
|
687
686
|
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
688
|
-
} else if (Cast<
|
689
|
-
|
690
|
-
std::cerr << ind << "
|
687
|
+
} else if (Cast<WhileRule>(node)) {
|
688
|
+
WhileRule* block = Cast<WhileRule>(node);
|
689
|
+
std::cerr << ind << "WhileRule " << block;
|
691
690
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
692
691
|
std::cerr << " " << block->tabs() << std::endl;
|
693
692
|
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
@@ -712,8 +711,8 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
712
711
|
debug_ast(block->arguments(), ind + " args: ", env);
|
713
712
|
debug_ast(block->block_parameters(), ind + " block_params: ", env);
|
714
713
|
if (block->block()) debug_ast(block->block(), ind + " ", env);
|
715
|
-
} else if (
|
716
|
-
std::cerr << ind << "
|
714
|
+
} else if (StyleRule* ruleset = Cast<StyleRule>(node)) {
|
715
|
+
std::cerr << ind << "StyleRule " << ruleset;
|
717
716
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
718
717
|
std::cerr << " [indent: " << ruleset->tabs() << "]";
|
719
718
|
std::cerr << (ruleset->is_invisible() ? " [INVISIBLE]" : "");
|
@@ -734,7 +733,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
734
733
|
std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
|
735
734
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
736
735
|
std::cerr << " [" << expression->name() << "]" << std::endl;
|
737
|
-
|
736
|
+
sass::string name(expression->name());
|
738
737
|
if (env && env->has(name)) debug_ast(Cast<Expression>((*env)[name]), ind + " -> ", env);
|
739
738
|
} else if (Cast<Function_Call>(node)) {
|
740
739
|
Function_Call* expression = Cast<Function_Call>(node);
|
@@ -881,7 +880,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
881
880
|
if (expression->is_delayed()) std::cerr << " [delayed]";
|
882
881
|
if (expression->is_interpolant()) std::cerr << " [interpolant]";
|
883
882
|
if (expression->quote_mark()) std::cerr << " [quote_mark: " << expression->quote_mark() << "]";
|
884
|
-
std::cerr <<
|
883
|
+
std::cerr << std::endl;
|
885
884
|
} else if (Cast<String_Constant>(node)) {
|
886
885
|
String_Constant* expression = Cast<String_Constant>(node);
|
887
886
|
std::cerr << ind << "String_Constant " << expression;
|
@@ -892,7 +891,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
892
891
|
std::cerr << " [" << prettyprint(expression->value()) << "]";
|
893
892
|
if (expression->is_delayed()) std::cerr << " [delayed]";
|
894
893
|
if (expression->is_interpolant()) std::cerr << " [interpolant]";
|
895
|
-
std::cerr <<
|
894
|
+
std::cerr << std::endl;
|
896
895
|
} else if (Cast<String_Schema>(node)) {
|
897
896
|
String_Schema* expression = Cast<String_Schema>(node);
|
898
897
|
std::cerr << ind << "String_Schema " << expression;
|
@@ -905,7 +904,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
905
904
|
if (expression->has_interpolant()) std::cerr << " [has interpolant]";
|
906
905
|
if (expression->is_left_interpolant()) std::cerr << " [left interpolant] ";
|
907
906
|
if (expression->is_right_interpolant()) std::cerr << " [right interpolant] ";
|
908
|
-
std::cerr <<
|
907
|
+
std::cerr << std::endl;
|
909
908
|
for(const auto& i : expression->elements()) { debug_ast(i, ind + " ", env); }
|
910
909
|
} else if (Cast<String>(node)) {
|
911
910
|
String* expression = Cast<String>(node);
|
@@ -913,7 +912,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
913
912
|
std::cerr << " " << expression->concrete_type();
|
914
913
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
915
914
|
if (expression->is_interpolant()) std::cerr << " [interpolant]";
|
916
|
-
std::cerr <<
|
915
|
+
std::cerr << std::endl;
|
917
916
|
} else if (Cast<Expression>(node)) {
|
918
917
|
Expression* expression = Cast<Expression>(node);
|
919
918
|
std::cerr << ind << "Expression " << expression;
|
@@ -937,12 +936,12 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
937
936
|
case Expression::Type::PARENT: std::cerr << " [PARENT]"; break;
|
938
937
|
}
|
939
938
|
std::cerr << std::endl;
|
940
|
-
} else if (Cast<
|
941
|
-
|
942
|
-
std::cerr << ind << "
|
939
|
+
} else if (Cast<ParentStatement>(node)) {
|
940
|
+
ParentStatement* parent = Cast<ParentStatement>(node);
|
941
|
+
std::cerr << ind << "ParentStatement " << parent;
|
943
942
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
944
|
-
std::cerr << " " <<
|
945
|
-
if (
|
943
|
+
std::cerr << " " << parent->tabs() << std::endl;
|
944
|
+
if (parent->block()) for(const Statement_Obj& i : parent->block()->elements()) { debug_ast(i, ind + " ", env); }
|
946
945
|
} else if (Cast<Statement>(node)) {
|
947
946
|
Statement* statement = Cast<Statement>(node);
|
948
947
|
std::cerr << ind << "Statement " << statement;
|
@@ -955,7 +954,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
955
954
|
|
956
955
|
|
957
956
|
/*
|
958
|
-
inline void debug_ast(const AST_Node* node,
|
957
|
+
inline void debug_ast(const AST_Node* node, sass::string ind = "", Env* env = 0)
|
959
958
|
{
|
960
959
|
debug_ast(const_cast<AST_Node*>(node), ind, env);
|
961
960
|
}
|