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
|
@@ -25,6 +25,7 @@ namespace Sass {
|
|
|
25
25
|
const char* kwd_gte(const char* src);
|
|
26
26
|
const char* kwd_lt(const char* src);
|
|
27
27
|
const char* kwd_lte(const char* src);
|
|
28
|
+
const char* kwd_using(const char* src);
|
|
28
29
|
|
|
29
30
|
// Match standard control chars
|
|
30
31
|
const char* kwd_at(const char* src);
|
|
@@ -64,16 +65,15 @@ namespace Sass {
|
|
|
64
65
|
size_t level = 0;
|
|
65
66
|
bool in_squote = false;
|
|
66
67
|
bool in_dquote = false;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
while (*src) {
|
|
70
|
-
|
|
71
|
-
// check for abort condition
|
|
72
|
-
if (end && src >= end) break;
|
|
68
|
+
bool in_backslash_escape = false;
|
|
73
69
|
|
|
70
|
+
while ((end == nullptr || src < end) && *src != '\0') {
|
|
74
71
|
// has escaped sequence?
|
|
75
|
-
if (
|
|
76
|
-
|
|
72
|
+
if (in_backslash_escape) {
|
|
73
|
+
in_backslash_escape = false;
|
|
74
|
+
}
|
|
75
|
+
else if (*src == '\\') {
|
|
76
|
+
in_backslash_escape = true;
|
|
77
77
|
}
|
|
78
78
|
else if (*src == '"') {
|
|
79
79
|
in_dquote = ! in_dquote;
|
|
@@ -119,7 +119,7 @@ namespace Sass {
|
|
|
119
119
|
// first start/opener must be consumed already!
|
|
120
120
|
template<prelexer start, prelexer stop>
|
|
121
121
|
const char* skip_over_scopes(const char* src) {
|
|
122
|
-
return skip_over_scopes<start, stop>(src,
|
|
122
|
+
return skip_over_scopes<start, stop>(src, nullptr);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
// Match a sequence of characters delimited by the supplied chars.
|
|
@@ -1,84 +1,86 @@
|
|
|
1
|
+
// sass.hpp must go before all system headers to get the
|
|
2
|
+
// __EXTENSIONS__ fix on Solaris.
|
|
1
3
|
#include "sass.hpp"
|
|
4
|
+
#include "ast.hpp"
|
|
5
|
+
|
|
2
6
|
#include "remove_placeholders.hpp"
|
|
3
|
-
#include "context.hpp"
|
|
4
|
-
#include "inspect.hpp"
|
|
5
|
-
#include <iostream>
|
|
6
7
|
|
|
7
8
|
namespace Sass {
|
|
8
9
|
|
|
9
10
|
Remove_Placeholders::Remove_Placeholders()
|
|
10
11
|
{ }
|
|
11
12
|
|
|
12
|
-
void Remove_Placeholders::operator()(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
void Remove_Placeholders::operator()(Block* b) {
|
|
14
|
+
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
15
|
+
if (b->get(i)) b->get(i)->perform(this);
|
|
16
|
+
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
void Remove_Placeholders::remove_placeholders(SimpleSelector* simple)
|
|
20
20
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
for (size_t i = 0, L = sl->length(); i < L; ++i) {
|
|
24
|
-
if (!sl->at(i)->contains_placeholder()) {
|
|
25
|
-
new_sl->append(sl->at(i));
|
|
26
|
-
}
|
|
21
|
+
if (PseudoSelector * pseudo = simple->getPseudoSelector()) {
|
|
22
|
+
if (pseudo->selector()) remove_placeholders(pseudo->selector());
|
|
27
23
|
}
|
|
28
|
-
|
|
29
|
-
return new_sl;
|
|
30
|
-
|
|
31
24
|
}
|
|
32
25
|
|
|
26
|
+
void Remove_Placeholders::remove_placeholders(CompoundSelector* compound)
|
|
27
|
+
{
|
|
28
|
+
for (size_t i = 0, L = compound->length(); i < L; ++i) {
|
|
29
|
+
if (compound->get(i)) remove_placeholders(compound->get(i));
|
|
30
|
+
}
|
|
31
|
+
listEraseItemIf(compound->elements(), listIsEmpty<SimpleSelector>);
|
|
32
|
+
}
|
|
33
33
|
|
|
34
|
-
void Remove_Placeholders::
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
while (cs) {
|
|
44
|
-
if (cs->head()) {
|
|
45
|
-
for (Simple_Selector_Obj& ss : cs->head()->elements()) {
|
|
46
|
-
if (Wrapped_Selector_Ptr ws = Cast<Wrapped_Selector>(ss)) {
|
|
47
|
-
if (Selector_List_Ptr wsl = Cast<Selector_List>(ws->selector())) {
|
|
48
|
-
Selector_List_Ptr clean = remove_placeholders(wsl);
|
|
49
|
-
// also clean superflous parent selectors
|
|
50
|
-
// probably not really the correct place
|
|
51
|
-
clean->remove_parent_selectors();
|
|
52
|
-
ws->selector(clean);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
cs = cs->tail();
|
|
58
|
-
}
|
|
34
|
+
void Remove_Placeholders::remove_placeholders(ComplexSelector* complex)
|
|
35
|
+
{
|
|
36
|
+
if (complex->has_placeholder()) {
|
|
37
|
+
complex->clear(); // remove all
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
for (size_t i = 0, L = complex->length(); i < L; ++i) {
|
|
41
|
+
if (CompoundSelector * compound = complex->get(i)->getCompound()) {
|
|
42
|
+
if (compound) remove_placeholders(compound);
|
|
59
43
|
}
|
|
60
44
|
}
|
|
45
|
+
listEraseItemIf(complex->elements(), listIsEmpty<SelectorComponent>);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
61
48
|
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
SelectorList* Remove_Placeholders::remove_placeholders(SelectorList* sl)
|
|
50
|
+
{
|
|
51
|
+
for (size_t i = 0, L = sl->length(); i < L; ++i) {
|
|
52
|
+
if (sl->get(i)) remove_placeholders(sl->get(i));
|
|
53
|
+
}
|
|
54
|
+
listEraseItemIf(sl->elements(), listIsEmpty<ComplexSelector>);
|
|
55
|
+
return sl;
|
|
56
|
+
}
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
st->perform(this);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
58
|
+
void Remove_Placeholders::operator()(CssMediaRule* rule)
|
|
59
|
+
{
|
|
60
|
+
if (rule->block()) operator()(rule->block());
|
|
71
61
|
}
|
|
72
62
|
|
|
73
|
-
void Remove_Placeholders::operator()(
|
|
74
|
-
|
|
63
|
+
void Remove_Placeholders::operator()(StyleRule* r)
|
|
64
|
+
{
|
|
65
|
+
if (SelectorListObj sl = r->selector()) {
|
|
66
|
+
// Set the new placeholder selector list
|
|
67
|
+
r->selector((remove_placeholders(sl)));
|
|
68
|
+
}
|
|
69
|
+
// Iterate into child blocks
|
|
70
|
+
Block_Obj b = r->block();
|
|
71
|
+
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
72
|
+
if (b->get(i)) { b->get(i)->perform(this); }
|
|
73
|
+
}
|
|
75
74
|
}
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
|
|
76
|
+
void Remove_Placeholders::operator()(SupportsRule* m)
|
|
77
|
+
{
|
|
78
|
+
if (m->block()) operator()(m->block());
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
void Remove_Placeholders::operator()(
|
|
81
|
-
|
|
81
|
+
void Remove_Placeholders::operator()(AtRule* a)
|
|
82
|
+
{
|
|
83
|
+
if (a->block()) a->block()->perform(this);
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
}
|
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
#ifndef SASS_REMOVE_PLACEHOLDERS_H
|
|
2
2
|
#define SASS_REMOVE_PLACEHOLDERS_H
|
|
3
3
|
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
#include "ast.hpp"
|
|
4
|
+
#include "ast_fwd_decl.hpp"
|
|
7
5
|
#include "operation.hpp"
|
|
8
6
|
|
|
9
7
|
namespace Sass {
|
|
10
8
|
|
|
9
|
+
class Remove_Placeholders : public Operation_CRTP<void, Remove_Placeholders> {
|
|
10
|
+
|
|
11
|
+
public:
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
SelectorList* remove_placeholders(SelectorList*);
|
|
14
|
+
void remove_placeholders(SimpleSelector* simple);
|
|
15
|
+
void remove_placeholders(CompoundSelector* complex);
|
|
16
|
+
void remove_placeholders(ComplexSelector* complex);
|
|
13
17
|
|
|
14
|
-
void fallback_impl(AST_Node_Ptr n) {}
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
public:
|
|
20
|
+
Remove_Placeholders();
|
|
21
|
+
~Remove_Placeholders() { }
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
void operator()(Block*);
|
|
24
|
+
void operator()(StyleRule*);
|
|
25
|
+
void operator()(CssMediaRule*);
|
|
26
|
+
void operator()(SupportsRule*);
|
|
27
|
+
void operator()(AtRule*);
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
void operator()(Supports_Block_Ptr);
|
|
27
|
-
void operator()(Directive_Ptr);
|
|
29
|
+
// ignore missed types
|
|
30
|
+
template <typename U>
|
|
31
|
+
void fallback(U x) {}
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
void fallback(U x) { return fallback_impl(x); }
|
|
31
|
-
};
|
|
33
|
+
};
|
|
32
34
|
|
|
33
35
|
}
|
|
34
36
|
|
data/ext/libsass/src/sass.cpp
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
// sass.hpp must go before all system headers to get the
|
|
2
|
+
// __EXTENSIONS__ fix on Solaris.
|
|
1
3
|
#include "sass.hpp"
|
|
4
|
+
|
|
2
5
|
#include <cstdlib>
|
|
3
6
|
#include <cstring>
|
|
4
7
|
#include <vector>
|
|
@@ -7,15 +10,16 @@
|
|
|
7
10
|
#include "sass.h"
|
|
8
11
|
#include "file.hpp"
|
|
9
12
|
#include "util.hpp"
|
|
13
|
+
#include "context.hpp"
|
|
10
14
|
#include "sass_context.hpp"
|
|
11
15
|
#include "sass_functions.hpp"
|
|
12
16
|
|
|
13
17
|
namespace Sass {
|
|
14
18
|
|
|
15
19
|
// helper to convert string list to vector
|
|
16
|
-
|
|
20
|
+
sass::vector<sass::string> list2vec(struct string_list* cur)
|
|
17
21
|
{
|
|
18
|
-
|
|
22
|
+
sass::vector<sass::string> list;
|
|
19
23
|
while (cur) {
|
|
20
24
|
list.push_back(cur->string);
|
|
21
25
|
cur = cur->next;
|
|
@@ -33,13 +37,16 @@ extern "C" {
|
|
|
33
37
|
void* ADDCALL sass_alloc_memory(size_t size)
|
|
34
38
|
{
|
|
35
39
|
void* ptr = malloc(size);
|
|
36
|
-
if (ptr == NULL)
|
|
37
|
-
|
|
40
|
+
if (ptr == NULL) {
|
|
41
|
+
std::cerr << "Out of memory.\n";
|
|
42
|
+
exit(EXIT_FAILURE);
|
|
43
|
+
}
|
|
38
44
|
return ptr;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
char* ADDCALL sass_copy_c_string(const char* str)
|
|
42
48
|
{
|
|
49
|
+
if (str == nullptr) return nullptr;
|
|
43
50
|
size_t len = strlen(str) + 1;
|
|
44
51
|
char* cpy = (char*) sass_alloc_memory(len);
|
|
45
52
|
std::memcpy(cpy, str, len);
|
|
@@ -55,14 +62,14 @@ extern "C" {
|
|
|
55
62
|
// caller must free the returned memory
|
|
56
63
|
char* ADDCALL sass_string_quote (const char *str, const char quote_mark)
|
|
57
64
|
{
|
|
58
|
-
|
|
65
|
+
sass::string quoted = quote(str, quote_mark);
|
|
59
66
|
return sass_copy_c_string(quoted.c_str());
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
// caller must free the returned memory
|
|
63
70
|
char* ADDCALL sass_string_unquote (const char *str)
|
|
64
71
|
{
|
|
65
|
-
|
|
72
|
+
sass::string unquoted = unquote(str);
|
|
66
73
|
return sass_copy_c_string(unquoted.c_str());
|
|
67
74
|
}
|
|
68
75
|
|
|
@@ -70,13 +77,13 @@ extern "C" {
|
|
|
70
77
|
{
|
|
71
78
|
// get the last import entry to get current base directory
|
|
72
79
|
Sass_Import_Entry import = sass_compiler_get_last_import(compiler);
|
|
73
|
-
const
|
|
80
|
+
const sass::vector<sass::string>& incs = compiler->cpp_ctx->include_paths;
|
|
74
81
|
// create the vector with paths to lookup
|
|
75
|
-
|
|
82
|
+
sass::vector<sass::string> paths(1 + incs.size());
|
|
76
83
|
paths.push_back(File::dir_name(import->abs_path));
|
|
77
84
|
paths.insert( paths.end(), incs.begin(), incs.end() );
|
|
78
85
|
// now resolve the file path relative to lookup paths
|
|
79
|
-
|
|
86
|
+
sass::string resolved(File::find_include(file, paths));
|
|
80
87
|
return sass_copy_c_string(resolved.c_str());
|
|
81
88
|
}
|
|
82
89
|
|
|
@@ -84,13 +91,13 @@ extern "C" {
|
|
|
84
91
|
{
|
|
85
92
|
// get the last import entry to get current base directory
|
|
86
93
|
Sass_Import_Entry import = sass_compiler_get_last_import(compiler);
|
|
87
|
-
const
|
|
94
|
+
const sass::vector<sass::string>& incs = compiler->cpp_ctx->include_paths;
|
|
88
95
|
// create the vector with paths to lookup
|
|
89
|
-
|
|
96
|
+
sass::vector<sass::string> paths(1 + incs.size());
|
|
90
97
|
paths.push_back(File::dir_name(import->abs_path));
|
|
91
98
|
paths.insert( paths.end(), incs.begin(), incs.end() );
|
|
92
99
|
// now resolve the file path relative to lookup paths
|
|
93
|
-
|
|
100
|
+
sass::string resolved(File::find_file(file, paths));
|
|
94
101
|
return sass_copy_c_string(resolved.c_str());
|
|
95
102
|
}
|
|
96
103
|
|
|
@@ -99,8 +106,8 @@ extern "C" {
|
|
|
99
106
|
// this has the original resolve logic for sass include
|
|
100
107
|
char* ADDCALL sass_find_include (const char* file, struct Sass_Options* opt)
|
|
101
108
|
{
|
|
102
|
-
|
|
103
|
-
|
|
109
|
+
sass::vector<sass::string> vec(list2vec(opt->include_paths));
|
|
110
|
+
sass::string resolved(File::find_include(file, vec));
|
|
104
111
|
return sass_copy_c_string(resolved.c_str());
|
|
105
112
|
}
|
|
106
113
|
|
|
@@ -108,8 +115,8 @@ extern "C" {
|
|
|
108
115
|
// Incs array has to be null terminated!
|
|
109
116
|
char* ADDCALL sass_find_file (const char* file, struct Sass_Options* opt)
|
|
110
117
|
{
|
|
111
|
-
|
|
112
|
-
|
|
118
|
+
sass::vector<sass::string> vec(list2vec(opt->include_paths));
|
|
119
|
+
sass::string resolved(File::find_file(file, vec));
|
|
113
120
|
return sass_copy_c_string(resolved.c_str());
|
|
114
121
|
}
|
|
115
122
|
|
|
@@ -130,7 +137,7 @@ extern "C" {
|
|
|
130
137
|
namespace Sass {
|
|
131
138
|
|
|
132
139
|
// helper to aid dreaded MSVC debug mode
|
|
133
|
-
char* sass_copy_string(
|
|
140
|
+
char* sass_copy_string(sass::string str)
|
|
134
141
|
{
|
|
135
142
|
// In MSVC the following can lead to segfault:
|
|
136
143
|
// sass_copy_c_string(stream.str().c_str());
|
|
@@ -146,4 +153,4 @@ namespace Sass {
|
|
|
146
153
|
return sass_copy_c_string(str.c_str());
|
|
147
154
|
}
|
|
148
155
|
|
|
149
|
-
}
|
|
156
|
+
}
|
data/ext/libsass/src/sass.hpp
CHANGED
|
@@ -11,14 +11,20 @@
|
|
|
11
11
|
#pragma warning(disable : 4005)
|
|
12
12
|
#endif
|
|
13
13
|
|
|
14
|
-
//
|
|
14
|
+
// applies to MSVC and MinGW
|
|
15
15
|
#ifdef _WIN32
|
|
16
16
|
// we do not want the ERROR macro
|
|
17
|
-
#
|
|
17
|
+
# ifndef NOGDI
|
|
18
|
+
# define NOGDI
|
|
19
|
+
# endif
|
|
18
20
|
// we do not want the min/max macro
|
|
19
|
-
#
|
|
21
|
+
# ifndef NOMINMAX
|
|
22
|
+
# define NOMINMAX
|
|
23
|
+
# endif
|
|
20
24
|
// we do not want the IN/OUT macro
|
|
21
|
-
#
|
|
25
|
+
# ifndef _NO_W32_PSEUDO_MODIFIERS
|
|
26
|
+
# define _NO_W32_PSEUDO_MODIFIERS
|
|
27
|
+
# endif
|
|
22
28
|
#endif
|
|
23
29
|
|
|
24
30
|
|
|
@@ -42,13 +48,17 @@
|
|
|
42
48
|
#endif
|
|
43
49
|
|
|
44
50
|
|
|
45
|
-
//
|
|
51
|
+
// Include C-API header
|
|
46
52
|
#include "sass/base.h"
|
|
47
53
|
|
|
54
|
+
// Include allocator
|
|
55
|
+
#include "memory.hpp"
|
|
56
|
+
|
|
48
57
|
// For C++ helper
|
|
49
58
|
#include <string>
|
|
59
|
+
#include <vector>
|
|
50
60
|
|
|
51
|
-
// output
|
|
61
|
+
// output behavior
|
|
52
62
|
namespace Sass {
|
|
53
63
|
|
|
54
64
|
// create some C++ aliases for the most used options
|
|
@@ -59,14 +69,15 @@ namespace Sass {
|
|
|
59
69
|
// only used internal to trigger ruby inspect behavior
|
|
60
70
|
const static Sass_Output_Style INSPECT = SASS_STYLE_INSPECT;
|
|
61
71
|
const static Sass_Output_Style TO_SASS = SASS_STYLE_TO_SASS;
|
|
72
|
+
const static Sass_Output_Style TO_CSS = SASS_STYLE_TO_CSS;
|
|
62
73
|
|
|
63
74
|
// helper to aid dreaded MSVC debug mode
|
|
64
75
|
// see implementation for more details
|
|
65
|
-
char* sass_copy_string(
|
|
76
|
+
char* sass_copy_string(sass::string str);
|
|
66
77
|
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
// input
|
|
80
|
+
// input behaviors
|
|
70
81
|
enum Sass_Input_Style {
|
|
71
82
|
SASS_CONTEXT_NULL,
|
|
72
83
|
SASS_CONTEXT_FILE,
|
|
@@ -90,13 +101,10 @@ struct Sass_Inspect_Options {
|
|
|
90
101
|
// Precision for fractional numbers
|
|
91
102
|
int precision;
|
|
92
103
|
|
|
93
|
-
// Do not compress colors in selectors
|
|
94
|
-
bool in_selector;
|
|
95
|
-
|
|
96
104
|
// initialization list (constructor with defaults)
|
|
97
105
|
Sass_Inspect_Options(Sass_Output_Style style = Sass::NESTED,
|
|
98
|
-
int precision =
|
|
99
|
-
: output_style(style), precision(precision)
|
|
106
|
+
int precision = 10)
|
|
107
|
+
: output_style(style), precision(precision)
|
|
100
108
|
{ }
|
|
101
109
|
|
|
102
110
|
};
|
|
@@ -125,7 +133,7 @@ struct Sass_Output_Options : Sass_Inspect_Options {
|
|
|
125
133
|
|
|
126
134
|
// initialization list (constructor with defaults)
|
|
127
135
|
Sass_Output_Options(Sass_Output_Style style = Sass::NESTED,
|
|
128
|
-
int precision =
|
|
136
|
+
int precision = 10,
|
|
129
137
|
const char* indent = " ",
|
|
130
138
|
const char* linefeed = "\n",
|
|
131
139
|
bool source_comments = false)
|