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
data/ext/libsass/src/units.hpp
CHANGED
|
@@ -55,8 +55,8 @@ namespace Sass {
|
|
|
55
55
|
|
|
56
56
|
class Units {
|
|
57
57
|
public:
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
sass::vector<sass::string> numerators;
|
|
59
|
+
sass::vector<sass::string> denominators;
|
|
60
60
|
public:
|
|
61
61
|
// default constructor
|
|
62
62
|
Units() :
|
|
@@ -69,7 +69,7 @@ namespace Sass {
|
|
|
69
69
|
denominators(ptr->denominators)
|
|
70
70
|
{ }
|
|
71
71
|
// convert to string
|
|
72
|
-
|
|
72
|
+
sass::string unit() const;
|
|
73
73
|
// get if units are empty
|
|
74
74
|
bool is_unitless() const;
|
|
75
75
|
// return if valid for css
|
|
@@ -83,6 +83,7 @@ namespace Sass {
|
|
|
83
83
|
// compare operations
|
|
84
84
|
bool operator< (const Units& rhs) const;
|
|
85
85
|
bool operator== (const Units& rhs) const;
|
|
86
|
+
bool operator!= (const Units& rhs) const;
|
|
86
87
|
// factor to convert into given units
|
|
87
88
|
double convert_factor(const Units&) const;
|
|
88
89
|
};
|
|
@@ -94,15 +95,15 @@ namespace Sass {
|
|
|
94
95
|
extern const double resolution_conversion_factors[3][3];
|
|
95
96
|
|
|
96
97
|
UnitType get_main_unit(const UnitClass unit);
|
|
97
|
-
enum Sass::UnitType string_to_unit(const
|
|
98
|
+
enum Sass::UnitType string_to_unit(const sass::string&);
|
|
98
99
|
const char* unit_to_string(Sass::UnitType unit);
|
|
99
100
|
enum Sass::UnitClass get_unit_type(Sass::UnitType unit);
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
sass::string get_unit_class(Sass::UnitType unit);
|
|
102
|
+
sass::string unit_to_class(const sass::string&);
|
|
102
103
|
// throws incompatibleUnits exceptions
|
|
103
|
-
double conversion_factor(const
|
|
104
|
+
double conversion_factor(const sass::string&, const sass::string&);
|
|
104
105
|
double conversion_factor(UnitType, UnitType, UnitClass, UnitClass);
|
|
105
|
-
double convert_units(const
|
|
106
|
+
double convert_units(const sass::string&, const sass::string&, int&, int&);
|
|
106
107
|
|
|
107
108
|
}
|
|
108
109
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2006 Nemanja Trifunovic
|
|
1
|
+
// Copyright 2006-2016 Nemanja Trifunovic
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Permission is hereby granted, free of charge, to any person or organization
|
|
@@ -41,7 +41,7 @@ namespace utf8
|
|
|
41
41
|
class invalid_code_point : public exception {
|
|
42
42
|
uint32_t cp;
|
|
43
43
|
public:
|
|
44
|
-
invalid_code_point(uint32_t
|
|
44
|
+
invalid_code_point(uint32_t codepoint) : cp(codepoint) {}
|
|
45
45
|
virtual const char* what() const throw() { return "Invalid code point"; }
|
|
46
46
|
uint32_t code_point() const {return cp;}
|
|
47
47
|
};
|
|
@@ -107,7 +107,9 @@ namespace utf8
|
|
|
107
107
|
*out++ = *it;
|
|
108
108
|
break;
|
|
109
109
|
case internal::NOT_ENOUGH_ROOM:
|
|
110
|
-
|
|
110
|
+
out = utf8::append (replacement, out);
|
|
111
|
+
start = end;
|
|
112
|
+
break;
|
|
111
113
|
case internal::INVALID_LEAD:
|
|
112
114
|
out = utf8::append (replacement, out);
|
|
113
115
|
++start;
|
|
@@ -194,10 +196,10 @@ namespace utf8
|
|
|
194
196
|
}
|
|
195
197
|
|
|
196
198
|
template <typename octet_iterator, typename distance_type>
|
|
197
|
-
void retreat (octet_iterator& it, distance_type n, octet_iterator
|
|
199
|
+
void retreat (octet_iterator& it, distance_type n, octet_iterator end)
|
|
198
200
|
{
|
|
199
201
|
for (distance_type i = 0; i < n; ++i)
|
|
200
|
-
utf8::prior(it,
|
|
202
|
+
utf8::prior(it, end);
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
template <typename octet_iterator>
|
|
@@ -240,7 +242,7 @@ namespace utf8
|
|
|
240
242
|
template <typename u16bit_iterator, typename octet_iterator>
|
|
241
243
|
u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result)
|
|
242
244
|
{
|
|
243
|
-
while (start
|
|
245
|
+
while (start < end) {
|
|
244
246
|
uint32_t cp = utf8::next(start, end);
|
|
245
247
|
if (cp > 0xffff) { //make a surrogate pair
|
|
246
248
|
*result++ = static_cast<uint16_t>((cp >> 10) + internal::LEAD_OFFSET);
|
|
@@ -264,7 +266,7 @@ namespace utf8
|
|
|
264
266
|
template <typename octet_iterator, typename u32bit_iterator>
|
|
265
267
|
u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result)
|
|
266
268
|
{
|
|
267
|
-
while (start
|
|
269
|
+
while (start < end)
|
|
268
270
|
(*result++) = utf8::next(start, end);
|
|
269
271
|
|
|
270
272
|
return result;
|
|
@@ -279,9 +281,9 @@ namespace utf8
|
|
|
279
281
|
public:
|
|
280
282
|
iterator () {}
|
|
281
283
|
explicit iterator (const octet_iterator& octet_it,
|
|
282
|
-
const octet_iterator&
|
|
283
|
-
const octet_iterator&
|
|
284
|
-
it(octet_it), range_start(
|
|
284
|
+
const octet_iterator& rangestart,
|
|
285
|
+
const octet_iterator& rangeend) :
|
|
286
|
+
it(octet_it), range_start(rangestart), range_end(rangeend)
|
|
285
287
|
{
|
|
286
288
|
if (it < range_start || it > range_end)
|
|
287
289
|
throw std::out_of_range("Invalid utf-8 iterator position");
|
data/ext/libsass/src/utf8/core.h
CHANGED
|
@@ -222,6 +222,9 @@ namespace internal
|
|
|
222
222
|
template <typename octet_iterator>
|
|
223
223
|
utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t& code_point)
|
|
224
224
|
{
|
|
225
|
+
if (it == end)
|
|
226
|
+
return NOT_ENOUGH_ROOM;
|
|
227
|
+
|
|
225
228
|
// Save the original value of it so we can go back in case of failure
|
|
226
229
|
// Of course, it does not make much sense with i.e. stream iterators
|
|
227
230
|
octet_iterator original_it = it;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
// sass.hpp must go before all system headers to get the
|
|
2
|
+
// __EXTENSIONS__ fix on Solaris.
|
|
1
3
|
#include "sass.hpp"
|
|
4
|
+
|
|
2
5
|
#include <string>
|
|
3
6
|
#include <vector>
|
|
4
7
|
#include <cstdlib>
|
|
@@ -8,7 +11,6 @@
|
|
|
8
11
|
|
|
9
12
|
namespace Sass {
|
|
10
13
|
namespace UTF_8 {
|
|
11
|
-
using std::string;
|
|
12
14
|
|
|
13
15
|
// naming conventions:
|
|
14
16
|
// offset: raw byte offset (0 based)
|
|
@@ -16,25 +18,25 @@ namespace Sass {
|
|
|
16
18
|
// index: code point offset (1 based or negative)
|
|
17
19
|
|
|
18
20
|
// function that will count the number of code points (utf-8 characters) from the given beginning to the given end
|
|
19
|
-
size_t code_point_count(const string& str, size_t start, size_t end) {
|
|
21
|
+
size_t code_point_count(const sass::string& str, size_t start, size_t end) {
|
|
20
22
|
return utf8::distance(str.begin() + start, str.begin() + end);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
size_t code_point_count(const string& str) {
|
|
25
|
+
size_t code_point_count(const sass::string& str) {
|
|
24
26
|
return utf8::distance(str.begin(), str.end());
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
// function that will return the byte offset at a code point position
|
|
28
|
-
size_t offset_at_position(const string& str, size_t position) {
|
|
29
|
-
string::const_iterator it = str.begin();
|
|
30
|
+
size_t offset_at_position(const sass::string& str, size_t position) {
|
|
31
|
+
sass::string::const_iterator it = str.begin();
|
|
30
32
|
utf8::advance(it, position, str.end());
|
|
31
33
|
return std::distance(str.begin(), it);
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
// function that returns number of bytes in a character at offset
|
|
35
|
-
size_t code_point_size_at_offset(const string& str, size_t offset) {
|
|
37
|
+
size_t code_point_size_at_offset(const sass::string& str, size_t offset) {
|
|
36
38
|
// get iterator from string and forward by offset
|
|
37
|
-
string::const_iterator stop = str.begin() + offset;
|
|
39
|
+
sass::string::const_iterator stop = str.begin() + offset;
|
|
38
40
|
// check if beyond boundary
|
|
39
41
|
if (stop == str.end()) return 0;
|
|
40
42
|
// advance by one code point
|
|
@@ -75,9 +77,9 @@ namespace Sass {
|
|
|
75
77
|
using std::wstring;
|
|
76
78
|
|
|
77
79
|
// convert from utf16/wide string to utf8 string
|
|
78
|
-
string convert_from_utf16(const wstring& utf16)
|
|
80
|
+
sass::string convert_from_utf16(const wstring& utf16)
|
|
79
81
|
{
|
|
80
|
-
string utf8;
|
|
82
|
+
sass::string utf8;
|
|
81
83
|
// pre-allocate expected memory
|
|
82
84
|
utf8.reserve(sizeof(utf16)/2);
|
|
83
85
|
utf8::utf16to8(utf16.begin(), utf16.end(),
|
|
@@ -86,7 +88,7 @@ namespace Sass {
|
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
// convert from utf8 string to utf16/wide string
|
|
89
|
-
wstring convert_to_utf16(const string& utf8)
|
|
91
|
+
wstring convert_to_utf16(const sass::string& utf8)
|
|
90
92
|
{
|
|
91
93
|
wstring utf16;
|
|
92
94
|
// pre-allocate expected memory
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include <string>
|
|
5
5
|
#include "utf8.h"
|
|
6
|
+
#include "memory.hpp"
|
|
6
7
|
|
|
7
8
|
namespace Sass {
|
|
8
9
|
namespace UTF_8 {
|
|
@@ -13,22 +14,22 @@ namespace Sass {
|
|
|
13
14
|
// index: code point offset (1 based or negative)
|
|
14
15
|
|
|
15
16
|
// function that will count the number of code points (utf-8 characters) from the beginning to the given end
|
|
16
|
-
size_t code_point_count(const
|
|
17
|
-
size_t code_point_count(const
|
|
17
|
+
size_t code_point_count(const sass::string& str, size_t start, size_t end);
|
|
18
|
+
size_t code_point_count(const sass::string& str);
|
|
18
19
|
|
|
19
20
|
// function that will return the byte offset of a code point in a
|
|
20
|
-
size_t offset_at_position(const
|
|
21
|
+
size_t offset_at_position(const sass::string& str, size_t position);
|
|
21
22
|
|
|
22
23
|
// function that returns number of bytes in a character in a string
|
|
23
|
-
size_t code_point_size_at_offset(const
|
|
24
|
+
size_t code_point_size_at_offset(const sass::string& str, size_t offset);
|
|
24
25
|
|
|
25
26
|
// function that will return a normalized index, given a crazy one
|
|
26
27
|
size_t normalize_index(int index, size_t len);
|
|
27
28
|
|
|
28
29
|
#ifdef _WIN32
|
|
29
30
|
// functions to handle unicode paths on windows
|
|
30
|
-
|
|
31
|
-
std::wstring convert_to_utf16(const
|
|
31
|
+
sass::string convert_from_utf16(const std::wstring& wstr);
|
|
32
|
+
std::wstring convert_to_utf16(const sass::string& str);
|
|
32
33
|
#endif
|
|
33
34
|
|
|
34
35
|
}
|
data/ext/libsass/src/util.cpp
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#include "sass.h"
|
|
3
3
|
#include "ast.hpp"
|
|
4
4
|
#include "util.hpp"
|
|
5
|
+
#include "util_string.hpp"
|
|
5
6
|
#include "lexer.hpp"
|
|
6
7
|
#include "prelexer.hpp"
|
|
7
8
|
#include "constants.hpp"
|
|
@@ -26,8 +27,8 @@ namespace Sass {
|
|
|
26
27
|
#endif
|
|
27
28
|
|
|
28
29
|
// https://github.com/sass/sass/commit/4e3e1d5684cc29073a507578fc977434ff488c93
|
|
29
|
-
if (fmod(val, 1) - 0.5 > - std::pow(0.1, precision + 1)) return std::ceil(val);
|
|
30
|
-
else if (fmod(val, 1) - 0.5 > std::pow(0.1, precision)) return std::floor(val);
|
|
30
|
+
if (std::fmod(val, 1) - 0.5 > - std::pow(0.1, precision + 1)) return std::ceil(val);
|
|
31
|
+
else if (std::fmod(val, 1) - 0.5 > std::pow(0.1, precision)) return std::floor(val);
|
|
31
32
|
// work around some compiler issue
|
|
32
33
|
// cygwin has it not defined in std
|
|
33
34
|
using namespace std;
|
|
@@ -75,7 +76,7 @@ namespace Sass {
|
|
|
75
76
|
free(arr);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
char **copy_strings(const
|
|
79
|
+
char **copy_strings(const sass::vector<sass::string>& strings, char*** array, int skip) {
|
|
79
80
|
int num = static_cast<int>(strings.size()) - skip;
|
|
80
81
|
char** arr = (char**) calloc(num + 1, sizeof(char*));
|
|
81
82
|
if (arr == 0)
|
|
@@ -96,10 +97,10 @@ namespace Sass {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
// read css string (handle multiline DELIM)
|
|
99
|
-
|
|
100
|
+
sass::string read_css_string(const sass::string& str, bool css)
|
|
100
101
|
{
|
|
101
102
|
if (!css) return str;
|
|
102
|
-
|
|
103
|
+
sass::string out("");
|
|
103
104
|
bool esc = false;
|
|
104
105
|
for (auto i : str) {
|
|
105
106
|
if (i == '\\') {
|
|
@@ -124,9 +125,9 @@ namespace Sass {
|
|
|
124
125
|
|
|
125
126
|
// double escape all escape sequences
|
|
126
127
|
// keep unescaped quotes and backslashes
|
|
127
|
-
|
|
128
|
+
sass::string evacuate_escapes(const sass::string& str)
|
|
128
129
|
{
|
|
129
|
-
|
|
130
|
+
sass::string out("");
|
|
130
131
|
bool esc = false;
|
|
131
132
|
for (auto i : str) {
|
|
132
133
|
if (i == '\\' && !esc) {
|
|
@@ -158,56 +159,77 @@ namespace Sass {
|
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
// bell characters are replaced with spaces
|
|
161
|
-
void newline_to_space(
|
|
162
|
+
void newline_to_space(sass::string& str)
|
|
162
163
|
{
|
|
163
164
|
std::replace(str.begin(), str.end(), '\n', ' ');
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
|
|
167
|
+
// 1. Removes whitespace after newlines.
|
|
168
|
+
// 2. Replaces newlines with spaces.
|
|
169
|
+
//
|
|
170
|
+
// This method only considers LF and CRLF as newlines.
|
|
171
|
+
sass::string string_to_output(const sass::string& str)
|
|
169
172
|
{
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
sass::string result;
|
|
174
|
+
result.reserve(str.size());
|
|
175
|
+
std::size_t pos = 0;
|
|
176
|
+
while (true) {
|
|
177
|
+
const std::size_t newline = str.find_first_of("\n\r", pos);
|
|
178
|
+
if (newline == sass::string::npos) break;
|
|
179
|
+
result.append(str, pos, newline - pos);
|
|
180
|
+
if (str[newline] == '\r') {
|
|
181
|
+
if (str[newline + 1] == '\n') {
|
|
182
|
+
pos = newline + 2;
|
|
183
|
+
} else {
|
|
184
|
+
// CR without LF: append as-is and continue.
|
|
185
|
+
result += '\r';
|
|
186
|
+
pos = newline + 1;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
pos = newline + 1;
|
|
191
|
+
}
|
|
192
|
+
result += ' ';
|
|
193
|
+
const std::size_t non_space = str.find_first_not_of(" \f\n\r\t\v", pos);
|
|
194
|
+
if (non_space != sass::string::npos) {
|
|
195
|
+
pos = non_space;
|
|
179
196
|
}
|
|
180
197
|
}
|
|
181
|
-
|
|
198
|
+
result.append(str, pos, sass::string::npos);
|
|
199
|
+
return result;
|
|
182
200
|
}
|
|
183
201
|
|
|
184
|
-
|
|
202
|
+
sass::string escape_string(const sass::string& str)
|
|
185
203
|
{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
204
|
+
sass::string out;
|
|
205
|
+
out.reserve(str.size());
|
|
206
|
+
for (char c : str) {
|
|
207
|
+
switch (c) {
|
|
208
|
+
case '\n':
|
|
209
|
+
out.append("\\n");
|
|
210
|
+
break;
|
|
211
|
+
case '\r':
|
|
212
|
+
out.append("\\r");
|
|
213
|
+
break;
|
|
214
|
+
case '\f':
|
|
215
|
+
out.append("\\f");
|
|
216
|
+
break;
|
|
217
|
+
default:
|
|
218
|
+
out += c;
|
|
196
219
|
}
|
|
197
220
|
}
|
|
198
221
|
return out;
|
|
199
222
|
}
|
|
200
223
|
|
|
201
|
-
|
|
224
|
+
sass::string comment_to_compact_string(const sass::string& text)
|
|
202
225
|
{
|
|
203
|
-
|
|
226
|
+
sass::string str = "";
|
|
204
227
|
size_t has = 0;
|
|
205
228
|
char prev = 0;
|
|
206
229
|
bool clean = false;
|
|
207
230
|
for (auto i : text) {
|
|
208
231
|
if (clean) {
|
|
209
232
|
if (i == '\n') { has = 0; }
|
|
210
|
-
else if (i == '\r') { has = 0; }
|
|
211
233
|
else if (i == '\t') { ++ has; }
|
|
212
234
|
else if (i == ' ') { ++ has; }
|
|
213
235
|
else if (i == '*') {}
|
|
@@ -219,8 +241,6 @@ namespace Sass {
|
|
|
219
241
|
}
|
|
220
242
|
} else if (i == '\n') {
|
|
221
243
|
clean = true;
|
|
222
|
-
} else if (i == '\r') {
|
|
223
|
-
clean = true;
|
|
224
244
|
} else {
|
|
225
245
|
str += i;
|
|
226
246
|
}
|
|
@@ -250,10 +270,10 @@ namespace Sass {
|
|
|
250
270
|
return quote_mark;
|
|
251
271
|
}
|
|
252
272
|
|
|
253
|
-
|
|
273
|
+
sass::string read_hex_escapes(const sass::string& s)
|
|
254
274
|
{
|
|
255
275
|
|
|
256
|
-
|
|
276
|
+
sass::string result;
|
|
257
277
|
bool skipped = false;
|
|
258
278
|
|
|
259
279
|
for (size_t i = 0, L = s.length(); i < L; ++i) {
|
|
@@ -270,7 +290,7 @@ namespace Sass {
|
|
|
270
290
|
|
|
271
291
|
// parse as many sequence chars as possible
|
|
272
292
|
// ToDo: Check if ruby aborts after possible max
|
|
273
|
-
while (i + len < L && s[i + len] &&
|
|
293
|
+
while (i + len < L && s[i + len] && Util::ascii_isxdigit(static_cast<unsigned char>(s[i + len]))) ++ len;
|
|
274
294
|
|
|
275
295
|
if (len > 1) {
|
|
276
296
|
|
|
@@ -319,7 +339,7 @@ namespace Sass {
|
|
|
319
339
|
|
|
320
340
|
}
|
|
321
341
|
|
|
322
|
-
|
|
342
|
+
sass::string unquote(const sass::string& s, char* qd, bool keep_utf8_sequences, bool strict)
|
|
323
343
|
{
|
|
324
344
|
|
|
325
345
|
// not enough room for quotes
|
|
@@ -335,7 +355,7 @@ namespace Sass {
|
|
|
335
355
|
else if (*s.begin() == '\'' && *s.rbegin() == '\'') q = '\'';
|
|
336
356
|
else return s;
|
|
337
357
|
|
|
338
|
-
|
|
358
|
+
sass::string unq;
|
|
339
359
|
unq.reserve(s.length()-2);
|
|
340
360
|
|
|
341
361
|
for (size_t i = 1, L = s.length() - 1; i < L; ++i) {
|
|
@@ -356,7 +376,7 @@ namespace Sass {
|
|
|
356
376
|
|
|
357
377
|
// parse as many sequence chars as possible
|
|
358
378
|
// ToDo: Check if ruby aborts after possible max
|
|
359
|
-
while (i + len < L && s[i + len] &&
|
|
379
|
+
while (i + len < L && s[i + len] && Util::ascii_isxdigit(static_cast<unsigned char>(s[i + len]))) ++ len;
|
|
360
380
|
|
|
361
381
|
// hex string?
|
|
362
382
|
if (keep_utf8_sequences) {
|
|
@@ -394,7 +414,7 @@ namespace Sass {
|
|
|
394
414
|
// // don't be that strict
|
|
395
415
|
// return s;
|
|
396
416
|
// // this basically always means an internal error and not users fault
|
|
397
|
-
// error("Unescaped delimiter in string to unquote found. [" + s + "]",
|
|
417
|
+
// error("Unescaped delimiter in string to unquote found. [" + s + "]", SourceSpan("[UNQUOTE]"));
|
|
398
418
|
// }
|
|
399
419
|
else {
|
|
400
420
|
if (strict && !skipped) {
|
|
@@ -411,16 +431,16 @@ namespace Sass {
|
|
|
411
431
|
|
|
412
432
|
}
|
|
413
433
|
|
|
414
|
-
|
|
434
|
+
sass::string quote(const sass::string& s, char q)
|
|
415
435
|
{
|
|
416
436
|
|
|
417
437
|
// autodetect with fallback to given quote
|
|
418
438
|
q = detect_best_quotemark(s.c_str(), q);
|
|
419
439
|
|
|
420
440
|
// return an empty quoted string
|
|
421
|
-
if (s.empty()) return
|
|
441
|
+
if (s.empty()) return sass::string(2, q ? q : '"');
|
|
422
442
|
|
|
423
|
-
|
|
443
|
+
sass::string quoted;
|
|
424
444
|
quoted.reserve(s.length()+2);
|
|
425
445
|
quoted.push_back(q);
|
|
426
446
|
|
|
@@ -508,42 +528,15 @@ namespace Sass {
|
|
|
508
528
|
}
|
|
509
529
|
|
|
510
530
|
namespace Util {
|
|
511
|
-
using std::string;
|
|
512
|
-
|
|
513
|
-
std::string rtrim(const std::string &str) {
|
|
514
|
-
std::string trimmed = str;
|
|
515
|
-
size_t pos_ws = trimmed.find_last_not_of(" \t\n\v\f\r");
|
|
516
|
-
if (pos_ws != std::string::npos)
|
|
517
|
-
{ trimmed.erase(pos_ws + 1); }
|
|
518
|
-
else { trimmed.clear(); }
|
|
519
|
-
return trimmed;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
std::string normalize_underscores(const std::string& str) {
|
|
523
|
-
std::string normalized = str;
|
|
524
|
-
for(size_t i = 0, L = normalized.length(); i < L; ++i) {
|
|
525
|
-
if(normalized[i] == '_') {
|
|
526
|
-
normalized[i] = '-';
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
return normalized;
|
|
530
|
-
}
|
|
531
531
|
|
|
532
|
-
|
|
533
|
-
std::string prefix = "0";
|
|
534
|
-
std::string normalized = str;
|
|
535
|
-
|
|
536
|
-
return normalized[0] == '.' ? normalized.insert(0, prefix) : normalized;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
bool isPrintable(Ruleset_Ptr r, Sass_Output_Style style) {
|
|
532
|
+
bool isPrintable(StyleRule* r, Sass_Output_Style style) {
|
|
540
533
|
if (r == NULL) {
|
|
541
534
|
return false;
|
|
542
535
|
}
|
|
543
536
|
|
|
544
537
|
Block_Obj b = r->block();
|
|
545
538
|
|
|
546
|
-
|
|
539
|
+
SelectorList* sl = r->selector();
|
|
547
540
|
bool hasSelectors = sl ? sl->length() > 0 : false;
|
|
548
541
|
|
|
549
542
|
if (!hasSelectors) {
|
|
@@ -554,16 +547,16 @@ namespace Sass {
|
|
|
554
547
|
bool hasPrintableChildBlocks = false;
|
|
555
548
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
556
549
|
Statement_Obj stm = b->at(i);
|
|
557
|
-
if (Cast<
|
|
550
|
+
if (Cast<AtRule>(stm)) {
|
|
558
551
|
return true;
|
|
559
|
-
} else if (
|
|
552
|
+
} else if (Declaration* d = Cast<Declaration>(stm)) {
|
|
560
553
|
return isPrintable(d, style);
|
|
561
|
-
} else if (
|
|
554
|
+
} else if (ParentStatement* p = Cast<ParentStatement>(stm)) {
|
|
562
555
|
Block_Obj pChildBlock = p->block();
|
|
563
556
|
if (isPrintable(pChildBlock, style)) {
|
|
564
557
|
hasPrintableChildBlocks = true;
|
|
565
558
|
}
|
|
566
|
-
} else if (
|
|
559
|
+
} else if (Comment* c = Cast<Comment>(stm)) {
|
|
567
560
|
// keep for uncompressed
|
|
568
561
|
if (style != COMPRESSED) {
|
|
569
562
|
hasDeclarations = true;
|
|
@@ -584,25 +577,25 @@ namespace Sass {
|
|
|
584
577
|
return false;
|
|
585
578
|
}
|
|
586
579
|
|
|
587
|
-
bool isPrintable(
|
|
580
|
+
bool isPrintable(String_Constant* s, Sass_Output_Style style)
|
|
588
581
|
{
|
|
589
582
|
return ! s->value().empty();
|
|
590
583
|
}
|
|
591
584
|
|
|
592
|
-
bool isPrintable(
|
|
585
|
+
bool isPrintable(String_Quoted* s, Sass_Output_Style style)
|
|
593
586
|
{
|
|
594
587
|
return true;
|
|
595
588
|
}
|
|
596
589
|
|
|
597
|
-
bool isPrintable(
|
|
590
|
+
bool isPrintable(Declaration* d, Sass_Output_Style style)
|
|
598
591
|
{
|
|
599
|
-
|
|
592
|
+
ExpressionObj val = d->value();
|
|
600
593
|
if (String_Quoted_Obj sq = Cast<String_Quoted>(val)) return isPrintable(sq.ptr(), style);
|
|
601
594
|
if (String_Constant_Obj sc = Cast<String_Constant>(val)) return isPrintable(sc.ptr(), style);
|
|
602
595
|
return true;
|
|
603
596
|
}
|
|
604
597
|
|
|
605
|
-
bool isPrintable(
|
|
598
|
+
bool isPrintable(SupportsRule* f, Sass_Output_Style style) {
|
|
606
599
|
if (f == NULL) {
|
|
607
600
|
return false;
|
|
608
601
|
}
|
|
@@ -613,10 +606,10 @@ namespace Sass {
|
|
|
613
606
|
bool hasPrintableChildBlocks = false;
|
|
614
607
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
615
608
|
Statement_Obj stm = b->at(i);
|
|
616
|
-
if (Cast<Declaration>(stm) || Cast<
|
|
609
|
+
if (Cast<Declaration>(stm) || Cast<AtRule>(stm)) {
|
|
617
610
|
hasDeclarations = true;
|
|
618
611
|
}
|
|
619
|
-
else if (
|
|
612
|
+
else if (ParentStatement* b = Cast<ParentStatement>(stm)) {
|
|
620
613
|
Block_Obj pChildBlock = b->block();
|
|
621
614
|
if (!b->is_invisible()) {
|
|
622
615
|
if (isPrintable(pChildBlock, style)) {
|
|
@@ -633,36 +626,37 @@ namespace Sass {
|
|
|
633
626
|
return false;
|
|
634
627
|
}
|
|
635
628
|
|
|
636
|
-
bool isPrintable(
|
|
629
|
+
bool isPrintable(CssMediaRule* m, Sass_Output_Style style)
|
|
637
630
|
{
|
|
638
|
-
if (m ==
|
|
631
|
+
if (m == nullptr) return false;
|
|
639
632
|
Block_Obj b = m->block();
|
|
640
|
-
if (b ==
|
|
633
|
+
if (b == nullptr) return false;
|
|
634
|
+
if (m->empty()) return false;
|
|
641
635
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
642
636
|
Statement_Obj stm = b->at(i);
|
|
643
|
-
if (Cast<
|
|
637
|
+
if (Cast<AtRule>(stm)) return true;
|
|
644
638
|
else if (Cast<Declaration>(stm)) return true;
|
|
645
|
-
else if (
|
|
639
|
+
else if (Comment* c = Cast<Comment>(stm)) {
|
|
646
640
|
if (isPrintable(c, style)) {
|
|
647
641
|
return true;
|
|
648
642
|
}
|
|
649
643
|
}
|
|
650
|
-
else if (
|
|
644
|
+
else if (StyleRule* r = Cast<StyleRule>(stm)) {
|
|
651
645
|
if (isPrintable(r, style)) {
|
|
652
646
|
return true;
|
|
653
647
|
}
|
|
654
648
|
}
|
|
655
|
-
else if (
|
|
649
|
+
else if (SupportsRule* f = Cast<SupportsRule>(stm)) {
|
|
656
650
|
if (isPrintable(f, style)) {
|
|
657
651
|
return true;
|
|
658
652
|
}
|
|
659
653
|
}
|
|
660
|
-
else if (
|
|
654
|
+
else if (CssMediaRule* mb = Cast<CssMediaRule>(stm)) {
|
|
661
655
|
if (isPrintable(mb, style)) {
|
|
662
656
|
return true;
|
|
663
657
|
}
|
|
664
658
|
}
|
|
665
|
-
else if (
|
|
659
|
+
else if (ParentStatement* b = Cast<ParentStatement>(stm)) {
|
|
666
660
|
if (isPrintable(b->block(), style)) {
|
|
667
661
|
return true;
|
|
668
662
|
}
|
|
@@ -671,7 +665,7 @@ namespace Sass {
|
|
|
671
665
|
return false;
|
|
672
666
|
}
|
|
673
667
|
|
|
674
|
-
bool isPrintable(
|
|
668
|
+
bool isPrintable(Comment* c, Sass_Output_Style style)
|
|
675
669
|
{
|
|
676
670
|
// keep for uncompressed
|
|
677
671
|
if (style != COMPRESSED) {
|
|
@@ -692,30 +686,30 @@ namespace Sass {
|
|
|
692
686
|
|
|
693
687
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
694
688
|
Statement_Obj stm = b->at(i);
|
|
695
|
-
if (Cast<Declaration>(stm) || Cast<
|
|
689
|
+
if (Cast<Declaration>(stm) || Cast<AtRule>(stm)) {
|
|
696
690
|
return true;
|
|
697
691
|
}
|
|
698
|
-
else if (
|
|
692
|
+
else if (Comment* c = Cast<Comment>(stm)) {
|
|
699
693
|
if (isPrintable(c, style)) {
|
|
700
694
|
return true;
|
|
701
695
|
}
|
|
702
696
|
}
|
|
703
|
-
else if (
|
|
697
|
+
else if (StyleRule* r = Cast<StyleRule>(stm)) {
|
|
704
698
|
if (isPrintable(r, style)) {
|
|
705
699
|
return true;
|
|
706
700
|
}
|
|
707
701
|
}
|
|
708
|
-
else if (
|
|
702
|
+
else if (SupportsRule* f = Cast<SupportsRule>(stm)) {
|
|
709
703
|
if (isPrintable(f, style)) {
|
|
710
704
|
return true;
|
|
711
705
|
}
|
|
712
706
|
}
|
|
713
|
-
else if (
|
|
707
|
+
else if (CssMediaRule * m = Cast<CssMediaRule>(stm)) {
|
|
714
708
|
if (isPrintable(m, style)) {
|
|
715
709
|
return true;
|
|
716
710
|
}
|
|
717
711
|
}
|
|
718
|
-
else if (
|
|
712
|
+
else if (ParentStatement* b = Cast<ParentStatement>(stm)) {
|
|
719
713
|
if (isPrintable(b->block(), style)) {
|
|
720
714
|
return true;
|
|
721
715
|
}
|
|
@@ -725,9 +719,5 @@ namespace Sass {
|
|
|
725
719
|
return false;
|
|
726
720
|
}
|
|
727
721
|
|
|
728
|
-
bool isAscii(const char chr) {
|
|
729
|
-
return unsigned(chr) < 128;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
722
|
}
|
|
733
723
|
}
|