sassc 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +13 -0
- data/Rakefile +1 -3
- data/ext/extconf.rb +13 -5
- data/ext/libsass/VERSION +1 -1
- data/ext/libsass/include/sass/base.h +2 -1
- data/ext/libsass/include/sass/context.h +1 -0
- data/ext/libsass/src/ast.cpp +49 -59
- data/ext/libsass/src/ast.hpp +263 -102
- data/ext/libsass/src/ast_def_macros.hpp +8 -0
- data/ext/libsass/src/ast_fwd_decl.cpp +2 -1
- data/ext/libsass/src/ast_fwd_decl.hpp +40 -116
- data/ext/libsass/src/ast_helpers.hpp +292 -0
- data/ext/libsass/src/ast_sel_cmp.cpp +209 -722
- data/ext/libsass/src/ast_sel_super.cpp +539 -0
- data/ext/libsass/src/ast_sel_unify.cpp +207 -212
- data/ext/libsass/src/ast_sel_weave.cpp +616 -0
- data/ext/libsass/src/ast_selectors.cpp +559 -1001
- data/ext/libsass/src/ast_selectors.hpp +311 -367
- data/ext/libsass/src/ast_supports.cpp +1 -17
- data/ext/libsass/src/ast_values.cpp +216 -29
- data/ext/libsass/src/ast_values.hpp +42 -33
- data/ext/libsass/src/bind.cpp +1 -1
- data/ext/libsass/src/cencode.c +4 -6
- data/ext/libsass/src/check_nesting.cpp +5 -6
- data/ext/libsass/src/check_nesting.hpp +4 -0
- data/ext/libsass/src/color_maps.cpp +11 -10
- data/ext/libsass/src/color_maps.hpp +0 -8
- data/ext/libsass/src/constants.cpp +5 -0
- data/ext/libsass/src/constants.hpp +6 -0
- data/ext/libsass/src/context.cpp +30 -60
- data/ext/libsass/src/context.hpp +8 -20
- data/ext/libsass/src/cssize.cpp +36 -120
- data/ext/libsass/src/cssize.hpp +4 -10
- data/ext/libsass/src/dart_helpers.hpp +199 -0
- data/ext/libsass/src/debugger.hpp +364 -207
- data/ext/libsass/src/emitter.cpp +3 -4
- data/ext/libsass/src/emitter.hpp +0 -2
- data/ext/libsass/src/environment.hpp +5 -0
- data/ext/libsass/src/error_handling.cpp +21 -0
- data/ext/libsass/src/error_handling.hpp +25 -3
- data/ext/libsass/src/eval.cpp +33 -153
- data/ext/libsass/src/eval.hpp +11 -13
- data/ext/libsass/src/eval_selectors.cpp +75 -0
- data/ext/libsass/src/expand.cpp +214 -167
- data/ext/libsass/src/expand.hpp +26 -6
- data/ext/libsass/src/extender.cpp +1186 -0
- data/ext/libsass/src/extender.hpp +399 -0
- data/ext/libsass/src/extension.cpp +43 -0
- data/ext/libsass/src/extension.hpp +89 -0
- data/ext/libsass/src/file.cpp +15 -14
- data/ext/libsass/src/file.hpp +5 -12
- data/ext/libsass/src/fn_colors.cpp +12 -10
- data/ext/libsass/src/fn_lists.cpp +12 -11
- data/ext/libsass/src/fn_miscs.cpp +22 -34
- data/ext/libsass/src/fn_numbers.cpp +13 -6
- data/ext/libsass/src/fn_selectors.cpp +94 -124
- data/ext/libsass/src/fn_strings.cpp +16 -14
- data/ext/libsass/src/fn_utils.cpp +5 -6
- data/ext/libsass/src/fn_utils.hpp +9 -3
- data/ext/libsass/src/inspect.cpp +154 -117
- data/ext/libsass/src/inspect.hpp +10 -8
- data/ext/libsass/src/lexer.cpp +17 -81
- data/ext/libsass/src/lexer.hpp +5 -16
- data/ext/libsass/src/listize.cpp +22 -36
- data/ext/libsass/src/listize.hpp +8 -9
- data/ext/libsass/src/memory/SharedPtr.hpp +39 -5
- data/ext/libsass/src/operation.hpp +27 -17
- data/ext/libsass/src/operators.cpp +1 -0
- data/ext/libsass/src/ordered_map.hpp +112 -0
- data/ext/libsass/src/output.cpp +30 -49
- data/ext/libsass/src/output.hpp +1 -1
- data/ext/libsass/src/parser.cpp +211 -381
- data/ext/libsass/src/parser.hpp +17 -15
- data/ext/libsass/src/parser_selectors.cpp +189 -0
- data/ext/libsass/src/permutate.hpp +140 -0
- data/ext/libsass/src/position.hpp +1 -1
- data/ext/libsass/src/prelexer.cpp +6 -6
- data/ext/libsass/src/remove_placeholders.cpp +55 -56
- data/ext/libsass/src/remove_placeholders.hpp +21 -18
- data/ext/libsass/src/sass.hpp +1 -0
- data/ext/libsass/src/sass2scss.cpp +4 -4
- data/ext/libsass/src/sass_context.cpp +42 -91
- data/ext/libsass/src/sass_context.hpp +2 -2
- data/ext/libsass/src/sass_functions.cpp +1 -1
- data/ext/libsass/src/sass_values.cpp +0 -1
- data/ext/libsass/src/stylesheet.cpp +22 -0
- data/ext/libsass/src/stylesheet.hpp +57 -0
- data/ext/libsass/src/to_value.cpp +2 -2
- data/ext/libsass/src/to_value.hpp +1 -1
- data/ext/libsass/src/units.cpp +5 -3
- data/ext/libsass/src/util.cpp +10 -12
- data/ext/libsass/src/util.hpp +2 -3
- data/ext/libsass/src/util_string.cpp +111 -61
- data/ext/libsass/src/util_string.hpp +61 -8
- data/lib/sassc/engine.rb +5 -3
- data/lib/sassc/functions_handler.rb +8 -8
- data/lib/sassc/native.rb +1 -1
- data/lib/sassc/script.rb +4 -4
- data/lib/sassc/version.rb +1 -1
- data/test/functions_test.rb +18 -1
- data/test/native_test.rb +1 -1
- metadata +17 -12
- data/ext/libsass/src/extend.cpp +0 -2132
- data/ext/libsass/src/extend.hpp +0 -86
- data/ext/libsass/src/node.cpp +0 -322
- data/ext/libsass/src/node.hpp +0 -118
- data/ext/libsass/src/paths.hpp +0 -71
- data/ext/libsass/src/sass_util.cpp +0 -152
- data/ext/libsass/src/sass_util.hpp +0 -256
- data/ext/libsass/src/subset_map.cpp +0 -58
- data/ext/libsass/src/subset_map.hpp +0 -76
data/ext/libsass/src/cssize.hpp
CHANGED
@@ -12,7 +12,6 @@ namespace Sass {
|
|
12
12
|
|
13
13
|
class Cssize : public Operation_CRTP<Statement*, Cssize> {
|
14
14
|
|
15
|
-
Context& ctx;
|
16
15
|
Backtraces& traces;
|
17
16
|
BlockStack block_stack;
|
18
17
|
std::vector<Statement*> p_stack;
|
@@ -21,12 +20,10 @@ namespace Sass {
|
|
21
20
|
Cssize(Context&);
|
22
21
|
~Cssize() { }
|
23
22
|
|
24
|
-
Selector_List* selector();
|
25
|
-
|
26
23
|
Block* operator()(Block*);
|
27
24
|
Statement* operator()(Ruleset*);
|
28
25
|
// Statement* operator()(Bubble*);
|
29
|
-
Statement* operator()(
|
26
|
+
Statement* operator()(CssMediaRule*);
|
30
27
|
Statement* operator()(Supports_Block*);
|
31
28
|
Statement* operator()(At_Root_Block*);
|
32
29
|
Statement* operator()(Directive*);
|
@@ -44,7 +41,7 @@ namespace Sass {
|
|
44
41
|
// Statement* operator()(Each*);
|
45
42
|
// Statement* operator()(While*);
|
46
43
|
// Statement* operator()(Return*);
|
47
|
-
// Statement* operator()(
|
44
|
+
// Statement* operator()(ExtendRule*);
|
48
45
|
// Statement* operator()(Definition*);
|
49
46
|
// Statement* operator()(Mixin_Call*);
|
50
47
|
// Statement* operator()(Content*);
|
@@ -54,16 +51,13 @@ namespace Sass {
|
|
54
51
|
std::vector<std::pair<bool, Block_Obj>> slice_by_bubble(Block*);
|
55
52
|
Statement* bubble(Directive*);
|
56
53
|
Statement* bubble(At_Root_Block*);
|
57
|
-
Statement* bubble(
|
54
|
+
Statement* bubble(CssMediaRule*);
|
58
55
|
Statement* bubble(Supports_Block*);
|
59
56
|
|
60
57
|
Block* debubble(Block* children, Statement* parent = 0);
|
61
|
-
Block* flatten(Block*);
|
58
|
+
Block* flatten(const Block*);
|
62
59
|
bool bubblable(Statement*);
|
63
60
|
|
64
|
-
List* merge_media_queries(Media_Block*, Media_Block*);
|
65
|
-
Media_Query* merge_media_query(Media_Query*, Media_Query*);
|
66
|
-
|
67
61
|
// generic fallback
|
68
62
|
template <typename U>
|
69
63
|
Statement* fallback(U x)
|
@@ -0,0 +1,199 @@
|
|
1
|
+
#ifndef SASS_DART_HELPERS_H
|
2
|
+
#define SASS_DART_HELPERS_H
|
3
|
+
|
4
|
+
#include <vector>
|
5
|
+
#include <utility>
|
6
|
+
#include <iterator>
|
7
|
+
#include <functional>
|
8
|
+
|
9
|
+
namespace Sass {
|
10
|
+
|
11
|
+
// ##########################################################################
|
12
|
+
// Flatten `vector<vector<T>>` to `vector<T>`
|
13
|
+
// ##########################################################################
|
14
|
+
template <class T>
|
15
|
+
T flatten(const std::vector<T>& all)
|
16
|
+
{
|
17
|
+
T flattened;
|
18
|
+
for (const auto& sub : all) {
|
19
|
+
std::copy(std::begin(sub), std::end(sub),
|
20
|
+
std::back_inserter(flattened));
|
21
|
+
}
|
22
|
+
return flattened;
|
23
|
+
}
|
24
|
+
|
25
|
+
// ##########################################################################
|
26
|
+
// Expands each element of this Iterable into zero or more elements.
|
27
|
+
// Calls a function on every element and ads all results to flat array
|
28
|
+
// ##########################################################################
|
29
|
+
// Equivalent to dart `cnt.any`
|
30
|
+
// Pass additional closure variables to `fn`
|
31
|
+
template <class T, class U, typename ...Args>
|
32
|
+
T expand(const T& cnt, U fn, Args... args) {
|
33
|
+
T flattened;
|
34
|
+
for (const auto& sub : cnt) {
|
35
|
+
auto rv = fn(sub, args...);
|
36
|
+
flattened.insert(flattened.end(),
|
37
|
+
rv.begin(), rv.end());
|
38
|
+
}
|
39
|
+
return flattened;
|
40
|
+
}
|
41
|
+
|
42
|
+
// ##########################################################################
|
43
|
+
// ##########################################################################
|
44
|
+
template <class T>
|
45
|
+
T flattenInner(const std::vector<T>& vec)
|
46
|
+
{
|
47
|
+
T outer;
|
48
|
+
for (const auto& sub : vec) {
|
49
|
+
outer.emplace_back(std::move(flatten(sub)));
|
50
|
+
}
|
51
|
+
return outer;
|
52
|
+
}
|
53
|
+
// EO flattenInner
|
54
|
+
|
55
|
+
// ##########################################################################
|
56
|
+
// Equivalent to dart `cnt.any`
|
57
|
+
// Pass additional closure variables to `fn`
|
58
|
+
// ##########################################################################
|
59
|
+
template <class T, class U, typename ...Args>
|
60
|
+
bool hasAny(const T& cnt, U fn, Args... args) {
|
61
|
+
for (const auto& sub : cnt) {
|
62
|
+
if (fn(sub, args...)) {
|
63
|
+
return true;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
return false;
|
67
|
+
}
|
68
|
+
// EO hasAny
|
69
|
+
|
70
|
+
// ##########################################################################
|
71
|
+
// Equivalent to dart `cnt.take(len).any`
|
72
|
+
// Pass additional closure variables to `fn`
|
73
|
+
// ##########################################################################
|
74
|
+
template <class T, class U, typename ...Args>
|
75
|
+
bool hasSubAny(const T& cnt, size_t len, U fn, Args... args) {
|
76
|
+
for (size_t i = 0; i < len; i++) {
|
77
|
+
if (fn(cnt[i], args...)) {
|
78
|
+
return true;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
return false;
|
82
|
+
}
|
83
|
+
|
84
|
+
// ##########################################################################
|
85
|
+
// Default predicate for lcs algorithm
|
86
|
+
// ##########################################################################
|
87
|
+
template <class T>
|
88
|
+
inline bool lcsIdentityCmp(const T& X, const T& Y, T& result)
|
89
|
+
{
|
90
|
+
// Assert equality
|
91
|
+
if (!ObjEqualityFn(X, Y)) {
|
92
|
+
return false;
|
93
|
+
}
|
94
|
+
// Store in reference
|
95
|
+
result = X;
|
96
|
+
// Return success
|
97
|
+
return true;
|
98
|
+
}
|
99
|
+
// EO lcsIdentityCmp
|
100
|
+
|
101
|
+
// ##########################################################################
|
102
|
+
// Longest common subsequence with predicate
|
103
|
+
// ##########################################################################
|
104
|
+
template <class T>
|
105
|
+
std::vector<T> lcs(
|
106
|
+
const std::vector<T>& X, const std::vector<T>& Y,
|
107
|
+
bool(*select)(const T&, const T&, T&) = lcsIdentityCmp<T>)
|
108
|
+
{
|
109
|
+
|
110
|
+
std::size_t m = X.size(), mm = X.size() + 1;
|
111
|
+
std::size_t n = Y.size(), nn = Y.size() + 1;
|
112
|
+
|
113
|
+
if (m == 0) return {};
|
114
|
+
if (n == 0) return {};
|
115
|
+
|
116
|
+
// MSVC does not support variable-length arrays
|
117
|
+
// To circumvent, allocate one array on the heap
|
118
|
+
// Then use a macro to access via double index
|
119
|
+
// e.g. `size_t L[m][n]` is supported by gcc
|
120
|
+
size_t* len = new size_t[mm * nn + 1];
|
121
|
+
bool* acc = new bool[mm * nn + 1];
|
122
|
+
T* res = new T[mm * nn + 1];
|
123
|
+
|
124
|
+
#define LEN(x, y) len[(x) * nn + (y)]
|
125
|
+
#define ACC(x, y) acc[(x) * nn + (y)]
|
126
|
+
#define RES(x, y) res[(x) * nn + (y)]
|
127
|
+
|
128
|
+
/* Following steps build L[m+1][n+1] in bottom up fashion. Note
|
129
|
+
that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
|
130
|
+
for (size_t i = 0; i <= m; i++) {
|
131
|
+
for (size_t j = 0; j <= n; j++) {
|
132
|
+
if (i == 0 || j == 0)
|
133
|
+
LEN(i, j) = 0;
|
134
|
+
else {
|
135
|
+
ACC(i - 1, j - 1) = select(X[i - 1], Y[j - 1], RES(i - 1, j - 1));
|
136
|
+
if (ACC(i - 1, j - 1))
|
137
|
+
LEN(i, j) = LEN(i - 1, j - 1) + 1;
|
138
|
+
else
|
139
|
+
LEN(i, j) = std::max(LEN(i - 1, j), LEN(i, j - 1));
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
// Following code is used to print LCS
|
145
|
+
std::vector<T> lcs;
|
146
|
+
std::size_t index = LEN(m, n);
|
147
|
+
lcs.reserve(index);
|
148
|
+
|
149
|
+
// Start from the right-most-bottom-most corner
|
150
|
+
// and one by one store objects in lcs[]
|
151
|
+
std::size_t i = m, j = n;
|
152
|
+
while (i > 0 && j > 0) {
|
153
|
+
|
154
|
+
// If current objects in X[] and Y are same,
|
155
|
+
// then current object is part of LCS
|
156
|
+
if (ACC(i - 1, j - 1))
|
157
|
+
{
|
158
|
+
// Put the stored object in result
|
159
|
+
// Note: we push instead of unshift
|
160
|
+
// Note: reverse the vector later
|
161
|
+
// ToDo: is deque more performant?
|
162
|
+
lcs.push_back(RES(i - 1, j - 1));
|
163
|
+
// reduce values of i, j and index
|
164
|
+
i -= 1; j -= 1; index -= 1;
|
165
|
+
}
|
166
|
+
|
167
|
+
// If not same, then find the larger of two and
|
168
|
+
// go in the direction of larger value
|
169
|
+
else if (LEN(i - 1, j) > LEN(i, j - 1)) {
|
170
|
+
i--;
|
171
|
+
}
|
172
|
+
else {
|
173
|
+
j--;
|
174
|
+
}
|
175
|
+
|
176
|
+
}
|
177
|
+
|
178
|
+
// reverse now as we used push_back
|
179
|
+
std::reverse(lcs.begin(), lcs.end());
|
180
|
+
|
181
|
+
// Delete temp memory on heap
|
182
|
+
delete[] len;
|
183
|
+
delete[] acc;
|
184
|
+
delete[] res;
|
185
|
+
|
186
|
+
#undef LEN
|
187
|
+
#undef ACC
|
188
|
+
#undef RES
|
189
|
+
|
190
|
+
return lcs;
|
191
|
+
}
|
192
|
+
// EO lcs
|
193
|
+
|
194
|
+
// ##########################################################################
|
195
|
+
// ##########################################################################
|
196
|
+
|
197
|
+
}
|
198
|
+
|
199
|
+
#endif
|
@@ -1,27 +1,286 @@
|
|
1
1
|
#ifndef SASS_DEBUGGER_H
|
2
2
|
#define SASS_DEBUGGER_H
|
3
3
|
|
4
|
+
// sass.hpp must go before all system headers to get the
|
5
|
+
// __EXTENSIONS__ fix on Solaris.
|
6
|
+
#include "sass.hpp"
|
7
|
+
|
8
|
+
#include <queue>
|
9
|
+
#include <vector>
|
4
10
|
#include <string>
|
5
11
|
#include <sstream>
|
6
|
-
#include "
|
12
|
+
#include "ast.hpp"
|
7
13
|
#include "ast_fwd_decl.hpp"
|
14
|
+
#include "extension.hpp"
|
15
|
+
|
16
|
+
#include "ordered_map.hpp"
|
8
17
|
|
9
18
|
using namespace Sass;
|
10
19
|
|
11
20
|
inline void debug_ast(AST_Node* node, std::string ind = "", Env* env = 0);
|
12
21
|
|
13
|
-
inline
|
14
|
-
|
22
|
+
inline std::string debug_vec(const AST_Node* node) {
|
23
|
+
if (node == NULL) return "null";
|
24
|
+
else return node->to_string();
|
15
25
|
}
|
16
26
|
|
17
|
-
inline
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
27
|
+
inline std::string debug_dude(std::vector<std::vector<int>> vec) {
|
28
|
+
std::stringstream out;
|
29
|
+
out << "{";
|
30
|
+
bool joinOut = false;
|
31
|
+
for (auto ct : vec) {
|
32
|
+
if (joinOut) out << ", ";
|
33
|
+
joinOut = true;
|
34
|
+
out << "{";
|
35
|
+
bool joinIn = false;
|
36
|
+
for (auto nr : ct) {
|
37
|
+
if (joinIn) out << ", ";
|
38
|
+
joinIn = true;
|
39
|
+
out << nr;
|
40
|
+
}
|
41
|
+
out << "}";
|
42
|
+
}
|
43
|
+
out << "}";
|
44
|
+
return out.str();
|
45
|
+
}
|
46
|
+
|
47
|
+
inline std::string debug_vec(std::string& str) {
|
48
|
+
return str;
|
49
|
+
}
|
50
|
+
|
51
|
+
inline std::string debug_vec(Extension& ext) {
|
52
|
+
std::stringstream out;
|
53
|
+
out << debug_vec(ext.extender);
|
54
|
+
out << " {@extend ";
|
55
|
+
out << debug_vec(ext.target);
|
56
|
+
if (ext.isOptional) {
|
57
|
+
out << " !optional";
|
58
|
+
}
|
59
|
+
out << "}";
|
60
|
+
return out.str();
|
61
|
+
}
|
62
|
+
|
63
|
+
template <class T>
|
64
|
+
inline std::string debug_vec(std::vector<T> vec) {
|
65
|
+
std::stringstream out;
|
66
|
+
out << "[";
|
67
|
+
for (size_t i = 0; i < vec.size(); i += 1) {
|
68
|
+
if (i > 0) out << ", ";
|
69
|
+
out << debug_vec(vec[i]);
|
70
|
+
}
|
71
|
+
out << "]";
|
72
|
+
return out.str();
|
73
|
+
}
|
74
|
+
|
75
|
+
template <class T>
|
76
|
+
inline std::string debug_vec(std::queue<T> vec) {
|
77
|
+
std::stringstream out;
|
78
|
+
out << "{";
|
79
|
+
for (size_t i = 0; i < vec.size(); i += 1) {
|
80
|
+
if (i > 0) out << ", ";
|
81
|
+
out << debug_vec(vec[i]);
|
82
|
+
}
|
83
|
+
out << "}";
|
84
|
+
return out.str();
|
85
|
+
}
|
86
|
+
|
87
|
+
template <class T, class U, class O>
|
88
|
+
inline std::string debug_vec(std::map<T, U, O> vec) {
|
89
|
+
std::stringstream out;
|
90
|
+
out << "{";
|
91
|
+
bool joinit = false;
|
92
|
+
for (auto it = vec.begin(); it != vec.end(); it++)
|
93
|
+
{
|
94
|
+
if (joinit) out << ", ";
|
95
|
+
out << debug_vec(it->first) // string (key)
|
96
|
+
<< ": "
|
97
|
+
<< debug_vec(it->second); // string's value
|
98
|
+
joinit = true;
|
99
|
+
}
|
100
|
+
out << "}";
|
101
|
+
return out.str();
|
102
|
+
}
|
103
|
+
|
104
|
+
template <class T, class U, class O, class V>
|
105
|
+
inline std::string debug_vec(const ordered_map<T, U, O, V>& vec) {
|
106
|
+
std::stringstream out;
|
107
|
+
out << "{";
|
108
|
+
bool joinit = false;
|
109
|
+
for (auto it = vec.begin(); it != vec.end(); it++)
|
110
|
+
{
|
111
|
+
if (joinit) out << ", ";
|
112
|
+
out << debug_vec(*it); // string (key)
|
113
|
+
// << debug_vec(it->second); // string's value
|
114
|
+
joinit = true;
|
115
|
+
}
|
116
|
+
out << "}";
|
117
|
+
return out.str();
|
118
|
+
}
|
119
|
+
|
120
|
+
template <class T, class U, class O, class V>
|
121
|
+
inline std::string debug_vec(std::unordered_map<T, U, O, V> vec) {
|
122
|
+
std::stringstream out;
|
123
|
+
out << "{";
|
124
|
+
bool joinit = false;
|
125
|
+
for (auto it = vec.begin(); it != vec.end(); it++)
|
126
|
+
{
|
127
|
+
if (joinit) out << ", ";
|
128
|
+
out << debug_vec(it->first) // string (key)
|
129
|
+
<< ": "
|
130
|
+
<< debug_vec(it->second); // string's value
|
131
|
+
joinit = true;
|
132
|
+
}
|
133
|
+
out << "}";
|
134
|
+
return out.str();
|
135
|
+
}
|
136
|
+
|
137
|
+
template <class T, class U, class O, class V>
|
138
|
+
inline std::string debug_keys(std::unordered_map<T, U, O, V> vec) {
|
139
|
+
std::stringstream out;
|
140
|
+
out << "{";
|
141
|
+
bool joinit = false;
|
142
|
+
for (auto it = vec.begin(); it != vec.end(); it++)
|
143
|
+
{
|
144
|
+
if (joinit) out << ", ";
|
145
|
+
out << debug_vec(it->first); // string (key)
|
146
|
+
joinit = true;
|
23
147
|
}
|
24
|
-
|
148
|
+
out << "}";
|
149
|
+
return out.str();
|
150
|
+
}
|
151
|
+
|
152
|
+
inline std::string debug_vec(ExtListSelSet& vec) {
|
153
|
+
std::stringstream out;
|
154
|
+
out << "{";
|
155
|
+
bool joinit = false;
|
156
|
+
for (auto it = vec.begin(); it != vec.end(); it++)
|
157
|
+
{
|
158
|
+
if (joinit) out << ", ";
|
159
|
+
out << debug_vec(*it); // string (key)
|
160
|
+
joinit = true;
|
161
|
+
}
|
162
|
+
out << "}";
|
163
|
+
return out.str();
|
164
|
+
}
|
165
|
+
|
166
|
+
/*
|
167
|
+
template <class T, class U, class O, class V>
|
168
|
+
inline std::string debug_values(tsl::ordered_map<T, U, O, V> vec) {
|
169
|
+
std::stringstream out;
|
170
|
+
out << "{";
|
171
|
+
bool joinit = false;
|
172
|
+
for (auto it = vec.begin(); it != vec.end(); it++)
|
173
|
+
{
|
174
|
+
if (joinit) out << ", ";
|
175
|
+
out << debug_vec(const_cast<U&>(it->second)); // string's value
|
176
|
+
joinit = true;
|
177
|
+
}
|
178
|
+
out << "}";
|
179
|
+
return out.str();
|
180
|
+
}
|
181
|
+
|
182
|
+
template <class T, class U, class O, class V>
|
183
|
+
inline std::string debug_vec(tsl::ordered_map<T, U, O, V> vec) {
|
184
|
+
std::stringstream out;
|
185
|
+
out << "{";
|
186
|
+
bool joinit = false;
|
187
|
+
for (auto it = vec.begin(); it != vec.end(); it++)
|
188
|
+
{
|
189
|
+
if (joinit) out << ", ";
|
190
|
+
out << debug_vec(it->first) // string (key)
|
191
|
+
<< ": "
|
192
|
+
<< debug_vec(const_cast<U&>(it->second)); // string's value
|
193
|
+
joinit = true;
|
194
|
+
}
|
195
|
+
out << "}";
|
196
|
+
return out.str();
|
197
|
+
}
|
198
|
+
|
199
|
+
template <class T, class U, class O, class V>
|
200
|
+
inline std::string debug_vals(tsl::ordered_map<T, U, O, V> vec) {
|
201
|
+
std::stringstream out;
|
202
|
+
out << "{";
|
203
|
+
bool joinit = false;
|
204
|
+
for (auto it = vec.begin(); it != vec.end(); it++)
|
205
|
+
{
|
206
|
+
if (joinit) out << ", ";
|
207
|
+
out << debug_vec(const_cast<U&>(it->second)); // string's value
|
208
|
+
joinit = true;
|
209
|
+
}
|
210
|
+
out << "}";
|
211
|
+
return out.str();
|
212
|
+
}
|
213
|
+
|
214
|
+
template <class T, class U, class O, class V>
|
215
|
+
inline std::string debug_keys(tsl::ordered_map<T, U, O, V> vec) {
|
216
|
+
std::stringstream out;
|
217
|
+
out << "{";
|
218
|
+
bool joinit = false;
|
219
|
+
for (auto it = vec.begin(); it != vec.end(); it++)
|
220
|
+
{
|
221
|
+
if (joinit) out << ", ";
|
222
|
+
out << debug_vec(it->first);
|
223
|
+
joinit = true;
|
224
|
+
}
|
225
|
+
out << "}";
|
226
|
+
return out.str();
|
227
|
+
}
|
228
|
+
*/
|
229
|
+
|
230
|
+
template <class T, class U>
|
231
|
+
inline std::string debug_vec(std::set<T, U> vec) {
|
232
|
+
std::stringstream out;
|
233
|
+
out << "{";
|
234
|
+
bool joinit = false;
|
235
|
+
for (auto item : vec) {
|
236
|
+
if (joinit) out << ", ";
|
237
|
+
out << debug_vec(item);
|
238
|
+
joinit = true;
|
239
|
+
}
|
240
|
+
out << "}";
|
241
|
+
return out.str();
|
242
|
+
}
|
243
|
+
|
244
|
+
/*
|
245
|
+
template <class T, class U, class O, class V>
|
246
|
+
inline std::string debug_vec(tsl::ordered_set<T, U, O, V> vec) {
|
247
|
+
std::stringstream out;
|
248
|
+
out << "{";
|
249
|
+
bool joinit = false;
|
250
|
+
for (auto item : vec) {
|
251
|
+
if (joinit) out << ", ";
|
252
|
+
out << debug_vec(item);
|
253
|
+
joinit = true;
|
254
|
+
}
|
255
|
+
out << "}";
|
256
|
+
return out.str();
|
257
|
+
}
|
258
|
+
*/
|
259
|
+
|
260
|
+
template <class T, class U, class O, class V>
|
261
|
+
inline std::string debug_vec(std::unordered_set<T, U, O, V> vec) {
|
262
|
+
std::stringstream out;
|
263
|
+
out << "{";
|
264
|
+
bool joinit = false;
|
265
|
+
for (auto item : vec) {
|
266
|
+
if (joinit) out << ", ";
|
267
|
+
out << debug_vec(item);
|
268
|
+
joinit = true;
|
269
|
+
}
|
270
|
+
out << "}";
|
271
|
+
return out.str();
|
272
|
+
}
|
273
|
+
|
274
|
+
inline std::string debug_bool(bool val) {
|
275
|
+
return val ? "true" : "false";
|
276
|
+
}
|
277
|
+
inline std::string debug_vec(ExtSmplSelSet* node) {
|
278
|
+
if (node == NULL) return "null";
|
279
|
+
else return debug_vec(*node);
|
280
|
+
}
|
281
|
+
|
282
|
+
inline void debug_ast(const AST_Node* node, std::string ind = "", Env* env = 0) {
|
283
|
+
debug_ast(const_cast<AST_Node*>(node), ind, env);
|
25
284
|
}
|
26
285
|
|
27
286
|
inline std::string str_replace(std::string str, const std::string& oldStr, const std::string& newStr)
|
@@ -53,7 +312,7 @@ inline std::string pstate_source_position(AST_Node* node)
|
|
53
312
|
std::stringstream str;
|
54
313
|
Position start(node->pstate());
|
55
314
|
Position end(start + node->pstate().offset);
|
56
|
-
str << (start.file == std::string::npos ?
|
315
|
+
str << (start.file == std::string::npos ? 99999999 : start.file)
|
57
316
|
<< "@[" << start.line << ":" << start.column << "]"
|
58
317
|
<< "-[" << end.line << ":" << end.column << "]";
|
59
318
|
#ifdef DEBUG_SHARED_PTR
|
@@ -90,127 +349,95 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
90
349
|
std::cerr << std::endl;
|
91
350
|
debug_ast(root_block->expression(), ind + ":", env);
|
92
351
|
debug_ast(root_block->block(), ind + " ", env);
|
93
|
-
} else if (Cast<
|
94
|
-
|
95
|
-
std::cerr << ind << "
|
352
|
+
} else if (Cast<SelectorList>(node)) {
|
353
|
+
SelectorList* selector = Cast<SelectorList>(node);
|
354
|
+
std::cerr << ind << "SelectorList " << selector;
|
96
355
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
97
356
|
std::cerr << " <" << selector->hash() << ">";
|
98
|
-
std::cerr <<
|
99
|
-
std::cerr << (selector->
|
100
|
-
std::cerr << (selector->
|
101
|
-
std::cerr << (selector->is_optional() ? " [is_optional]": " -");
|
102
|
-
std::cerr << (selector->has_parent_ref() ? " [has-parent]": " -");
|
103
|
-
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
104
|
-
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
357
|
+
std::cerr << (selector->is_invisible() ? " [is_invisible]" : " -");
|
358
|
+
std::cerr << (selector->isInvisible() ? " [isInvisible]" : " -");
|
359
|
+
std::cerr << (selector->has_real_parent_ref() ? " [real-parent]": " -");
|
105
360
|
std::cerr << std::endl;
|
106
|
-
debug_ast(selector->schema(), ind + "#{} ");
|
107
361
|
|
108
|
-
for(const
|
362
|
+
for(const ComplexSelector_Obj& i : selector->elements()) { debug_ast(i, ind + " ", env); }
|
109
363
|
|
110
|
-
|
111
|
-
|
112
|
-
|
364
|
+
} else if (Cast<ComplexSelector>(node)) {
|
365
|
+
ComplexSelector* selector = Cast<ComplexSelector>(node);
|
366
|
+
std::cerr << ind << "ComplexSelector " << selector
|
367
|
+
<< " (" << pstate_source_position(node) << ")"
|
368
|
+
<< " <" << selector->hash() << ">"
|
369
|
+
<< " [" << (selector->chroots() ? "CHROOT" : "CONNECT") << "]"
|
370
|
+
<< " [length:" << longToHex(selector->length()) << "]"
|
371
|
+
<< " [weight:" << longToHex(selector->specificity()) << "]"
|
372
|
+
<< (selector->is_invisible() ? " [is_invisible]" : " -")
|
373
|
+
<< (selector->isInvisible() ? " [isInvisible]" : " -")
|
374
|
+
<< (selector->hasPreLineFeed() ? " [hasPreLineFeed]" : " -")
|
113
375
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
// debug_ast(selector->selector(), ind + "->", env);
|
376
|
+
// << (selector->is_invisible() ? " [INVISIBLE]": " -")
|
377
|
+
// << (selector->has_placeholder() ? " [PLACEHOLDER]": " -")
|
378
|
+
// << (selector->is_optional() ? " [is_optional]": " -")
|
379
|
+
<< (selector->has_real_parent_ref() ? " [real parent]": " -")
|
380
|
+
// << (selector->has_line_feed() ? " [line-feed]": " -")
|
381
|
+
// << (selector->has_line_break() ? " [line-break]": " -")
|
382
|
+
<< " -- \n";
|
122
383
|
|
123
|
-
|
124
|
-
Parent_Selector* selector = Cast<Parent_Selector>(node);
|
125
|
-
std::cerr << ind << "Parent_Selector " << selector;
|
126
|
-
// if (selector->not_selector()) cerr << " [in_declaration]";
|
127
|
-
std::cerr << " (" << pstate_source_position(node) << ")";
|
128
|
-
std::cerr << " <" << selector->hash() << ">";
|
129
|
-
std::cerr << " [" << (selector->real() ? "REAL" : "FAKE") << "]";
|
130
|
-
std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << std::endl;
|
131
|
-
// debug_ast(selector->selector(), ind + "->", env);
|
384
|
+
for(const SelectorComponentObj& i : selector->elements()) { debug_ast(i, ind + " ", env); }
|
132
385
|
|
133
|
-
} else if (Cast<
|
134
|
-
|
135
|
-
std::cerr << ind << "
|
386
|
+
} else if (Cast<SelectorCombinator>(node)) {
|
387
|
+
SelectorCombinator* selector = Cast<SelectorCombinator>(node);
|
388
|
+
std::cerr << ind << "SelectorCombinator " << selector
|
136
389
|
<< " (" << pstate_source_position(node) << ")"
|
137
390
|
<< " <" << selector->hash() << ">"
|
138
|
-
<< " [length:" << longToHex(selector->length()) << "]"
|
139
391
|
<< " [weight:" << longToHex(selector->specificity()) << "]"
|
140
|
-
<<
|
141
|
-
<< (selector->is_invisible() ? " [INVISIBLE]": " -")
|
142
|
-
<< (selector->has_placeholder() ? " [PLACEHOLDER]": " -")
|
143
|
-
<< (selector->is_optional() ? " [is_optional]": " -")
|
144
|
-
<< (selector->has_parent_ref() ? " [has parent]": " -")
|
145
|
-
<< (selector->has_line_feed() ? " [line-feed]": " -")
|
146
|
-
<< (selector->has_line_break() ? " [line-break]": " -")
|
392
|
+
<< (selector->has_real_parent_ref() ? " [real parent]": " -")
|
147
393
|
<< " -- ";
|
394
|
+
|
148
395
|
std::string del;
|
149
396
|
switch (selector->combinator()) {
|
150
|
-
case
|
151
|
-
case
|
152
|
-
case
|
153
|
-
case Complex_Selector::ANCESTOR_OF: del = " "; break;
|
154
|
-
case Complex_Selector::REFERENCE: del = "//"; break;
|
397
|
+
case SelectorCombinator::CHILD: del = ">"; break;
|
398
|
+
case SelectorCombinator::GENERAL: del = "~"; break;
|
399
|
+
case SelectorCombinator::ADJACENT: del = "+"; break;
|
155
400
|
}
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
std::cerr << ind << " |" << del << "| {trailing op}" << std::endl;
|
163
|
-
}
|
164
|
-
ComplexSelectorSet set = selector->sources();
|
165
|
-
// debug_sources_set(set, ind + " @--> ");
|
166
|
-
} else if (Cast<Compound_Selector>(node)) {
|
167
|
-
Compound_Selector* selector = Cast<Compound_Selector>(node);
|
168
|
-
std::cerr << ind << "Compound_Selector " << selector;
|
401
|
+
|
402
|
+
std::cerr << "[" << del << "]" << "\n";
|
403
|
+
|
404
|
+
} else if (Cast<CompoundSelector>(node)) {
|
405
|
+
CompoundSelector* selector = Cast<CompoundSelector>(node);
|
406
|
+
std::cerr << ind << "CompoundSelector " << selector;
|
169
407
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
170
408
|
std::cerr << " <" << selector->hash() << ">";
|
409
|
+
std::cerr << (selector->hasRealParent() ? " [REAL PARENT]" : "") << ">";
|
171
410
|
std::cerr << " [weight:" << longToHex(selector->specificity()) << "]";
|
172
|
-
std::cerr <<
|
173
|
-
std::cerr << (selector->
|
174
|
-
std::cerr << (selector->
|
175
|
-
std::cerr <<
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
Wrapped_Selector* selector = Cast<Wrapped_Selector>(node);
|
182
|
-
std::cerr << ind << "Wrapped_Selector " << selector;
|
411
|
+
std::cerr << (selector->hasPostLineBreak() ? " [hasPostLineBreak]" : " -");
|
412
|
+
std::cerr << (selector->is_invisible() ? " [is_invisible]" : " -");
|
413
|
+
std::cerr << (selector->isInvisible() ? " [isInvisible]" : " -");
|
414
|
+
std::cerr << "\n";
|
415
|
+
for(const SimpleSelector_Obj& i : selector->elements()) { debug_ast(i, ind + " ", env); }
|
416
|
+
|
417
|
+
} else if (Cast<Parent_Reference>(node)) {
|
418
|
+
Parent_Reference* selector = Cast<Parent_Reference>(node);
|
419
|
+
std::cerr << ind << "Parent_Reference " << selector;
|
183
420
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
184
421
|
std::cerr << " <" << selector->hash() << ">";
|
185
|
-
std::cerr << "
|
186
|
-
|
187
|
-
std::cerr << (selector->has_parent_ref() ? " [has-parent]": " -");
|
188
|
-
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
189
|
-
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
190
|
-
std::cerr << std::endl;
|
191
|
-
debug_ast(selector->selector(), ind + " () ", env);
|
422
|
+
std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << std::endl;
|
423
|
+
|
192
424
|
} else if (Cast<Pseudo_Selector>(node)) {
|
193
425
|
Pseudo_Selector* selector = Cast<Pseudo_Selector>(node);
|
194
426
|
std::cerr << ind << "Pseudo_Selector " << selector;
|
195
427
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
196
428
|
std::cerr << " <" << selector->hash() << ">";
|
197
429
|
std::cerr << " <<" << selector->ns_name() << ">>";
|
198
|
-
std::cerr << (selector->
|
199
|
-
std::cerr << (selector->
|
200
|
-
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
201
|
-
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
430
|
+
std::cerr << (selector->isClass() ? " [isClass]": " -");
|
431
|
+
std::cerr << (selector->isSyntacticClass() ? " [isSyntacticClass]": " -");
|
202
432
|
std::cerr << std::endl;
|
203
|
-
debug_ast(selector->
|
433
|
+
debug_ast(selector->argument(), ind + " <= ", env);
|
434
|
+
debug_ast(selector->selector(), ind + " || ", env);
|
204
435
|
} else if (Cast<Attribute_Selector>(node)) {
|
205
436
|
Attribute_Selector* selector = Cast<Attribute_Selector>(node);
|
206
437
|
std::cerr << ind << "Attribute_Selector " << selector;
|
207
438
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
208
439
|
std::cerr << " <" << selector->hash() << ">";
|
209
440
|
std::cerr << " <<" << selector->ns_name() << ">>";
|
210
|
-
std::cerr << (selector->is_optional() ? " [is_optional]": " -");
|
211
|
-
std::cerr << (selector->has_parent_ref() ? " [has-parent]": " -");
|
212
|
-
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
213
|
-
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
214
441
|
std::cerr << std::endl;
|
215
442
|
debug_ast(selector->value(), ind + "[" + selector->matcher() + "] ", env);
|
216
443
|
} else if (Cast<Class_Selector>(node)) {
|
@@ -219,10 +446,6 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
219
446
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
220
447
|
std::cerr << " <" << selector->hash() << ">";
|
221
448
|
std::cerr << " <<" << selector->ns_name() << ">>";
|
222
|
-
std::cerr << (selector->is_optional() ? " [is_optional]": " -");
|
223
|
-
std::cerr << (selector->has_parent_ref() ? " [has-parent]": " -");
|
224
|
-
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
225
|
-
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
226
449
|
std::cerr << std::endl;
|
227
450
|
} else if (Cast<Id_Selector>(node)) {
|
228
451
|
Id_Selector* selector = Cast<Id_Selector>(node);
|
@@ -230,10 +453,6 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
230
453
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
231
454
|
std::cerr << " <" << selector->hash() << ">";
|
232
455
|
std::cerr << " <<" << selector->ns_name() << ">>";
|
233
|
-
std::cerr << (selector->is_optional() ? " [is_optional]": " -");
|
234
|
-
std::cerr << (selector->has_parent_ref() ? " [has-parent]": " -");
|
235
|
-
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
236
|
-
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
237
456
|
std::cerr << std::endl;
|
238
457
|
} else if (Cast<Type_Selector>(node)) {
|
239
458
|
Type_Selector* selector = Cast<Type_Selector>(node);
|
@@ -241,10 +460,6 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
241
460
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
242
461
|
std::cerr << " <" << selector->hash() << ">";
|
243
462
|
std::cerr << " <<" << selector->ns_name() << ">>";
|
244
|
-
std::cerr << (selector->is_optional() ? " [is_optional]": " -");
|
245
|
-
std::cerr << (selector->has_parent_ref() ? " [has-parent]": " -");
|
246
|
-
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
247
|
-
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
248
463
|
std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">";
|
249
464
|
std::cerr << std::endl;
|
250
465
|
} else if (Cast<Placeholder_Selector>(node)) {
|
@@ -253,23 +468,18 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
253
468
|
std::cerr << ind << "Placeholder_Selector [" << selector->ns_name() << "] " << selector;
|
254
469
|
std::cerr << " (" << pstate_source_position(selector) << ")"
|
255
470
|
<< " <" << selector->hash() << ">"
|
256
|
-
<<
|
257
|
-
<< (selector->is_optional() ? " [is_optional]": " -")
|
258
|
-
<< (selector->has_line_break() ? " [line-break]": " -")
|
259
|
-
<< (selector->has_line_feed() ? " [line-feed]": " -")
|
471
|
+
<< (selector->isInvisible() ? " [isInvisible]" : " -")
|
260
472
|
<< std::endl;
|
261
473
|
|
262
|
-
} else if (Cast<
|
263
|
-
|
264
|
-
std::cerr << ind << "
|
474
|
+
} else if (Cast<SimpleSelector>(node)) {
|
475
|
+
SimpleSelector* selector = Cast<SimpleSelector>(node);
|
476
|
+
std::cerr << ind << "SimpleSelector " << selector;
|
265
477
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
266
|
-
std::cerr << (selector->has_line_break() ? " [line-break]": " -") << (selector->has_line_feed() ? " [line-feed]": " -") << std::endl;
|
267
478
|
|
268
479
|
} else if (Cast<Selector_Schema>(node)) {
|
269
480
|
Selector_Schema* selector = Cast<Selector_Schema>(node);
|
270
481
|
std::cerr << ind << "Selector_Schema " << selector;
|
271
482
|
std::cerr << " (" << pstate_source_position(node) << ")"
|
272
|
-
<< " [@media:" << selector->media_block() << "]"
|
273
483
|
<< (selector->connect_parent() ? " [connect-parent]": " -")
|
274
484
|
<< std::endl;
|
275
485
|
|
@@ -279,9 +489,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
279
489
|
} else if (Cast<Selector>(node)) {
|
280
490
|
Selector* selector = Cast<Selector>(node);
|
281
491
|
std::cerr << ind << "Selector " << selector;
|
282
|
-
std::cerr << " (" << pstate_source_position(node) << ")"
|
283
|
-
std::cerr << (selector->has_line_break() ? " [line-break]": " -")
|
284
|
-
<< (selector->has_line_feed() ? " [line-feed]": " -")
|
492
|
+
std::cerr << " (" << pstate_source_position(node) << ")"
|
285
493
|
<< std::endl;
|
286
494
|
|
287
495
|
} else if (Cast<Media_Query_Expression>(node)) {
|
@@ -302,14 +510,33 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
302
510
|
<< std::endl;
|
303
511
|
debug_ast(block->media_type(), ind + " ");
|
304
512
|
for(const auto& i : block->elements()) { debug_ast(i, ind + " ", env); }
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
std::cerr << ind << "
|
309
|
-
std::cerr << " (" << pstate_source_position(
|
310
|
-
std::cerr << " " <<
|
311
|
-
debug_ast(
|
312
|
-
|
513
|
+
}
|
514
|
+
else if (Cast<MediaRule>(node)) {
|
515
|
+
MediaRule* rule = Cast<MediaRule>(node);
|
516
|
+
std::cerr << ind << "MediaRule " << rule;
|
517
|
+
std::cerr << " (" << pstate_source_position(rule) << ")";
|
518
|
+
std::cerr << " " << rule->tabs() << std::endl;
|
519
|
+
debug_ast(rule->schema(), ind + " =@ ");
|
520
|
+
debug_ast(rule->block(), ind + " ");
|
521
|
+
}
|
522
|
+
else if (Cast<CssMediaRule>(node)) {
|
523
|
+
CssMediaRule* rule = Cast<CssMediaRule>(node);
|
524
|
+
std::cerr << ind << "CssMediaRule " << rule;
|
525
|
+
std::cerr << " (" << pstate_source_position(rule) << ")";
|
526
|
+
std::cerr << " " << rule->tabs() << std::endl;
|
527
|
+
for (auto item : rule->elements()) {
|
528
|
+
debug_ast(item, ind + " == ");
|
529
|
+
}
|
530
|
+
debug_ast(rule->block(), ind + " ");
|
531
|
+
}
|
532
|
+
else if (Cast<CssMediaQuery>(node)) {
|
533
|
+
CssMediaQuery* query = Cast<CssMediaQuery>(node);
|
534
|
+
std::cerr << ind << "CssMediaQuery " << query;
|
535
|
+
std::cerr << " (" << pstate_source_position(query) << ")";
|
536
|
+
std::cerr << " [" << (query->modifier()) << "] ";
|
537
|
+
std::cerr << " [" << (query->type()) << "] ";
|
538
|
+
std::cerr << " " << debug_vec(query->features());
|
539
|
+
std::cerr << std::endl;
|
313
540
|
} else if (Cast<Supports_Block>(node)) {
|
314
541
|
Supports_Block* block = Cast<Supports_Block>(node);
|
315
542
|
std::cerr << ind << "Supports_Block " << block;
|
@@ -349,6 +576,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
349
576
|
std::cerr << ind << "Block " << root_block;
|
350
577
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
351
578
|
if (root_block->is_root()) std::cerr << " [root]";
|
579
|
+
if (root_block->isInvisible()) std::cerr << " [isInvisible]";
|
352
580
|
std::cerr << " " << root_block->tabs() << std::endl;
|
353
581
|
for(const Statement_Obj& i : root_block->elements()) { debug_ast(i, ind + " ", env); }
|
354
582
|
} else if (Cast<Warning>(node)) {
|
@@ -387,10 +615,11 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
387
615
|
Return* block = Cast<Return>(node);
|
388
616
|
std::cerr << ind << "Return " << block;
|
389
617
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
390
|
-
std::cerr << " " << block->tabs()
|
391
|
-
|
392
|
-
|
393
|
-
|
618
|
+
std::cerr << " " << block->tabs();
|
619
|
+
std::cerr << " [" << block->value()->to_string() << "]" << std::endl;
|
620
|
+
} else if (Cast<ExtendRule>(node)) {
|
621
|
+
ExtendRule* block = Cast<ExtendRule>(node);
|
622
|
+
std::cerr << ind << "ExtendRule " << block;
|
394
623
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
395
624
|
std::cerr << " " << block->tabs() << std::endl;
|
396
625
|
debug_ast(block->selector(), ind + "-> ", env);
|
@@ -724,54 +953,6 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
|
|
724
953
|
if (ind == "") std::cerr << "####################################################################\n";
|
725
954
|
}
|
726
955
|
|
727
|
-
inline void debug_node(Node* node, std::string ind = "")
|
728
|
-
{
|
729
|
-
if (ind == "") std::cerr << "#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
|
730
|
-
if (node->isCombinator()) {
|
731
|
-
std::cerr << ind;
|
732
|
-
std::cerr << "Combinator ";
|
733
|
-
std::cerr << node << " ";
|
734
|
-
if (node->got_line_feed) std::cerr << "[LF] ";
|
735
|
-
switch (node->combinator()) {
|
736
|
-
case Complex_Selector::ADJACENT_TO: std::cerr << "{+} "; break;
|
737
|
-
case Complex_Selector::PARENT_OF: std::cerr << "{>} "; break;
|
738
|
-
case Complex_Selector::PRECEDES: std::cerr << "{~} "; break;
|
739
|
-
case Complex_Selector::REFERENCE: std::cerr << "{@} "; break;
|
740
|
-
case Complex_Selector::ANCESTOR_OF: std::cerr << "{ } "; break;
|
741
|
-
}
|
742
|
-
std::cerr << std::endl;
|
743
|
-
// debug_ast(node->combinator(), ind + " ");
|
744
|
-
} else if (node->isSelector()) {
|
745
|
-
std::cerr << ind;
|
746
|
-
std::cerr << "Selector ";
|
747
|
-
std::cerr << node << " ";
|
748
|
-
if (node->got_line_feed) std::cerr << "[LF] ";
|
749
|
-
std::cerr << std::endl;
|
750
|
-
debug_ast(node->selector(), ind + " ");
|
751
|
-
} else if (node->isCollection()) {
|
752
|
-
std::cerr << ind;
|
753
|
-
std::cerr << "Collection ";
|
754
|
-
std::cerr << node << " ";
|
755
|
-
if (node->got_line_feed) std::cerr << "[LF] ";
|
756
|
-
std::cerr << std::endl;
|
757
|
-
for(auto n : (*node->collection())) {
|
758
|
-
debug_node(&n, ind + " ");
|
759
|
-
}
|
760
|
-
} else if (node->isNil()) {
|
761
|
-
std::cerr << ind;
|
762
|
-
std::cerr << "Nil ";
|
763
|
-
std::cerr << node << " ";
|
764
|
-
if (node->got_line_feed) std::cerr << "[LF] ";
|
765
|
-
std::cerr << std::endl;
|
766
|
-
} else {
|
767
|
-
std::cerr << ind;
|
768
|
-
std::cerr << "OTHER ";
|
769
|
-
std::cerr << node << " ";
|
770
|
-
if (node->got_line_feed) std::cerr << "[LF] ";
|
771
|
-
std::cerr << std::endl;
|
772
|
-
}
|
773
|
-
if (ind == "") std::cerr << "#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
|
774
|
-
}
|
775
956
|
|
776
957
|
/*
|
777
958
|
inline void debug_ast(const AST_Node* node, std::string ind = "", Env* env = 0)
|
@@ -779,29 +960,5 @@ inline void debug_ast(const AST_Node* node, std::string ind = "", Env* env = 0)
|
|
779
960
|
debug_ast(const_cast<AST_Node*>(node), ind, env);
|
780
961
|
}
|
781
962
|
*/
|
782
|
-
inline void debug_node(const Node* node, std::string ind = "")
|
783
|
-
{
|
784
|
-
debug_node(const_cast<Node*>(node), ind);
|
785
|
-
}
|
786
|
-
|
787
|
-
inline void debug_subset_map(Sass::Subset_Map& map, std::string ind = "")
|
788
|
-
{
|
789
|
-
if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
790
|
-
for(auto const &it : map.values()) {
|
791
|
-
debug_ast(it.first, ind + "first: ");
|
792
|
-
debug_ast(it.second, ind + "second: ");
|
793
|
-
}
|
794
|
-
if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
795
|
-
}
|
796
|
-
|
797
|
-
inline void debug_subset_entries(SubSetMapPairs* entries, std::string ind = "")
|
798
|
-
{
|
799
|
-
if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
800
|
-
for(auto const &pair : *entries) {
|
801
|
-
debug_ast(pair.first, ind + "first: ");
|
802
|
-
debug_ast(pair.second, ind + "second: ");
|
803
|
-
}
|
804
|
-
if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
805
|
-
}
|
806
963
|
|
807
964
|
#endif // SASS_DEBUGGER
|