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
@@ -11,11 +11,11 @@
11
11
 
12
12
  namespace Sass {
13
13
 
14
- void bind(std::string type, std::string name, Parameters_Obj ps, Arguments_Obj as, Env* env, Eval* eval, Backtraces& traces)
14
+ void bind(sass::string type, sass::string name, Parameters_Obj ps, Arguments_Obj as, Env* env, Eval* eval, Backtraces& traces)
15
15
  {
16
- std::string callee(type + " " + name);
16
+ sass::string callee(type + " " + name);
17
17
 
18
- std::map<std::string, Parameter_Obj> param_map;
18
+ std::map<sass::string, Parameter_Obj> param_map;
19
19
  List_Obj varargs = SASS_MEMORY_NEW(List, as->pstate());
20
20
  varargs->is_arglist(true); // enable keyword size handling
21
21
 
@@ -52,7 +52,7 @@ namespace Sass {
52
52
  }
53
53
  }
54
54
  }
55
- std::stringstream msg;
55
+ sass::ostream msg;
56
56
  msg << "wrong number of arguments (" << LA << " for " << LP << ")";
57
57
  msg << " for `" << name << "'";
58
58
  return error(msg.str(), as->pstate(), traces);
@@ -73,7 +73,7 @@ namespace Sass {
73
73
  rest->separator(),
74
74
  true);
75
75
  // wrap each item from list as an argument
