sassc 1.11.4 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -2
- data/CODE_OF_CONDUCT.md +10 -0
- data/README.md +4 -1
- data/ext/libsass/.editorconfig +1 -1
- data/ext/libsass/.github/CONTRIBUTING.md +7 -7
- data/ext/libsass/.github/ISSUE_TEMPLATE.md +31 -6
- data/ext/libsass/.gitignore +3 -0
- data/ext/libsass/.travis.yml +37 -18
- data/ext/libsass/GNUmakefile.am +23 -37
- data/ext/libsass/Makefile +10 -6
- data/ext/libsass/Makefile.conf +3 -0
- data/ext/libsass/Readme.md +68 -63
- data/ext/libsass/appveyor.yml +7 -3
- data/ext/libsass/configure.ac +10 -14
- data/ext/libsass/docs/api-context-internal.md +29 -21
- data/ext/libsass/docs/api-context.md +26 -6
- data/ext/libsass/docs/api-doc.md +49 -16
- data/ext/libsass/docs/api-function-example.md +1 -1
- data/ext/libsass/docs/api-function.md +31 -7
- data/ext/libsass/docs/api-importer.md +19 -19
- data/ext/libsass/docs/api-value.md +4 -2
- data/ext/libsass/docs/build-on-windows.md +4 -4
- data/ext/libsass/docs/build-with-mingw.md +3 -3
- data/ext/libsass/docs/build.md +9 -9
- data/ext/libsass/docs/custom-functions-internal.md +10 -8
- data/ext/libsass/docs/implementations.md +20 -8
- data/ext/libsass/docs/unicode.md +16 -10
- data/ext/libsass/include/sass/base.h +0 -3
- data/ext/libsass/include/sass/context.h +20 -2
- data/ext/libsass/include/sass/functions.h +31 -0
- data/ext/libsass/include/sass/values.h +3 -1
- data/ext/libsass/include/sass/version.h +1 -1
- data/ext/libsass/include/sass/version.h.in +1 -1
- data/ext/libsass/include/sass2scss.h +1 -1
- data/ext/libsass/res/resource.rc +6 -6
- data/ext/libsass/script/ci-build-libsass +10 -5
- data/ext/libsass/script/ci-build-plugin +62 -0
- data/ext/libsass/script/ci-install-compiler +1 -1
- data/ext/libsass/script/ci-install-deps +4 -7
- data/ext/libsass/script/ci-report-coverage +13 -3
- data/ext/libsass/script/tap-driver +1 -1
- data/ext/libsass/script/tap-runner +1 -1
- data/ext/libsass/src/GNUmakefile.am +1 -1
- data/ext/libsass/src/ast.cpp +537 -762
- data/ext/libsass/src/ast.hpp +377 -419
- data/ext/libsass/src/ast_def_macros.hpp +26 -1
- data/ext/libsass/src/ast_fwd_decl.cpp +29 -0
- data/ext/libsass/src/ast_fwd_decl.hpp +94 -21
- data/ext/libsass/src/b64/encode.h +3 -1
- data/ext/libsass/src/backtrace.cpp +46 -0
- data/ext/libsass/src/backtrace.hpp +7 -54
- data/ext/libsass/src/bind.cpp +72 -50
- data/ext/libsass/src/bind.hpp +0 -1
- data/ext/libsass/src/cencode.c +6 -0
- data/ext/libsass/src/check_nesting.cpp +157 -135
- data/ext/libsass/src/check_nesting.hpp +11 -10
- data/ext/libsass/src/color_maps.cpp +10 -6
- data/ext/libsass/src/color_maps.hpp +6 -8
- data/ext/libsass/src/constants.cpp +4 -3
- data/ext/libsass/src/constants.hpp +4 -3
- data/ext/libsass/src/context.cpp +110 -47
- data/ext/libsass/src/context.hpp +11 -1
- data/ext/libsass/src/cssize.cpp +105 -94
- data/ext/libsass/src/cssize.hpp +4 -5
- data/ext/libsass/src/debugger.hpp +247 -244
- data/ext/libsass/src/emitter.cpp +30 -6
- data/ext/libsass/src/emitter.hpp +7 -0
- data/ext/libsass/src/environment.cpp +67 -16
- data/ext/libsass/src/environment.hpp +28 -7
- data/ext/libsass/src/error_handling.cpp +92 -64
- data/ext/libsass/src/error_handling.hpp +64 -43
- data/ext/libsass/src/eval.cpp +494 -544
- data/ext/libsass/src/eval.hpp +17 -23
- data/ext/libsass/src/expand.cpp +182 -154
- data/ext/libsass/src/expand.hpp +4 -5
- data/ext/libsass/src/extend.cpp +299 -291
- data/ext/libsass/src/extend.hpp +46 -11
- data/ext/libsass/src/file.cpp +103 -36
- data/ext/libsass/src/file.hpp +21 -4
- data/ext/libsass/src/functions.cpp +561 -312
- data/ext/libsass/src/functions.hpp +8 -5
- data/ext/libsass/src/inspect.cpp +108 -53
- data/ext/libsass/src/inspect.hpp +5 -2
- data/ext/libsass/src/lexer.cpp +15 -7
- data/ext/libsass/src/lexer.hpp +13 -4
- data/ext/libsass/src/listize.cpp +3 -2
- data/ext/libsass/src/listize.hpp +0 -1
- data/ext/libsass/src/memory/SharedPtr.cpp +16 -18
- data/ext/libsass/src/memory/SharedPtr.hpp +47 -43
- data/ext/libsass/src/node.cpp +34 -38
- data/ext/libsass/src/node.hpp +6 -8
- data/ext/libsass/src/operation.hpp +2 -2
- data/ext/libsass/src/operators.cpp +240 -0
- data/ext/libsass/src/operators.hpp +30 -0
- data/ext/libsass/src/output.cpp +22 -20
- data/ext/libsass/src/parser.cpp +719 -358
- data/ext/libsass/src/parser.hpp +57 -22
- data/ext/libsass/src/plugins.cpp +28 -10
- data/ext/libsass/src/position.cpp +21 -3
- data/ext/libsass/src/position.hpp +2 -1
- data/ext/libsass/src/prelexer.cpp +104 -19
- data/ext/libsass/src/prelexer.hpp +10 -3
- data/ext/libsass/src/remove_placeholders.cpp +9 -10
- data/ext/libsass/src/remove_placeholders.hpp +1 -5
- data/ext/libsass/src/sass.cpp +62 -4
- data/ext/libsass/src/sass.hpp +5 -2
- data/ext/libsass/src/sass_context.cpp +96 -58
- data/ext/libsass/src/sass_context.hpp +7 -5
- data/ext/libsass/src/sass_functions.cpp +63 -1
- data/ext/libsass/src/sass_functions.hpp +19 -1
- data/ext/libsass/src/sass_util.cpp +3 -3
- data/ext/libsass/src/sass_util.hpp +4 -4
- data/ext/libsass/src/sass_values.cpp +42 -39
- data/ext/libsass/src/sass_values.hpp +2 -1
- data/ext/libsass/src/source_map.cpp +16 -18
- data/ext/libsass/src/subset_map.cpp +6 -8
- data/ext/libsass/src/subset_map.hpp +6 -6
- data/ext/libsass/src/to_c.cpp +2 -2
- data/ext/libsass/src/to_value.cpp +8 -3
- data/ext/libsass/src/to_value.hpp +1 -0
- data/ext/libsass/src/units.cpp +349 -45
- data/ext/libsass/src/units.hpp +39 -22
- data/ext/libsass/src/utf8/checked.h +7 -0
- data/ext/libsass/src/utf8/unchecked.h +7 -0
- data/ext/libsass/src/utf8_string.cpp +1 -1
- data/ext/libsass/src/util.cpp +139 -45
- data/ext/libsass/src/util.hpp +4 -7
- data/ext/libsass/src/values.cpp +15 -23
- data/ext/libsass/win/libsass.sln +13 -2
- data/ext/libsass/win/libsass.sln.DotSettings +9 -0
- data/ext/libsass/win/libsass.targets +3 -0
- data/ext/libsass/win/libsass.vcxproj.filters +9 -0
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +1 -1
- data/test/native_test.rb +1 -1
- metadata +11 -4
data/ext/libsass/src/cssize.hpp
CHANGED
@@ -8,20 +8,19 @@
|
|
8
8
|
|
9
9
|
namespace Sass {
|
10
10
|
|
11
|
-
typedef Environment<AST_Node_Obj> Env;
|
12
11
|
struct Backtrace;
|
13
12
|
|
14
13
|
class Cssize : public Operation_CRTP<Statement_Ptr, Cssize> {
|
15
14
|
|
16
15
|
Context& ctx;
|
17
|
-
|
18
|
-
std::vector<
|
19
|
-
|
16
|
+
Backtraces& traces;
|
17
|
+
std::vector<Block_Ptr> block_stack;
|
18
|
+
std::vector<Statement_Ptr> p_stack;
|
20
19
|
|
21
20
|
Statement_Ptr fallback_impl(AST_Node_Ptr n);
|
22
21
|
|
23
22
|
public:
|
24
|
-
Cssize(Context
|
23
|
+
Cssize(Context&);
|
25
24
|
~Cssize() { }
|
26
25
|
|
27
26
|
Selector_List_Ptr selector();
|
@@ -10,11 +10,15 @@ using namespace Sass;
|
|
10
10
|
|
11
11
|
inline void debug_ast(AST_Node_Ptr node, std::string ind = "", Env* env = 0);
|
12
12
|
|
13
|
-
inline void
|
13
|
+
inline void debug_ast(const AST_Node* node, std::string ind = "", Env* env = 0) {
|
14
|
+
debug_ast(const_cast<AST_Node*>(node), ind, env);
|
15
|
+
}
|
16
|
+
|
17
|
+
inline void debug_sources_set(ComplexSelectorSet& set, std::string ind = "")
|
14
18
|
{
|
15
19
|
if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
16
20
|
for(auto const &pair : set) {
|
17
|
-
debug_ast(
|
21
|
+
debug_ast(pair, ind + "");
|
18
22
|
// debug_ast(set[pair], ind + "first: ");
|
19
23
|
}
|
20
24
|
if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
@@ -64,30 +68,30 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
64
68
|
{
|
65
69
|
if (node == 0) return;
|
66
70
|
if (ind == "") std::cerr << "####################################################################\n";
|
67
|
-
if (
|
68
|
-
Bubble_Ptr bubble =
|
71
|
+
if (Cast<Bubble>(node)) {
|
72
|
+
Bubble_Ptr bubble = Cast<Bubble>(node);
|
69
73
|
std::cerr << ind << "Bubble " << bubble;
|
70
74
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
71
75
|
std::cerr << " " << bubble->tabs();
|
72
76
|
std::cerr << std::endl;
|
73
|
-
debug_ast(
|
74
|
-
} else if (
|
75
|
-
Trace_Ptr trace =
|
77
|
+
debug_ast(bubble->node(), ind + " ", env);
|
78
|
+
} else if (Cast<Trace>(node)) {
|
79
|
+
Trace_Ptr trace = Cast<Trace>(node);
|
76
80
|
std::cerr << ind << "Trace " << trace;
|
77
81
|
std::cerr << " (" << pstate_source_position(node) << ")"
|
78
|
-
<< " [name:" << trace->name() << "]"
|
82
|
+
<< " [name:" << trace->name() << ", type: " << trace->type() << "]"
|
79
83
|
<< std::endl;
|
80
|
-
debug_ast(
|
81
|
-
} else if (
|
82
|
-
At_Root_Block_Ptr root_block =
|
84
|
+
debug_ast(trace->block(), ind + " ", env);
|
85
|
+
} else if (Cast<At_Root_Block>(node)) {
|
86
|
+
At_Root_Block_Ptr root_block = Cast<At_Root_Block>(node);
|
83
87
|
std::cerr << ind << "At_Root_Block " << root_block;
|
84
88
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
85
89
|
std::cerr << " " << root_block->tabs();
|
86
90
|
std::cerr << std::endl;
|
87
|
-
debug_ast(
|
88
|
-
debug_ast(
|
89
|
-
} else if (
|
90
|
-
Selector_List_Ptr selector =
|
91
|
+
debug_ast(root_block->expression(), ind + ":", env);
|
92
|
+
debug_ast(root_block->block(), ind + " ", env);
|
93
|
+
} else if (Cast<Selector_List>(node)) {
|
94
|
+
Selector_List_Ptr selector = Cast<Selector_List>(node);
|
91
95
|
std::cerr << ind << "Selector_List " << selector;
|
92
96
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
93
97
|
std::cerr << " <" << selector->hash() << ">";
|
@@ -99,15 +103,16 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
99
103
|
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
100
104
|
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
101
105
|
std::cerr << std::endl;
|
106
|
+
debug_ast(selector->schema(), ind + "#{} ");
|
102
107
|
|
103
|
-
for(const Complex_Selector_Obj& i : selector->elements()) { debug_ast(
|
108
|
+
for(const Complex_Selector_Obj& i : selector->elements()) { debug_ast(i, ind + " ", env); }
|
104
109
|
|
105
|
-
// } else if (
|
106
|
-
// Expression_Ptr expression =
|
110
|
+
// } else if (Cast<Expression>(node)) {
|
111
|
+
// Expression_Ptr expression = Cast<Expression>(node);
|
107
112
|
// std::cerr << ind << "Expression " << expression << " " << expression->concrete_type() << std::endl;
|
108
113
|
|
109
|
-
} else if (
|
110
|
-
Parent_Selector_Ptr selector =
|
114
|
+
} else if (Cast<Parent_Selector>(node)) {
|
115
|
+
Parent_Selector_Ptr selector = Cast<Parent_Selector>(node);
|
111
116
|
std::cerr << ind << "Parent_Selector " << selector;
|
112
117
|
// if (selector->not_selector()) cerr << " [in_declaration]";
|
113
118
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
@@ -116,8 +121,8 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
116
121
|
std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << std::endl;
|
117
122
|
// debug_ast(selector->selector(), ind + "->", env);
|
118
123
|
|
119
|
-
} else if (
|
120
|
-
Complex_Selector_Ptr selector =
|
124
|
+
} else if (Cast<Complex_Selector>(node)) {
|
125
|
+
Complex_Selector_Ptr selector = Cast<Complex_Selector>(node);
|
121
126
|
std::cerr << ind << "Complex_Selector " << selector
|
122
127
|
<< " (" << pstate_source_position(node) << ")"
|
123
128
|
<< " <" << selector->hash() << ">"
|
@@ -141,16 +146,16 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
141
146
|
}
|
142
147
|
// if (del = "/") del += selector->reference()->perform(&to_string) + "/";
|
143
148
|
std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << std::endl;
|
144
|
-
debug_ast(
|
149
|
+
debug_ast(selector->head(), ind + " " /* + "[" + del + "]" */, env);
|
145
150
|
if (selector->tail()) {
|
146
|
-
debug_ast(
|
151
|
+
debug_ast(selector->tail(), ind + "{" + del + "}", env);
|
147
152
|
} else if(del != " ") {
|
148
153
|
std::cerr << ind << " |" << del << "| {trailing op}" << std::endl;
|
149
154
|
}
|
150
|
-
|
155
|
+
ComplexSelectorSet set = selector->sources();
|
151
156
|
// debug_sources_set(set, ind + " @--> ");
|
152
|
-
} else if (
|
153
|
-
Compound_Selector_Ptr selector =
|
157
|
+
} else if (Cast<Compound_Selector>(node)) {
|
158
|
+
Compound_Selector_Ptr selector = Cast<Compound_Selector>(node);
|
154
159
|
std::cerr << ind << "Compound_Selector " << selector;
|
155
160
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
156
161
|
std::cerr << " <" << selector->hash() << ">";
|
@@ -162,9 +167,9 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
162
167
|
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
163
168
|
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
164
169
|
std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << std::endl;
|
165
|
-
for(const Simple_Selector_Obj& i : selector->elements()) { debug_ast(
|
166
|
-
} else if (
|
167
|
-
Wrapped_Selector_Ptr selector =
|
170
|
+
for(const Simple_Selector_Obj& i : selector->elements()) { debug_ast(i, ind + " ", env); }
|
171
|
+
} else if (Cast<Wrapped_Selector>(node)) {
|
172
|
+
Wrapped_Selector_Ptr selector = Cast<Wrapped_Selector>(node);
|
168
173
|
std::cerr << ind << "Wrapped_Selector " << selector;
|
169
174
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
170
175
|
std::cerr << " <" << selector->hash() << ">";
|
@@ -174,9 +179,9 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
174
179
|
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
175
180
|
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
176
181
|
std::cerr << std::endl;
|
177
|
-
debug_ast(
|
178
|
-
} else if (
|
179
|
-
Pseudo_Selector_Ptr selector =
|
182
|
+
debug_ast(selector->selector(), ind + " () ", env);
|
183
|
+
} else if (Cast<Pseudo_Selector>(node)) {
|
184
|
+
Pseudo_Selector_Ptr selector = Cast<Pseudo_Selector>(node);
|
180
185
|
std::cerr << ind << "Pseudo_Selector " << selector;
|
181
186
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
182
187
|
std::cerr << " <" << selector->hash() << ">";
|
@@ -186,9 +191,9 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
186
191
|
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
187
192
|
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
188
193
|
std::cerr << std::endl;
|
189
|
-
debug_ast(
|
190
|
-
} else if (
|
191
|
-
Attribute_Selector_Ptr selector =
|
194
|
+
debug_ast(selector->expression(), ind + " <= ", env);
|
195
|
+
} else if (Cast<Attribute_Selector>(node)) {
|
196
|
+
Attribute_Selector_Ptr selector = Cast<Attribute_Selector>(node);
|
192
197
|
std::cerr << ind << "Attribute_Selector " << selector;
|
193
198
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
194
199
|
std::cerr << " <" << selector->hash() << ">";
|
@@ -198,9 +203,9 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
198
203
|
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
199
204
|
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
200
205
|
std::cerr << std::endl;
|
201
|
-
debug_ast(
|
202
|
-
} else if (
|
203
|
-
Class_Selector_Ptr selector =
|
206
|
+
debug_ast(selector->value(), ind + "[" + selector->matcher() + "] ", env);
|
207
|
+
} else if (Cast<Class_Selector>(node)) {
|
208
|
+
Class_Selector_Ptr selector = Cast<Class_Selector>(node);
|
204
209
|
std::cerr << ind << "Class_Selector " << selector;
|
205
210
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
206
211
|
std::cerr << " <" << selector->hash() << ">";
|
@@ -210,8 +215,8 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
210
215
|
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
211
216
|
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
212
217
|
std::cerr << std::endl;
|
213
|
-
} else if (
|
214
|
-
Id_Selector_Ptr selector =
|
218
|
+
} else if (Cast<Id_Selector>(node)) {
|
219
|
+
Id_Selector_Ptr selector = Cast<Id_Selector>(node);
|
215
220
|
std::cerr << ind << "Id_Selector " << selector;
|
216
221
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
217
222
|
std::cerr << " <" << selector->hash() << ">";
|
@@ -221,8 +226,8 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
221
226
|
std::cerr << (selector->has_line_break() ? " [line-break]": " -");
|
222
227
|
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
223
228
|
std::cerr << std::endl;
|
224
|
-
} else if (
|
225
|
-
Element_Selector_Ptr selector =
|
229
|
+
} else if (Cast<Element_Selector>(node)) {
|
230
|
+
Element_Selector_Ptr selector = Cast<Element_Selector>(node);
|
226
231
|
std::cerr << ind << "Element_Selector " << selector;
|
227
232
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
228
233
|
std::cerr << " <" << selector->hash() << ">";
|
@@ -233,9 +238,9 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
233
238
|
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
|
234
239
|
std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">";
|
235
240
|
std::cerr << std::endl;
|
236
|
-
} else if (
|
241
|
+
} else if (Cast<Placeholder_Selector>(node)) {
|
237
242
|
|
238
|
-
Placeholder_Selector_Ptr selector =
|
243
|
+
Placeholder_Selector_Ptr selector = Cast<Placeholder_Selector>(node);
|
239
244
|
std::cerr << ind << "Placeholder_Selector [" << selector->ns_name() << "] " << selector;
|
240
245
|
std::cerr << " (" << pstate_source_position(selector) << ")"
|
241
246
|
<< " <" << selector->hash() << ">"
|
@@ -245,212 +250,211 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
245
250
|
<< (selector->has_line_feed() ? " [line-feed]": " -")
|
246
251
|
<< std::endl;
|
247
252
|
|
248
|
-
} else if (
|
249
|
-
Simple_Selector* selector =
|
253
|
+
} else if (Cast<Simple_Selector>(node)) {
|
254
|
+
Simple_Selector* selector = Cast<Simple_Selector>(node);
|
250
255
|
std::cerr << ind << "Simple_Selector " << selector;
|
251
256
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
252
257
|
std::cerr << (selector->has_line_break() ? " [line-break]": " -") << (selector->has_line_feed() ? " [line-feed]": " -") << std::endl;
|
253
258
|
|
254
|
-
} else if (
|
255
|
-
Selector_Schema_Ptr selector =
|
259
|
+
} else if (Cast<Selector_Schema>(node)) {
|
260
|
+
Selector_Schema_Ptr selector = Cast<Selector_Schema>(node);
|
256
261
|
std::cerr << ind << "Selector_Schema " << selector;
|
257
262
|
std::cerr << " (" << pstate_source_position(node) << ")"
|
258
|
-
<< (selector->at_root() && selector->at_root() ? " [@ROOT]" : "")
|
259
263
|
<< " [@media:" << selector->media_block() << "]"
|
260
|
-
<< (selector->
|
261
|
-
<< (selector->has_line_feed() ? " [line-feed]": " -")
|
264
|
+
<< (selector->connect_parent() ? " [connect-parent]": " -")
|
262
265
|
<< std::endl;
|
263
266
|
|
264
|
-
debug_ast(
|
267
|
+
debug_ast(selector->contents(), ind + " ");
|
265
268
|
// for(auto i : selector->elements()) { debug_ast(i, ind + " ", env); }
|
266
269
|
|
267
|
-
} else if (
|
268
|
-
Selector_Ptr selector =
|
270
|
+
} else if (Cast<Selector>(node)) {
|
271
|
+
Selector_Ptr selector = Cast<Selector>(node);
|
269
272
|
std::cerr << ind << "Selector " << selector;
|
270
273
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
271
274
|
std::cerr << (selector->has_line_break() ? " [line-break]": " -")
|
272
275
|
<< (selector->has_line_feed() ? " [line-feed]": " -")
|
273
276
|
<< std::endl;
|
274
277
|
|
275
|
-
} else if (
|
276
|
-
Media_Query_Expression_Ptr block =
|
278
|
+
} else if (Cast<Media_Query_Expression>(node)) {
|
279
|
+
Media_Query_Expression_Ptr block = Cast<Media_Query_Expression>(node);
|
277
280
|
std::cerr << ind << "Media_Query_Expression " << block;
|
278
281
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
279
282
|
std::cerr << (block->is_interpolated() ? " [is_interpolated]": " -")
|
280
283
|
<< std::endl;
|
281
|
-
debug_ast(
|
282
|
-
debug_ast(
|
284
|
+
debug_ast(block->feature(), ind + " feature) ");
|
285
|
+
debug_ast(block->value(), ind + " value) ");
|
283
286
|
|
284
|
-
} else if (
|
285
|
-
Media_Query_Ptr block =
|
287
|
+
} else if (Cast<Media_Query>(node)) {
|
288
|
+
Media_Query_Ptr block = Cast<Media_Query>(node);
|
286
289
|
std::cerr << ind << "Media_Query " << block;
|
287
290
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
288
291
|
std::cerr << (block->is_negated() ? " [is_negated]": " -")
|
289
292
|
<< (block->is_restricted() ? " [is_restricted]": " -")
|
290
293
|
<< std::endl;
|
291
|
-
debug_ast(
|
292
|
-
for(const auto& i : block->elements()) { debug_ast(
|
294
|
+
debug_ast(block->media_type(), ind + " ");
|
295
|
+
for(const auto& i : block->elements()) { debug_ast(i, ind + " ", env); }
|
293
296
|
|
294
|
-
} else if (
|
295
|
-
Media_Block_Ptr block =
|
297
|
+
} else if (Cast<Media_Block>(node)) {
|
298
|
+
Media_Block_Ptr block = Cast<Media_Block>(node);
|
296
299
|
std::cerr << ind << "Media_Block " << block;
|
297
300
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
298
301
|
std::cerr << " " << block->tabs() << std::endl;
|
299
|
-
debug_ast(
|
300
|
-
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(
|
301
|
-
} else if (
|
302
|
-
Supports_Block_Ptr block =
|
302
|
+
debug_ast(block->media_queries(), ind + " =@ ");
|
303
|
+
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
304
|
+
} else if (Cast<Supports_Block>(node)) {
|
305
|
+
Supports_Block_Ptr block = Cast<Supports_Block>(node);
|
303
306
|
std::cerr << ind << "Supports_Block " << block;
|
304
307
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
305
308
|
std::cerr << " " << block->tabs() << std::endl;
|
306
|
-
debug_ast(
|
307
|
-
debug_ast(
|
308
|
-
} else if (
|
309
|
-
Supports_Operator_Ptr block =
|
309
|
+
debug_ast(block->condition(), ind + " =@ ");
|
310
|
+
debug_ast(block->block(), ind + " <>");
|
311
|
+
} else if (Cast<Supports_Operator>(node)) {
|
312
|
+
Supports_Operator_Ptr block = Cast<Supports_Operator>(node);
|
310
313
|
std::cerr << ind << "Supports_Operator " << block;
|
311
314
|
std::cerr << " (" << pstate_source_position(node) << ")"
|
312
315
|
<< std::endl;
|
313
|
-
debug_ast(
|
314
|
-
debug_ast(
|
315
|
-
} else if (
|
316
|
-
Supports_Negation_Ptr block =
|
316
|
+
debug_ast(block->left(), ind + " left) ");
|
317
|
+
debug_ast(block->right(), ind + " right) ");
|
318
|
+
} else if (Cast<Supports_Negation>(node)) {
|
319
|
+
Supports_Negation_Ptr block = Cast<Supports_Negation>(node);
|
317
320
|
std::cerr << ind << "Supports_Negation " << block;
|
318
321
|
std::cerr << " (" << pstate_source_position(node) << ")"
|
319
322
|
<< std::endl;
|
320
|
-
debug_ast(
|
321
|
-
} else if (
|
322
|
-
At_Root_Query_Ptr block =
|
323
|
+
debug_ast(block->condition(), ind + " condition) ");
|
324
|
+
} else if (Cast<At_Root_Query>(node)) {
|
325
|
+
At_Root_Query_Ptr block = Cast<At_Root_Query>(node);
|
323
326
|
std::cerr << ind << "At_Root_Query " << block;
|
324
327
|
std::cerr << " (" << pstate_source_position(node) << ")"
|
325
328
|
<< std::endl;
|
326
|
-
debug_ast(
|
327
|
-
debug_ast(
|
328
|
-
} else if (
|
329
|
-
Supports_Declaration_Ptr block =
|
329
|
+
debug_ast(block->feature(), ind + " feature) ");
|
330
|
+
debug_ast(block->value(), ind + " value) ");
|
331
|
+
} else if (Cast<Supports_Declaration>(node)) {
|
332
|
+
Supports_Declaration_Ptr block = Cast<Supports_Declaration>(node);
|
330
333
|
std::cerr << ind << "Supports_Declaration " << block;
|
331
334
|
std::cerr << " (" << pstate_source_position(node) << ")"
|
332
335
|
<< std::endl;
|
333
|
-
debug_ast(
|
334
|
-
debug_ast(
|
335
|
-
} else if (
|
336
|
-
Block_Ptr root_block =
|
336
|
+
debug_ast(block->feature(), ind + " feature) ");
|
337
|
+
debug_ast(block->value(), ind + " value) ");
|
338
|
+
} else if (Cast<Block>(node)) {
|
339
|
+
Block_Ptr root_block = Cast<Block>(node);
|
337
340
|
std::cerr << ind << "Block " << root_block;
|
338
341
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
339
342
|
if (root_block->is_root()) std::cerr << " [root]";
|
340
343
|
std::cerr << " " << root_block->tabs() << std::endl;
|
341
|
-
for(const Statement_Obj& i : root_block->elements()) { debug_ast(
|
342
|
-
} else if (
|
343
|
-
Warning_Ptr block =
|
344
|
+
for(const Statement_Obj& i : root_block->elements()) { debug_ast(i, ind + " ", env); }
|
345
|
+
} else if (Cast<Warning>(node)) {
|
346
|
+
Warning_Ptr block = Cast<Warning>(node);
|
344
347
|
std::cerr << ind << "Warning " << block;
|
345
348
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
346
349
|
std::cerr << " " << block->tabs() << std::endl;
|
347
|
-
debug_ast(
|
348
|
-
} else if (
|
349
|
-
Error_Ptr block =
|
350
|
+
debug_ast(block->message(), ind + " : ");
|
351
|
+
} else if (Cast<Error>(node)) {
|
352
|
+
Error_Ptr block = Cast<Error>(node);
|
350
353
|
std::cerr << ind << "Error " << block;
|
351
354
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
352
355
|
std::cerr << " " << block->tabs() << std::endl;
|
353
|
-
} else if (
|
354
|
-
Debug_Ptr block =
|
356
|
+
} else if (Cast<Debug>(node)) {
|
357
|
+
Debug_Ptr block = Cast<Debug>(node);
|
355
358
|
std::cerr << ind << "Debug " << block;
|
356
359
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
357
360
|
std::cerr << " " << block->tabs() << std::endl;
|
358
|
-
debug_ast(
|
359
|
-
} else if (
|
360
|
-
Comment_Ptr block =
|
361
|
+
debug_ast(block->value(), ind + " ");
|
362
|
+
} else if (Cast<Comment>(node)) {
|
363
|
+
Comment_Ptr block = Cast<Comment>(node);
|
361
364
|
std::cerr << ind << "Comment " << block;
|
362
365
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
363
366
|
std::cerr << " " << block->tabs() <<
|
364
367
|
" <" << prettyprint(block->pstate().token.ws_before()) << ">" << std::endl;
|
365
|
-
debug_ast(
|
366
|
-
} else if (
|
367
|
-
If_Ptr block =
|
368
|
+
debug_ast(block->text(), ind + "// ", env);
|
369
|
+
} else if (Cast<If>(node)) {
|
370
|
+
If_Ptr block = Cast<If>(node);
|
368
371
|
std::cerr << ind << "If " << block;
|
369
372
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
370
373
|
std::cerr << " " << block->tabs() << std::endl;
|
371
|
-
debug_ast(
|
372
|
-
debug_ast(
|
373
|
-
debug_ast(
|
374
|
-
} else if (
|
375
|
-
Return_Ptr block =
|
374
|
+
debug_ast(block->predicate(), ind + " = ");
|
375
|
+
debug_ast(block->block(), ind + " <>");
|
376
|
+
debug_ast(block->alternative(), ind + " ><");
|
377
|
+
} else if (Cast<Return>(node)) {
|
378
|
+
Return_Ptr block = Cast<Return>(node);
|
376
379
|
std::cerr << ind << "Return " << block;
|
377
380
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
378
381
|
std::cerr << " " << block->tabs() << std::endl;
|
379
|
-
} else if (
|
380
|
-
Extension_Ptr block =
|
382
|
+
} else if (Cast<Extension>(node)) {
|
383
|
+
Extension_Ptr block = Cast<Extension>(node);
|
381
384
|
std::cerr << ind << "Extension " << block;
|
382
385
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
383
386
|
std::cerr << " " << block->tabs() << std::endl;
|
384
|
-
debug_ast(
|
385
|
-
} else if (
|
386
|
-
Content_Ptr block =
|
387
|
+
debug_ast(block->selector(), ind + "-> ", env);
|
388
|
+
} else if (Cast<Content>(node)) {
|
389
|
+
Content_Ptr block = Cast<Content>(node);
|
387
390
|
std::cerr << ind << "Content " << block;
|
388
391
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
389
392
|
std::cerr << " [@media:" << block->media_block() << "]";
|
390
393
|
std::cerr << " " << block->tabs() << std::endl;
|
391
|
-
} else if (
|
392
|
-
Import_Stub_Ptr block =
|
394
|
+
} else if (Cast<Import_Stub>(node)) {
|
395
|
+
Import_Stub_Ptr block = Cast<Import_Stub>(node);
|
393
396
|
std::cerr << ind << "Import_Stub " << block;
|
394
397
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
395
398
|
std::cerr << " [" << block->imp_path() << "] ";
|
396
399
|
std::cerr << " " << block->tabs() << std::endl;
|
397
|
-
} else if (
|
398
|
-
Import_Ptr block =
|
400
|
+
} else if (Cast<Import>(node)) {
|
401
|
+
Import_Ptr block = Cast<Import>(node);
|
399
402
|
std::cerr << ind << "Import " << block;
|
400
403
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
401
404
|
std::cerr << " " << block->tabs() << std::endl;
|
402
405
|
// std::vector<std::string> files_;
|
403
|
-
for (auto imp : block->urls()) debug_ast(
|
404
|
-
debug_ast(
|
405
|
-
} else if (
|
406
|
-
Assignment_Ptr block =
|
406
|
+
for (auto imp : block->urls()) debug_ast(imp, ind + "@: ", env);
|
407
|
+
debug_ast(block->import_queries(), ind + "@@ ");
|
408
|
+
} else if (Cast<Assignment>(node)) {
|
409
|
+
Assignment_Ptr block = Cast<Assignment>(node);
|
407
410
|
std::cerr << ind << "Assignment " << block;
|
408
411
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
409
412
|
std::cerr << " <<" << block->variable() << ">> " << block->tabs() << std::endl;
|
410
|
-
debug_ast(
|
411
|
-
} else if (
|
412
|
-
Declaration_Ptr block =
|
413
|
+
debug_ast(block->value(), ind + "=", env);
|
414
|
+
} else if (Cast<Declaration>(node)) {
|
415
|
+
Declaration_Ptr block = Cast<Declaration>(node);
|
413
416
|
std::cerr << ind << "Declaration " << block;
|
414
417
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
418
|
+
std::cerr << " [is_custom_property: " << block->is_custom_property() << "] ";
|
415
419
|
std::cerr << " " << block->tabs() << std::endl;
|
416
|
-
debug_ast(
|
417
|
-
debug_ast(
|
418
|
-
debug_ast(
|
419
|
-
} else if (
|
420
|
-
Keyframe_Rule_Ptr has_block =
|
420
|
+
debug_ast(block->property(), ind + " prop: ", env);
|
421
|
+
debug_ast(block->value(), ind + " value: ", env);
|
422
|
+
debug_ast(block->block(), ind + " ", env);
|
423
|
+
} else if (Cast<Keyframe_Rule>(node)) {
|
424
|
+
Keyframe_Rule_Ptr has_block = Cast<Keyframe_Rule>(node);
|
421
425
|
std::cerr << ind << "Keyframe_Rule " << has_block;
|
422
426
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
423
427
|
std::cerr << " " << has_block->tabs() << std::endl;
|
424
|
-
if (has_block->name()) debug_ast(
|
425
|
-
if (has_block->block()) for(const Statement_Obj& i : has_block->block()->elements()) { debug_ast(
|
426
|
-
} else if (
|
427
|
-
Directive_Ptr block =
|
428
|
+
if (has_block->name()) debug_ast(has_block->name(), ind + "@");
|
429
|
+
if (has_block->block()) for(const Statement_Obj& i : has_block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
430
|
+
} else if (Cast<Directive>(node)) {
|
431
|
+
Directive_Ptr block = Cast<Directive>(node);
|
428
432
|
std::cerr << ind << "Directive " << block;
|
429
433
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
430
434
|
std::cerr << " [" << block->keyword() << "] " << block->tabs() << std::endl;
|
431
|
-
debug_ast(
|
432
|
-
debug_ast(
|
433
|
-
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(
|
434
|
-
} else if (
|
435
|
-
Each_Ptr block =
|
435
|
+
debug_ast(block->selector(), ind + "~", env);
|
436
|
+
debug_ast(block->value(), ind + "+", env);
|
437
|
+
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
438
|
+
} else if (Cast<Each>(node)) {
|
439
|
+
Each_Ptr block = Cast<Each>(node);
|
436
440
|
std::cerr << ind << "Each " << block;
|
437
441
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
438
442
|
std::cerr << " " << block->tabs() << std::endl;
|
439
|
-
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(
|
440
|
-
} else if (
|
441
|
-
For_Ptr block =
|
443
|
+
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
444
|
+
} else if (Cast<For>(node)) {
|
445
|
+
For_Ptr block = Cast<For>(node);
|
442
446
|
std::cerr << ind << "For " << block;
|
443
447
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
444
448
|
std::cerr << " " << block->tabs() << std::endl;
|
445
|
-
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(
|
446
|
-
} else if (
|
447
|
-
While_Ptr block =
|
449
|
+
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
450
|
+
} else if (Cast<While>(node)) {
|
451
|
+
While_Ptr block = Cast<While>(node);
|
448
452
|
std::cerr << ind << "While " << block;
|
449
453
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
450
454
|
std::cerr << " " << block->tabs() << std::endl;
|
451
|
-
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(
|
452
|
-
} else if (
|
453
|
-
Definition_Ptr block =
|
455
|
+
if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
456
|
+
} else if (Cast<Definition>(node)) {
|
457
|
+
Definition_Ptr block = Cast<Definition>(node);
|
454
458
|
std::cerr << ind << "Definition " << block;
|
455
459
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
456
460
|
std::cerr << " [name: " << block->name() << "] ";
|
@@ -459,73 +463,69 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
459
463
|
// std::cerr << " [signature: " << block->signature() << "] ";
|
460
464
|
std::cerr << " [native: " << block->native_function() << "] ";
|
461
465
|
std::cerr << " " << block->tabs() << std::endl;
|
462
|
-
debug_ast(
|
463
|
-
if (block->block()) debug_ast(
|
464
|
-
} else if (
|
465
|
-
Mixin_Call_Ptr block =
|
466
|
+
debug_ast(block->parameters(), ind + " params: ", env);
|
467
|
+
if (block->block()) debug_ast(block->block(), ind + " ", env);
|
468
|
+
} else if (Cast<Mixin_Call>(node)) {
|
469
|
+
Mixin_Call_Ptr block = Cast<Mixin_Call>(node);
|
466
470
|
std::cerr << ind << "Mixin_Call " << block << " " << block->tabs();
|
467
471
|
std::cerr << " (" << pstate_source_position(block) << ")";
|
468
472
|
std::cerr << " [" << block->name() << "]";
|
469
473
|
std::cerr << " [has_content: " << block->has_content() << "] " << std::endl;
|
470
|
-
debug_ast(
|
471
|
-
if (block->block()) debug_ast(
|
472
|
-
} else if (Ruleset_Ptr ruleset =
|
474
|
+
debug_ast(block->arguments(), ind + " args: ");
|
475
|
+
if (block->block()) debug_ast(block->block(), ind + " ", env);
|
476
|
+
} else if (Ruleset_Ptr ruleset = Cast<Ruleset>(node)) {
|
473
477
|
std::cerr << ind << "Ruleset " << ruleset;
|
474
478
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
475
479
|
std::cerr << " [indent: " << ruleset->tabs() << "]";
|
476
480
|
std::cerr << (ruleset->is_invisible() ? " [INVISIBLE]" : "");
|
477
|
-
std::cerr << (ruleset->at_root() ? " [@ROOT]" : "");
|
478
481
|
std::cerr << (ruleset->is_root() ? " [root]" : "");
|
479
482
|
std::cerr << std::endl;
|
480
|
-
debug_ast(
|
481
|
-
debug_ast(
|
482
|
-
} else if (
|
483
|
-
Block_Ptr block =
|
483
|
+
debug_ast(ruleset->selector(), ind + ">");
|
484
|
+
debug_ast(ruleset->block(), ind + " ");
|
485
|
+
} else if (Cast<Block>(node)) {
|
486
|
+
Block_Ptr block = Cast<Block>(node);
|
484
487
|
std::cerr << ind << "Block " << block;
|
485
488
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
486
489
|
std::cerr << (block->is_invisible() ? " [INVISIBLE]" : "");
|
487
490
|
std::cerr << " [indent: " << block->tabs() << "]" << std::endl;
|
488
|
-
for(const Statement_Obj& i : block->elements()) { debug_ast(
|
489
|
-
} else if (
|
490
|
-
|
491
|
-
std::cerr << ind << "Textual " << expression;
|
492
|
-
std::cerr << " (" << pstate_source_position(node) << ")";
|
493
|
-
if (expression->type() == Textual::NUMBER) std::cerr << " [NUMBER]";
|
494
|
-
else if (expression->type() == Textual::PERCENTAGE) std::cerr << " [PERCENTAGE]";
|
495
|
-
else if (expression->type() == Textual::DIMENSION) std::cerr << " [DIMENSION]";
|
496
|
-
else if (expression->type() == Textual::HEX) std::cerr << " [HEX]";
|
497
|
-
std::cerr << " [" << expression->value() << "]";
|
498
|
-
std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
|
499
|
-
if (expression->is_delayed()) std::cerr << " [delayed]";
|
500
|
-
std::cerr << std::endl;
|
501
|
-
} else if (dynamic_cast<Variable_Ptr>(node)) {
|
502
|
-
Variable_Ptr expression = dynamic_cast<Variable_Ptr>(node);
|
491
|
+
for(const Statement_Obj& i : block->elements()) { debug_ast(i, ind + " ", env); }
|
492
|
+
} else if (Cast<Variable>(node)) {
|
493
|
+
Variable_Ptr expression = Cast<Variable>(node);
|
503
494
|
std::cerr << ind << "Variable " << expression;
|
504
495
|
std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
|
505
496
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
506
497
|
std::cerr << " [" << expression->name() << "]" << std::endl;
|
507
498
|
std::string name(expression->name());
|
508
|
-
if (env && env->has(name)) debug_ast(
|
509
|
-
} else if (
|
510
|
-
Function_Call_Schema_Ptr expression =
|
499
|
+
if (env && env->has(name)) debug_ast(Cast<Expression>((*env)[name]), ind + " -> ", env);
|
500
|
+
} else if (Cast<Function_Call_Schema>(node)) {
|
501
|
+
Function_Call_Schema_Ptr expression = Cast<Function_Call_Schema>(node);
|
511
502
|
std::cerr << ind << "Function_Call_Schema " << expression;
|
512
503
|
std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
|
513
504
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
514
505
|
std::cerr << "" << std::endl;
|
515
|
-
debug_ast(
|
516
|
-
debug_ast(
|
517
|
-
} else if (
|
518
|
-
Function_Call_Ptr expression =
|
506
|
+
debug_ast(expression->name(), ind + "name: ", env);
|
507
|
+
debug_ast(expression->arguments(), ind + " args: ", env);
|
508
|
+
} else if (Cast<Function_Call>(node)) {
|
509
|
+
Function_Call_Ptr expression = Cast<Function_Call>(node);
|
519
510
|
std::cerr << ind << "Function_Call " << expression;
|
520
511
|
std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
|
521
512
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
522
513
|
std::cerr << " [" << expression->name() << "]";
|
523
514
|
if (expression->is_delayed()) std::cerr << " [delayed]";
|
524
515
|
if (expression->is_interpolant()) std::cerr << " [interpolant]";
|
516
|
+
if (expression->is_css()) std::cerr << " [css]";
|
517
|
+
std::cerr << std::endl;
|
518
|
+
debug_ast(expression->arguments(), ind + " args: ", env);
|
519
|
+
debug_ast(expression->func(), ind + " func: ", env);
|
520
|
+
} else if (Cast<Function>(node)) {
|
521
|
+
Function_Ptr expression = Cast<Function>(node);
|
522
|
+
std::cerr << ind << "Function " << expression;
|
523
|
+
std::cerr << " (" << pstate_source_position(node) << ")";
|
524
|
+
if (expression->is_css()) std::cerr << " [css]";
|
525
525
|
std::cerr << std::endl;
|
526
|
-
debug_ast(
|
527
|
-
} else if (
|
528
|
-
Arguments_Ptr expression =
|
526
|
+
debug_ast(expression->definition(), ind + " definition: ", env);
|
527
|
+
} else if (Cast<Arguments>(node)) {
|
528
|
+
Arguments_Ptr expression = Cast<Arguments>(node);
|
529
529
|
std::cerr << ind << "Arguments " << expression;
|
530
530
|
if (expression->is_delayed()) std::cerr << " [delayed]";
|
531
531
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
@@ -533,41 +533,41 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
533
533
|
if (expression->has_rest_argument()) std::cerr << " [has_rest_argument]";
|
534
534
|
if (expression->has_keyword_argument()) std::cerr << " [has_keyword_argument]";
|
535
535
|
std::cerr << std::endl;
|
536
|
-
for(const Argument_Obj& i : expression->elements()) { debug_ast(
|
537
|
-
} else if (
|
538
|
-
Argument_Ptr expression =
|
536
|
+
for(const Argument_Obj& i : expression->elements()) { debug_ast(i, ind + " ", env); }
|
537
|
+
} else if (Cast<Argument>(node)) {
|
538
|
+
Argument_Ptr expression = Cast<Argument>(node);
|
539
539
|
std::cerr << ind << "Argument " << expression;
|
540
540
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
541
|
-
std::cerr << " [" << expression->value() << "]";
|
541
|
+
std::cerr << " [" << expression->value().ptr() << "]";
|
542
542
|
std::cerr << " [name: " << expression->name() << "] ";
|
543
543
|
std::cerr << " [rest: " << expression->is_rest_argument() << "] ";
|
544
544
|
std::cerr << " [keyword: " << expression->is_keyword_argument() << "] " << std::endl;
|
545
|
-
debug_ast(
|
546
|
-
} else if (
|
547
|
-
Parameters_Ptr expression =
|
545
|
+
debug_ast(expression->value(), ind + " value: ", env);
|
546
|
+
} else if (Cast<Parameters>(node)) {
|
547
|
+
Parameters_Ptr expression = Cast<Parameters>(node);
|
548
548
|
std::cerr << ind << "Parameters " << expression;
|
549
549
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
550
550
|
std::cerr << " [has_optional: " << expression->has_optional_parameters() << "] ";
|
551
551
|
std::cerr << " [has_rest: " << expression->has_rest_parameter() << "] ";
|
552
552
|
std::cerr << std::endl;
|
553
|
-
for(const Parameter_Obj& i : expression->elements()) { debug_ast(
|
554
|
-
} else if (
|
555
|
-
Parameter_Ptr expression =
|
553
|
+
for(const Parameter_Obj& i : expression->elements()) { debug_ast(i, ind + " ", env); }
|
554
|
+
} else if (Cast<Parameter>(node)) {
|
555
|
+
Parameter_Ptr expression = Cast<Parameter>(node);
|
556
556
|
std::cerr << ind << "Parameter " << expression;
|
557
557
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
558
558
|
std::cerr << " [name: " << expression->name() << "] ";
|
559
|
-
std::cerr << " [default: " << expression->default_value() << "] ";
|
559
|
+
std::cerr << " [default: " << expression->default_value().ptr() << "] ";
|
560
560
|
std::cerr << " [rest: " << expression->is_rest_parameter() << "] " << std::endl;
|
561
|
-
} else if (
|
562
|
-
Unary_Expression_Ptr expression =
|
561
|
+
} else if (Cast<Unary_Expression>(node)) {
|
562
|
+
Unary_Expression_Ptr expression = Cast<Unary_Expression>(node);
|
563
563
|
std::cerr << ind << "Unary_Expression " << expression;
|
564
564
|
std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
|
565
565
|
std::cerr << " [delayed: " << expression->is_delayed() << "] ";
|
566
566
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
567
567
|
std::cerr << " [" << expression->type() << "]" << std::endl;
|
568
|
-
debug_ast(
|
569
|
-
} else if (
|
570
|
-
Binary_Expression_Ptr expression =
|
568
|
+
debug_ast(expression->operand(), ind + " operand: ", env);
|
569
|
+
} else if (Cast<Binary_Expression>(node)) {
|
570
|
+
Binary_Expression_Ptr expression = Cast<Binary_Expression>(node);
|
571
571
|
std::cerr << ind << "Binary_Expression " << expression;
|
572
572
|
if (expression->is_interpolant()) std::cerr << " [is interpolant] ";
|
573
573
|
if (expression->is_left_interpolant()) std::cerr << " [left interpolant] ";
|
@@ -577,67 +577,70 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
577
577
|
std::cerr << " [ws_after: " << expression->op().ws_after << "] ";
|
578
578
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
579
579
|
std::cerr << " [" << expression->type_name() << "]" << std::endl;
|
580
|
-
debug_ast(
|
581
|
-
debug_ast(
|
582
|
-
} else if (
|
583
|
-
Map_Ptr expression =
|
580
|
+
debug_ast(expression->left(), ind + " left: ", env);
|
581
|
+
debug_ast(expression->right(), ind + " right: ", env);
|
582
|
+
} else if (Cast<Map>(node)) {
|
583
|
+
Map_Ptr expression = Cast<Map>(node);
|
584
584
|
std::cerr << ind << "Map " << expression;
|
585
585
|
std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
|
586
586
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
587
587
|
std::cerr << " [Hashed]" << std::endl;
|
588
588
|
for (const auto& i : expression->elements()) {
|
589
|
-
debug_ast(
|
590
|
-
debug_ast(
|
589
|
+
debug_ast(i.first, ind + " key: ");
|
590
|
+
debug_ast(i.second, ind + " val: ");
|
591
591
|
}
|
592
|
-
} else if (
|
593
|
-
List_Ptr expression =
|
592
|
+
} else if (Cast<List>(node)) {
|
593
|
+
List_Ptr expression = Cast<List>(node);
|
594
594
|
std::cerr << ind << "List " << expression;
|
595
595
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
596
596
|
std::cerr << " (" << expression->length() << ") " <<
|
597
|
-
(expression->separator() == SASS_COMMA ? "Comma " : expression->separator() == SASS_HASH ? "Map" : "Space ") <<
|
597
|
+
(expression->separator() == SASS_COMMA ? "Comma " : expression->separator() == SASS_HASH ? "Map " : "Space ") <<
|
598
598
|
" [delayed: " << expression->is_delayed() << "] " <<
|
599
599
|
" [interpolant: " << expression->is_interpolant() << "] " <<
|
600
600
|
" [listized: " << expression->from_selector() << "] " <<
|
601
601
|
" [arglist: " << expression->is_arglist() << "] " <<
|
602
|
+
" [bracketed: " << expression->is_bracketed() << "] " <<
|
603
|
+
" [expanded: " << expression->is_expanded() << "] " <<
|
602
604
|
" [hash: " << expression->hash() << "] " <<
|
603
605
|
std::endl;
|
604
|
-
for(const auto& i : expression->elements()) { debug_ast(
|
605
|
-
} else if (
|
606
|
-
Content_Ptr expression =
|
606
|
+
for(const auto& i : expression->elements()) { debug_ast(i, ind + " ", env); }
|
607
|
+
} else if (Cast<Content>(node)) {
|
608
|
+
Content_Ptr expression = Cast<Content>(node);
|
607
609
|
std::cerr << ind << "Content " << expression;
|
608
610
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
609
611
|
std::cerr << " [@media:" << expression->media_block() << "]";
|
610
612
|
std::cerr << " [Statement]" << std::endl;
|
611
|
-
} else if (
|
612
|
-
Boolean_Ptr expression =
|
613
|
+
} else if (Cast<Boolean>(node)) {
|
614
|
+
Boolean_Ptr expression = Cast<Boolean>(node);
|
613
615
|
std::cerr << ind << "Boolean " << expression;
|
614
616
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
615
617
|
std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
|
616
618
|
std::cerr << " [" << expression->value() << "]" << std::endl;
|
617
|
-
} else if (
|
618
|
-
Color_Ptr expression =
|
619
|
+
} else if (Cast<Color>(node)) {
|
620
|
+
Color_Ptr expression = Cast<Color>(node);
|
619
621
|
std::cerr << ind << "Color " << expression;
|
620
622
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
621
623
|
std::cerr << " [delayed: " << expression->is_delayed() << "] ";
|
622
624
|
std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
|
623
625
|
std::cerr << " [" << expression->r() << ":" << expression->g() << ":" << expression->b() << "@" << expression->a() << "]" << std::endl;
|
624
|
-
} else if (
|
625
|
-
Number_Ptr expression =
|
626
|
+
} else if (Cast<Number>(node)) {
|
627
|
+
Number_Ptr expression = Cast<Number>(node);
|
626
628
|
std::cerr << ind << "Number " << expression;
|
627
629
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
630
|
+
std::cerr << " [delayed: " << expression->is_delayed() << "] ";
|
628
631
|
std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
|
629
632
|
std::cerr << " [" << expression->value() << expression->unit() << "]" <<
|
630
633
|
" [hash: " << expression->hash() << "] " <<
|
631
634
|
std::endl;
|
632
|
-
} else if (
|
633
|
-
Null_Ptr expression =
|
635
|
+
} else if (Cast<Null>(node)) {
|
636
|
+
Null_Ptr expression = Cast<Null>(node);
|
634
637
|
std::cerr << ind << "Null " << expression;
|
635
638
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
636
639
|
std::cerr << " [interpolant: " << expression->is_interpolant() << "] "
|
637
640
|
// " [hash: " << expression->hash() << "] "
|
638
641
|
<< std::endl;
|
639
|
-
} else if (
|
640
|
-
String_Quoted_Ptr expression =
|
642
|
+
} else if (Cast<String_Quoted>(node)) {
|
643
|
+
String_Quoted_Ptr expression = Cast<String_Quoted>(node);
|
641
644
|
std::cerr << ind << "String_Quoted " << expression;
|
642
645
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
643
646
|
std::cerr << " [" << prettyprint(expression->value()) << "]";
|
@@ -645,8 +648,8 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
645
648
|
if (expression->is_interpolant()) std::cerr << " [interpolant]";
|
646
649
|
if (expression->quote_mark()) std::cerr << " [quote_mark: " << expression->quote_mark() << "]";
|
647
650
|
std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl;
|
648
|
-
} else if (
|
649
|
-
String_Constant_Ptr expression =
|
651
|
+
} else if (Cast<String_Constant>(node)) {
|
652
|
+
String_Constant_Ptr expression = Cast<String_Constant>(node);
|
650
653
|
std::cerr << ind << "String_Constant " << expression;
|
651
654
|
if (expression->concrete_type()) {
|
652
655
|
std::cerr << " " << expression->concrete_type();
|
@@ -656,28 +659,29 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
656
659
|
if (expression->is_delayed()) std::cerr << " [delayed]";
|
657
660
|
if (expression->is_interpolant()) std::cerr << " [interpolant]";
|
658
661
|
std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl;
|
659
|
-
} else if (
|
660
|
-
String_Schema_Ptr expression =
|
662
|
+
} else if (Cast<String_Schema>(node)) {
|
663
|
+
String_Schema_Ptr expression = Cast<String_Schema>(node);
|
661
664
|
std::cerr << ind << "String_Schema " << expression;
|
662
665
|
std::cerr << " (" << pstate_source_position(expression) << ")";
|
663
666
|
std::cerr << " " << expression->concrete_type();
|
664
667
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
668
|
+
if (expression->css()) std::cerr << " [css]";
|
665
669
|
if (expression->is_delayed()) std::cerr << " [delayed]";
|
666
670
|
if (expression->is_interpolant()) std::cerr << " [is interpolant]";
|
667
671
|
if (expression->has_interpolant()) std::cerr << " [has interpolant]";
|
668
672
|
if (expression->is_left_interpolant()) std::cerr << " [left interpolant] ";
|
669
673
|
if (expression->is_right_interpolant()) std::cerr << " [right interpolant] ";
|
670
674
|
std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl;
|
671
|
-
for(const auto& i : expression->elements()) { debug_ast(
|
672
|
-
} else if (
|
673
|
-
String_Ptr expression =
|
675
|
+
for(const auto& i : expression->elements()) { debug_ast(i, ind + " ", env); }
|
676
|
+
} else if (Cast<String>(node)) {
|
677
|
+
String_Ptr expression = Cast<String>(node);
|
674
678
|
std::cerr << ind << "String " << expression;
|
675
679
|
std::cerr << " " << expression->concrete_type();
|
676
680
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
677
681
|
if (expression->is_interpolant()) std::cerr << " [interpolant]";
|
678
682
|
std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl;
|
679
|
-
} else if (
|
680
|
-
Expression_Ptr expression =
|
683
|
+
} else if (Cast<Expression>(node)) {
|
684
|
+
Expression_Ptr expression = Cast<Expression>(node);
|
681
685
|
std::cerr << ind << "Expression " << expression;
|
682
686
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
683
687
|
switch (expression->concrete_type()) {
|
@@ -694,16 +698,18 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
|
|
694
698
|
case Expression::Concrete_Type::C_ERROR: std::cerr << " [C_ERROR]"; break;
|
695
699
|
case Expression::Concrete_Type::FUNCTION: std::cerr << " [FUNCTION]"; break;
|
696
700
|
case Expression::Concrete_Type::NUM_TYPES: std::cerr << " [NUM_TYPES]"; break;
|
701
|
+
case Expression::Concrete_Type::VARIABLE: std::cerr << " [VARIABLE]"; break;
|
702
|
+
case Expression::Concrete_Type::FUNCTION_VAL: std::cerr << " [FUNCTION_VAL]"; break;
|
697
703
|
}
|
698
704
|
std::cerr << std::endl;
|
699
|
-
} else if (
|
700
|
-
Has_Block_Ptr has_block =
|
705
|
+
} else if (Cast<Has_Block>(node)) {
|
706
|
+
Has_Block_Ptr has_block = Cast<Has_Block>(node);
|
701
707
|
std::cerr << ind << "Has_Block " << has_block;
|
702
708
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
703
709
|
std::cerr << " " << has_block->tabs() << std::endl;
|
704
|
-
if (has_block->block()) for(const Statement_Obj& i : has_block->block()->elements()) { debug_ast(
|
705
|
-
} else if (
|
706
|
-
Statement_Ptr statement =
|
710
|
+
if (has_block->block()) for(const Statement_Obj& i : has_block->block()->elements()) { debug_ast(i, ind + " ", env); }
|
711
|
+
} else if (Cast<Statement>(node)) {
|
712
|
+
Statement_Ptr statement = Cast<Statement>(node);
|
707
713
|
std::cerr << ind << "Statement " << statement;
|
708
714
|
std::cerr << " (" << pstate_source_position(node) << ")";
|
709
715
|
std::cerr << " " << statement->tabs() << std::endl;
|
@@ -735,7 +741,7 @@ inline void debug_node(Node* node, std::string ind = "")
|
|
735
741
|
std::cerr << node << " ";
|
736
742
|
if (node->got_line_feed) std::cerr << "[LF] ";
|
737
743
|
std::cerr << std::endl;
|
738
|
-
debug_ast(
|
744
|
+
debug_ast(node->selector(), ind + " ");
|
739
745
|
} else if (node->isCollection()) {
|
740
746
|
std::cerr << ind;
|
741
747
|
std::cerr << "Collection ";
|
@@ -776,21 +782,18 @@ inline void debug_subset_map(Sass::Subset_Map& map, std::string ind = "")
|
|
776
782
|
{
|
777
783
|
if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
778
784
|
for(auto const &it : map.values()) {
|
779
|
-
debug_ast(
|
780
|
-
debug_ast(
|
785
|
+
debug_ast(it.first, ind + "first: ");
|
786
|
+
debug_ast(it.second, ind + "second: ");
|
781
787
|
}
|
782
788
|
if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
783
789
|
}
|
784
790
|
|
785
|
-
|
786
|
-
typedef std::vector<ExtensionPair> SubsetMapEntries;
|
787
|
-
|
788
|
-
inline void debug_subset_entries(SubsetMapEntries* entries, std::string ind = "")
|
791
|
+
inline void debug_subset_entries(SubSetMapPairs* entries, std::string ind = "")
|
789
792
|
{
|
790
793
|
if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
791
794
|
for(auto const &pair : *entries) {
|
792
|
-
debug_ast(
|
793
|
-
debug_ast(
|
795
|
+
debug_ast(pair.first, ind + "first: ");
|
796
|
+
debug_ast(pair.second, ind + "second: ");
|
794
797
|
}
|
795
798
|
if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
796
799
|
}
|