sassc 2.0.0 → 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 (260) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.gitmodules +1 -1
  4. data/.travis.yml +9 -3
  5. data/CHANGELOG.md +36 -0
  6. data/CODE_OF_CONDUCT.md +1 -1
  7. data/README.md +1 -1
  8. data/Rakefile +43 -7
  9. data/ext/depend +4 -0
  10. data/ext/extconf.rb +92 -0
  11. data/ext/libsass/VERSION +1 -0
  12. data/ext/libsass/include/sass/base.h +9 -1
  13. data/ext/libsass/include/sass/context.h +5 -1
  14. data/ext/libsass/src/MurmurHash2.hpp +91 -0
  15. data/ext/libsass/src/ast.cpp +755 -2028
  16. data/ext/libsass/src/ast.hpp +492 -2477
  17. data/ext/libsass/src/{to_c.cpp → ast2c.cpp} +22 -16
  18. data/ext/libsass/src/ast2c.hpp +39 -0
  19. data/ext/libsass/src/ast_def_macros.hpp +70 -10
  20. data/ext/libsass/src/ast_fwd_decl.cpp +5 -3
  21. data/ext/libsass/src/ast_fwd_decl.hpp +107 -296
  22. data/ext/libsass/src/ast_helpers.hpp +292 -0
  23. data/ext/libsass/src/ast_sel_cmp.cpp +396 -0
  24. data/ext/libsass/src/ast_sel_super.cpp +539 -0
  25. data/ext/libsass/src/ast_sel_unify.cpp +275 -0
  26. data/ext/libsass/src/ast_sel_weave.cpp +616 -0
  27. data/ext/libsass/src/ast_selectors.cpp +1043 -0
  28. data/ext/libsass/src/ast_selectors.hpp +522 -0
  29. data/ext/libsass/src/ast_supports.cpp +114 -0
  30. data/ext/libsass/src/ast_supports.hpp +121 -0
  31. data/ext/libsass/src/ast_values.cpp +1154 -0
  32. data/ext/libsass/src/ast_values.hpp +498 -0
  33. data/ext/libsass/src/backtrace.cpp +11 -7
  34. data/ext/libsass/src/backtrace.hpp +5 -5
  35. data/ext/libsass/src/base64vlq.cpp +5 -2
  36. data/ext/libsass/src/base64vlq.hpp +1 -1
  37. data/ext/libsass/src/bind.cpp +35 -34
  38. data/ext/libsass/src/bind.hpp +3 -1
  39. data/ext/libsass/src/c2ast.cpp +64 -0
  40. data/ext/libsass/src/c2ast.hpp +14 -0
  41. data/ext/libsass/src/cencode.c +4 -6
  42. data/ext/libsass/src/check_nesting.cpp +83 -88
  43. data/ext/libsass/src/check_nesting.hpp +39 -34
  44. data/ext/libsass/src/color_maps.cpp +168 -164
  45. data/ext/libsass/src/color_maps.hpp +152 -160
  46. data/ext/libsass/src/constants.cpp +20 -0
  47. data/ext/libsass/src/constants.hpp +19 -0
  48. data/ext/libsass/src/context.cpp +104 -121
  49. data/ext/libsass/src/context.hpp +43 -55
  50. data/ext/libsass/src/cssize.cpp +103 -188
  51. data/ext/libsass/src/cssize.hpp +45 -51
  52. data/ext/libsass/src/dart_helpers.hpp +199 -0
  53. data/ext/libsass/src/debugger.hpp +524 -361
  54. data/ext/libsass/src/emitter.cpp +26 -26
  55. data/ext/libsass/src/emitter.hpp +20 -18
  56. data/ext/libsass/src/environment.cpp +41 -27
  57. data/ext/libsass/src/environment.hpp +33 -22
  58. data/ext/libsass/src/error_handling.cpp +92 -94
  59. data/ext/libsass/src/error_handling.hpp +73 -50
  60. data/ext/libsass/src/eval.cpp +380 -515
  61. data/ext/libsass/src/eval.hpp +64 -57
  62. data/ext/libsass/src/eval_selectors.cpp +75 -0
  63. data/ext/libsass/src/expand.cpp +322 -263
  64. data/ext/libsass/src/expand.hpp +55 -39
  65. data/ext/libsass/src/extender.cpp +1188 -0
  66. data/ext/libsass/src/extender.hpp +399 -0
  67. data/ext/libsass/src/extension.cpp +43 -0
  68. data/ext/libsass/src/extension.hpp +89 -0
  69. data/ext/libsass/src/file.cpp +134 -88
  70. data/ext/libsass/src/file.hpp +28 -37
  71. data/ext/libsass/src/fn_colors.cpp +596 -0
  72. data/ext/libsass/src/fn_colors.hpp +85 -0
  73. data/ext/libsass/src/fn_lists.cpp +285 -0
  74. data/ext/libsass/src/fn_lists.hpp +34 -0
  75. data/ext/libsass/src/fn_maps.cpp +94 -0
  76. data/ext/libsass/src/fn_maps.hpp +30 -0
  77. data/ext/libsass/src/fn_miscs.cpp +244 -0
  78. data/ext/libsass/src/fn_miscs.hpp +40 -0
  79. data/ext/libsass/src/fn_numbers.cpp +227 -0
  80. data/ext/libsass/src/fn_numbers.hpp +45 -0
  81. data/ext/libsass/src/fn_selectors.cpp +205 -0
  82. data/ext/libsass/src/fn_selectors.hpp +35 -0
  83. data/ext/libsass/src/fn_strings.cpp +268 -0
  84. data/ext/libsass/src/fn_strings.hpp +34 -0
  85. data/ext/libsass/src/fn_utils.cpp +158 -0
  86. data/ext/libsass/src/fn_utils.hpp +62 -0
  87. data/ext/libsass/src/inspect.cpp +253 -266
  88. data/ext/libsass/src/inspect.hpp +72 -74
  89. data/ext/libsass/src/json.cpp +2 -2
  90. data/ext/libsass/src/lexer.cpp +25 -84
  91. data/ext/libsass/src/lexer.hpp +5 -16
  92. data/ext/libsass/src/listize.cpp +27 -43
  93. data/ext/libsass/src/listize.hpp +14 -11
  94. data/ext/libsass/src/mapping.hpp +1 -0
  95. data/ext/libsass/src/memory.hpp +12 -0
  96. data/ext/libsass/src/memory/allocator.cpp +48 -0
  97. data/ext/libsass/src/memory/allocator.hpp +138 -0
  98. data/ext/libsass/src/memory/config.hpp +20 -0
  99. data/ext/libsass/src/memory/memory_pool.hpp +186 -0
  100. data/ext/libsass/src/memory/shared_ptr.cpp +33 -0
  101. data/ext/libsass/src/memory/shared_ptr.hpp +332 -0
  102. data/ext/libsass/src/operation.hpp +193 -143
  103. data/ext/libsass/src/operators.cpp +56 -29
  104. data/ext/libsass/src/operators.hpp +11 -11
  105. data/ext/libsass/src/ordered_map.hpp +112 -0
  106. data/ext/libsass/src/output.cpp +59 -75
  107. data/ext/libsass/src/output.hpp +15 -22
  108. data/ext/libsass/src/parser.cpp +662 -818
  109. data/ext/libsass/src/parser.hpp +96 -100
  110. data/ext/libsass/src/parser_selectors.cpp +189 -0
  111. data/ext/libsass/src/permutate.hpp +164 -0
  112. data/ext/libsass/src/plugins.cpp +12 -8
  113. data/ext/libsass/src/plugins.hpp +8 -8
  114. data/ext/libsass/src/position.cpp +10 -26
  115. data/ext/libsass/src/position.hpp +44 -21
  116. data/ext/libsass/src/prelexer.cpp +14 -8
  117. data/ext/libsass/src/prelexer.hpp +9 -9
  118. data/ext/libsass/src/remove_placeholders.cpp +59 -57
  119. data/ext/libsass/src/remove_placeholders.hpp +20 -18
  120. data/ext/libsass/src/sass.cpp +25 -18
  121. data/ext/libsass/src/sass.hpp +22 -14
  122. data/ext/libsass/src/sass2scss.cpp +49 -18
  123. data/ext/libsass/src/sass_context.cpp +104 -132
  124. data/ext/libsass/src/sass_context.hpp +2 -2
  125. data/ext/libsass/src/sass_functions.cpp +7 -4
  126. data/ext/libsass/src/sass_functions.hpp +1 -1
  127. data/ext/libsass/src/sass_values.cpp +26 -21
  128. data/ext/libsass/src/settings.hpp +19 -0
  129. data/ext/libsass/src/source.cpp +69 -0
  130. data/ext/libsass/src/source.hpp +95 -0
  131. data/ext/libsass/src/source_data.hpp +32 -0
  132. data/ext/libsass/src/source_map.cpp +27 -20
  133. data/ext/libsass/src/source_map.hpp +14 -11
  134. data/ext/libsass/src/stylesheet.cpp +22 -0
  135. data/ext/libsass/src/stylesheet.hpp +57 -0
  136. data/ext/libsass/src/to_value.cpp +24 -22
  137. data/ext/libsass/src/to_value.hpp +18 -22
  138. data/ext/libsass/src/units.cpp +28 -22
  139. data/ext/libsass/src/units.hpp +9 -8
  140. data/ext/libsass/src/utf8/checked.h +12 -10
  141. data/ext/libsass/src/utf8/core.h +3 -0
  142. data/ext/libsass/src/utf8_string.cpp +12 -10
  143. data/ext/libsass/src/utf8_string.hpp +7 -6
  144. data/ext/libsass/src/util.cpp +97 -107
  145. data/ext/libsass/src/util.hpp +74 -30
  146. data/ext/libsass/src/util_string.cpp +125 -0
  147. data/ext/libsass/src/util_string.hpp +73 -0
  148. data/ext/libsass/src/values.cpp +33 -24
  149. data/ext/libsass/src/values.hpp +2 -2
  150. data/lib/sassc.rb +24 -0
  151. data/lib/sassc/engine.rb +7 -5
  152. data/lib/sassc/functions_handler.rb +11 -13
  153. data/lib/sassc/native.rb +10 -9
  154. data/lib/sassc/native/native_functions_api.rb +0 -5
  155. data/lib/sassc/script.rb +4 -6
  156. data/lib/sassc/version.rb +1 -1
  157. data/sassc.gemspec +32 -12
  158. data/test/engine_test.rb +32 -2
  159. data/test/functions_test.rb +38 -1
  160. data/test/native_test.rb +4 -4
  161. metadata +95 -109
  162. data/ext/Rakefile +0 -3
  163. data/ext/libsass/.editorconfig +0 -15
  164. data/ext/libsass/.gitattributes +0 -2
  165. data/ext/libsass/.github/CONTRIBUTING.md +0 -65
  166. data/ext/libsass/.github/ISSUE_TEMPLATE.md +0 -54
  167. data/ext/libsass/.gitignore +0 -85
  168. data/ext/libsass/.travis.yml +0 -64
  169. data/ext/libsass/COPYING +0 -25
  170. data/ext/libsass/GNUmakefile.am +0 -88
  171. data/ext/libsass/INSTALL +0 -1
  172. data/ext/libsass/LICENSE +0 -25
  173. data/ext/libsass/Makefile +0 -351
  174. data/ext/libsass/Makefile.conf +0 -55
  175. data/ext/libsass/Readme.md +0 -104
  176. data/ext/libsass/SECURITY.md +0 -10
  177. data/ext/libsass/appveyor.yml +0 -91
  178. data/ext/libsass/configure.ac +0 -138
  179. data/ext/libsass/contrib/libsass.spec +0 -66
  180. data/ext/libsass/docs/README.md +0 -20
  181. data/ext/libsass/docs/api-context-example.md +0 -45
  182. data/ext/libsass/docs/api-context-internal.md +0 -163
  183. data/ext/libsass/docs/api-context.md +0 -295
  184. data/ext/libsass/docs/api-doc.md +0 -215
  185. data/ext/libsass/docs/api-function-example.md +0 -67
  186. data/ext/libsass/docs/api-function-internal.md +0 -8
  187. data/ext/libsass/docs/api-function.md +0 -74
  188. data/ext/libsass/docs/api-importer-example.md +0 -112
  189. data/ext/libsass/docs/api-importer-internal.md +0 -20
  190. data/ext/libsass/docs/api-importer.md +0 -86
  191. data/ext/libsass/docs/api-value-example.md +0 -55
  192. data/ext/libsass/docs/api-value-internal.md +0 -76
  193. data/ext/libsass/docs/api-value.md +0 -154
  194. data/ext/libsass/docs/build-on-darwin.md +0 -27
  195. data/ext/libsass/docs/build-on-gentoo.md +0 -55
  196. data/ext/libsass/docs/build-on-windows.md +0 -139
  197. data/ext/libsass/docs/build-shared-library.md +0 -35
  198. data/ext/libsass/docs/build-with-autotools.md +0 -78
  199. data/ext/libsass/docs/build-with-makefiles.md +0 -68
  200. data/ext/libsass/docs/build-with-mingw.md +0 -107
  201. data/ext/libsass/docs/build-with-visual-studio.md +0 -90
  202. data/ext/libsass/docs/build.md +0 -97
  203. data/ext/libsass/docs/compatibility-plan.md +0 -48
  204. data/ext/libsass/docs/contributing.md +0 -17
  205. data/ext/libsass/docs/custom-functions-internal.md +0 -122
  206. data/ext/libsass/docs/dev-ast-memory.md +0 -223
  207. data/ext/libsass/docs/implementations.md +0 -56
  208. data/ext/libsass/docs/plugins.md +0 -47
  209. data/ext/libsass/docs/setup-environment.md +0 -68
  210. data/ext/libsass/docs/source-map-internals.md +0 -51
  211. data/ext/libsass/docs/trace.md +0 -26
  212. data/ext/libsass/docs/triage.md +0 -17
  213. data/ext/libsass/docs/unicode.md +0 -39
  214. data/ext/libsass/extconf.rb +0 -6
  215. data/ext/libsass/include/sass/version.h.in +0 -12
  216. data/ext/libsass/m4/.gitkeep +0 -0
  217. data/ext/libsass/m4/m4-ax_cxx_compile_stdcxx_11.m4 +0 -167
  218. data/ext/libsass/res/resource.rc +0 -35
  219. data/ext/libsass/script/bootstrap +0 -13
  220. data/ext/libsass/script/branding +0 -10
  221. data/ext/libsass/script/ci-build-libsass +0 -134
  222. data/ext/libsass/script/ci-build-plugin +0 -62
  223. data/ext/libsass/script/ci-install-compiler +0 -6
  224. data/ext/libsass/script/ci-install-deps +0 -20
  225. data/ext/libsass/script/ci-report-coverage +0 -42
  226. data/ext/libsass/script/spec +0 -5
  227. data/ext/libsass/script/tap-driver +0 -652
  228. data/ext/libsass/script/tap-runner +0 -1
  229. data/ext/libsass/script/test-leaks.pl +0 -103
  230. data/ext/libsass/src/GNUmakefile.am +0 -54
  231. data/ext/libsass/src/extend.cpp +0 -2130
  232. data/ext/libsass/src/extend.hpp +0 -86
  233. data/ext/libsass/src/functions.cpp +0 -2234
  234. data/ext/libsass/src/functions.hpp +0 -198
  235. data/ext/libsass/src/memory/SharedPtr.cpp +0 -114
  236. data/ext/libsass/src/memory/SharedPtr.hpp +0 -206
  237. data/ext/libsass/src/node.cpp +0 -319
  238. data/ext/libsass/src/node.hpp +0 -118
  239. data/ext/libsass/src/paths.hpp +0 -71
  240. data/ext/libsass/src/sass_util.cpp +0 -149
  241. data/ext/libsass/src/sass_util.hpp +0 -256
  242. data/ext/libsass/src/subset_map.cpp +0 -55
  243. data/ext/libsass/src/subset_map.hpp +0 -76
  244. data/ext/libsass/src/support/libsass.pc.in +0 -11
  245. data/ext/libsass/src/to_c.hpp +0 -39
  246. data/ext/libsass/test/test_node.cpp +0 -94
  247. data/ext/libsass/test/test_paths.cpp +0 -28
  248. data/ext/libsass/test/test_selector_difference.cpp +0 -25
  249. data/ext/libsass/test/test_specificity.cpp +0 -25
  250. data/ext/libsass/test/test_subset_map.cpp +0 -472
  251. data/ext/libsass/test/test_superselector.cpp +0 -69
  252. data/ext/libsass/test/test_unification.cpp +0 -31
  253. data/ext/libsass/version.sh +0 -10
  254. data/ext/libsass/win/libsass.sln +0 -39
  255. data/ext/libsass/win/libsass.sln.DotSettings +0 -9
  256. data/ext/libsass/win/libsass.targets +0 -118
  257. data/ext/libsass/win/libsass.vcxproj +0 -188
  258. data/ext/libsass/win/libsass.vcxproj.filters +0 -357
  259. data/lib/sassc/native/lib_c.rb +0 -21
  260. data/lib/tasks/libsass.rb +0 -33
