sassc 2.0.1 → 2.1.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.gitmodules +1 -1
  4. data/.travis.yml +7 -3
  5. data/CHANGELOG.md +3 -0
  6. data/CODE_OF_CONDUCT.md +1 -1
  7. data/README.md +1 -1
  8. data/Rakefile +23 -8
  9. data/ext/extconf.rb +39 -0
  10. data/ext/libsass/.gitignore +1 -0
  11. data/ext/libsass/GNUmakefile.am +23 -39
  12. data/ext/libsass/Makefile +56 -91
  13. data/ext/libsass/Makefile.conf +16 -2
  14. data/ext/libsass/configure.ac +8 -12
  15. data/ext/libsass/include/sass/base.h +1 -0
  16. data/ext/libsass/include/sass/context.h +1 -1
  17. data/ext/libsass/src/GNUmakefile.am +1 -5
  18. data/ext/libsass/src/ast.cpp +747 -2010
  19. data/ext/libsass/src/ast.hpp +239 -2383
  20. data/ext/libsass/src/{to_c.cpp → ast2c.cpp} +22 -16
  21. data/ext/libsass/src/ast2c.hpp +39 -0
  22. data/ext/libsass/src/ast_def_macros.hpp +62 -10
  23. data/ext/libsass/src/ast_fwd_decl.cpp +1 -0
  24. data/ext/libsass/src/ast_fwd_decl.hpp +43 -165
  25. data/ext/libsass/src/ast_sel_cmp.cpp +909 -0
  26. data/ext/libsass/src/ast_sel_unify.cpp +280 -0
  27. data/ext/libsass/src/ast_selectors.cpp +1475 -0
  28. data/ext/libsass/src/ast_selectors.hpp +568 -0
  29. data/ext/libsass/src/ast_supports.cpp +130 -0
  30. data/ext/libsass/src/ast_supports.hpp +121 -0
  31. data/ext/libsass/src/ast_values.cpp +967 -0
  32. data/ext/libsass/src/ast_values.hpp +489 -0
  33. data/ext/libsass/src/backtrace.cpp +4 -0
  34. data/ext/libsass/src/base64vlq.cpp +3 -0
  35. data/ext/libsass/src/bind.cpp +18 -17
  36. data/ext/libsass/src/bind.hpp +3 -1
  37. data/ext/libsass/src/c2ast.cpp +64 -0
  38. data/ext/libsass/src/c2ast.hpp +14 -0
  39. data/ext/libsass/src/cencode.c +2 -2
  40. data/ext/libsass/src/check_nesting.cpp +52 -56
  41. data/ext/libsass/src/check_nesting.hpp +35 -34
  42. data/ext/libsass/src/color_maps.cpp +156 -153
  43. data/ext/libsass/src/color_maps.hpp +152 -152
  44. data/ext/libsass/src/constants.cpp +15 -0
  45. data/ext/libsass/src/constants.hpp +13 -0
  46. data/ext/libsass/src/context.cpp +24 -14
  47. data/ext/libsass/src/context.hpp +6 -6
  48. data/ext/libsass/src/cssize.cpp +69 -71
  49. data/ext/libsass/src/cssize.hpp +50 -50
  50. data/ext/libsass/src/debugger.hpp +117 -110
  51. data/ext/libsass/src/emitter.cpp +13 -12
  52. data/ext/libsass/src/emitter.hpp +13 -9
  53. data/ext/libsass/src/environment.cpp +15 -1
  54. data/ext/libsass/src/environment.hpp +6 -0
  55. data/ext/libsass/src/error_handling.cpp +36 -59
  56. data/ext/libsass/src/error_handling.hpp +29 -16
  57. data/ext/libsass/src/eval.cpp +302 -323
  58. data/ext/libsass/src/eval.hpp +64 -55
  59. data/ext/libsass/src/expand.cpp +94 -88
  60. data/ext/libsass/src/expand.hpp +33 -37
  61. data/ext/libsass/src/extend.cpp +38 -36
  62. data/ext/libsass/src/extend.hpp +15 -15
  63. data/ext/libsass/src/file.cpp +34 -2
  64. data/ext/libsass/src/fn_colors.cpp +594 -0
  65. data/ext/libsass/src/fn_colors.hpp +85 -0
  66. data/ext/libsass/src/fn_lists.cpp +284 -0
  67. data/ext/libsass/src/fn_lists.hpp +34 -0
  68. data/ext/libsass/src/fn_maps.cpp +94 -0
  69. data/ext/libsass/src/fn_maps.hpp +30 -0
  70. data/ext/libsass/src/fn_miscs.cpp +256 -0
  71. data/ext/libsass/src/fn_miscs.hpp +40 -0
  72. data/ext/libsass/src/fn_numbers.cpp +220 -0
  73. data/ext/libsass/src/fn_numbers.hpp +45 -0
  74. data/ext/libsass/src/fn_selectors.cpp +235 -0
  75. data/ext/libsass/src/fn_selectors.hpp +35 -0
  76. data/ext/libsass/src/fn_strings.cpp +254 -0
  77. data/ext/libsass/src/fn_strings.hpp +34 -0
  78. data/ext/libsass/src/fn_utils.cpp +156 -0
  79. data/ext/libsass/src/fn_utils.hpp +56 -0
  80. data/ext/libsass/src/inspect.cpp +101 -152
  81. data/ext/libsass/src/inspect.hpp +69 -73
  82. data/ext/libsass/src/json.cpp +2 -2
  83. data/ext/libsass/src/lexer.cpp +6 -3
  84. data/ext/libsass/src/listize.cpp +9 -11
  85. data/ext/libsass/src/listize.hpp +11 -7
  86. data/ext/libsass/src/memory/SharedPtr.cpp +2 -83
  87. data/ext/libsass/src/memory/SharedPtr.hpp +127 -143
  88. data/ext/libsass/src/node.cpp +13 -10
  89. data/ext/libsass/src/node.hpp +3 -3
  90. data/ext/libsass/src/operation.hpp +184 -144
  91. data/ext/libsass/src/operators.cpp +43 -17
  92. data/ext/libsass/src/operators.hpp +5 -5
  93. data/ext/libsass/src/output.cpp +21 -18
  94. data/ext/libsass/src/output.hpp +14 -21
  95. data/ext/libsass/src/parser.cpp +215 -183
  96. data/ext/libsass/src/parser.hpp +28 -24
  97. data/ext/libsass/src/plugins.cpp +5 -1
  98. data/ext/libsass/src/position.cpp +3 -0
  99. data/ext/libsass/src/prelexer.cpp +9 -3
  100. data/ext/libsass/src/prelexer.hpp +9 -9
  101. data/ext/libsass/src/remove_placeholders.cpp +14 -11
  102. data/ext/libsass/src/remove_placeholders.hpp +8 -9
  103. data/ext/libsass/src/sass.cpp +9 -3
  104. data/ext/libsass/src/sass.hpp +12 -9
  105. data/ext/libsass/src/sass2scss.cpp +45 -14
  106. data/ext/libsass/src/sass_context.cpp +18 -15
  107. data/ext/libsass/src/sass_functions.cpp +6 -3
  108. data/ext/libsass/src/sass_functions.hpp +1 -1
  109. data/ext/libsass/src/sass_util.cpp +3 -0
  110. data/ext/libsass/src/sass_values.cpp +21 -13
  111. data/ext/libsass/src/source_map.cpp +5 -2
  112. data/ext/libsass/src/source_map.hpp +2 -2
  113. data/ext/libsass/src/subset_map.cpp +4 -1
  114. data/ext/libsass/src/to_value.cpp +23 -21
  115. data/ext/libsass/src/to_value.hpp +18 -22
  116. data/ext/libsass/src/units.cpp +4 -0
  117. data/ext/libsass/src/units.hpp +1 -0
  118. data/ext/libsass/src/utf8/checked.h +12 -10
  119. data/ext/libsass/src/utf8/core.h +3 -0
  120. data/ext/libsass/src/utf8_string.cpp +3 -0
  121. data/ext/libsass/src/util.cpp +67 -75
  122. data/ext/libsass/src/util.hpp +64 -19
  123. data/ext/libsass/src/util_string.cpp +75 -0
  124. data/ext/libsass/src/util_string.hpp +19 -0
  125. data/ext/libsass/src/values.cpp +22 -13
  126. data/ext/libsass/src/values.hpp +2 -2
  127. data/ext/libsass/win/libsass.targets +30 -4
  128. data/ext/libsass/win/libsass.vcxproj.filters +82 -4
  129. data/lib/sassc.rb +24 -0
  130. data/lib/sassc/engine.rb +2 -2
  131. data/lib/sassc/native.rb +8 -1
  132. data/lib/sassc/version.rb +1 -1
  133. data/sassc.gemspec +19 -11
  134. data/test/engine_test.rb +26 -1
  135. data/test/native_test.rb +1 -1
  136. metadata +66 -72
  137. data/ext/Rakefile +0 -3
  138. data/ext/libsass/.github/CONTRIBUTING.md +0 -65
  139. data/ext/libsass/.github/ISSUE_TEMPLATE.md +0 -54
  140. data/ext/libsass/.travis.yml +0 -64
  141. data/ext/libsass/Readme.md +0 -104
  142. data/ext/libsass/SECURITY.md +0 -10
  143. data/ext/libsass/appveyor.yml +0 -91
  144. data/ext/libsass/docs/README.md +0 -20
  145. data/ext/libsass/docs/api-context-example.md +0 -45
  146. data/ext/libsass/docs/api-context-internal.md +0 -163
  147. data/ext/libsass/docs/api-context.md +0 -295
  148. data/ext/libsass/docs/api-doc.md +0 -215
  149. data/ext/libsass/docs/api-function-example.md +0 -67
  150. data/ext/libsass/docs/api-function-internal.md +0 -8
  151. data/ext/libsass/docs/api-function.md +0 -74
  152. data/ext/libsass/docs/api-importer-example.md +0 -112
  153. data/ext/libsass/docs/api-importer-internal.md +0 -20
  154. data/ext/libsass/docs/api-importer.md +0 -86
  155. data/ext/libsass/docs/api-value-example.md +0 -55
  156. data/ext/libsass/docs/api-value-internal.md +0 -76
  157. data/ext/libsass/docs/api-value.md +0 -154
  158. data/ext/libsass/docs/build-on-darwin.md +0 -27
  159. data/ext/libsass/docs/build-on-gentoo.md +0 -55
  160. data/ext/libsass/docs/build-on-windows.md +0 -139
  161. data/ext/libsass/docs/build-shared-library.md +0 -35
  162. data/ext/libsass/docs/build-with-autotools.md +0 -78
  163. data/ext/libsass/docs/build-with-makefiles.md +0 -68
  164. data/ext/libsass/docs/build-with-mingw.md +0 -107
  165. data/ext/libsass/docs/build-with-visual-studio.md +0 -90
  166. data/ext/libsass/docs/build.md +0 -97
  167. data/ext/libsass/docs/compatibility-plan.md +0 -48
  168. data/ext/libsass/docs/contributing.md +0 -17
  169. data/ext/libsass/docs/custom-functions-internal.md +0 -122
  170. data/ext/libsass/docs/dev-ast-memory.md +0 -223
  171. data/ext/libsass/docs/implementations.md +0 -56
  172. data/ext/libsass/docs/plugins.md +0 -47
  173. data/ext/libsass/docs/setup-environment.md +0 -68
  174. data/ext/libsass/docs/source-map-internals.md +0 -51
  175. data/ext/libsass/docs/trace.md +0 -26
  176. data/ext/libsass/docs/triage.md +0 -17
  177. data/ext/libsass/docs/unicode.md +0 -39
  178. data/ext/libsass/extconf.rb +0 -6
  179. data/ext/libsass/script/bootstrap +0 -13
  180. data/ext/libsass/script/branding +0 -10
  181. data/ext/libsass/script/ci-build-libsass +0 -134
  182. data/ext/libsass/script/ci-build-plugin +0 -62
  183. data/ext/libsass/script/ci-install-compiler +0 -6
  184. data/ext/libsass/script/ci-install-deps +0 -20
  185. data/ext/libsass/script/ci-report-coverage +0 -42
  186. data/ext/libsass/script/spec +0 -5
  187. data/ext/libsass/script/tap-driver +0 -652
  188. data/ext/libsass/script/tap-runner +0 -1
  189. data/ext/libsass/script/test-leaks.pl +0 -103
  190. data/ext/libsass/src/functions.cpp +0 -2234
  191. data/ext/libsass/src/functions.hpp +0 -198
  192. data/ext/libsass/src/to_c.hpp +0 -39
  193. data/ext/libsass/test/test_node.cpp +0 -94
  194. data/ext/libsass/test/test_paths.cpp +0 -28
  195. data/ext/libsass/test/test_selector_difference.cpp +0 -25
  196. data/ext/libsass/test/test_specificity.cpp +0 -25
  197. data/ext/libsass/test/test_subset_map.cpp +0 -472
  198. data/ext/libsass/test/test_superselector.cpp +0 -69
  199. data/ext/libsass/test/test_unification.cpp +0 -31
  200. data/lib/tasks/libsass.rb +0 -33
