sassc 2.2.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/CHANGELOG.md +18 -0
  4. data/Rakefile +1 -3
  5. data/ext/extconf.rb +13 -5
  6. data/ext/libsass/VERSION +1 -1
  7. data/ext/libsass/include/sass/base.h +2 -1
  8. data/ext/libsass/include/sass/context.h +4 -0
  9. data/ext/libsass/src/MurmurHash2.hpp +91 -0
  10. data/ext/libsass/src/ast.cpp +158 -168
  11. data/ext/libsass/src/ast.hpp +389 -230
  12. data/ext/libsass/src/ast_def_macros.hpp +18 -10
  13. data/ext/libsass/src/ast_fwd_decl.cpp +4 -3
  14. data/ext/libsass/src/ast_fwd_decl.hpp +98 -165
  15. data/ext/libsass/src/ast_helpers.hpp +292 -0
  16. data/ext/libsass/src/ast_sel_cmp.cpp +219 -732
  17. data/ext/libsass/src/ast_sel_super.cpp +539 -0
  18. data/ext/libsass/src/ast_sel_unify.cpp +207 -212
  19. data/ext/libsass/src/ast_sel_weave.cpp +616 -0
  20. data/ext/libsass/src/ast_selectors.cpp +594 -1026
  21. data/ext/libsass/src/ast_selectors.hpp +339 -385
  22. data/ext/libsass/src/ast_supports.cpp +36 -52
  23. data/ext/libsass/src/ast_supports.hpp +29 -29
  24. data/ext/libsass/src/ast_values.cpp +271 -84
  25. data/ext/libsass/src/ast_values.hpp +116 -107
  26. data/ext/libsass/src/backtrace.cpp +9 -9
  27. data/ext/libsass/src/backtrace.hpp +5 -5
  28. data/ext/libsass/src/base64vlq.cpp +2 -2
  29. data/ext/libsass/src/base64vlq.hpp +1 -1
  30. data/ext/libsass/src/bind.cpp +18 -18
  31. data/ext/libsass/src/bind.hpp +1 -1
  32. data/ext/libsass/src/c2ast.cpp +3 -3
  33. data/ext/libsass/src/c2ast.hpp +1 -1
  34. data/ext/libsass/src/cencode.c +4 -6
  35. data/ext/libsass/src/check_nesting.cpp +40 -41
  36. data/ext/libsass/src/check_nesting.hpp +6 -2
  37. data/ext/libsass/src/color_maps.cpp +14 -13
  38. data/ext/libsass/src/color_maps.hpp +1 -9
  39. data/ext/libsass/src/constants.cpp +5 -0
  40. data/ext/libsass/src/constants.hpp +6 -0
  41. data/ext/libsass/src/context.cpp +92 -119
  42. data/ext/libsass/src/context.hpp +41 -53
  43. data/ext/libsass/src/cssize.cpp +66 -149
  44. data/ext/libsass/src/cssize.hpp +17 -23
  45. data/ext/libsass/src/dart_helpers.hpp +199 -0
  46. data/ext/libsass/src/debugger.hpp +451 -295
  47. data/ext/libsass/src/emitter.cpp +15 -16
  48. data/ext/libsass/src/emitter.hpp +10 -12
  49. data/ext/libsass/src/environment.cpp +27 -27
  50. data/ext/libsass/src/environment.hpp +29 -24
  51. data/ext/libsass/src/error_handling.cpp +62 -41
  52. data/ext/libsass/src/error_handling.hpp +61 -51
  53. data/ext/libsass/src/eval.cpp +167 -281
  54. data/ext/libsass/src/eval.hpp +27 -29
  55. data/ext/libsass/src/eval_selectors.cpp +75 -0
  56. data/ext/libsass/src/expand.cpp +275 -222
  57. data/ext/libsass/src/expand.hpp +36 -16
  58. data/ext/libsass/src/extender.cpp +1188 -0
  59. data/ext/libsass/src/extender.hpp +399 -0
  60. data/ext/libsass/src/extension.cpp +43 -0
  61. data/ext/libsass/src/extension.hpp +89 -0
  62. data/ext/libsass/src/file.cpp +81 -72
  63. data/ext/libsass/src/file.hpp +28 -37
  64. data/ext/libsass/src/fn_colors.cpp +20 -18
  65. data/ext/libsass/src/fn_lists.cpp +30 -29
  66. data/ext/libsass/src/fn_maps.cpp +3 -3
  67. data/ext/libsass/src/fn_miscs.cpp +34 -46
  68. data/ext/libsass/src/fn_numbers.cpp +20 -13
  69. data/ext/libsass/src/fn_selectors.cpp +98 -128
  70. data/ext/libsass/src/fn_strings.cpp +47 -33
  71. data/ext/libsass/src/fn_utils.cpp +31 -29
  72. data/ext/libsass/src/fn_utils.hpp +17 -11
  73. data/ext/libsass/src/inspect.cpp +186 -148
  74. data/ext/libsass/src/inspect.hpp +31 -29
  75. data/ext/libsass/src/lexer.cpp +20 -82
  76. data/ext/libsass/src/lexer.hpp +5 -16
  77. data/ext/libsass/src/listize.cpp +23 -37
  78. data/ext/libsass/src/listize.hpp +8 -9
  79. data/ext/libsass/src/mapping.hpp +1 -0
  80. data/ext/libsass/src/memory/allocator.cpp +48 -0
  81. data/ext/libsass/src/memory/allocator.hpp +138 -0
  82. data/ext/libsass/src/memory/config.hpp +20 -0
  83. data/ext/libsass/src/memory/memory_pool.hpp +186 -0
  84. data/ext/libsass/src/memory/{SharedPtr.cpp → shared_ptr.cpp} +2 -2
  85. data/ext/libsass/src/memory/{SharedPtr.hpp → shared_ptr.hpp} +55 -9
  86. data/ext/libsass/src/memory.hpp +12 -0
  87. data/ext/libsass/src/operation.hpp +71 -61
  88. data/ext/libsass/src/operators.cpp +19 -18
  89. data/ext/libsass/src/operators.hpp +11 -11
  90. data/ext/libsass/src/ordered_map.hpp +112 -0
  91. data/ext/libsass/src/output.cpp +45 -64
  92. data/ext/libsass/src/output.hpp +6 -6
  93. data/ext/libsass/src/parser.cpp +512 -700
  94. data/ext/libsass/src/parser.hpp +89 -97
  95. data/ext/libsass/src/parser_selectors.cpp +189 -0
  96. data/ext/libsass/src/permutate.hpp +164 -0
  97. data/ext/libsass/src/plugins.cpp +7 -7
  98. data/ext/libsass/src/plugins.hpp +8 -8
  99. data/ext/libsass/src/position.cpp +7 -26
  100. data/ext/libsass/src/position.hpp +44 -21
  101. data/ext/libsass/src/prelexer.cpp +6 -6
  102. data/ext/libsass/src/remove_placeholders.cpp +55 -56
  103. data/ext/libsass/src/remove_placeholders.hpp +21 -18
  104. data/ext/libsass/src/sass.cpp +16 -15
  105. data/ext/libsass/src/sass.hpp +10 -5
  106. data/ext/libsass/src/sass2scss.cpp +4 -4
  107. data/ext/libsass/src/sass_context.cpp +91 -122
  108. data/ext/libsass/src/sass_context.hpp +2 -2
  109. data/ext/libsass/src/sass_functions.cpp +1 -1
  110. data/ext/libsass/src/sass_values.cpp +8 -11
  111. data/ext/libsass/src/settings.hpp +19 -0
  112. data/ext/libsass/src/source.cpp +69 -0
  113. data/ext/libsass/src/source.hpp +95 -0
  114. data/ext/libsass/src/source_data.hpp +32 -0
  115. data/ext/libsass/src/source_map.cpp +22 -18
  116. data/ext/libsass/src/source_map.hpp +12 -9
  117. data/ext/libsass/src/stylesheet.cpp +22 -0
  118. data/ext/libsass/src/stylesheet.hpp +57 -0
  119. data/ext/libsass/src/to_value.cpp +2 -2
  120. data/ext/libsass/src/to_value.hpp +1 -1
  121. data/ext/libsass/src/units.cpp +24 -22
  122. data/ext/libsass/src/units.hpp +8 -8
  123. data/ext/libsass/src/utf8_string.cpp +9 -10
  124. data/ext/libsass/src/utf8_string.hpp +7 -6
  125. data/ext/libsass/src/util.cpp +48 -50
  126. data/ext/libsass/src/util.hpp +20 -21
  127. data/ext/libsass/src/util_string.cpp +111 -61
  128. data/ext/libsass/src/util_string.hpp +62 -8
  129. data/ext/libsass/src/values.cpp +12 -12
  130. data/lib/sassc/engine.rb +5 -3
  131. data/lib/sassc/functions_handler.rb +8 -8
  132. data/lib/sassc/native.rb +4 -6
  133. data/lib/sassc/script.rb +4 -4
  134. data/lib/sassc/version.rb +1 -1
  135. data/test/functions_test.rb +18 -1
  136. data/test/native_test.rb +4 -4
  137. metadata +29 -15
  138. data/ext/libsass/src/extend.cpp +0 -2132
  139. data/ext/libsass/src/extend.hpp +0 -86
  140. data/ext/libsass/src/node.cpp +0 -322
  141. data/ext/libsass/src/node.hpp +0 -118
  142. data/ext/libsass/src/paths.hpp +0 -71
  143. data/ext/libsass/src/sass_util.cpp +0 -152
  144. data/ext/libsass/src/sass_util.hpp +0 -256
  145. data/ext/libsass/src/subset_map.cpp +0 -58
  146. data/ext/libsass/src/subset_map.hpp +0 -76
  147. data/lib/sassc/native/lib_c.rb +0 -21
