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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.gitmodules +1 -1
- data/.travis.yml +9 -3
- data/CHANGELOG.md +36 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/README.md +1 -1
- data/Rakefile +43 -7
- data/ext/depend +4 -0
- data/ext/extconf.rb +92 -0
- data/ext/libsass/VERSION +1 -0
- data/ext/libsass/include/sass/base.h +9 -1
- data/ext/libsass/include/sass/context.h +5 -1
- data/ext/libsass/src/MurmurHash2.hpp +91 -0
- data/ext/libsass/src/ast.cpp +755 -2028
- data/ext/libsass/src/ast.hpp +492 -2477
- data/ext/libsass/src/{to_c.cpp → ast2c.cpp} +22 -16
- data/ext/libsass/src/ast2c.hpp +39 -0
- data/ext/libsass/src/ast_def_macros.hpp +70 -10
- data/ext/libsass/src/ast_fwd_decl.cpp +5 -3
- data/ext/libsass/src/ast_fwd_decl.hpp +107 -296
- data/ext/libsass/src/ast_helpers.hpp +292 -0
- data/ext/libsass/src/ast_sel_cmp.cpp +396 -0
- data/ext/libsass/src/ast_sel_super.cpp +539 -0
- data/ext/libsass/src/ast_sel_unify.cpp +275 -0
- data/ext/libsass/src/ast_sel_weave.cpp +616 -0
- data/ext/libsass/src/ast_selectors.cpp +1043 -0
- data/ext/libsass/src/ast_selectors.hpp +522 -0
- data/ext/libsass/src/ast_supports.cpp +114 -0
- data/ext/libsass/src/ast_supports.hpp +121 -0
- data/ext/libsass/src/ast_values.cpp +1154 -0
- data/ext/libsass/src/ast_values.hpp +498 -0
- data/ext/libsass/src/backtrace.cpp +11 -7
- data/ext/libsass/src/backtrace.hpp +5 -5
- data/ext/libsass/src/base64vlq.cpp +5 -2
- data/ext/libsass/src/base64vlq.hpp +1 -1
- data/ext/libsass/src/bind.cpp +35 -34
- data/ext/libsass/src/bind.hpp +3 -1
- data/ext/libsass/src/c2ast.cpp +64 -0
- data/ext/libsass/src/c2ast.hpp +14 -0
- data/ext/libsass/src/cencode.c +4 -6
- data/ext/libsass/src/check_nesting.cpp +83 -88
- data/ext/libsass/src/check_nesting.hpp +39 -34
- data/ext/libsass/src/color_maps.cpp +168 -164
- data/ext/libsass/src/color_maps.hpp +152 -160
- data/ext/libsass/src/constants.cpp +20 -0
- data/ext/libsass/src/constants.hpp +19 -0
- data/ext/libsass/src/context.cpp +104 -121
- data/ext/libsass/src/context.hpp +43 -55
- data/ext/libsass/src/cssize.cpp +103 -188
- data/ext/libsass/src/cssize.hpp +45 -51
- data/ext/libsass/src/dart_helpers.hpp +199 -0
- data/ext/libsass/src/debugger.hpp +524 -361
- data/ext/libsass/src/emitter.cpp +26 -26
- data/ext/libsass/src/emitter.hpp +20 -18
- data/ext/libsass/src/environment.cpp +41 -27
- data/ext/libsass/src/environment.hpp +33 -22
- data/ext/libsass/src/error_handling.cpp +92 -94
- data/ext/libsass/src/error_handling.hpp +73 -50
- data/ext/libsass/src/eval.cpp +380 -515
- data/ext/libsass/src/eval.hpp +64 -57
- data/ext/libsass/src/eval_selectors.cpp +75 -0
- data/ext/libsass/src/expand.cpp +322 -263
- data/ext/libsass/src/expand.hpp +55 -39
- data/ext/libsass/src/extender.cpp +1188 -0
- data/ext/libsass/src/extender.hpp +399 -0
- data/ext/libsass/src/extension.cpp +43 -0
- data/ext/libsass/src/extension.hpp +89 -0
- data/ext/libsass/src/file.cpp +134 -88
- data/ext/libsass/src/file.hpp +28 -37
- data/ext/libsass/src/fn_colors.cpp +596 -0
- data/ext/libsass/src/fn_colors.hpp +85 -0
- data/ext/libsass/src/fn_lists.cpp +285 -0
- data/ext/libsass/src/fn_lists.hpp +34 -0
- data/ext/libsass/src/fn_maps.cpp +94 -0
- data/ext/libsass/src/fn_maps.hpp +30 -0
- data/ext/libsass/src/fn_miscs.cpp +244 -0
- data/ext/libsass/src/fn_miscs.hpp +40 -0
- data/ext/libsass/src/fn_numbers.cpp +227 -0
- data/ext/libsass/src/fn_numbers.hpp +45 -0
- data/ext/libsass/src/fn_selectors.cpp +205 -0
- data/ext/libsass/src/fn_selectors.hpp +35 -0
- data/ext/libsass/src/fn_strings.cpp +268 -0
- data/ext/libsass/src/fn_strings.hpp +34 -0
- data/ext/libsass/src/fn_utils.cpp +158 -0
- data/ext/libsass/src/fn_utils.hpp +62 -0
- data/ext/libsass/src/inspect.cpp +253 -266
- data/ext/libsass/src/inspect.hpp +72 -74
- data/ext/libsass/src/json.cpp +2 -2
- data/ext/libsass/src/lexer.cpp +25 -84
- data/ext/libsass/src/lexer.hpp +5 -16
- data/ext/libsass/src/listize.cpp +27 -43
- data/ext/libsass/src/listize.hpp +14 -11
- data/ext/libsass/src/mapping.hpp +1 -0
- data/ext/libsass/src/memory.hpp +12 -0
- data/ext/libsass/src/memory/allocator.cpp +48 -0
- data/ext/libsass/src/memory/allocator.hpp +138 -0
- data/ext/libsass/src/memory/config.hpp +20 -0
- data/ext/libsass/src/memory/memory_pool.hpp +186 -0
- data/ext/libsass/src/memory/shared_ptr.cpp +33 -0
- data/ext/libsass/src/memory/shared_ptr.hpp +332 -0
- data/ext/libsass/src/operation.hpp +193 -143
- data/ext/libsass/src/operators.cpp +56 -29
- data/ext/libsass/src/operators.hpp +11 -11
- data/ext/libsass/src/ordered_map.hpp +112 -0
- data/ext/libsass/src/output.cpp +59 -75
- data/ext/libsass/src/output.hpp +15 -22
- data/ext/libsass/src/parser.cpp +662 -818
- data/ext/libsass/src/parser.hpp +96 -100
- data/ext/libsass/src/parser_selectors.cpp +189 -0
- data/ext/libsass/src/permutate.hpp +164 -0
- data/ext/libsass/src/plugins.cpp +12 -8
- data/ext/libsass/src/plugins.hpp +8 -8
- data/ext/libsass/src/position.cpp +10 -26
- data/ext/libsass/src/position.hpp +44 -21
- data/ext/libsass/src/prelexer.cpp +14 -8
- data/ext/libsass/src/prelexer.hpp +9 -9
- data/ext/libsass/src/remove_placeholders.cpp +59 -57
- data/ext/libsass/src/remove_placeholders.hpp +20 -18
- data/ext/libsass/src/sass.cpp +25 -18
- data/ext/libsass/src/sass.hpp +22 -14
- data/ext/libsass/src/sass2scss.cpp +49 -18
- data/ext/libsass/src/sass_context.cpp +104 -132
- data/ext/libsass/src/sass_context.hpp +2 -2
- data/ext/libsass/src/sass_functions.cpp +7 -4
- data/ext/libsass/src/sass_functions.hpp +1 -1
- data/ext/libsass/src/sass_values.cpp +26 -21
- data/ext/libsass/src/settings.hpp +19 -0
- data/ext/libsass/src/source.cpp +69 -0
- data/ext/libsass/src/source.hpp +95 -0
- data/ext/libsass/src/source_data.hpp +32 -0
- data/ext/libsass/src/source_map.cpp +27 -20
- data/ext/libsass/src/source_map.hpp +14 -11
- data/ext/libsass/src/stylesheet.cpp +22 -0
- data/ext/libsass/src/stylesheet.hpp +57 -0
- data/ext/libsass/src/to_value.cpp +24 -22
- data/ext/libsass/src/to_value.hpp +18 -22
- data/ext/libsass/src/units.cpp +28 -22
- data/ext/libsass/src/units.hpp +9 -8
- data/ext/libsass/src/utf8/checked.h +12 -10
- data/ext/libsass/src/utf8/core.h +3 -0
- data/ext/libsass/src/utf8_string.cpp +12 -10
- data/ext/libsass/src/utf8_string.hpp +7 -6
- data/ext/libsass/src/util.cpp +97 -107
- data/ext/libsass/src/util.hpp +74 -30
- data/ext/libsass/src/util_string.cpp +125 -0
- data/ext/libsass/src/util_string.hpp +73 -0
- data/ext/libsass/src/values.cpp +33 -24
- data/ext/libsass/src/values.hpp +2 -2
- data/lib/sassc.rb +24 -0
- data/lib/sassc/engine.rb +7 -5
- data/lib/sassc/functions_handler.rb +11 -13
- data/lib/sassc/native.rb +10 -9
- data/lib/sassc/native/native_functions_api.rb +0 -5
- data/lib/sassc/script.rb +4 -6
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +32 -12
- data/test/engine_test.rb +32 -2
- data/test/functions_test.rb +38 -1
- data/test/native_test.rb +4 -4
- metadata +95 -109
- data/ext/Rakefile +0 -3
- data/ext/libsass/.editorconfig +0 -15
- data/ext/libsass/.gitattributes +0 -2
- data/ext/libsass/.github/CONTRIBUTING.md +0 -65
- data/ext/libsass/.github/ISSUE_TEMPLATE.md +0 -54
- data/ext/libsass/.gitignore +0 -85
- data/ext/libsass/.travis.yml +0 -64
- data/ext/libsass/COPYING +0 -25
- data/ext/libsass/GNUmakefile.am +0 -88
- data/ext/libsass/INSTALL +0 -1
- data/ext/libsass/LICENSE +0 -25
- data/ext/libsass/Makefile +0 -351
- data/ext/libsass/Makefile.conf +0 -55
- data/ext/libsass/Readme.md +0 -104
- data/ext/libsass/SECURITY.md +0 -10
- data/ext/libsass/appveyor.yml +0 -91
- data/ext/libsass/configure.ac +0 -138
- data/ext/libsass/contrib/libsass.spec +0 -66
- data/ext/libsass/docs/README.md +0 -20
- data/ext/libsass/docs/api-context-example.md +0 -45
- data/ext/libsass/docs/api-context-internal.md +0 -163
- data/ext/libsass/docs/api-context.md +0 -295
- data/ext/libsass/docs/api-doc.md +0 -215
- data/ext/libsass/docs/api-function-example.md +0 -67
- data/ext/libsass/docs/api-function-internal.md +0 -8
- data/ext/libsass/docs/api-function.md +0 -74
- data/ext/libsass/docs/api-importer-example.md +0 -112
- data/ext/libsass/docs/api-importer-internal.md +0 -20
- data/ext/libsass/docs/api-importer.md +0 -86
- data/ext/libsass/docs/api-value-example.md +0 -55
- data/ext/libsass/docs/api-value-internal.md +0 -76
- data/ext/libsass/docs/api-value.md +0 -154
- data/ext/libsass/docs/build-on-darwin.md +0 -27
- data/ext/libsass/docs/build-on-gentoo.md +0 -55
- data/ext/libsass/docs/build-on-windows.md +0 -139
- data/ext/libsass/docs/build-shared-library.md +0 -35
- data/ext/libsass/docs/build-with-autotools.md +0 -78
- data/ext/libsass/docs/build-with-makefiles.md +0 -68
- data/ext/libsass/docs/build-with-mingw.md +0 -107
- data/ext/libsass/docs/build-with-visual-studio.md +0 -90
- data/ext/libsass/docs/build.md +0 -97
- data/ext/libsass/docs/compatibility-plan.md +0 -48
- data/ext/libsass/docs/contributing.md +0 -17
- data/ext/libsass/docs/custom-functions-internal.md +0 -122
- data/ext/libsass/docs/dev-ast-memory.md +0 -223
- data/ext/libsass/docs/implementations.md +0 -56
- data/ext/libsass/docs/plugins.md +0 -47
- data/ext/libsass/docs/setup-environment.md +0 -68
- data/ext/libsass/docs/source-map-internals.md +0 -51
- data/ext/libsass/docs/trace.md +0 -26
- data/ext/libsass/docs/triage.md +0 -17
- data/ext/libsass/docs/unicode.md +0 -39
- data/ext/libsass/extconf.rb +0 -6
- data/ext/libsass/include/sass/version.h.in +0 -12
- data/ext/libsass/m4/.gitkeep +0 -0
- data/ext/libsass/m4/m4-ax_cxx_compile_stdcxx_11.m4 +0 -167
- data/ext/libsass/res/resource.rc +0 -35
- data/ext/libsass/script/bootstrap +0 -13
- data/ext/libsass/script/branding +0 -10
- data/ext/libsass/script/ci-build-libsass +0 -134
- data/ext/libsass/script/ci-build-plugin +0 -62
- data/ext/libsass/script/ci-install-compiler +0 -6
- data/ext/libsass/script/ci-install-deps +0 -20
- data/ext/libsass/script/ci-report-coverage +0 -42
- data/ext/libsass/script/spec +0 -5
- data/ext/libsass/script/tap-driver +0 -652
- data/ext/libsass/script/tap-runner +0 -1
- data/ext/libsass/script/test-leaks.pl +0 -103
- data/ext/libsass/src/GNUmakefile.am +0 -54
- data/ext/libsass/src/extend.cpp +0 -2130
- data/ext/libsass/src/extend.hpp +0 -86
- data/ext/libsass/src/functions.cpp +0 -2234
- data/ext/libsass/src/functions.hpp +0 -198
- data/ext/libsass/src/memory/SharedPtr.cpp +0 -114
- data/ext/libsass/src/memory/SharedPtr.hpp +0 -206
- data/ext/libsass/src/node.cpp +0 -319
- data/ext/libsass/src/node.hpp +0 -118
- data/ext/libsass/src/paths.hpp +0 -71
- data/ext/libsass/src/sass_util.cpp +0 -149
- data/ext/libsass/src/sass_util.hpp +0 -256
- data/ext/libsass/src/subset_map.cpp +0 -55
- data/ext/libsass/src/subset_map.hpp +0 -76
- data/ext/libsass/src/support/libsass.pc.in +0 -11
- data/ext/libsass/src/to_c.hpp +0 -39
- data/ext/libsass/test/test_node.cpp +0 -94
- data/ext/libsass/test/test_paths.cpp +0 -28
- data/ext/libsass/test/test_selector_difference.cpp +0 -25
- data/ext/libsass/test/test_specificity.cpp +0 -25
- data/ext/libsass/test/test_subset_map.cpp +0 -472
- data/ext/libsass/test/test_superselector.cpp +0 -69
- data/ext/libsass/test/test_unification.cpp +0 -31
- data/ext/libsass/version.sh +0 -10
- data/ext/libsass/win/libsass.sln +0 -39
- data/ext/libsass/win/libsass.sln.DotSettings +0 -9
- data/ext/libsass/win/libsass.targets +0 -118
- data/ext/libsass/win/libsass.vcxproj +0 -188
- data/ext/libsass/win/libsass.vcxproj.filters +0 -357
- data/lib/sassc/native/lib_c.rb +0 -21
- 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
|
|
173
|
-
extern const
|
|
174
|
-
extern const
|
|
175
|
-
extern const
|
|
176
|
-
extern const
|
|
177
|
-
extern const
|
|
178
|
-
extern const
|
|
179
|
-
extern const
|
|
180
|
-
extern const
|
|
181
|
-
extern const
|
|
182
|
-
extern const
|
|
183
|
-
extern const
|
|
184
|
-
extern const
|
|
185
|
-
extern const
|
|
186
|
-
extern const
|
|
187
|
-
extern const
|
|
188
|
-
extern const
|
|
189
|
-
extern const
|
|
190
|
-
extern const
|
|
191
|
-
extern const
|
|
192
|
-
extern const
|
|
193
|
-
extern const
|
|
194
|
-
extern const
|
|
195
|
-
extern const
|
|
196
|
-
extern const
|
|
197
|
-
extern const
|
|
198
|
-
extern const
|
|
199
|
-
extern const
|
|
200
|
-
extern const
|
|
201
|
-
extern const
|
|
202
|
-
extern const
|
|
203
|
-
extern const
|
|
204
|
-
extern const
|
|
205
|
-
extern const
|
|
206
|
-
extern const
|
|
207
|
-
extern const
|
|
208
|
-
extern const
|
|
209
|
-
extern const
|
|
210
|
-
extern const
|
|
211
|
-
extern const
|
|
212
|
-
extern const
|
|
213
|
-
extern const
|
|
214
|
-
extern const
|
|
215
|
-
extern const
|
|
216
|
-
extern const
|
|
217
|
-
extern const
|
|
218
|
-
extern const
|
|
219
|
-
extern const
|
|
220
|
-
extern const
|
|
221
|
-
extern const
|
|
222
|
-
extern const
|
|
223
|
-
extern const
|
|
224
|
-
extern const
|
|
225
|
-
extern const
|
|
226
|
-
extern const
|
|
227
|
-
extern const
|
|
228
|
-
extern const
|
|
229
|
-
extern const
|
|
230
|
-
extern const
|
|
231
|
-
extern const
|
|
232
|
-
extern const
|
|
233
|
-
extern const
|
|
234
|
-
extern const
|
|
235
|
-
extern const
|
|
236
|
-
extern const
|
|
237
|
-
extern const
|
|
238
|
-
extern const
|
|
239
|
-
extern const
|
|
240
|
-
extern const
|
|
241
|
-
extern const
|
|
242
|
-
extern const
|
|
243
|
-
extern const
|
|
244
|
-
extern const
|
|
245
|
-
extern const
|
|
246
|
-
extern const
|
|
247
|
-
extern const
|
|
248
|
-
extern const
|
|
249
|
-
extern const
|
|
250
|
-
extern const
|
|
251
|
-
extern const
|
|
252
|
-
extern const
|
|
253
|
-
extern const
|
|
254
|
-
extern const
|
|
255
|
-
extern const
|
|
256
|
-
extern const
|
|
257
|
-
extern const
|
|
258
|
-
extern const
|
|
259
|
-
extern const
|
|
260
|
-
extern const
|
|
261
|
-
extern const
|
|
262
|
-
extern const
|
|
263
|
-
extern const
|
|
264
|
-
extern const
|
|
265
|
-
extern const
|
|
266
|
-
extern const
|
|
267
|
-
extern const
|
|
268
|
-
extern const
|
|
269
|
-
extern const
|
|
270
|
-
extern const
|
|
271
|
-
extern const
|
|
272
|
-
extern const
|
|
273
|
-
extern const
|
|
274
|
-
extern const
|
|
275
|
-
extern const
|
|
276
|
-
extern const
|
|
277
|
-
extern const
|
|
278
|
-
extern const
|
|
279
|
-
extern const
|
|
280
|
-
extern const
|
|
281
|
-
extern const
|
|
282
|
-
extern const
|
|
283
|
-
extern const
|
|
284
|
-
extern const
|
|
285
|
-
extern const
|
|
286
|
-
extern const
|
|
287
|
-
extern const
|
|
288
|
-
extern const
|
|
289
|
-
extern const
|
|
290
|
-
extern const
|
|
291
|
-
extern const
|
|
292
|
-
extern const
|
|
293
|
-
extern const
|
|
294
|
-
extern const
|
|
295
|
-
extern const
|
|
296
|
-
extern const
|
|
297
|
-
extern const
|
|
298
|
-
extern const
|
|
299
|
-
extern const
|
|
300
|
-
extern const
|
|
301
|
-
extern const
|
|
302
|
-
extern const
|
|
303
|
-
extern const
|
|
304
|
-
extern const
|
|
305
|
-
extern const
|
|
306
|
-
extern const
|
|
307
|
-
extern const
|
|
308
|
-
extern const
|
|
309
|
-
extern const
|
|
310
|
-
extern const
|
|
311
|
-
extern const
|
|
312
|
-
extern const
|
|
313
|
-
extern const
|
|
314
|
-
extern const
|
|
315
|
-
extern const
|
|
316
|
-
extern const
|
|
317
|
-
extern const
|
|
318
|
-
extern const
|
|
319
|
-
extern const
|
|
320
|
-
extern const
|
|
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
|
-
|
|
324
|
-
|
|
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
|
|
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[];
|
data/ext/libsass/src/context.cpp
CHANGED
|
@@ -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
|
-
|
|
11
|
-
#include "
|
|
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 "
|
|
21
|
-
#include "check_nesting.hpp"
|
|
18
|
+
#include "parser.hpp"
|
|
22
19
|
#include "cssize.hpp"
|
|
23
|
-
#include "
|
|
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
|
|
30
|
+
static sass::string safe_input(const char* in_path)
|
|
42
31
|
{
|
|
43
|
-
|
|
44
|
-
|
|
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
|
|
36
|
+
static sass::string safe_output(const char* out_path, sass::string input_path)
|
|
50
37
|
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
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 (
|
|
81
|
-
c_importers (
|
|
82
|
-
c_functions (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
220
|
+
sass::vector<Include> Context::find_includes(const Importer& import)
|
|
238
221
|
{
|
|
239
222
|
// make sure we resolve against an absolute path
|
|
240
|
-
|
|
223
|
+
sass::string base_path(rel2abs(import.base_path));
|
|
241
224
|
// first try to resolve the load path relative to the base path
|
|
242
|
-
|
|
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
|
-
|
|
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
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
-
|
|
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
|
-
|
|
287
|
+
sass::string cwd(File::get_cwd());
|
|
305
288
|
// make path relative to the current directory
|
|
306
|
-
|
|
289
|
+
sass::string stack("An @import loop has been found:");
|
|
307
290
|
for (size_t n = 1; n < i + 2; ++n) {
|
|
308
|
-
stack += "\n " +
|
|
309
|
-
" imports " +
|
|
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(
|
|
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
|
|
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,
|
|
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,
|
|
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
|
|
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
|
-
|
|
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 (
|
|
368
|
+
void Context::import_url (Import* imp, sass::string load_path, const sass::string& ctx_path) {
|
|
386
369
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
425
|
+
sass::string uniq_path = load_path;
|
|
443
426
|
if (!only_one && count) {
|
|
444
|
-
|
|
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 ==
|
|
462
|
-
else error(err_message,
|
|
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
|
-
|
|
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&,
|
|
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
|
|
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,
|
|
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
|
|
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
|
-
|
|
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(
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
676
|
+
sass::string Context::format_embedded_source_map()
|
|
694
677
|
{
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
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
|
-
|
|
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
|
-
|
|
688
|
+
sass::string Context::format_source_mapping_url(const sass::string& file)
|
|
706
689
|
{
|
|
707
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
743
|
-
|
|
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,
|
|
732
|
+
void register_overload_stub(Context& ctx, sass::string name, Env* env)
|
|
750
733
|
{
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
734
|
+
Definition* stub = SASS_MEMORY_NEW(Definition,
|
|
735
|
+
SourceSpan{ "[built-in function]" },
|
|
736
|
+
nullptr,
|
|
754
737
|
name,
|
|
755
|
-
|
|
756
|
-
|
|
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
|
-
|
|
858
|
+
Definition* def = make_c_function(descr, ctx);
|
|
876
859
|
def->environment(env);
|
|
877
860
|
(*env)[def->name() + "[f]"] = def;
|
|
878
861
|
}
|