@@ -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[];
@@ -169,161 +161,161 @@ namespace Sass {
169
161
  }
170
162
 
171
163
  namespace Colors {
172
- extern const Color aliceblue;
173
- extern const Color antiquewhite;
174
- extern const Color cyan;
175
- extern const Color aqua;
176
- extern const Color aquamarine;
177
- extern const Color azure;
178
- extern const Color beige;
179
- extern const Color bisque;
180
- extern const Color black;
181
- extern const Color blanchedalmond;
182
- extern const Color blue;
183
- extern const Color blueviolet;
184
- extern const Color brown;
185
- extern const Color burlywood;
186
- extern const Color cadetblue;
187
- extern const Color chartreuse;
188
- extern const Color chocolate;
189
- extern const Color coral;
190
- extern const Color cornflowerblue;
191
- extern const Color cornsilk;
192
- extern const Color crimson;
193
- extern const Color darkblue;
194
- extern const Color darkcyan;
195
- extern const Color darkgoldenrod;
196
- extern const Color darkgray;
197
- extern const Color darkgrey;
198
- extern const Color darkgreen;
199
- extern const Color darkkhaki;
200
- extern const Color darkmagenta;
201
- extern const Color darkolivegreen;
202
- extern const Color darkorange;
203
- extern const Color darkorchid;
204
- extern const Color darkred;
205
- extern const Color darksalmon;
206
- extern const Color darkseagreen;
207
- extern const Color darkslateblue;
208
- extern const Color darkslategray;
209
- extern const Color darkslategrey;
210
- extern const Color darkturquoise;
211
- extern const Color darkviolet;
212
- extern const Color deeppink;
213
- extern const Color deepskyblue;
214
- extern const Color dimgray;
215
- extern const Color dimgrey;
216
- extern const Color dodgerblue;
217
- extern const Color firebrick;
218
- extern const Color floralwhite;
219
- extern const Color forestgreen;
220
- extern const Color magenta;
221
- extern const Color fuchsia;
222
- extern const Color gainsboro;
223
- extern const Color ghostwhite;
224
- extern const Color gold;
225
- extern const Color goldenrod;
226
- extern const Color gray;
227
- extern const Color grey;
228
- extern const Color green;
229
- extern const Color greenyellow;
230
- extern const Color honeydew;
231
- extern const Color hotpink;
232
- extern const Color indianred;
233
- extern const Color indigo;
234
- extern const Color ivory;
235
- extern const Color khaki;
236
- extern const Color lavender;
237
- extern const Color lavenderblush;
238
- extern const Color lawngreen;
239
- extern const Color lemonchiffon;
240
- extern const Color lightblue;
241
- extern const Color lightcoral;
242
- extern const Color lightcyan;
243
- extern const Color lightgoldenrodyellow;
244
- extern const Color lightgray;
245
- extern const Color lightgrey;
246
- extern const Color lightgreen;
247
- extern const Color lightpink;
248
- extern const Color lightsalmon;
249
- extern const Color lightseagreen;
250
- extern const Color lightskyblue;
251
- extern const Color lightslategray;
252
- extern const Color lightslategrey;
253
- extern const Color lightsteelblue;
254
- extern const Color lightyellow;
255
- extern const Color lime;
256
- extern const Color limegreen;
257
- extern const Color linen;
258
- extern const Color maroon;
259
- extern const Color mediumaquamarine;
260
- extern const Color mediumblue;
261
- extern const Color mediumorchid;
262
- extern const Color mediumpurple;
263
- extern const Color mediumseagreen;
264
- extern const Color mediumslateblue;
265
- extern const Color mediumspringgreen;
266
- extern const Color mediumturquoise;
267
- extern const Color mediumvioletred;
268
- extern const Color midnightblue;
269
- extern const Color mintcream;
270
- extern const Color mistyrose;
271
- extern const Color moccasin;
272
- extern const Color navajowhite;
273
- extern const Color navy;
274
- extern const Color oldlace;
275
- extern const Color olive;
276
- extern const Color olivedrab;
277
- extern const Color orange;
278
- extern const Color orangered;
279
- extern const Color orchid;
280
- extern const Color palegoldenrod;
281
- extern const Color palegreen;
282
- extern const Color paleturquoise;
283
- extern const Color palevioletred;
284
- extern const Color papayawhip;
285
- extern const Color peachpuff;
286
- extern const Color peru;
287
- extern const Color pink;
288
- extern const Color plum;
289
- extern const Color powderblue;
290
- extern const Color purple;
291
- extern const Color red;
292
- extern const Color rosybrown;
293
- extern const Color royalblue;
294
- extern const Color saddlebrown;
295
- extern const Color salmon;
296
- extern const Color sandybrown;
297
- extern const Color seagreen;
298
- extern const Color seashell;
299
- extern const Color sienna;
300
- extern const Color silver;
301
- extern const Color skyblue;
302
- extern const Color slateblue;
303
- extern const Color slategray;
304
- extern const Color slategrey;
305
- extern const Color snow;
306
- extern const Color springgreen;
307
- extern const Color steelblue;
308
- extern const Color tan;
309
- extern const Color teal;
310
- extern const Color thistle;
311
- extern const Color tomato;
312
- extern const Color turquoise;
313
- extern const Color violet;
314
- extern const Color wheat;
315
- extern const Color white;
316
- extern const Color whitesmoke;
317
- extern const Color yellow;
318
- extern const Color yellowgreen;
319
- extern const Color rebeccapurple;
320
- extern const Color transparent;
164
+ extern const Color_RGBA aliceblue;
165
+ extern const Color_RGBA antiquewhite;
166
+ extern const Color_RGBA cyan;
167
+ extern const Color_RGBA aqua;
168
+ extern const Color_RGBA aquamarine;
169
+ extern const Color_RGBA azure;
170
+ extern const Color_RGBA beige;
171
+ extern const Color_RGBA bisque;
172
+ extern const Color_RGBA black;
173
+ extern const Color_RGBA blanchedalmond;
174
+ extern const Color_RGBA blue;
175
+ extern const Color_RGBA blueviolet;
176
+ extern const Color_RGBA brown;
177
+ extern const Color_RGBA burlywood;
178
+ extern const Color_RGBA cadetblue;
179
+ extern const Color_RGBA chartreuse;
180
+ extern const Color_RGBA chocolate;
181
+ extern const Color_RGBA coral;
182
+ extern const Color_RGBA cornflowerblue;
183
+ extern const Color_RGBA cornsilk;
184
+ extern const Color_RGBA crimson;
185
+ extern const Color_RGBA darkblue;
186
+ extern const Color_RGBA darkcyan;
187
+ extern const Color_RGBA darkgoldenrod;
188
+ extern const Color_RGBA darkgray;
189
+ extern const Color_RGBA darkgrey;
190
+ extern const Color_RGBA darkgreen;
191
+ extern const Color_RGBA darkkhaki;
192
+ extern const Color_RGBA darkmagenta;
193
+ extern const Color_RGBA darkolivegreen;
194
+ extern const Color_RGBA darkorange;
195
+ extern const Color_RGBA darkorchid;
196
+ extern const Color_RGBA darkred;
197
+ extern const Color_RGBA darksalmon;
198
+ extern const Color_RGBA darkseagreen;
199
+ extern const Color_RGBA darkslateblue;
200
+ extern const Color_RGBA darkslategray;
201
+ extern const Color_RGBA darkslategrey;
202
+ extern const Color_RGBA darkturquoise;
203
+ extern const Color_RGBA darkviolet;
204
+ extern const Color_RGBA deeppink;
205
+ extern const Color_RGBA deepskyblue;
206
+ extern const Color_RGBA dimgray;
207
+ extern const Color_RGBA dimgrey;
208
+ extern const Color_RGBA dodgerblue;
209
+ extern const Color_RGBA firebrick;
210
+ extern const Color_RGBA floralwhite;
211
+ extern const Color_RGBA forestgreen;
212
+ extern const Color_RGBA magenta;
213
+ extern const Color_RGBA fuchsia;
214
+ extern const Color_RGBA gainsboro;
215
+ extern const Color_RGBA ghostwhite;
216
+ extern const Color_RGBA gold;
217
+ extern const Color_RGBA goldenrod;
218
+ extern const Color_RGBA gray;
219
+ extern const Color_RGBA grey;
220
+ extern const Color_RGBA green;
221
+ extern const Color_RGBA greenyellow;
222
+ extern const Color_RGBA honeydew;
223
+ extern const Color_RGBA hotpink;
224
+ extern const Color_RGBA indianred;
225
+ extern const Color_RGBA indigo;
226
+ extern const Color_RGBA ivory;
227
+ extern const Color_RGBA khaki;
228
+ extern const Color_RGBA lavender;
229
+ extern const Color_RGBA lavenderblush;
230
+ extern const Color_RGBA lawngreen;
231
+ extern const Color_RGBA lemonchiffon;
232
+ extern const Color_RGBA lightblue;
233
+ extern const Color_RGBA lightcoral;
234
+ extern const Color_RGBA lightcyan;
235
+ extern const Color_RGBA lightgoldenrodyellow;
236
+ extern const Color_RGBA lightgray;
237
+ extern const Color_RGBA lightgrey;
238
+ extern const Color_RGBA lightgreen;
239
+ extern const Color_RGBA lightpink;
240
+ extern const Color_RGBA lightsalmon;
241
+ extern const Color_RGBA lightseagreen;
242
+ extern const Color_RGBA lightskyblue;
243
+ extern const Color_RGBA lightslategray;
244
+ extern const Color_RGBA lightslategrey;
245
+ extern const Color_RGBA lightsteelblue;
246
+ extern const Color_RGBA lightyellow;
247
+ extern const Color_RGBA lime;
248
+ extern const Color_RGBA limegreen;
249
+ extern const Color_RGBA linen;
250
+ extern const Color_RGBA maroon;
251
+ extern const Color_RGBA mediumaquamarine;
252
+ extern const Color_RGBA mediumblue;
253
+ extern const Color_RGBA mediumorchid;
254
+ extern const Color_RGBA mediumpurple;
255
+ extern const Color_RGBA mediumseagreen;
256
+ extern const Color_RGBA mediumslateblue;
257
+ extern const Color_RGBA mediumspringgreen;
258
+ extern const Color_RGBA mediumturquoise;
259
+ extern const Color_RGBA mediumvioletred;
260
+ extern const Color_RGBA midnightblue;
261
+ extern const Color_RGBA mintcream;
262
+ extern const Color_RGBA mistyrose;
263
+ extern const Color_RGBA moccasin;
264
+ extern const Color_RGBA navajowhite;
265
+ extern const Color_RGBA navy;
266
+ extern const Color_RGBA oldlace;
267
+ extern const Color_RGBA olive;
268
+ extern const Color_RGBA olivedrab;
269
+ extern const Color_RGBA orange;
270
+ extern const Color_RGBA orangered;
271
+ extern const Color_RGBA orchid;
272
+ extern const Color_RGBA palegoldenrod;
273
+ extern const Color_RGBA palegreen;
274
+ extern const Color_RGBA paleturquoise;
275
+ extern const Color_RGBA palevioletred;
276
+ extern const Color_RGBA papayawhip;
277
+ extern const Color_RGBA peachpuff;
278
+ extern const Color_RGBA peru;
279
+ extern const Color_RGBA pink;
280
+ extern const Color_RGBA plum;
281
+ extern const Color_RGBA powderblue;
282
+ extern const Color_RGBA purple;
283
+ extern const Color_RGBA red;
284
+ extern const Color_RGBA rosybrown;
285
+ extern const Color_RGBA royalblue;
286
+ extern const Color_RGBA saddlebrown;
287
+ extern const Color_RGBA salmon;
288
+ extern const Color_RGBA sandybrown;
289
+ extern const Color_RGBA seagreen;
290
+ extern const Color_RGBA seashell;
291
+ extern const Color_RGBA sienna;
292
+ extern const Color_RGBA silver;
293
+ extern const Color_RGBA skyblue;
294
+ extern const Color_RGBA slateblue;
295
+ extern const Color_RGBA slategray;
296
+ extern const Color_RGBA slategrey;
297
+ extern const Color_RGBA snow;
298
+ extern const Color_RGBA springgreen;
299
+ extern const Color_RGBA steelblue;
300
+ extern const Color_RGBA tan;
301
+ extern const Color_RGBA teal;
302
+ extern const Color_RGBA thistle;
303
+ extern const Color_RGBA tomato;
304
+ extern const Color_RGBA turquoise;
305
+ extern const Color_RGBA violet;
306
+ extern const Color_RGBA wheat;
307
+ extern const Color_RGBA white;
308
+ extern const Color_RGBA whitesmoke;
309
+ extern const Color_RGBA yellow;
310
+ extern const Color_RGBA yellowgreen;
311
+ extern const Color_RGBA rebeccapurple;
312
+ extern const Color_RGBA transparent;
321
313
  }