76
- for (Expression_Obj item : rest->elements()) {
76
+ for (ExpressionObj item : rest->elements()) {
77
77
  if (Argument_Obj arg = Cast<Argument>(item)) {
78
78
  arglist->append(SASS_MEMORY_COPY(arg)); // copy
79
79
  } else {
@@ -100,7 +100,7 @@ namespace Sass {
100
100
  Map_Obj argmap = Cast<Map>(a->value());
101
101
  for (auto key : argmap->keys()) {
102
102
  if (String_Constant_Obj str = Cast<String_Constant>(key)) {
103
- std::string param = unquote(str->value());
103
+ sass::string param = unquote(str->value());
104
104
  arglist->append(SASS_MEMORY_NEW(Argument,
105
105
  key->pstate(),
106
106
  argmap->at(key),
@@ -130,7 +130,7 @@ namespace Sass {
130
130
  // skip any list completely if empty
131
131
  if (ls && ls->empty() && a->is_rest_argument()) continue;
132
132
 
133
- Expression_Obj value = a->value();
133
+ ExpressionObj value = a->value();
134
134
  if (Argument_Obj arg = Cast<Argument>(value)) {
135
135
  arglist->append(arg);
136
136
  }
@@ -141,7 +141,7 @@ namespace Sass {
141
141
  arglist->separator(rest->separator());
142
142
 
143
143
  for (size_t i = 0, L = rest->length(); i < L; ++i) {
144
- Expression_Obj obj = rest->value_at_index(i);
144
+ ExpressionObj obj = rest->value_at_index(i);
145
145
  arglist->append(SASS_MEMORY_NEW(Argument,
146
146
  obj->pstate(),
147
147
  obj,
@@ -168,7 +168,7 @@ namespace Sass {
168
168
  }
169
169
  // consumed parameter
170
170
  ++ip;
171
- // no more paramaters
171
+ // no more parameters
172
172
  break;
173
173
  }
174
174
 
@@ -177,7 +177,7 @@ namespace Sass {
177
177
  // normal param and rest arg
178
178
  List_Obj arglist = Cast<List>(a->value());
179
179
  if (!arglist) {
180
- if (Expression_Obj arg = Cast<Expression>(a->value())) {
180
+ if (ExpressionObj arg = Cast<Expression>(a->value())) {
181
181
  arglist = SASS_MEMORY_NEW(List, a->pstate(), 1);
182
182
  arglist->append(arg);
183
183
  }
@@ -189,7 +189,7 @@ namespace Sass {
189
189
  } else {
190
190
  if (arglist->length() > LP - ip && !ps->has_rest_parameter()) {
191
191
  size_t arg_count = (arglist->length() + LA - 1);
192
- std::stringstream msg;
192
+ sass::ostream msg;
193
193
  msg << callee << " takes " << LP;
194
194
  msg << (LP == 1 ? " argument" : " arguments");
195
195
  msg << " but " << arg_count;
@@ -202,7 +202,7 @@ namespace Sass {
202
202
  }
203
203
  }
204
204
  // otherwise move one of the rest args into the param, converting to argument if necessary
205
- Expression_Obj obj = arglist->at(0);
205
+ ExpressionObj obj = arglist->at(0);
206
206
  if (!(a = Cast<Argument>(obj))) {
207
207
  Expression* a_to_convert = obj;
208
208
  a = SASS_MEMORY_NEW(Argument,
@@ -226,10 +226,10 @@ namespace Sass {
226
226
  traces.push_back(Backtrace(key->pstate()));
227
227
  throw Exception::InvalidVarKwdType(key->pstate(), traces, key->inspect(), a);
228
228
  }
229
- std::string param = "$" + unquote(val->value());
229
+ sass::string param = "$" + unquote(val->value());
230
230
 
231
231
  if (!param_map.count(param)) {
232
- std::stringstream msg;
232
+ sass::ostream msg;
233
233
  msg << callee << " has no parameter named " << param;
234
234
  error(msg.str(), a->pstate(), traces);
235
235
  }
@@ -243,7 +243,7 @@ namespace Sass {
243
243
 
244
244
  if (a->name().empty()) {
245
245
  if (env->has_local(p->name())) {
246
- std::stringstream msg;
246
+ sass::ostream msg;
247
247
  msg << "parameter " << p->name()
248
248
  << " provided more than once in call to " << callee;
249
249
  error(msg.str(), a->pstate(), traces);
@@ -258,21 +258,21 @@ namespace Sass {
258
258
  if (ps->has_rest_parameter()) {
259
259
  varargs->append(a);
260
260
  } else {
261
- std::stringstream msg;
261
+ sass::ostream msg;
262
262
  msg << callee << " has no parameter named " << a->name();
263
263
  error(msg.str(), a->pstate(), traces);
264
264
  }
265
265
  }
266
266
  if (param_map[a->name()]) {
267
267
  if (param_map[a->name()]->is_rest_parameter()) {
268
- std::stringstream msg;
268
+ sass::ostream msg;
269
269
  msg << "argument " << a->name() << " of " << callee
270
270
  << "cannot be used as named argument";
271
271
  error(msg.str(), a->pstate(), traces);
272
272
  }
273
273
  }
274
274
  if (env->has_local(a->name())) {
275
- std::stringstream msg;
275
+ sass::ostream msg;
276
276
  msg << "parameter " << p->name()
277
277
  << "provided more than once in call to " << callee;
278
278
  error(msg.str(), a->pstate(), traces);
@@ -8,7 +8,7 @@
8
8
 
9
9
  namespace Sass {
10
10
 
11
- void bind(std::string type, std::string name, Parameters_Obj, Arguments_Obj, Env*, Eval*, Backtraces& traces);
11
+ void bind(sass::string type, sass::string name, Parameters_Obj, Arguments_Obj, Env*, Eval*, Backtraces& traces);
12
12
 
13
13
  }
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  namespace Sass {
10
10
 
11
- Value* c2ast(union Sass_Value* v, Backtraces traces, ParserState pstate)
11
+ Value* c2ast(union Sass_Value* v, Backtraces traces, SourceSpan pstate)
12
12
  {
13
13
  using std::strlen;
14
14
  using std::strcpy;
@@ -51,10 +51,10 @@ namespace Sass {
51
51
  e = SASS_MEMORY_NEW(Null, pstate);
52
52
  } break;
53
53
  case SASS_ERROR: {
54
- error("Error in C function: " + std::string(sass_error_get_message(v)), pstate, traces);
54
+ error("Error in C function: " + sass::string(sass_error_get_message(v)), pstate, traces);
55
55
  } break;
56
56
  case SASS_WARNING: {
57
- error("Warning in C function: " + std::string(sass_warning_get_message(v)), pstate, traces);
57
+ error("Warning in C function: " + sass::string(sass_warning_get_message(v)), pstate, traces);
58
58
  } break;
59
59
  default: break;
60
60
  }
@@ -7,7 +7,7 @@
7
7
 
8
8
  namespace Sass {
9
9
 
10
- Value* c2ast(union Sass_Value* v, Backtraces traces, ParserState pstate);
10
+ Value* c2ast(union Sass_Value* v, Backtraces traces, SourceSpan pstate);
11
11
 
12
12
  }
13
13
 
@@ -46,9 +46,8 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
46
46
  result = (fragment & 0x0fc) >> 2;
47
47
  *codechar++ = base64_encode_value(result);
48
48
  result = (fragment & 0x003) << 4;
49
- #ifndef _MSC_VER
50
- /* fall through */
51
- #endif
49
+ /* fall through */
50
+
52
51
  case step_B:
53
52
  if (plainchar == plaintextend)
54
53
  {
@@ -60,9 +59,8 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
60
59
  result |= (fragment & 0x0f0) >> 4;
61
60
  *codechar++ = base64_encode_value(result);
62
61
  result = (fragment & 0x00f) << 2;
63
- #ifndef _MSC_VER
64
- /* fall through */
65
- #endif
62
+ /* fall through */
63
+
66
64
  case step_C:
67
65
  if (plainchar == plaintextend)
68
66
  {
@@ -1,20 +1,18 @@
1
1
  // sass.hpp must go before all system headers to get the
2
2
  // __EXTENSIONS__ fix on Solaris.
3
3
  #include "sass.hpp"
4
-
5
- #include <vector>
6
-
4
+ #include "ast.hpp"
7
5
  #include "check_nesting.hpp"
8
6
 
9
7
  namespace Sass {
10
8
 
11
9
  CheckNesting::CheckNesting()
12
- : parents(std::vector<Statement*>()),
13
- traces(std::vector<Backtrace>()),
10
+ : parents(sass::vector<Statement*>()),
11
+ traces(sass::vector<Backtrace>()),
14
12
  parent(0), current_mixin_definition(0)
15
13
  { }
16
14
 
17
- void error(AST_Node* node, Backtraces traces, std::string msg) {
15
+ void error(AST_Node* node, Backtraces traces, sass::string msg) {
18
16
  traces.push_back(Backtrace(node->pstate()));
19
17
  throw Exception::InvalidSass(node->pstate(), traces, msg);
20
18
  }
@@ -23,9 +21,9 @@ namespace Sass {
23
21
  {
24
22
  Statement* old_parent = this->parent;
25
23
 
26
- if (At_Root_Block* root = Cast<At_Root_Block>(parent)) {
27
- std::vector<Statement*> old_parents = this->parents;
28
- std::vector<Statement*> new_parents;
24
+ if (AtRootRule* root = Cast<AtRootRule>(parent)) {
25
+ sass::vector<Statement*> old_parents = this->parents;
26
+ sass::vector<Statement*> new_parents;
29
27
 
30
28
  for (size_t i = 0, L = this->parents.size(); i < L; i++) {
31
29
  Statement* p = this->parents.at(i);
@@ -47,7 +45,7 @@ namespace Sass {
47
45
  }
48
46
  }
49
47
 
50
- At_Root_Block* ar = Cast<At_Root_Block>(parent);
48
+ AtRootRule* ar = Cast<AtRootRule>(parent);
51
49
  Block* ret = ar->block();
52
50
 
53
51
  if (ret != NULL) {
@@ -77,7 +75,7 @@ namespace Sass {
77
75
  }
78
76
 
79
77
  if (!b) {
80
- if (Has_Block* bb = Cast<Has_Block>(parent)) {
78
+ if (ParentStatement* bb = Cast<ParentStatement>(parent)) {
81
79
  b = bb->block();
82
80
  }
83
81
  }
@@ -145,7 +143,7 @@ namespace Sass {
145
143
  if (is_charset(node))
146
144
  { this->invalid_charset_parent(this->parent, node); }
147
145
 
148
- if (Cast<Extension>(node))
146
+ if (Cast<ExtendRule>(node))
149
147
  { this->invalid_extend_parent(this->parent, node); }
150
148
 
151
149
  // if (Cast<Import>(node))
@@ -194,7 +192,7 @@ namespace Sass {
194
192
  void CheckNesting::invalid_extend_parent(Statement* parent, AST_Node* node)
195
193
  {
196
194
  if (!(
197
- Cast<Ruleset>(parent) ||
195
+ Cast<StyleRule>(parent) ||
198
196
  Cast<Mixin_Call>(parent) ||
199
197
  is_mixin(parent)
200
198
  )) {
@@ -206,10 +204,10 @@ namespace Sass {
206
204
  // {
207
205
  // for (auto pp : this->parents) {
208
206
  // if (
209
- // Cast<Each>(pp) ||
210
- // Cast<For>(pp) ||
207
+ // Cast<EachRule>(pp) ||
208
+ // Cast<ForRule>(pp) ||
211
209
  // Cast<If>(pp) ||
212
- // Cast<While>(pp) ||
210
+ // Cast<WhileRule>(pp) ||
213
211
  // Cast<Trace>(pp) ||
214
212
  // Cast<Mixin_Call>(pp) ||
215
213
  // is_mixin(pp)
@@ -231,10 +229,10 @@ namespace Sass {
231
229
  {
232
230
  for (Statement* pp : this->parents) {
233
231
  if (
234
- Cast<Each>(pp) ||
235
- Cast<For>(pp) ||
232
+ Cast<EachRule>(pp) ||
233
+ Cast<ForRule>(pp) ||
236
234
  Cast<If>(pp) ||
237
- Cast<While>(pp) ||
235
+ Cast<WhileRule>(pp) ||
238
236
  Cast<Trace>(pp) ||
239
237
  Cast<Mixin_Call>(pp) ||
240
238
  is_mixin(pp)
@@ -248,10 +246,10 @@ namespace Sass {
248
246
  {
249
247
  for (Statement* pp : this->parents) {
250
248
  if (
251
- Cast<Each>(pp) ||
252
- Cast<For>(pp) ||
249
+ Cast<EachRule>(pp) ||
250
+ Cast<ForRule>(pp) ||
253
251
  Cast<If>(pp) ||
254
- Cast<While>(pp) ||
252
+ Cast<WhileRule>(pp) ||
255
253
  Cast<Trace>(pp) ||
256
254
  Cast<Mixin_Call>(pp) ||
257
255
  is_mixin(pp)
@@ -264,19 +262,19 @@ namespace Sass {
264
262
  void CheckNesting::invalid_function_child(Statement* child)
265
263
  {
266
264
  if (!(
267
- Cast<Each>(child) ||
268
- Cast<For>(child) ||
265
+ Cast<EachRule>(child) ||
266
+ Cast<ForRule>(child) ||
269
267
  Cast<If>(child) ||
270
- Cast<While>(child) ||
268
+ Cast<WhileRule>(child) ||
271
269
  Cast<Trace>(child) ||
272
270
  Cast<Comment>(child) ||
273
- Cast<Debug>(child) ||
271
+ Cast<DebugRule>(child) ||
274
272
  Cast<Return>(child) ||
275
273
  Cast<Variable>(child) ||
276
274
  // Ruby Sass doesn't distinguish variables and assignments
277
275
  Cast<Assignment>(child) ||
278
- Cast<Warning>(child) ||
279
- Cast<Error>(child)
276
+ Cast<WarningRule>(child) ||
277
+ Cast<ErrorRule>(child)
280
278
  )) {
281
279
  error(child, traces, "Functions can only contain variable declarations and control directives.");
282
280
  }
@@ -285,10 +283,10 @@ namespace Sass {
285
283
  void CheckNesting::invalid_prop_child(Statement* child)
286
284
  {
287
285
  if (!(
288
- Cast<Each>(child) ||
289
- Cast<For>(child) ||
286
+ Cast<EachRule>(child) ||
287
+ Cast<ForRule>(child) ||
290
288
  Cast<If>(child) ||
291
- Cast<While>(child) ||
289
+ Cast<WhileRule>(child) ||
292
290
  Cast<Trace>(child) ||
293
291
  Cast<Comment>(child) ||
294
292
  Cast<Declaration>(child) ||
@@ -303,7 +301,7 @@ namespace Sass {
303
301
  if (!(
304
302
  is_mixin(parent) ||
305
303
  is_directive_node(parent) ||
306
- Cast<Ruleset>(parent) ||
304
+ Cast<StyleRule>(parent) ||
307
305
  Cast<Keyframe_Rule>(parent) ||
308
306
  Cast<Declaration>(parent) ||
309
307
  Cast<Mixin_Call>(parent)
@@ -345,17 +343,17 @@ namespace Sass {
345
343
  !is_at_root_node(grandparent);
346
344
 
347
345
  return Cast<Import>(parent) ||
348
- Cast<Each>(parent) ||
349
- Cast<For>(parent) ||
346
+ Cast<EachRule>(parent) ||
347
+ Cast<ForRule>(parent) ||
350
348
  Cast<If>(parent) ||
351
- Cast<While>(parent) ||
349
+ Cast<WhileRule>(parent) ||
352
350
  Cast<Trace>(parent) ||
353
351
  valid_bubble_node;
354
352
  }
355
353
 
356
354
  bool CheckNesting::is_charset(Statement* n)
357
355
  {
358
- Directive* d = Cast<Directive>(n);
356
+ AtRule* d = Cast<AtRule>(n);
359
357
  return d && d->keyword() == "charset";
360
358
  }
361
359
 
@@ -373,7 +371,7 @@ namespace Sass {
373
371
 
374
372
  bool CheckNesting::is_root_node(Statement* n)
375
373
  {
376
- if (Cast<Ruleset>(n)) return false;
374
+ if (Cast<StyleRule>(n)) return false;
377
375
 
378
376
  Block* b = Cast<Block>(n);
379
377
  return b && b->is_root();
@@ -381,14 +379,15 @@ namespace Sass {
381
379
 
382
380
  bool CheckNesting::is_at_root_node(Statement* n)
383
381
  {
384
- return Cast<At_Root_Block>(n) != NULL;
382
+ return Cast<AtRootRule>(n) != NULL;
385
383
  }
386
384
 
387
385
  bool CheckNesting::is_directive_node(Statement* n)
388
386
  {
389
- return Cast<Directive>(n) ||
387
+ return Cast<AtRule>(n) ||
390
388
  Cast<Import>(n) ||
391
- Cast<Media_Block>(n) ||
392
- Cast<Supports_Block>(n);
389
+ Cast<MediaRule>(n) ||
390
+ Cast<CssMediaRule>(n) ||
391
+ Cast<SupportsRule>(n);
393
392
  }
394
393
  }
@@ -1,14 +1,18 @@
1
1
  #ifndef SASS_CHECK_NESTING_H
2
2
  #define SASS_CHECK_NESTING_H
3
3
 
4
+ // sass.hpp must go before all system headers to get the
5
+ // __EXTENSIONS__ fix on Solaris.
6
+ #include "sass.hpp"
4
7
  #include "ast.hpp"
5
8
  #include "operation.hpp"
9
+ #include <vector>
6
10
 
7
11
  namespace Sass {
8
12
 
9
13
  class CheckNesting : public Operation_CRTP<Statement*, CheckNesting> {
10
14
 
11
- std::vector<Statement*> parents;
15
+ sass::vector<Statement*> parents;
12
16
  Backtraces traces;
13
17
  Statement* parent;
14
18
  Definition* current_mixin_definition;
@@ -29,7 +33,7 @@ namespace Sass {
29
33
  Statement* s = Cast<Statement>(x);
30
34
  if (s && this->should_visit(s)) {
31
35
  Block* b1 = Cast<Block>(s);
32
- Has_Block* b2 = Cast<Has_Block>(s);
36
+ ParentStatement* b2 = Cast<ParentStatement>(s);
33
37
  if (b1 || b2) return visit_children(s);
34
38
  }
35
39
  return s;
@@ -4,6 +4,7 @@
4
4
 
5
5
  #include "ast.hpp"
6
6
  #include "color_maps.hpp"
7
+ #include "util_string.hpp"
7
8
 
8
9
  namespace Sass {
9
10
 
@@ -161,7 +162,7 @@ namespace Sass {
161
162
  }
162
163
 
163
164
  namespace Colors {
164
- const ParserState color_table("[COLOR TABLE]");
165
+ const SourceSpan color_table("[COLOR TABLE]");
165
166
  const Color_RGBA aliceblue(color_table, 240, 248, 255, 1);
166
167
  const Color_RGBA antiquewhite(color_table, 250, 235, 215, 1);
167
168
  const Color_RGBA cyan(color_table, 0, 255, 255, 1);
@@ -313,7 +314,7 @@ namespace Sass {
313
314
  const Color_RGBA transparent(color_table, 0, 0, 0, 0);
314
315
  }
315
316
 
316
- const std::map<const int, const char*> colors_to_names {
317
+ static const auto* const colors_to_names = new std::unordered_map<int, const char*> {
317
318
  { 240 * 0x10000 + 248 * 0x100 + 255, ColorNames::aliceblue },
318
319
  { 250 * 0x10000 + 235 * 0x100 + 215, ColorNames::antiquewhite },
319
320
  { 0 * 0x10000 + 255 * 0x100 + 255, ColorNames::cyan },
@@ -455,7 +456,7 @@ namespace Sass {
455
456
  { 102 * 0x10000 + 51 * 0x100 + 153, ColorNames::rebeccapurple }
456
457
  };
457
458
 
458
- const std::map<const char*, const Color_RGBA*, map_cmp_str> names_to_colors
459
+ static const auto *const names_to_colors = new std::unordered_map<sass::string, const Color_RGBA*>
459
460
  {
460
461
  { ColorNames::aliceblue, &Colors::aliceblue },
461
462
  { ColorNames::antiquewhite, &Colors::antiquewhite },
@@ -610,29 +611,29 @@ namespace Sass {
610
611
 
611
612
  const Color_RGBA* name_to_color(const char* key)
612
613
  {
613
- return name_to_color(std::string(key));
614
+ return name_to_color(sass::string(key));
614
615
  }
615
616
 
616
- const Color_RGBA* name_to_color(const std::string& key)
617
+ const Color_RGBA* name_to_color(const sass::string& key)
617
618
  {
618
619
  // case insensitive lookup. See #2462
619
- std::string lower{key};
620
- std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
620
+ sass::string lower = key;
621
+ Util::ascii_str_tolower(&lower);
621
622
 
622
- auto p = names_to_colors.find(lower.c_str());
623
- if (p != names_to_colors.end()) {
623
+ auto p = names_to_colors->find(lower);
624
+ if (p != names_to_colors->end()) {
624
625
  return p->second;
625
626
  }
626
- return 0;
627
+ return nullptr;
627
628
  }
628
629
 
629
630
  const char* color_to_name(const int key)
630
631
  {
631
- auto p = colors_to_names.find(key);
632
- if (p != colors_to_names.end()) {
632
+ auto p = colors_to_names->find(key);
633
+ if (p != colors_to_names->end()) {
633
634
  return p->second;
634
635
  }
635
- return 0;
636
+ return nullptr;
636
637
  }
637
638
 
638
639
  const char* color_to_name(const double key)
@@ -7,14 +7,6 @@
7
7
 
8
8
  namespace Sass {
9
9
 
10
- struct map_cmp_str
11
- {
12
- bool operator()(char const *a, char const *b) const
13
- {
14
- return std::strcmp(a, b) < 0;
15
- }
16
- };
17
-
18
10
  namespace ColorNames
19
11
  {
20
12
  extern const char aliceblue[];
@@ -321,7 +313,7 @@ namespace Sass {
321
313
  }
322
314
 
323
315
  const Color_RGBA* name_to_color(const char*);
324
- const Color_RGBA* name_to_color(const std::string&);
316
+ const Color_RGBA* name_to_color(const sass::string&);
325
317
  const char* color_to_name(const int);
326
318
  const char* color_to_name(const Color_RGBA&);
327
319
  const char* color_to_name(const double);
@@ -45,6 +45,7 @@ namespace Sass {
45
45
  extern const char for_kwd[] = "@for";
46
46
  extern const char from_kwd[] = "from";
47
47
  extern const char to_kwd[] = "to";
48
+ extern const char of_kwd[] = "of";
48
49
  extern const char through_kwd[] = "through";
49
50
  extern const char each_kwd[] = "@each";
50
51
  extern const char in_kwd[] = "in";
@@ -161,6 +162,10 @@ namespace Sass {
161
162
  extern const char uri_chars[] = ":;/?!%&#@|[]{}'`^\"*+-.,_=~";
162
163
  extern const char real_uri_chars[] = "#%&";
163
164
 
165
+ extern const char selector_combinator_child[] = ">";
166
+ extern const char selector_combinator_general[] = "~";
167
+ extern const char selector_combinator_adjacent[] = "+";
168
+
164
169
  // some specific constant character classes
165
170
  // they must be static to be useable by lexer
166
171
  extern const char static_ops[] = "*/%";
@@ -43,6 +43,7 @@ namespace Sass {
43
43
  extern const char for_kwd[];
44
44
  extern const char from_kwd[];
45
45
  extern const char to_kwd[];
46
+ extern const char of_kwd[];
46
47
  extern const char through_kwd[];
47
48
  extern const char each_kwd[];
48
49
  extern const char in_kwd[];
@@ -161,6 +162,11 @@ namespace Sass {
161
162
  extern const char uri_chars[];
162
163
  extern const char real_uri_chars[];
163
164
 
165
+ // constants for selector combinators
166
+ extern const char selector_combinator_child[];
167
+ extern const char selector_combinator_general[];
168
+ extern const char selector_combinator_adjacent[];
169
+
164
170
  // some specific constant character classes
165
171
  // they must be static to be useable by lexer
166
172
  extern const char static_ops[];