@@ -1,33 +1,292 @@
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 "node.hpp"
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
- inline void debug_ast(AST_Node* node, std::string ind = "", Env* env = 0);
20
+ inline void debug_ast(AST_Node* node, sass::string ind = "", Env* env = 0);
12
21
 
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);
22
+ inline sass::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 void debug_sources_set(ComplexSelectorSet& set, std::string ind = "")
18
- {
19
- if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
20
- for(auto const &pair : set) {
21
- debug_ast(pair, ind + "");
22
- // debug_ast(set[pair], ind + "first: ");
27
+ inline sass::string debug_dude(sass::vector<sass::vector<int>> vec) {
28
+ sass::sstream 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 sass::string debug_vec(sass::string& str) {
48
+ return str;
49
+ }
50
+
51
+ inline sass::string debug_vec(Extension& ext) {
52
+ sass::sstream 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 sass::string debug_vec(sass::vector<T> vec) {
65
+ sass::sstream 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 sass::string debug_vec(std::queue<T> vec) {
77
+ sass::sstream 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 sass::string debug_vec(std::map<T, U, O> vec) {
89
+ sass::sstream 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 sass::string debug_vec(const ordered_map<T, U, O, V>& vec) {
106
+ sass::sstream 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 sass::string debug_vec(std::unordered_map<T, U, O, V> vec) {
122
+ sass::sstream 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 sass::string debug_keys(std::unordered_map<T, U, O, V> vec) {
139
+ sass::sstream 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;
147
+ }
148
+ out << "}";
149
+ return out.str();
150
+ }
151
+
152
+ inline sass::string debug_vec(ExtListSelSet& vec) {
153
+ sass::sstream 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 sass::string debug_values(tsl::ordered_map<T, U, O, V> vec) {
169
+ sass::sstream 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 sass::string debug_vec(tsl::ordered_map<T, U, O, V> vec) {
184
+ sass::sstream 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 sass::string debug_vals(tsl::ordered_map<T, U, O, V> vec) {
201
+ sass::sstream 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 sass::string debug_keys(tsl::ordered_map<T, U, O, V> vec) {
216
+ sass::sstream 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 sass::string debug_vec(std::set<T, U> vec) {
232
+ sass::sstream 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 sass::string debug_vec(tsl::ordered_set<T, U, O, V> vec) {
247
+ sass::sstream 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 sass::string debug_vec(std::unordered_set<T, U, O, V> vec) {
262
+ sass::sstream out;
263
+ out << "{";
264
+ bool joinit = false;
265
+ for (auto item : vec) {
266
+ if (joinit) out << ", ";
267
+ out << debug_vec(item);
268
+ joinit = true;
23
269
  }
24
- if (ind == "") std::cerr << "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
270
+ out << "}";
271
+ return out.str();
25
272
  }
26
273
 
27
- inline std::string str_replace(std::string str, const std::string& oldStr, const std::string& newStr)
274
+ inline sass::string debug_bool(bool val) {
275
+ return val ? "true" : "false";
276
+ }
277
+ inline sass::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, sass::string ind = "", Env* env = 0) {
283
+ debug_ast(const_cast<AST_Node*>(node), ind, env);
284
+ }
285
+
286
+ inline sass::string str_replace(sass::string str, const sass::string& oldStr, const sass::string& newStr)
28
287
  {
29
288
  size_t pos = 0;
30
- while((pos = str.find(oldStr, pos)) != std::string::npos)
289
+ while((pos = str.find(oldStr, pos)) != sass::string::npos)
31
290
  {
32
291
  str.replace(pos, oldStr.length(), newStr);
33
292
  pos += newStr.length();
@@ -35,25 +294,26 @@ inline std::string str_replace(std::string str, const std::string& oldStr, const
35
294
  return str;
36
295
  }
37
296
 
38
- inline std::string prettyprint(const std::string& str) {
39
- std::string clean = str_replace(str, "\n", "\\n");
297
+ inline sass::string prettyprint(const sass::string& str) {
298
+ sass::string clean = str_replace(str, "\n", "\\n");
40
299
  clean = str_replace(clean, " ", "\\t");
41
300
  clean = str_replace(clean, "\r", "\\r");
42
301
  return clean;
43
302
  }
44
303
 
45
- inline std::string longToHex(long long t) {
46
- std::stringstream is;
304
+ inline sass::string longToHex(long long t) {
305
+ sass::sstream is;
47
306
  is << std::hex << t;
48
307
  return is.str();
49
308
  }
50
309
 
51
- inline std::string pstate_source_position(AST_Node* node)
310
+ inline sass::string pstate_source_position(AST_Node* node)
52
311
  {
53
- std::stringstream str;
54
- Position start(node->pstate());
55
- Position end(start + node->pstate().offset);
56
- str << (start.file == std::string::npos ? -1 : start.file)
312
+ sass::sstream str;
313
+ Offset start(node->pstate().position);
314
+ Offset end(start + node->pstate().offset);
315
+ size_t file = node->pstate().getSrcId();
316
+ str << (file == sass::string::npos ? 99999999 : file)
57
317
  << "@[" << start.line << ":" << start.column << "]"
58
318
  << "-[" << end.line << ":" << end.column << "]";
59
319
  #ifdef DEBUG_SHARED_PTR
@@ -64,7 +324,7 @@ inline std::string pstate_source_position(AST_Node* node)
64
324
  return str.str();
65
325
  }
66
326
 
67
- inline void debug_ast(AST_Node* node, std::string ind, Env* env)
327
+ inline void debug_ast(AST_Node* node, sass::string ind, Env* env)
68
328
  {
69
329
  if (node == 0) return;
70
330
  if (ind == "") std::cerr << "####################################################################\n";
@@ -82,194 +342,144 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
82
342
  << " [name:" << trace->name() << ", type: " << trace->type() << "]"
83
343
  << std::endl;
84
344
  debug_ast(trace->block(), ind + " ", env);
85
- } else if (Cast<At_Root_Block>(node)) {
86
- At_Root_Block* root_block = Cast<At_Root_Block>(node);
87
- std::cerr << ind << "At_Root_Block " << root_block;
345
+ } else if (Cast<AtRootRule>(node)) {
346
+ AtRootRule* root_block = Cast<AtRootRule>(node);
347
+ std::cerr << ind << "AtRootRule " << root_block;
88
348
  std::cerr << " (" << pstate_source_position(node) << ")";
89
349
  std::cerr << " " << root_block->tabs();
90
350
  std::cerr << std::endl;
91
351
  debug_ast(root_block->expression(), ind + ":", env);
92
352
  debug_ast(root_block->block(), ind + " ", env);
93
- } else if (Cast<Selector_List>(node)) {
94
- Selector_List* selector = Cast<Selector_List>(node);
95
- std::cerr << ind << "Selector_List " << selector;
353
+ } else if (Cast<SelectorList>(node)) {
354
+ SelectorList* selector = Cast<SelectorList>(node);
355
+ std::cerr << ind << "SelectorList " << selector;
96
356
  std::cerr << " (" << pstate_source_position(node) << ")";
97
357
  std::cerr << " <" << selector->hash() << ">";
98
- std::cerr << " [@media:" << selector->media_block() << "]";
99
- std::cerr << (selector->is_invisible() ? " [INVISIBLE]": " -");
100
- std::cerr << (selector->has_placeholder() ? " [PLACEHOLDER]": " -");
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]": " -");
358
+ std::cerr << (selector->is_invisible() ? " [is_invisible]" : " -");
359
+ std::cerr << (selector->isInvisible() ? " [isInvisible]" : " -");
360
+ std::cerr << (selector->has_real_parent_ref() ? " [real-parent]": " -");
105
361
  std::cerr << std::endl;
106
- debug_ast(selector->schema(), ind + "#{} ");
107
362
 
108
- for(const Complex_Selector_Obj& i : selector->elements()) { debug_ast(i, ind + " ", env); }
363
+ for(const ComplexSelector_Obj& i : selector->elements()) { debug_ast(i, ind + " ", env); }
109
364
 
110
- // } else if (Cast<Expression>(node)) {
111
- // Expression* expression = Cast<Expression>(node);
112
- // std::cerr << ind << "Expression " << expression << " " << expression->concrete_type() << std::endl;
365
+ } else if (Cast<ComplexSelector>(node)) {
366
+ ComplexSelector* selector = Cast<ComplexSelector>(node);
367
+ std::cerr << ind << "ComplexSelector " << selector
368
+ << " (" << pstate_source_position(node) << ")"
369
+ << " <" << selector->hash() << ">"
370
+ << " [" << (selector->chroots() ? "CHROOT" : "CONNECT") << "]"
371
+ << " [length:" << longToHex(selector->length()) << "]"
372
+ << " [weight:" << longToHex(selector->specificity()) << "]"
373
+ << (selector->is_invisible() ? " [is_invisible]" : " -")
374
+ << (selector->isInvisible() ? " [isInvisible]" : " -")
375
+ << (selector->hasPreLineFeed() ? " [hasPreLineFeed]" : " -")
113
376
 
114
- } else if (Cast<Parent_Reference>(node)) {
115
- Parent_Reference* selector = Cast<Parent_Reference>(node);
116
- std::cerr << ind << "Parent_Reference " << selector;
117
- // if (selector->not_selector()) cerr << " [in_declaration]";
118
- std::cerr << " (" << pstate_source_position(node) << ")";
119
- std::cerr << " <" << selector->hash() << ">";
120
- std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << std::endl;
121
- // debug_ast(selector->selector(), ind + "->", env);
377
+ // << (selector->is_invisible() ? " [INVISIBLE]": " -")
378
+ // << (selector->has_placeholder() ? " [PLACEHOLDER]": " -")
379
+ // << (selector->is_optional() ? " [is_optional]": " -")
380
+ << (selector->has_real_parent_ref() ? " [real parent]": " -")
381
+ // << (selector->has_line_feed() ? " [line-feed]": " -")
382
+ // << (selector->has_line_break() ? " [line-break]": " -")
383
+ << " -- \n";
122
384
 
123
- } else if (Cast<Parent_Selector>(node)) {
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);
385
+ for(const SelectorComponentObj& i : selector->elements()) { debug_ast(i, ind + " ", env); }
132
386
 
133
- } else if (Cast<Complex_Selector>(node)) {
134
- Complex_Selector* selector = Cast<Complex_Selector>(node);
135
- std::cerr << ind << "Complex_Selector " << selector
387
+ } else if (Cast<SelectorCombinator>(node)) {
388
+ SelectorCombinator* selector = Cast<SelectorCombinator>(node);
389
+ std::cerr << ind << "SelectorCombinator " << selector
136
390
  << " (" << pstate_source_position(node) << ")"
137
391
  << " <" << selector->hash() << ">"
138
- << " [length:" << longToHex(selector->length()) << "]"
139
392
  << " [weight:" << longToHex(selector->specificity()) << "]"
140
- << " [@media:" << selector->media_block() << "]"
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]": " -")
393
+ << (selector->has_real_parent_ref() ? " [real parent]": " -")
147
394
  << " -- ";
148
- std::string del;
395
+
396
+ sass::string del;
149
397
  switch (selector->combinator()) {
150
- case Complex_Selector::PARENT_OF: del = ">"; break;
151
- case Complex_Selector::PRECEDES: del = "~"; break;
152
- case Complex_Selector::ADJACENT_TO: del = "+"; break;
153
- case Complex_Selector::ANCESTOR_OF: del = " "; break;
154
- case Complex_Selector::REFERENCE: del = "//"; break;
398
+ case SelectorCombinator::CHILD: del = ">"; break;
399
+ case SelectorCombinator::GENERAL: del = "~"; break;
400
+ case SelectorCombinator::ADJACENT: del = "+"; break;
155
401
  }
156
- // if (del = "/") del += selector->reference()->perform(&to_string) + "/";
157
- std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << std::endl;
158
- debug_ast(selector->head(), ind + " " /* + "[" + del + "]" */, env);
159
- if (selector->tail()) {
160
- debug_ast(selector->tail(), ind + "{" + del + "}", env);
161
- } else if(del != " ") {
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;
402
+
403
+ std::cerr << "[" << del << "]" << "\n";
404
+
405
+ } else if (Cast<CompoundSelector>(node)) {
406
+ CompoundSelector* selector = Cast<CompoundSelector>(node);
407
+ std::cerr << ind << "CompoundSelector " << selector;
169
408
  std::cerr << " (" << pstate_source_position(node) << ")";
170
409
  std::cerr << " <" << selector->hash() << ">";
410
+ std::cerr << (selector->hasRealParent() ? " [REAL PARENT]" : "") << ">";
171
411
  std::cerr << " [weight:" << longToHex(selector->specificity()) << "]";
172
- std::cerr << " [@media:" << selector->media_block() << "]";
173
- std::cerr << (selector->extended() ? " [extended]": " -");
174
- std::cerr << (selector->is_optional() ? " [is_optional]": " -");
175
- std::cerr << (selector->has_parent_ref() ? " [has-parent]": " -");
176
- std::cerr << (selector->has_line_break() ? " [line-break]": " -");
177
- std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
178
- std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << std::endl;
179
- for(const Simple_Selector_Obj& i : selector->elements()) { debug_ast(i, ind + " ", env); }
180
- } else if (Cast<Wrapped_Selector>(node)) {
181
- Wrapped_Selector* selector = Cast<Wrapped_Selector>(node);
182
- std::cerr << ind << "Wrapped_Selector " << selector;
412
+ std::cerr << (selector->hasPostLineBreak() ? " [hasPostLineBreak]" : " -");
413
+ std::cerr << (selector->is_invisible() ? " [is_invisible]" : " -");
414
+ std::cerr << (selector->isInvisible() ? " [isInvisible]" : " -");
415
+ std::cerr << "\n";
416
+ for(const SimpleSelector_Obj& i : selector->elements()) { debug_ast(i, ind + " ", env); }
417
+
418
+ } else if (Cast<Parent_Reference>(node)) {
419
+ Parent_Reference* selector = Cast<Parent_Reference>(node);
420
+ std::cerr << ind << "Parent_Reference " << selector;
183
421
  std::cerr << " (" << pstate_source_position(node) << ")";
184
422
  std::cerr << " <" << selector->hash() << ">";
185
- std::cerr << " <<" << selector->ns_name() << ">>";
186
- std::cerr << (selector->is_optional() ? " [is_optional]": " -");
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
423
  std::cerr << std::endl;
191
- debug_ast(selector->selector(), ind + " () ", env);
192
- } else if (Cast<Pseudo_Selector>(node)) {
193
- Pseudo_Selector* selector = Cast<Pseudo_Selector>(node);
194
- std::cerr << ind << "Pseudo_Selector " << selector;
424
+
425
+ } else if (Cast<PseudoSelector>(node)) {
426
+ PseudoSelector* selector = Cast<PseudoSelector>(node);
427
+ std::cerr << ind << "PseudoSelector " << selector;
195
428
  std::cerr << " (" << pstate_source_position(node) << ")";
196
429
  std::cerr << " <" << selector->hash() << ">";
197
430
  std::cerr << " <<" << selector->ns_name() << ">>";
198
- std::cerr << (selector->is_optional() ? " [is_optional]": " -");
199
- std::cerr << (selector->has_parent_ref() ? " [has-parent]": " -");
200
- std::cerr << (selector->has_line_break() ? " [line-break]": " -");
201
- std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
431
+ std::cerr << (selector->isClass() ? " [isClass]": " -");
432
+ std::cerr << (selector->isSyntacticClass() ? " [isSyntacticClass]": " -");
202
433
  std::cerr << std::endl;
203
- debug_ast(selector->expression(), ind + " <= ", env);
204
- } else if (Cast<Attribute_Selector>(node)) {
205
- Attribute_Selector* selector = Cast<Attribute_Selector>(node);
206
- std::cerr << ind << "Attribute_Selector " << selector;
434
+ debug_ast(selector->argument(), ind + " <= ", env);
435
+ debug_ast(selector->selector(), ind + " || ", env);
436
+ } else if (Cast<AttributeSelector>(node)) {
437
+ AttributeSelector* selector = Cast<AttributeSelector>(node);
438
+ std::cerr << ind << "AttributeSelector " << selector;
207
439
  std::cerr << " (" << pstate_source_position(node) << ")";
208
440
  std::cerr << " <" << selector->hash() << ">";
209
441
  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
442
  std::cerr << std::endl;
215
443
  debug_ast(selector->value(), ind + "[" + selector->matcher() + "] ", env);
216
- } else if (Cast<Class_Selector>(node)) {
217
- Class_Selector* selector = Cast<Class_Selector>(node);
218
- std::cerr << ind << "Class_Selector " << selector;
444
+ } else if (Cast<ClassSelector>(node)) {
445
+ ClassSelector* selector = Cast<ClassSelector>(node);
446
+ std::cerr << ind << "ClassSelector " << selector;
219
447
  std::cerr << " (" << pstate_source_position(node) << ")";
220
448
  std::cerr << " <" << selector->hash() << ">";
221
449
  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
450
  std::cerr << std::endl;
227
- } else if (Cast<Id_Selector>(node)) {
228
- Id_Selector* selector = Cast<Id_Selector>(node);
229
- std::cerr << ind << "Id_Selector " << selector;
451
+ } else if (Cast<IDSelector>(node)) {
452
+ IDSelector* selector = Cast<IDSelector>(node);
453
+ std::cerr << ind << "IDSelector " << selector;
230
454
  std::cerr << " (" << pstate_source_position(node) << ")";
231
455
  std::cerr << " <" << selector->hash() << ">";
232
456
  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
457
  std::cerr << std::endl;
238
- } else if (Cast<Type_Selector>(node)) {
239
- Type_Selector* selector = Cast<Type_Selector>(node);
240
- std::cerr << ind << "Type_Selector " << selector;
458
+ } else if (Cast<TypeSelector>(node)) {
459
+ TypeSelector* selector = Cast<TypeSelector>(node);
460
+ std::cerr << ind << "TypeSelector " << selector;
241
461
  std::cerr << " (" << pstate_source_position(node) << ")";
242
462
  std::cerr << " <" << selector->hash() << ">";
243
463
  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
- std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">";
249
464
  std::cerr << std::endl;
250
- } else if (Cast<Placeholder_Selector>(node)) {
465
+ } else if (Cast<PlaceholderSelector>(node)) {
251
466
 
252
- Placeholder_Selector* selector = Cast<Placeholder_Selector>(node);
253
- std::cerr << ind << "Placeholder_Selector [" << selector->ns_name() << "] " << selector;
467
+ PlaceholderSelector* selector = Cast<PlaceholderSelector>(node);
468
+ std::cerr << ind << "PlaceholderSelector [" << selector->ns_name() << "] " << selector;
254
469
  std::cerr << " (" << pstate_source_position(selector) << ")"
255
470
  << " <" << selector->hash() << ">"
256
- << " [@media:" << selector->media_block() << "]"
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<Simple_Selector>(node)) {
263
- Simple_Selector* selector = Cast<Simple_Selector>(node);
264
- std::cerr << ind << "Simple_Selector " << selector;
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,31 +510,50 @@ 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
- } else if (Cast<Media_Block>(node)) {
307
- Media_Block* block = Cast<Media_Block>(node);
308
- std::cerr << ind << "Media_Block " << block;
309
- std::cerr << " (" << pstate_source_position(node) << ")";
310
- std::cerr << " " << block->tabs() << std::endl;
311
- debug_ast(block->media_queries(), ind + " =@ ");
312
- if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
313
- } else if (Cast<Supports_Block>(node)) {
314
- Supports_Block* block = Cast<Supports_Block>(node);
315
- std::cerr << ind << "Supports_Block " << block;
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;
540
+ } else if (Cast<SupportsRule>(node)) {
541
+ SupportsRule* block = Cast<SupportsRule>(node);
542
+ std::cerr << ind << "SupportsRule " << block;
316
543
  std::cerr << " (" << pstate_source_position(node) << ")";
317
544
  std::cerr << " " << block->tabs() << std::endl;
318
545
  debug_ast(block->condition(), ind + " =@ ");
319
546
  debug_ast(block->block(), ind + " <>");
320
- } else if (Cast<Supports_Operator>(node)) {
321
- Supports_Operator* block = Cast<Supports_Operator>(node);
322
- std::cerr << ind << "Supports_Operator " << block;
547
+ } else if (Cast<SupportsOperation>(node)) {
548
+ SupportsOperation* block = Cast<SupportsOperation>(node);
549
+ std::cerr << ind << "SupportsOperation " << block;
323
550
  std::cerr << " (" << pstate_source_position(node) << ")"
324
551
  << std::endl;
325
552
  debug_ast(block->left(), ind + " left) ");
326
553
  debug_ast(block->right(), ind + " right) ");
327
- } else if (Cast<Supports_Negation>(node)) {
328
- Supports_Negation* block = Cast<Supports_Negation>(node);
329
- std::cerr << ind << "Supports_Negation " << block;
554
+ } else if (Cast<SupportsNegation>(node)) {
555
+ SupportsNegation* block = Cast<SupportsNegation>(node);
556
+ std::cerr << ind << "SupportsNegation " << block;
330
557
  std::cerr << " (" << pstate_source_position(node) << ")"
331
558
  << std::endl;
332
559
  debug_ast(block->condition(), ind + " condition) ");
@@ -337,9 +564,9 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
337
564
  << std::endl;
338
565
  debug_ast(block->feature(), ind + " feature) ");
339
566
  debug_ast(block->value(), ind + " value) ");
340
- } else if (Cast<Supports_Declaration>(node)) {
341
- Supports_Declaration* block = Cast<Supports_Declaration>(node);
342
- std::cerr << ind << "Supports_Declaration " << block;
567
+ } else if (Cast<SupportsDeclaration>(node)) {
568
+ SupportsDeclaration* block = Cast<SupportsDeclaration>(node);
569
+ std::cerr << ind << "SupportsDeclaration " << block;
343
570
  std::cerr << " (" << pstate_source_position(node) << ")"
344
571
  << std::endl;
345
572
  debug_ast(block->feature(), ind + " feature) ");
@@ -349,22 +576,23 @@ 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
- } else if (Cast<Warning>(node)) {
355
- Warning* block = Cast<Warning>(node);
356
- std::cerr << ind << "Warning " << block;
582
+ } else if (Cast<WarningRule>(node)) {
583
+ WarningRule* block = Cast<WarningRule>(node);
584
+ std::cerr << ind << "WarningRule " << block;
357
585
  std::cerr << " (" << pstate_source_position(node) << ")";
358
586
  std::cerr << " " << block->tabs() << std::endl;
359
587
  debug_ast(block->message(), ind + " : ");
360
- } else if (Cast<Error>(node)) {
361
- Error* block = Cast<Error>(node);
362
- std::cerr << ind << "Error " << block;
588
+ } else if (Cast<ErrorRule>(node)) {
589
+ ErrorRule* block = Cast<ErrorRule>(node);
590
+ std::cerr << ind << "ErrorRule " << block;
363
591
  std::cerr << " (" << pstate_source_position(node) << ")";
364
592
  std::cerr << " " << block->tabs() << std::endl;
365
- } else if (Cast<Debug>(node)) {
366
- Debug* block = Cast<Debug>(node);
367
- std::cerr << ind << "Debug " << block;
593
+ } else if (Cast<DebugRule>(node)) {
594
+ DebugRule* block = Cast<DebugRule>(node);
595
+ std::cerr << ind << "DebugRule " << block;
368
596
  std::cerr << " (" << pstate_source_position(node) << ")";
369
597
  std::cerr << " " << block->tabs() << std::endl;
370
598
  debug_ast(block->value(), ind + " ");
@@ -372,8 +600,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
372
600
  Comment* block = Cast<Comment>(node);
373
601
  std::cerr << ind << "Comment " << block;
374
602
  std::cerr << " (" << pstate_source_position(node) << ")";
375
- std::cerr << " " << block->tabs() <<
376
- " <" << prettyprint(block->pstate().token.ws_before()) << ">" << std::endl;
603
+ std::cerr << " " << block->tabs() << std::endl;
377
604
  debug_ast(block->text(), ind + "// ", env);
378
605
  } else if (Cast<If>(node)) {
379
606
  If* block = Cast<If>(node);
@@ -387,10 +614,11 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
387
614
  Return* block = Cast<Return>(node);
388
615
  std::cerr << ind << "Return " << block;
389
616
  std::cerr << " (" << pstate_source_position(node) << ")";
390
- std::cerr << " " << block->tabs() << std::endl;
391
- } else if (Cast<Extension>(node)) {
392
- Extension* block = Cast<Extension>(node);
393
- std::cerr << ind << "Extension " << block;
617
+ std::cerr << " " << block->tabs();
618
+ std::cerr << " [" << block->value()->to_string() << "]" << std::endl;
619
+ } else if (Cast<ExtendRule>(node)) {
620
+ ExtendRule* block = Cast<ExtendRule>(node);
621
+ std::cerr << ind << "ExtendRule " << block;
394
622
  std::cerr << " (" << pstate_source_position(node) << ")";
395
623
  std::cerr << " " << block->tabs() << std::endl;
396
624
  debug_ast(block->selector(), ind + "-> ", env);
@@ -411,7 +639,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
411
639
  std::cerr << ind << "Import " << block;
412
640
  std::cerr << " (" << pstate_source_position(node) << ")";
413
641
  std::cerr << " " << block->tabs() << std::endl;
414
- // std::vector<std::string> files_;
642
+ // sass::vector<sass::string> files_;
415
643
  for (auto imp : block->urls()) debug_ast(imp, ind + "@: ", env);
416
644
  debug_ast(block->import_queries(), ind + "@@ ");
417
645
  } else if (Cast<Assignment>(node)) {
@@ -430,35 +658,35 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
430
658
  debug_ast(block->value(), ind + " value: ", env);
431
659
  debug_ast(block->block(), ind + " ", env);
432
660
  } else if (Cast<Keyframe_Rule>(node)) {
433
- Keyframe_Rule* has_block = Cast<Keyframe_Rule>(node);
434
- std::cerr << ind << "Keyframe_Rule " << has_block;
661
+ Keyframe_Rule* ParentStatement = Cast<Keyframe_Rule>(node);
662
+ std::cerr << ind << "Keyframe_Rule " << ParentStatement;
435
663
  std::cerr << " (" << pstate_source_position(node) << ")";
436
- std::cerr << " " << has_block->tabs() << std::endl;
437
- if (has_block->name()) debug_ast(has_block->name(), ind + "@");
438
- if (has_block->block()) for(const Statement_Obj& i : has_block->block()->elements()) { debug_ast(i, ind + " ", env); }
439
- } else if (Cast<Directive>(node)) {
440
- Directive* block = Cast<Directive>(node);
441
- std::cerr << ind << "Directive " << block;
664
+ std::cerr << " " << ParentStatement->tabs() << std::endl;
665
+ if (ParentStatement->name()) debug_ast(ParentStatement->name(), ind + "@");
666
+ if (ParentStatement->block()) for(const Statement_Obj& i : ParentStatement->block()->elements()) { debug_ast(i, ind + " ", env); }
667
+ } else if (Cast<AtRule>(node)) {
668
+ AtRule* block = Cast<AtRule>(node);
669
+ std::cerr << ind << "AtRule " << block;
442
670
  std::cerr << " (" << pstate_source_position(node) << ")";
443
671
  std::cerr << " [" << block->keyword() << "] " << block->tabs() << std::endl;
444
672
  debug_ast(block->selector(), ind + "~", env);
445
673
  debug_ast(block->value(), ind + "+", env);
446
674
  if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
447
- } else if (Cast<Each>(node)) {
448
- Each* block = Cast<Each>(node);
449
- std::cerr << ind << "Each " << block;
675
+ } else if (Cast<EachRule>(node)) {
676
+ EachRule* block = Cast<EachRule>(node);
677
+ std::cerr << ind << "EachRule " << block;
450
678
  std::cerr << " (" << pstate_source_position(node) << ")";
451
679
  std::cerr << " " << block->tabs() << std::endl;
452
680
  if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
453
- } else if (Cast<For>(node)) {
454
- For* block = Cast<For>(node);
455
- std::cerr << ind << "For " << block;
681
+ } else if (Cast<ForRule>(node)) {
682
+ ForRule* block = Cast<ForRule>(node);
683
+ std::cerr << ind << "ForRule " << block;
456
684
  std::cerr << " (" << pstate_source_position(node) << ")";
457
685
  std::cerr << " " << block->tabs() << std::endl;
458
686
  if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
459
- } else if (Cast<While>(node)) {
460
- While* block = Cast<While>(node);
461
- std::cerr << ind << "While " << block;
687
+ } else if (Cast<WhileRule>(node)) {
688
+ WhileRule* block = Cast<WhileRule>(node);
689
+ std::cerr << ind << "WhileRule " << block;
462
690
  std::cerr << " (" << pstate_source_position(node) << ")";
463
691
  std::cerr << " " << block->tabs() << std::endl;
464
692
  if (block->block()) for(const Statement_Obj& i : block->block()->elements()) { debug_ast(i, ind + " ", env); }
@@ -483,8 +711,8 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
483
711
  debug_ast(block->arguments(), ind + " args: ", env);
484
712
  debug_ast(block->block_parameters(), ind + " block_params: ", env);
485
713
  if (block->block()) debug_ast(block->block(), ind + " ", env);
486
- } else if (Ruleset* ruleset = Cast<Ruleset>(node)) {
487
- std::cerr << ind << "Ruleset " << ruleset;
714
+ } else if (StyleRule* ruleset = Cast<StyleRule>(node)) {
715
+ std::cerr << ind << "StyleRule " << ruleset;
488
716
  std::cerr << " (" << pstate_source_position(node) << ")";
489
717
  std::cerr << " [indent: " << ruleset->tabs() << "]";
490
718
  std::cerr << (ruleset->is_invisible() ? " [INVISIBLE]" : "");
@@ -505,7 +733,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
505
733
  std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
506
734
  std::cerr << " (" << pstate_source_position(node) << ")";
507
735
  std::cerr << " [" << expression->name() << "]" << std::endl;
508
- std::string name(expression->name());
736
+ sass::string name(expression->name());
509
737
  if (env && env->has(name)) debug_ast(Cast<Expression>((*env)[name]), ind + " -> ", env);
510
738
  } else if (Cast<Function_Call>(node)) {
511
739
  Function_Call* expression = Cast<Function_Call>(node);
@@ -652,7 +880,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
652
880
  if (expression->is_delayed()) std::cerr << " [delayed]";
653
881
  if (expression->is_interpolant()) std::cerr << " [interpolant]";
654
882
  if (expression->quote_mark()) std::cerr << " [quote_mark: " << expression->quote_mark() << "]";
655
- std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl;
883
+ std::cerr << std::endl;
656
884
  } else if (Cast<String_Constant>(node)) {
657
885
  String_Constant* expression = Cast<String_Constant>(node);
658
886
  std::cerr << ind << "String_Constant " << expression;
@@ -663,7 +891,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
663
891
  std::cerr << " [" << prettyprint(expression->value()) << "]";
664
892
  if (expression->is_delayed()) std::cerr << " [delayed]";
665
893
  if (expression->is_interpolant()) std::cerr << " [interpolant]";
666
- std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl;
894
+ std::cerr << std::endl;
667
895
  } else if (Cast<String_Schema>(node)) {
668
896
  String_Schema* expression = Cast<String_Schema>(node);
669
897
  std::cerr << ind << "String_Schema " << expression;
@@ -676,7 +904,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
676
904
  if (expression->has_interpolant()) std::cerr << " [has interpolant]";
677
905
  if (expression->is_left_interpolant()) std::cerr << " [left interpolant] ";
678
906
  if (expression->is_right_interpolant()) std::cerr << " [right interpolant] ";
679
- std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl;
907
+ std::cerr << std::endl;
680
908
  for(const auto& i : expression->elements()) { debug_ast(i, ind + " ", env); }
681
909
  } else if (Cast<String>(node)) {
682
910
  String* expression = Cast<String>(node);
@@ -684,7 +912,7 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
684
912
  std::cerr << " " << expression->concrete_type();
685
913
  std::cerr << " (" << pstate_source_position(node) << ")";
686
914
  if (expression->is_interpolant()) std::cerr << " [interpolant]";
687
- std::cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << std::endl;
915
+ std::cerr << std::endl;
688
916
  } else if (Cast<Expression>(node)) {
689
917
  Expression* expression = Cast<Expression>(node);
690
918
  std::cerr << ind << "Expression " << expression;
@@ -708,12 +936,12 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
708
936
  case Expression::Type::PARENT: std::cerr << " [PARENT]"; break;
709
937
  }
710
938
  std::cerr << std::endl;
711
- } else if (Cast<Has_Block>(node)) {
712
- Has_Block* has_block = Cast<Has_Block>(node);
713
- std::cerr << ind << "Has_Block " << has_block;
939
+ } else if (Cast<ParentStatement>(node)) {
940
+ ParentStatement* parent = Cast<ParentStatement>(node);
941
+ std::cerr << ind << "ParentStatement " << parent;
714
942
  std::cerr << " (" << pstate_source_position(node) << ")";
715
- std::cerr << " " << has_block->tabs() << std::endl;
716
- if (has_block->block()) for(const Statement_Obj& i : has_block->block()->elements()) { debug_ast(i, ind + " ", env); }
943
+ std::cerr << " " << parent->tabs() << std::endl;
944
+ if (parent->block()) for(const Statement_Obj& i : parent->block()->elements()) { debug_ast(i, ind + " ", env); }
717
945
  } else if (Cast<Statement>(node)) {
718
946
  Statement* statement = Cast<Statement>(node);
719
947
  std::cerr << ind << "Statement " << statement;
@@ -724,84 +952,12 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
724
952
  if (ind == "") std::cerr << "####################################################################\n";
725
953
  }
726
954
 
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
955
 
776
956
  /*
777
- inline void debug_ast(const AST_Node* node, std::string ind = "", Env* env = 0)
957
+ inline void debug_ast(const AST_Node* node, sass::string ind = "", Env* env = 0)
778
958
  {
779
959
  debug_ast(const_cast<AST_Node*>(node), ind, env);
780
960
  }
781
961
  */
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
962
 
807
963
  #endif // SASS_DEBUGGER