322
314
 
323
- Color_Ptr_Const name_to_color(const char*);
324
- Color_Ptr_Const name_to_color(const std::string&);
315
+ const Color_RGBA* name_to_color(const char*);
316
+ const Color_RGBA* name_to_color(const sass::string&);
325
317
  const char* color_to_name(const int);
326
- const char* color_to_name(const Color&);
318
+ const char* color_to_name(const Color_RGBA&);
327
319
  const char* color_to_name(const double);
328
320
 
329
321
  }
@@ -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 "constants.hpp"
3
6
 
4
7
  namespace Sass {
@@ -18,6 +21,15 @@ namespace Sass {
18
21
  extern const unsigned long Specificity_Pseudo = 1000;
19
22
  extern const unsigned long Specificity_ID = 1000000;
20
23
 
24
+ extern const int UnificationOrder_Element = 1;
25
+ extern const int UnificationOrder_Id = 2;
26
+ extern const int UnificationOrder_Class = 2;
27
+ extern const int UnificationOrder_Attribute = 3;
28
+ extern const int UnificationOrder_PseudoClass = 4;
29
+ extern const int UnificationOrder_Wrapped = 5;
30
+ extern const int UnificationOrder_PseudoElement = 6;
31
+ extern const int UnificationOrder_Placeholder = 7;
32
+
21
33
  // sass keywords
22
34
  extern const char at_root_kwd[] = "@at-root";
23
35
  extern const char import_kwd[] = "@import";
@@ -33,6 +45,7 @@ namespace Sass {
33
45
  extern const char for_kwd[] = "@for";
34
46
  extern const char from_kwd[] = "from";
35
47
  extern const char to_kwd[] = "to";
48
+ extern const char of_kwd[] = "of";
36
49
  extern const char through_kwd[] = "through";
37
50
  extern const char each_kwd[] = "@each";
38
51
  extern const char in_kwd[] = "in";
@@ -116,6 +129,9 @@ namespace Sass {
116
129
  extern const char true_kwd[] = "true";
117
130
  extern const char false_kwd[] = "false";
118
131
 
132
+ // definition keywords
133
+ extern const char using_kwd[] = "using";
134
+
119
135
  // miscellaneous punctuation and delimiters
120
136
  extern const char percent_str[] = "%";
121
137
  extern const char empty_str[] = "";
@@ -146,6 +162,10 @@ namespace Sass {
146
162
  extern const char uri_chars[] = ":;/?!%&#@|[]{}'`^\"*+-.,_=~";
147
163
  extern const char real_uri_chars[] = "#%&";
148
164
 
165
+ extern const char selector_combinator_child[] = ">";
166
+ extern const char selector_combinator_general[] = "~";
167
+ extern const char selector_combinator_adjacent[] = "+";
168
+
149
169
  // some specific constant character classes
150
170
  // they must be static to be useable by lexer
151
171
  extern const char static_ops[] = "*/%";
@@ -18,6 +18,16 @@ namespace Sass {
18
18
  extern const unsigned long Specificity_Pseudo;
19
19
  extern const unsigned long Specificity_ID;
20
20
 
21
+ // Selector unification order;
22
+ extern const int UnificationOrder_Element;
23
+ extern const int UnificationOrder_Id;
24
+ extern const int UnificationOrder_Class;
25
+ extern const int UnificationOrder_Attribute;
26
+ extern const int UnificationOrder_PseudoClass;
27
+ extern const int UnificationOrder_Wrapped;
28
+ extern const int UnificationOrder_PseudoElement;
29
+ extern const int UnificationOrder_Placeholder;
30
+
21
31
  // sass keywords
22
32
  extern const char at_root_kwd[];
23
33
  extern const char import_kwd[];
@@ -33,6 +43,7 @@ namespace Sass {
33
43
  extern const char for_kwd[];
34
44
  extern const char from_kwd[];
35
45
  extern const char to_kwd[];
46
+ extern const char of_kwd[];
36
47
  extern const char through_kwd[];
37
48
  extern const char each_kwd[];
38
49
  extern const char in_kwd[];
@@ -117,6 +128,9 @@ namespace Sass {
117
128
  extern const char true_kwd[];
118
129
  extern const char false_kwd[];
119
130
 
131
+ // definition keywords
132
+ extern const char using_kwd[];
133
+
120
134
  // miscellaneous punctuation and delimiters
121
135
  extern const char percent_str[];
122
136
  extern const char empty_str[];
@@ -148,6 +162,11 @@ namespace Sass {
148
162
  extern const char uri_chars[];
149
163
  extern const char real_uri_chars[];
150
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
+
151
170
  // some specific constant character classes
152
171
  // they must be static to be useable by lexer
153
172
  extern const char static_ops[];
@@ -1,34 +1,23 @@
1
+ // sass.hpp must go before all system headers to get the
2
+ // __EXTENSIONS__ fix on Solaris.
1
3
  #include "sass.hpp"
2
- #include <string>
3
- #include <cstdlib>
4
- #include <cstring>
5
- #include <iomanip>
6
- #include <sstream>
7
- #include <iostream>
8
-
9
4
  #include "ast.hpp"
10
- #include "util.hpp"
11
- #include "sass.h"
5
+
6
+ #include "remove_placeholders.hpp"
7
+ #include "sass_functions.hpp"
8
+ #include "check_nesting.hpp"
9
+ #include "fn_selectors.hpp"
10
+ #include "fn_strings.hpp"
11
+ #include "fn_numbers.hpp"
12
+ #include "fn_colors.hpp"
13
+ #include "fn_miscs.hpp"
14
+ #include "fn_lists.hpp"
15
+ #include "fn_maps.hpp"
12
16
  #include "context.hpp"
13
- #include "plugins.hpp"
14
- #include "constants.hpp"
15
- #include "parser.hpp"
16
- #include "file.hpp"
17
- #include "inspect.hpp"
18
- #include "output.hpp"
19
17
  #include "expand.hpp"
20
- #include "eval.hpp"
21
- #include "check_nesting.hpp"
18
+ #include "parser.hpp"
22
19
  #include "cssize.hpp"
23
- #include "listize.hpp"
24
- #include "extend.hpp"
25
- #include "remove_placeholders.hpp"
26
- #include "functions.hpp"
27
- #include "sass_functions.hpp"
28
- #include "backtrace.hpp"
29
- #include "sass2scss.h"
30
- #include "prelexer.hpp"
31
- #include "emitter.hpp"
20
+ #include "source.hpp"
32
21
 
33
22
  namespace Sass {
34
23
  using namespace Constants;
@@ -38,25 +27,19 @@ namespace Sass {
38
27
  inline bool sort_importers (const Sass_Importer_Entry& i, const Sass_Importer_Entry& j)
39
28
  { return sass_importer_get_priority(i) > sass_importer_get_priority(j); }
40
29
 
41
- static std::string safe_input(const char* in_path)
30
+ static sass::string safe_input(const char* in_path)
42
31
  {
43
- // enforce some safe defaults
44
- // used to create relative file links
45
- std::string safe_path(in_path ? in_path : "");
46
- return safe_path == "" ? "stdin" : safe_path;
32
+ if (in_path == nullptr || in_path[0] == '\0') return "stdin";
33
+ return in_path;
47
34
  }
48
35
 
49
- static std::string safe_output(const char* out_path, const std::string& input_path = "")
36
+ static sass::string safe_output(const char* out_path, sass::string input_path)
50
37
  {
51
- std::string safe_path(out_path ? out_path : "");
52
- // maybe we can extract an output path from input path
53
- if (safe_path == "" && input_path != "") {
54
- int lastindex = static_cast<int>(input_path.find_last_of("."));
55
- return (lastindex > -1 ? input_path.substr(0, lastindex) : input_path) + ".css";
38
+ if (out_path == nullptr || out_path[0] == '\0') {
39
+ if (input_path.empty()) return "stdout";
40
+ return input_path.substr(0, input_path.find_last_of(".")) + ".css";
56
41
  }
57
- // enforce some safe defaults
58
- // used to create relative file links
59
- return safe_path == "" ? "stdout" : safe_path;
42
+ return out_path;
60
43
  }
61
44
 
62
45
  Context::Context(struct Sass_Context& c_ctx)
@@ -71,15 +54,15 @@ namespace Sass {
71
54
  strings(),
72
55
  resources(),
73
56
  sheets(),
74
- subset_map(),
75
57
  import_stack(),
76
58
  callee_stack(),
77
59
  traces(),
60
+ extender(Extender::NORMAL, traces),
78
61
  c_compiler(NULL),
79
62
 
80
- c_headers (std::vector<Sass_Importer_Entry>()),
81
- c_importers (std::vector<Sass_Importer_Entry>()),
82
- c_functions (std::vector<Sass_Function_Entry>()),
63
+ c_headers (sass::vector<Sass_Importer_Entry>()),
64
+ c_importers (sass::vector<Sass_Importer_Entry>()),
65
+ c_functions (sass::vector<Sass_Function_Entry>()),
83
66
 
84
67
  indent (safe_str(c_options.indent, " ")),
85
68
  linefeed (safe_str(c_options.linefeed, "\n")),
@@ -150,7 +133,7 @@ namespace Sass {
150
133
  }
151
134
  // clear inner structures (vectors) and input source
152
135
  resources.clear(); import_stack.clear();
153
- subset_map.clear(), sheets.clear();
136
+ sheets.clear();
154
137
  }
155
138
 
156
139
  Data_Context::~Data_Context()
@@ -173,7 +156,7 @@ namespace Sass {
173
156
  const char* end = Prelexer::find_first<PATH_SEP>(beg);
174
157
 
175
158
  while (end) {
176
- std::string path(beg, end - beg);
159
+ sass::string path(beg, end - beg);
177
160
  if (!path.empty()) {
178
161
  if (*path.rbegin() != '/') path += '/';
179
162
  include_paths.push_back(path);
@@ -182,7 +165,7 @@ namespace Sass {
182
165
  end = Prelexer::find_first<PATH_SEP>(beg);
183
166
  }
184
167
 
185
- std::string path(beg);
168
+ sass::string path(beg);
186
169
  if (!path.empty()) {
187
170
  if (*path.rbegin() != '/') path += '/';
188
171
  include_paths.push_back(path);
@@ -206,7 +189,7 @@ namespace Sass {
206
189
  const char* end = Prelexer::find_first<PATH_SEP>(beg);
207
190
 
208
191
  while (end) {
209
- std::string path(beg, end - beg);
192
+ sass::string path(beg, end - beg);
210
193
  if (!path.empty()) {
211
194
  if (*path.rbegin() != '/') path += '/';
212
195
  plugin_paths.push_back(path);
@@ -215,7 +198,7 @@ namespace Sass {
215
198
  end = Prelexer::find_first<PATH_SEP>(beg);
216
199
  }
217
200
 
218
- std::string path(beg);
201
+ sass::string path(beg);
219
202
  if (!path.empty()) {
220
203
  if (*path.rbegin() != '/') path += '/';
221
204
  plugin_paths.push_back(path);
@@ -234,17 +217,17 @@ namespace Sass {
234
217
 
235
218
  // resolve the imp_path in base_path or include_paths
236
219
  // looks for alternatives and returns a list from one directory
237
- std::vector<Include> Context::find_includes(const Importer& import)
220
+ sass::vector<Include> Context::find_includes(const Importer& import)
238
221
  {
239
222
  // make sure we resolve against an absolute path
240
- std::string base_path(rel2abs(import.base_path));
223
+ sass::string base_path(rel2abs(import.base_path));
241
224
  // first try to resolve the load path relative to the base path
242
- std::vector<Include> vec(resolve_includes(base_path, import.imp_path));
225
+ sass::vector<Include> vec(resolve_includes(base_path, import.imp_path));
243
226
  // then search in every include path (but only if nothing found yet)
244
227
  for (size_t i = 0, S = include_paths.size(); vec.size() == 0 && i < S; ++i)
245
228
  {
246
229
  // call resolve_includes and individual base path and append all results
247
- std::vector<Include> resolved(resolve_includes(include_paths[i], import.imp_path));
230
+ sass::vector<Include> resolved(resolve_includes(include_paths[i], import.imp_path));
248
231
  if (resolved.size()) vec.insert(vec.end(), resolved.begin(), resolved.end());
249
232
  }
250
233
  // return vector
@@ -291,22 +274,22 @@ namespace Sass {
291
274
 
292
275
  // get pointer to the loaded content
293
276
  const char* contents = resources[idx].contents;
294
- // keep a copy of the path around (for parserstates)
295
- // ToDo: we clean it, but still not very elegant!?
296
- strings.push_back(sass_copy_c_string(inc.abs_path.c_str()));
277
+ SourceFileObj source = SASS_MEMORY_NEW(SourceFile,
278
+ inc.abs_path.c_str(), contents, idx);
279
+
297
280
  // create the initial parser state from resource
298
- ParserState pstate(strings.back(), contents, idx);
281
+ SourceSpan pstate(source);
299
282
 
300
283
  // check existing import stack for possible recursion
301
284
  for (size_t i = 0; i < import_stack.size() - 2; ++i) {
302
285
  auto parent = import_stack[i];
303
286
  if (std::strcmp(parent->abs_path, import->abs_path) == 0) {
304
- std::string cwd(File::get_cwd());
287
+ sass::string cwd(File::get_cwd());
305
288
  // make path relative to the current directory
306
- std::string stack("An @import loop has been found:");
289
+ sass::string stack("An @import loop has been found:");
307
290
  for (size_t n = 1; n < i + 2; ++n) {
308
- stack += "\n " + std::string(File::abs2rel(import_stack[n]->abs_path, cwd, cwd)) +
309
- " imports " + std::string(File::abs2rel(import_stack[n+1]->abs_path, cwd, cwd));
291
+ stack += "\n " + sass::string(File::abs2rel(import_stack[n]->abs_path, cwd, cwd)) +
292
+ " imports " + sass::string(File::abs2rel(import_stack[n+1]->abs_path, cwd, cwd));
310
293
  }
311
294
  // implement error throw directly until we
312
295
  // decided how to handle full stack traces
@@ -316,7 +299,7 @@ namespace Sass {
316
299
  }
317
300
 
318
301
  // create a parser instance from the given c_str buffer
319
- Parser p(Parser::from_c_str(contents, *this, traces, pstate));
302
+ Parser p(source, *this, traces);
320
303
  // do not yet dispose these buffers
321
304
  sass_import_take_source(import);
322
305
  sass_import_take_srcmap(import);
@@ -327,7 +310,7 @@ namespace Sass {
327
310
  // remove current stack frame
328
311
  import_stack.pop_back();
329
312
  // create key/value pair for ast node
330
- std::pair<const std::string, StyleSheet>
313
+ std::pair<const sass::string, StyleSheet>
331
314
  ast_pair(inc.abs_path, { res, root });
332
315
  // register resulting resource
333
316
  sheets.insert(ast_pair);
@@ -335,7 +318,7 @@ namespace Sass {
335
318
 
336
319
  // register include with resolved path and its content
337
320
  // memory of the resources will be freed by us on exit
338
- void Context::register_resource(const Include& inc, const Resource& res, ParserState& prstate)
321
+ void Context::register_resource(const Include& inc, const Resource& res, SourceSpan& prstate)
339
322
  {
340
323
  traces.push_back(Backtrace(prstate));
341
324
  register_resource(inc, res);
@@ -343,16 +326,16 @@ namespace Sass {
343
326
  }
344
327
 
345
328
  // Add a new import to the context (called from `import_url`)
346
- Include Context::load_import(const Importer& imp, ParserState pstate)
329
+ Include Context::load_import(const Importer& imp, SourceSpan pstate)
347
330
  {
348
331
 
349
332
  // search for valid imports (ie. partials) on the filesystem
350
333
  // this may return more than one valid result (ambiguous imp_path)
351
- const std::vector<Include> resolved(find_includes(imp));
334
+ const sass::vector<Include> resolved(find_includes(imp));
352
335
 
353
336
  // error nicely on ambiguous imp_path
354
337
  if (resolved.size() > 1) {
355
- std::stringstream msg_stream;
338
+ sass::ostream msg_stream;
356
339
  msg_stream << "It's not clear which file to import for ";
357
340
  msg_stream << "'@import \"" << imp.imp_path << "\"'." << "\n";
358
341
  msg_stream << "Candidates:" << "\n";
@@ -382,30 +365,30 @@ namespace Sass {
382
365
 
383
366
  }
384
367
 
385
- void Context::import_url (Import_Ptr imp, std::string load_path, const std::string& ctx_path) {
368
+ void Context::import_url (Import* imp, sass::string load_path, const sass::string& ctx_path) {
386
369
 
387
- ParserState pstate(imp->pstate());
388
- std::string imp_path(unquote(load_path));
389
- std::string protocol("file");
370
+ SourceSpan pstate(imp->pstate());
371
+ sass::string imp_path(unquote(load_path));
372
+ sass::string protocol("file");
390
373
 
391
374
  using namespace Prelexer;
392
375
  if (const char* proto = sequence< identifier, exactly<':'>, exactly<'/'>, exactly<'/'> >(imp_path.c_str())) {
393
376
 
394
- protocol = std::string(imp_path.c_str(), proto - 3);
377
+ protocol = sass::string(imp_path.c_str(), proto - 3);
395
378
  // if (protocol.compare("file") && true) { }
396
379
  }
397
380
 
398
- // add urls (protocol other than file) and urls without procotol to `urls` member
381
+ // add urls (protocol other than file) and urls without protocol to `urls` member
399
382
  // ToDo: if ctx_path is already a file resource, we should not add it here?
400
383
  if (imp->import_queries() || protocol != "file" || imp_path.substr(0, 2) == "//") {
401
384
  imp->urls().push_back(SASS_MEMORY_NEW(String_Quoted, imp->pstate(), load_path));
402
385
  }
403
386
  else if (imp_path.length() > 4 && imp_path.substr(imp_path.length() - 4, 4) == ".css") {
404
- String_Constant_Ptr loc = SASS_MEMORY_NEW(String_Constant, pstate, unquote(load_path));
387
+ String_Constant* loc = SASS_MEMORY_NEW(String_Constant, pstate, unquote(load_path));
405
388
  Argument_Obj loc_arg = SASS_MEMORY_NEW(Argument, pstate, loc);
406
389
  Arguments_Obj loc_args = SASS_MEMORY_NEW(Arguments, pstate);
407
390
  loc_args->append(loc_arg);
408
- Function_Call_Ptr new_url = SASS_MEMORY_NEW(Function_Call, pstate, "url", loc_args);
391
+ Function_Call* new_url = SASS_MEMORY_NEW(Function_Call, pstate, sass::string("url"), loc_args);
409
392
  imp->urls().push_back(new_url);
410
393
  }
411
394
  else {
@@ -421,7 +404,7 @@ namespace Sass {
421
404
 
422
405
 
423
406
  // call custom importers on the given (unquoted) load_path and eventually parse the resulting style_sheet
424
- bool Context::call_loader(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import_Ptr imp, std::vector<Sass_Importer_Entry> importers, bool only_one)
407
+ bool Context::call_loader(const sass::string& load_path, const char* ctx_path, SourceSpan& pstate, Import* imp, sass::vector<Sass_Importer_Entry> importers, bool only_one)
425
408
  {
426
409
  // unique counter
427
410
  size_t count = 0;
@@ -439,9 +422,9 @@ namespace Sass {
439
422
  Sass_Import_List it_includes = includes;
440
423
  while (*it_includes) { ++count;
441
424
  // create unique path to use as key
442
- std::string uniq_path = load_path;
425
+ sass::string uniq_path = load_path;
443
426
  if (!only_one && count) {
444
- std::stringstream path_strm;
427
+ sass::ostream path_strm;
445
428
  path_strm << uniq_path << ":" << count;
446
429
  uniq_path = path_strm.str();
447
430
  }
@@ -458,14 +441,14 @@ namespace Sass {
458
441
  // it may (or may not) override the line and column info
459
442
  if (const char* err_message = sass_import_get_error_message(include_ent)) {
460
443
  if (source || srcmap) register_resource({ importer, uniq_path }, { source, srcmap }, pstate);
461
- if (line == std::string::npos && column == std::string::npos) error(err_message, pstate, traces);
462
- else error(err_message, ParserState(ctx_path, source, Position(line, column)), traces);
444
+ if (line == sass::string::npos && column == sass::string::npos) error(err_message, pstate, traces);
445
+ else { error(err_message, { pstate.source, { line, column } }, traces); }
463
446
  }
464
447
  // content for import was set
465
448
  else if (source) {
466
449
  // resolved abs_path should be set by custom importer
467
450
  // use the created uniq_path as fallback (maybe enforce)
468
- std::string path_key(abs_path ? abs_path : uniq_path);
451
+ sass::string path_key(abs_path ? abs_path : uniq_path);
469
452
  // create the importer struct
470
453
  Include include(importer, path_key);
471
454
  // attach information to AST node
@@ -502,7 +485,7 @@ namespace Sass {
502
485
 
503
486
  void register_function(Context&, Signature sig, Native_Function f, Env* env);
504
487
  void register_function(Context&, Signature sig, Native_Function f, size_t arity, Env* env);
505
- void register_overload_stub(Context&, std::string name, Env* env);
488
+ void register_overload_stub(Context&, sass::string name, Env* env);
506
489
  void register_built_in_functions(Context&, Env* env);
507
490
  void register_c_functions(Context&, Env* env, Sass_Function_List);
508
491
  void register_c_function(Context&, Env* env, Sass_Function_Entry);
@@ -519,7 +502,7 @@ namespace Sass {
519
502
  OutputBuffer emitted = emitter.get_buffer();
520
503
  // should we append a source map url?
521
504
  if (!c_options.omit_source_map_url) {
522
- // generate an embeded source map
505
+ // generate an embedded source map
523
506
  if (c_options.source_map_embed) {
524
507
  emitted.buffer += linefeed;
525
508
  emitted.buffer += format_embedded_source_map();
@@ -535,7 +518,7 @@ namespace Sass {
535
518
  return sass_copy_c_string(emitted.buffer.c_str());
536
519
  }
537
520
 
538
- void Context::apply_custom_headers(Block_Obj root, const char* ctx_path, ParserState pstate)
521
+ void Context::apply_custom_headers(Block_Obj root, const char* ctx_path, SourceSpan pstate)
539
522
  {
540
523
  // create a custom import to resolve headers
541
524
  Import_Obj imp = SASS_MEMORY_NEW(Import, pstate);
@@ -556,11 +539,11 @@ namespace Sass {
556
539
  {
557
540
 
558
541
  // check if entry file is given
559
- if (input_path.empty()) return 0;
542
+ if (input_path.empty()) return {};
560
543
 
561
544
  // create absolute path from input filename
562
545
  // ToDo: this should be resolved via custom importers
563
- std::string abs_path(rel2abs(input_path, CWD));
546
+ sass::string abs_path(rel2abs(input_path, CWD));
564
547
 
565
548
  // try to load the entry file
566
549
  char* contents = read_file(abs_path);
@@ -575,7 +558,9 @@ namespace Sass {
575
558
  }
576
559
 
577
560
  // abort early if no content could be loaded (various reasons)
578
- if (!contents) throw std::runtime_error("File to read not found or unreadable: " + input_path);
561
+ if (!contents) throw std::runtime_error(
562
+ "File to read not found or unreadable: "
563
+ + std::string(input_path.c_str()));
579
564
 
580
565
  // store entry path
581
566
  entry_path = abs_path;
@@ -602,7 +587,7 @@ namespace Sass {
602
587
  {
603
588
 
604
589
  // check if source string is given
605
- if (!source_c_str) return 0;
590
+ if (!source_c_str) return {};
606
591
 
607
592
  // convert indented sass syntax
608
593
  if(c_options.is_indented_syntax_src) {
@@ -618,7 +603,7 @@ namespace Sass {
618
603
  entry_path = input_path.empty() ? "stdin" : input_path;
619
604
 
620
605
  // ToDo: this may be resolved via custom importers
621
- std::string abs_path(rel2abs(entry_path));
606
+ sass::string abs_path(rel2abs(entry_path));
622
607
  char* abs_path_c_str = sass_copy_c_string(abs_path.c_str());
623
608
  strings.push_back(abs_path_c_str);
624
609
 
@@ -639,17 +624,15 @@ namespace Sass {
639
624
  return compile();
640
625
  }
641
626
 
642
-
643
-
644
627
  // parse root block from includes
645
628
  Block_Obj Context::compile()
646
629
  {
647
630
  // abort if there is no data
648
- if (resources.size() == 0) return 0;
631
+ if (resources.size() == 0) return {};
649
632
  // get root block from the first style sheet
650
633
  Block_Obj root = sheets.at(entry_path).root;
651
634
  // abort on invalid root
652
- if (root.isNull()) return 0;
635
+ if (root.isNull()) return {};
653
636
  Env global; // create root environment
654
637
  // register built-in functions on env
655
638
  register_built_in_functions(*this, &global);
@@ -668,60 +651,60 @@ namespace Sass {
668
651
  }
669
652
  // expand and eval the tree
670
653
  root = expand(root);
654
+
655
+ Extension unsatisfied;
656
+ // check that all extends were used
657
+ if (extender.checkForUnsatisfiedExtends(unsatisfied)) {
658
+ throw Exception::UnsatisfiedExtend(traces, unsatisfied);
659
+ }
660
+
671
661
  // check nesting
672
662
  check_nesting(root);
673
663
  // merge and bubble certain rules
674
664
  root = cssize(root);
675
- // should we extend something?
676
- if (!subset_map.empty()) {
677
- // create crtp visitor object
678
- Extend extend(subset_map);
679
- extend.setEval(expand.eval);
680
- // extend tree nodes
681
- extend(root);
682
- }
683
665
 
684
666
  // clean up by removing empty placeholders
685
667
  // ToDo: maybe we can do this somewhere else?
686
668
  Remove_Placeholders remove_placeholders;
687
669
  root->perform(&remove_placeholders);
670
+
688
671
  // return processed tree
689
672
  return root;
690
673
  }
691
674
  // EO compile
692
675
 
693
- std::string Context::format_embedded_source_map()
676
+ sass::string Context::format_embedded_source_map()
694
677
  {
695
- std::string map = emitter.render_srcmap(*this);
696
- std::istringstream is( map );
697
- std::ostringstream buffer;
678
+ sass::string map = emitter.render_srcmap(*this);
679
+ sass::istream is( map.c_str() );
680
+ sass::ostream buffer;
698
681
  base64::encoder E;
699
682
  E.encode(is, buffer);
700
- std::string url = "data:application/json;base64," + buffer.str();
683
+ sass::string url = "data:application/json;base64," + buffer.str();
701
684
  url.erase(url.size() - 1);
702
685
  return "/*# sourceMappingURL=" + url + " */";
703
686
  }
704
687
 
705
- std::string Context::format_source_mapping_url(const std::string& file)
688
+ sass::string Context::format_source_mapping_url(const sass::string& file)
706
689
  {
707
- std::string url = abs2rel(file, output_path, CWD);
690
+ sass::string url = abs2rel(file, output_path, CWD);
708
691
  return "/*# sourceMappingURL=" + url + " */";
709
692
  }
710
693
 
711
694
  char* Context::render_srcmap()
712
695
  {
713
696
  if (source_map_file == "") return 0;
714
- std::string map = emitter.render_srcmap(*this);
697
+ sass::string map = emitter.render_srcmap(*this);
715
698
  return sass_copy_c_string(map.c_str());
716
699
  }
717
700
 
718
701
 
719
702
  // for data context we want to start after "stdin"
720
703
  // we probably always want to skip the header includes?
721
- std::vector<std::string> Context::get_included_files(bool skip, size_t headers)
704
+ sass::vector<sass::string> Context::get_included_files(bool skip, size_t headers)
722
705
  {
723
706
  // create a copy of the vector for manipulations
724
- std::vector<std::string> includes = included_files;
707
+ sass::vector<sass::string> includes = included_files;
725
708
  if (includes.size() == 0) return includes;
726
709
  if (skip) { includes.erase( includes.begin(), includes.begin() + 1 + headers); }
727
710
  else { includes.erase( includes.begin() + 1, includes.begin() + 1 + headers); }
@@ -732,28 +715,28 @@ namespace Sass {
732
715
 
733
716
  void register_function(Context& ctx, Signature sig, Native_Function f, Env* env)
734
717
  {
735
- Definition_Ptr def = make_native_function(sig, f, ctx);
718
+ Definition* def = make_native_function(sig, f, ctx);
736
719
  def->environment(env);
737
720
  (*env)[def->name() + "[f]"] = def;
738
721
  }
739
722
 
740
723
  void register_function(Context& ctx, Signature sig, Native_Function f, size_t arity, Env* env)
741
724
  {
742
- Definition_Ptr def = make_native_function(sig, f, ctx);
743
- std::stringstream ss;
725
+ Definition* def = make_native_function(sig, f, ctx);
726
+ sass::ostream ss;
744
727
  ss << def->name() << "[f]" << arity;
745
728
  def->environment(env);
746
729
  (*env)[ss.str()] = def;
747
730
  }
748
731
 
749
- void register_overload_stub(Context& ctx, std::string name, Env* env)
732
+ void register_overload_stub(Context& ctx, sass::string name, Env* env)
750
733
  {
751
- Definition_Ptr stub = SASS_MEMORY_NEW(Definition,
752
- ParserState("[built-in function]"),
753
- 0,
734
+ Definition* stub = SASS_MEMORY_NEW(Definition,
735
+ SourceSpan{ "[built-in function]" },
736
+ nullptr,
754
737
  name,
755
- 0,
756
- 0,
738
+ Parameters_Obj{},
739
+ nullptr,
757
740
  true);
758
741
  (*env)[name + "[f]"] = stub;
759
742
  }
@@ -872,7 +855,7 @@ namespace Sass {
872
855
  }
873
856
  void register_c_function(Context& ctx, Env* env, Sass_Function_Entry descr)
874
857
  {
875
- Definition_Ptr def = make_c_function(descr, ctx);
858
+ Definition* def = make_c_function(descr, ctx);
876
859
  def->environment(env);
877
860
  (*env)[def->name() + "[f]"] = def;
878
861
  }