@@ -1,4 +1,7 @@
1
+ // sass.hpp must go before all system headers to get the
2
+ // __EXTENSIONS__ fix on Solaris.
1
3
  #include "sass.hpp"
4
+
2
5
  #include <cstring>
3
6
  #include <stdexcept>
4
7
  #include <sstream>
@@ -67,23 +70,23 @@ namespace Sass {
67
70
  }
68
71
 
69
72
  // now create the code trace (ToDo: maybe have util functions?)
70
- if (e.pstate.line != std::string::npos && e.pstate.column != std::string::npos) {
73
+ if (e.pstate.line != std::string::npos &&
74
+ e.pstate.column != std::string::npos &&
75
+ e.pstate.src != nullptr) {
71
76
  size_t lines = e.pstate.line;
72
- const char* line_beg = e.pstate.src;
73
77
  // scan through src until target line
74
78
  // move line_beg pointer to line start
75
- while (line_beg && *line_beg && lines != 0) {
79
+ const char* line_beg;
80
+ for (line_beg = e.pstate.src; *line_beg != '\0'; ++line_beg) {
81
+ if (lines == 0) break;
76
82
  if (*line_beg == '\n') --lines;
77
- utf8::unchecked::next(line_beg);
78
83
  }
79
- const char* line_end = line_beg;
80
84
  // move line_end before next newline character
81
- while (line_end && *line_end && *line_end != '\n') {
82
- if (*line_end == '\n') break;
83
- if (*line_end == '\r') break;
84
- utf8::unchecked::next(line_end);
85
+ const char* line_end;
86
+ for (line_end = line_beg; *line_end != '\0'; ++line_end) {
87
+ if (*line_end == '\n' || *line_end == '\r') break;
85
88
  }
86
- if (line_end && *line_end != 0) ++ line_end;
89
+ if (*line_end != '\0') ++line_end;
87
90
  size_t line_len = line_end - line_beg;
88
91
  size_t move_in = 0; size_t shorten = 0;
89
92
  size_t left_chars = 42; size_t max_chars = 76;
@@ -212,7 +215,7 @@ namespace Sass {
212
215
  {
213
216
 
214
217
  // assert valid pointer
215
- if (compiler == 0) return 0;
218
+ if (compiler == 0) return {};
216
219
  // The cpp context must be set by now
217
220
  Context* cpp_ctx = compiler->cpp_ctx;
218
221
  Sass_Context* c_ctx = compiler->c_ctx;
@@ -233,7 +236,7 @@ namespace Sass {
233
236
  // dispatch parse call
234
237
  Block_Obj root(cpp_ctx->parse());
235
238
  // abort on errors
236
- if (!root) return 0;
239
+ if (!root) return {};
237
240
 
238
241
  // skip all prefixed files? (ToDo: check srcmap)
239
242
  // IMO source-maps should point to headers already
@@ -253,7 +256,7 @@ namespace Sass {
253
256
  catch (...) { handle_errors(c_ctx); }
254
257
 
255
258
  // error
256
- return 0;
259
+ return {};
257
260
 
258
261
  }
259
262
 
@@ -381,7 +384,7 @@ extern "C" {
381
384
 
382
385
  inline void init_options (struct Sass_Options* options)
383
386
  {
384
- options->precision = 5;
387
+ options->precision = 10;
385
388
  options->indent = " ";
386
389
  options->linefeed = LFEED;
387
390
  }
@@ -617,7 +620,7 @@ extern "C" {
617
620
  if (cpp_ctx) delete(cpp_ctx);
618
621
  compiler->cpp_ctx = NULL;
619
622
  compiler->c_ctx = NULL;
620
- compiler->root = NULL;
623
+ compiler->root = {};
621
624
  free(compiler);
622
625
  }
623
626
 
@@ -1,4 +1,7 @@
1
+ // sass.hpp must go before all system headers to get the
2
+ // __EXTENSIONS__ fix on Solaris.
1
3
  #include "sass.hpp"
4
+
2
5
  #include <cstring>
3
6
  #include "util.hpp"
4
7
  #include "context.hpp"
@@ -167,21 +170,21 @@ extern "C" {
167
170
 
168
171
  // Getters and Setters for environments (lexical, local and global)
169
172
  union Sass_Value* ADDCALL sass_env_get_lexical (Sass_Env_Frame env, const char* name) {
170
- Expression_Ptr ex = Cast<Expression>((*env->frame)[name]);
173
+ Expression* ex = Cast<Expression>((*env->frame)[name]);
171
174
  return ex != NULL ? ast_node_to_sass_value(ex) : NULL;
172
175
  }
173
176
  void ADDCALL sass_env_set_lexical (Sass_Env_Frame env, const char* name, union Sass_Value* val) {
174
177
  (*env->frame)[name] = sass_value_to_ast_node(val);
175
178
  }
176
179
  union Sass_Value* ADDCALL sass_env_get_local (Sass_Env_Frame env, const char* name) {
177
- Expression_Ptr ex = Cast<Expression>(env->frame->get_local(name));
180
+ Expression* ex = Cast<Expression>(env->frame->get_local(name));
178
181
  return ex != NULL ? ast_node_to_sass_value(ex) : NULL;
179
182
  }
180
183
  void ADDCALL sass_env_set_local (Sass_Env_Frame env, const char* name, union Sass_Value* val) {
181
184
  env->frame->set_local(name, sass_value_to_ast_node(val));
182
185
  }
183
186
  union Sass_Value* ADDCALL sass_env_get_global (Sass_Env_Frame env, const char* name) {
184
- Expression_Ptr ex = Cast<Expression>(env->frame->get_global(name));
187
+ Expression* ex = Cast<Expression>(env->frame->get_global(name));
185
188
  return ex != NULL ? ast_node_to_sass_value(ex) : NULL;
186
189
  }
187
190
  void ADDCALL sass_env_set_global (Sass_Env_Frame env, const char* name, union Sass_Value* val) {
@@ -3,7 +3,7 @@
3
3
 
4
4
  #include "sass.h"
5
5
  #include "environment.hpp"
6
- #include "functions.hpp"
6
+ #include "fn_utils.hpp"
7
7
 
8
8
  // Struct to hold custom function callback
9
9
  struct Sass_Function {
@@ -1,4 +1,7 @@
1
+ // sass.hpp must go before all system headers to get the
2
+ // __EXTENSIONS__ fix on Solaris.
1
3
  #include "sass.hpp"
4
+
2
5
  #include "node.hpp"
3
6
 
4
7
  namespace Sass {
@@ -1,4 +1,7 @@
1
+ // sass.hpp must go before all system headers to get the
2
+ // __EXTENSIONS__ fix on Solaris.
1
3
  #include "sass.hpp"
4
+
2
5
  #include <cstdlib>
3
6
  #include <cstring>
4
7
  #include "util.hpp"
@@ -290,7 +293,7 @@ extern "C" {
290
293
  union Sass_Value* ADDCALL sass_value_op (enum Sass_OP op, const union Sass_Value* a, const union Sass_Value* b)
291
294
  {
292
295
 
293
- Sass::Value_Ptr rv;
296
+ Sass::Value_Obj rv;
294
297
 
295
298
  try {
296
299
 
@@ -312,28 +315,34 @@ extern "C" {
312
315
  }
313
316
 
314
317
  if (sass_value_is_number(a) && sass_value_is_number(b)) {
315
- Number_Ptr_Const l_n = Cast<Number>(lhs);
316
- Number_Ptr_Const r_n = Cast<Number>(rhs);
318
+ const Number* l_n = Cast<Number>(lhs);
319
+ const Number* r_n = Cast<Number>(rhs);
317
320
  rv = Operators::op_numbers(op, *l_n, *r_n, options, l_n->pstate());
318
321
  }
319
322
  else if (sass_value_is_number(a) && sass_value_is_color(a)) {
320
- Number_Ptr_Const l_n = Cast<Number>(lhs);
321
- Color_Ptr_Const r_c = Cast<Color>(rhs);
323
+ const Number* l_n = Cast<Number>(lhs);
324
+ // Direct HSLA operations are not supported
325
+ // All color maths will be deprecated anyway
326
+ Color_RGBA_Obj r_c = Cast<Color>(rhs)->toRGBA();
322
327
  rv = Operators::op_number_color(op, *l_n, *r_c, options, l_n->pstate());
323
328
  }
324
329
  else if (sass_value_is_color(a) && sass_value_is_number(b)) {
325
- Color_Ptr_Const l_c = Cast<Color>(lhs);
326
- Number_Ptr_Const r_n = Cast<Number>(rhs);
330
+ // Direct HSLA operations are not supported
331
+ // All color maths will be deprecated anyway
332
+ Color_RGBA_Obj l_c = Cast<Color>(lhs)->toRGBA();
333
+ const Number* r_n = Cast<Number>(rhs);
327
334
  rv = Operators::op_color_number(op, *l_c, *r_n, options, l_c->pstate());
328
335
  }
329
336
  else if (sass_value_is_color(a) && sass_value_is_color(b)) {
330
- Color_Ptr_Const l_c = Cast<Color>(lhs);
331
- Color_Ptr_Const r_c = Cast<Color>(rhs);
337
+ // Direct HSLA operations are not supported
338
+ // All color maths will be deprecated anyway
339
+ Color_RGBA_Obj l_c = Cast<Color>(lhs)->toRGBA();
340
+ Color_RGBA_Obj r_c = Cast<Color>(rhs)->toRGBA();
332
341
  rv = Operators::op_colors(op, *l_c, *r_c, options, l_c->pstate());
333
342
  }
334
343
  else /* convert other stuff to string and apply operation */ {
335
- Value_Ptr l_v = Cast<Value>(lhs);
336
- Value_Ptr r_v = Cast<Value>(rhs);
344
+ Value* l_v = Cast<Value>(lhs);
345
+ Value* r_v = Cast<Value>(rhs);
337
346
  rv = Operators::op_strings(op, *l_v, *r_v, options, l_v->pstate());
338
347
  }
339
348
 
@@ -341,8 +350,7 @@ extern "C" {
341
350
  if (!rv) return sass_make_error("invalid return value");
342
351
 
343
352
  // convert result back to ast node
344
- return ast_node_to_sass_value(rv);
345
-
353
+ return ast_node_to_sass_value(rv.ptr());
346
354
  }
347
355
 
348
356
  // simply pass the error message back to the caller for now
@@ -1,4 +1,7 @@
1
+ // sass.hpp must go before all system headers to get the
2
+ // __EXTENSIONS__ fix on Solaris.
1
3
  #include "sass.hpp"
4
+
2
5
  #include <string>
3
6
  #include <sstream>
4
7
  #include <iostream>
@@ -170,12 +173,12 @@ namespace Sass {
170
173
  current_position += offset;
171
174
  }
172
175
 
173
- void SourceMap::add_open_mapping(const AST_Node_Ptr node)
176
+ void SourceMap::add_open_mapping(const AST_Node* node)
174
177
  {
175
178
  mappings.push_back(Mapping(node->pstate(), current_position));
176
179
  }
177
180
 
178
- void SourceMap::add_close_mapping(const AST_Node_Ptr node)
181
+ void SourceMap::add_close_mapping(const AST_Node* node)
179
182
  {
180
183
  mappings.push_back(Mapping(node->pstate() + node->pstate().offset, current_position));
181
184
  }
@@ -28,8 +28,8 @@ namespace Sass {
28
28
  void prepend(const Offset& offset);
29
29
  void append(const OutputBuffer& out);
30
30
  void prepend(const OutputBuffer& out);
31
- void add_open_mapping(const AST_Node_Ptr node);
32
- void add_close_mapping(const AST_Node_Ptr node);
31
+ void add_open_mapping(const AST_Node* node);
32
+ void add_close_mapping(const AST_Node* node);
33
33
 
34
34
  std::string render_srcmap(Context &ctx);
35
35
  ParserState remap(const ParserState& pstate);
@@ -1,4 +1,7 @@
1
+ // sass.hpp must go before all system headers to get the
2
+ // __EXTENSIONS__ fix on Solaris.
1
3
  #include "sass.hpp"
4
+
2
5
  #include "ast.hpp"
3
6
  #include "subset_map.hpp"
4
7
 
@@ -52,4 +55,4 @@ namespace Sass {
52
55
  return get_kv(sel);
53
56
  }
54
57
 
55
- }
58
+ }
@@ -1,60 +1,62 @@
1
+ // sass.hpp must go before all system headers to get the
2
+ // __EXTENSIONS__ fix on Solaris.
1
3
  #include "sass.hpp"
4
+
2
5
  #include "ast.hpp"
3
6
  #include "to_value.hpp"
4
7
 
5
8
  namespace Sass {
6
9
 
7
- Value_Ptr To_Value::fallback_impl(AST_Node_Ptr n)
8
- {
9
- // throw a runtime error if this happens
10
- // we want a well defined set of possible nodes
11
- throw std::runtime_error("invalid node for to_value");
12
- }
13
-
14
10
  // Custom_Error is a valid value
15
- Value_Ptr To_Value::operator()(Custom_Error_Ptr e)
11
+ Value* To_Value::operator()(Custom_Error* e)
16
12
  {
17
13
  return e;
18
14
  }
19
15
 
20
16
  // Custom_Warning is a valid value
21
- Value_Ptr To_Value::operator()(Custom_Warning_Ptr w)
17
+ Value* To_Value::operator()(Custom_Warning* w)
22
18
  {
23
19
  return w;
24
20
  }
25
21
 
26
22
  // Boolean is a valid value
27
- Value_Ptr To_Value::operator()(Boolean_Ptr b)
23
+ Value* To_Value::operator()(Boolean* b)
28
24
  {
29
25
  return b;
30
26
  }
31
27
 
32
28
  // Number is a valid value
33
- Value_Ptr To_Value::operator()(Number_Ptr n)
29
+ Value* To_Value::operator()(Number* n)
34
30
  {
35
31
  return n;
36
32
  }
37
33
 
38
34
  // Color is a valid value
39
- Value_Ptr To_Value::operator()(Color_Ptr c)
35
+ Value* To_Value::operator()(Color_RGBA* c)
36
+ {
37
+ return c;
38
+ }
39
+
40
+ // Color is a valid value
41
+ Value* To_Value::operator()(Color_HSLA* c)
40
42
  {
41
43
  return c;
42
44
  }
43
45
 
44
46
  // String_Constant is a valid value
45
- Value_Ptr To_Value::operator()(String_Constant_Ptr s)
47
+ Value* To_Value::operator()(String_Constant* s)
46
48
  {
47
49
  return s;
48
50
  }
49
51
 
50
52
  // String_Quoted is a valid value
51
- Value_Ptr To_Value::operator()(String_Quoted_Ptr s)
53
+ Value* To_Value::operator()(String_Quoted* s)
52
54
  {
53
55
  return s;
54
56
  }
55
57
 
56
58
  // List is a valid value
57
- Value_Ptr To_Value::operator()(List_Ptr l)
59
+ Value* To_Value::operator()(List* l)
58
60
  {
59
61
  List_Obj ll = SASS_MEMORY_NEW(List,
60
62
  l->pstate(),
@@ -69,32 +71,32 @@ namespace Sass {
69
71
  }
70
72
 
71
73
  // Map is a valid value
72
- Value_Ptr To_Value::operator()(Map_Ptr m)
74
+ Value* To_Value::operator()(Map* m)
73
75
  {
74
76
  return m;
75
77
  }
76
78
 
77
79
  // Null is a valid value
78
- Value_Ptr To_Value::operator()(Null_Ptr n)
80
+ Value* To_Value::operator()(Null* n)
79
81
  {
80
82
  return n;
81
83
  }
82
84
 
83
85
  // Function is a valid value
84
- Value_Ptr To_Value::operator()(Function_Ptr n)
86
+ Value* To_Value::operator()(Function* n)
85
87
  {
86
88
  return n;
87
89
  }
88
90
 
89
91
  // Argument returns its value
90
- Value_Ptr To_Value::operator()(Argument_Ptr arg)
92
+ Value* To_Value::operator()(Argument* arg)
91
93
  {
92
94
  if (!arg->name().empty()) return 0;
93
95
  return arg->value()->perform(this);
94
96
  }
95
97
 
96
98
  // Selector_List is converted to a string
97
- Value_Ptr To_Value::operator()(Selector_List_Ptr s)
99
+ Value* To_Value::operator()(Selector_List* s)
98
100
  {
99
101
  return SASS_MEMORY_NEW(String_Quoted,
100
102
  s->pstate(),
@@ -102,7 +104,7 @@ namespace Sass {
102
104
  }
103
105
 
104
106
  // Binary_Expression is converted to a string
105
- Value_Ptr To_Value::operator()(Binary_Expression_Ptr s)
107
+ Value* To_Value::operator()(Binary_Expression* s)
106
108
  {
107
109
  return SASS_MEMORY_NEW(String_Quoted,
108
110
  s->pstate(),
@@ -7,9 +7,7 @@
7
7
 
8
8
  namespace Sass {
9
9
 
10
- class To_Value : public Operation_CRTP<Value_Ptr, To_Value> {
11
-
12
- Value_Ptr fallback_impl(AST_Node_Ptr n);
10
+ class To_Value : public Operation_CRTP<Value*, To_Value> {
13
11
 
14
12
  private:
15
13
 
@@ -21,28 +19,26 @@ namespace Sass {
21
19
  : ctx(ctx)
22
20
  { }
23
21
  ~To_Value() { }
24
- using Operation<Value_Ptr>::operator();
25
-
26
- Value_Ptr operator()(Argument_Ptr);
27
- Value_Ptr operator()(Boolean_Ptr);
28
- Value_Ptr operator()(Number_Ptr);
29
- Value_Ptr operator()(Color_Ptr);
30
- Value_Ptr operator()(String_Constant_Ptr);
31
- Value_Ptr operator()(String_Quoted_Ptr);
32
- Value_Ptr operator()(Custom_Warning_Ptr);
33
- Value_Ptr operator()(Custom_Error_Ptr);
34
- Value_Ptr operator()(List_Ptr);
35
- Value_Ptr operator()(Map_Ptr);
36
- Value_Ptr operator()(Null_Ptr);
37
- Value_Ptr operator()(Function_Ptr);
22
+ using Operation<Value*>::operator();
23
+
24
+ Value* operator()(Argument*);
25
+ Value* operator()(Boolean*);
26
+ Value* operator()(Number*);
27
+ Value* operator()(Color_RGBA*);
28
+ Value* operator()(Color_HSLA*);
29
+ Value* operator()(String_Constant*);
30
+ Value* operator()(String_Quoted*);
31
+ Value* operator()(Custom_Warning*);
32
+ Value* operator()(Custom_Error*);
33
+ Value* operator()(List*);
34
+ Value* operator()(Map*);
35
+ Value* operator()(Null*);
36
+ Value* operator()(Function*);
38
37
 
39
38
  // convert to string via `To_String`
40
- Value_Ptr operator()(Selector_List_Ptr);
41
- Value_Ptr operator()(Binary_Expression_Ptr);
39
+ Value* operator()(Selector_List*);
40
+ Value* operator()(Binary_Expression*);
42
41
 
43
- // fallback throws error
44
- template <typename U>
45
- Value_Ptr fallback(U x) { return fallback_impl(x); }
46
42
  };
47
43
 
48
44
  }
@@ -266,6 +266,10 @@ namespace Sass {
266
266
  return (numerators == rhs.numerators) &&
267
267
  (denominators == rhs.denominators);
268
268
  }
269
+ bool Units::operator!= (const Units& rhs) const
270
+ {
271
+ return ! (*this == rhs);
272
+ }
269
273
 
270
274
  double Units::normalize()
271
275
  {