sassc 2.3.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/.travis.yml +1 -0
- data/CHANGELOG.md +5 -0
- data/ext/libsass/VERSION +1 -1
- data/ext/libsass/include/sass/context.h +3 -0
- data/ext/libsass/src/MurmurHash2.hpp +91 -0
- data/ext/libsass/src/ast.cpp +117 -117
- data/ext/libsass/src/ast.hpp +160 -162
- data/ext/libsass/src/ast_def_macros.hpp +10 -10
- data/ext/libsass/src/ast_fwd_decl.cpp +2 -2
- data/ext/libsass/src/ast_fwd_decl.hpp +61 -52
- data/ext/libsass/src/ast_helpers.hpp +5 -5
- data/ext/libsass/src/ast_sel_cmp.cpp +18 -18
- data/ext/libsass/src/ast_sel_super.cpp +52 -52
- data/ext/libsass/src/ast_sel_unify.cpp +16 -16
- data/ext/libsass/src/ast_sel_weave.cpp +62 -62
- data/ext/libsass/src/ast_selectors.cpp +87 -77
- data/ext/libsass/src/ast_selectors.hpp +72 -62
- data/ext/libsass/src/ast_supports.cpp +35 -35
- data/ext/libsass/src/ast_supports.hpp +29 -29
- data/ext/libsass/src/ast_values.cpp +58 -58
- data/ext/libsass/src/ast_values.hpp +75 -75
- data/ext/libsass/src/backtrace.cpp +9 -9
- data/ext/libsass/src/backtrace.hpp +5 -5
- data/ext/libsass/src/base64vlq.cpp +2 -2
- data/ext/libsass/src/base64vlq.hpp +1 -1
- data/ext/libsass/src/bind.cpp +17 -17
- data/ext/libsass/src/bind.hpp +1 -1
- data/ext/libsass/src/c2ast.cpp +3 -3
- data/ext/libsass/src/c2ast.hpp +1 -1
- data/ext/libsass/src/check_nesting.cpp +36 -36
- data/ext/libsass/src/check_nesting.hpp +2 -2
- data/ext/libsass/src/color_maps.cpp +5 -5
- data/ext/libsass/src/color_maps.hpp +1 -1
- data/ext/libsass/src/context.cpp +63 -60
- data/ext/libsass/src/context.hpp +33 -33
- data/ext/libsass/src/cssize.cpp +30 -29
- data/ext/libsass/src/cssize.hpp +13 -13
- data/ext/libsass/src/dart_helpers.hpp +5 -5
- data/ext/libsass/src/debugger.hpp +127 -128
- data/ext/libsass/src/emitter.cpp +12 -12
- data/ext/libsass/src/emitter.hpp +10 -10
- data/ext/libsass/src/environment.cpp +27 -27
- data/ext/libsass/src/environment.hpp +24 -24
- data/ext/libsass/src/error_handling.cpp +42 -42
- data/ext/libsass/src/error_handling.hpp +38 -50
- data/ext/libsass/src/eval.cpp +138 -132
- data/ext/libsass/src/eval.hpp +17 -17
- data/ext/libsass/src/eval_selectors.cpp +3 -3
- data/ext/libsass/src/expand.cpp +70 -64
- data/ext/libsass/src/expand.hpp +12 -12
- data/ext/libsass/src/extender.cpp +55 -53
- data/ext/libsass/src/extender.hpp +14 -14
- data/ext/libsass/src/file.cpp +66 -58
- data/ext/libsass/src/file.hpp +23 -25
- data/ext/libsass/src/fn_colors.cpp +9 -9
- data/ext/libsass/src/fn_lists.cpp +18 -18
- data/ext/libsass/src/fn_maps.cpp +3 -3
- data/ext/libsass/src/fn_miscs.cpp +15 -15
- data/ext/libsass/src/fn_numbers.cpp +7 -7
- data/ext/libsass/src/fn_selectors.cpp +8 -8
- data/ext/libsass/src/fn_strings.cpp +34 -22
- data/ext/libsass/src/fn_utils.cpp +29 -26
- data/ext/libsass/src/fn_utils.hpp +10 -10
- data/ext/libsass/src/inspect.cpp +35 -34
- data/ext/libsass/src/inspect.hpp +21 -21
- data/ext/libsass/src/lexer.cpp +3 -1
- data/ext/libsass/src/listize.cpp +2 -2
- 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/{SharedPtr.cpp → shared_ptr.cpp} +2 -2
- data/ext/libsass/src/memory/{SharedPtr.hpp → shared_ptr.hpp} +18 -6
- data/ext/libsass/src/operation.hpp +44 -44
- data/ext/libsass/src/operators.cpp +18 -18
- data/ext/libsass/src/operators.hpp +11 -11
- data/ext/libsass/src/ordered_map.hpp +18 -18
- data/ext/libsass/src/output.cpp +16 -16
- data/ext/libsass/src/output.hpp +5 -5
- data/ext/libsass/src/parser.cpp +327 -345
- data/ext/libsass/src/parser.hpp +77 -87
- data/ext/libsass/src/parser_selectors.cpp +6 -6
- data/ext/libsass/src/permutate.hpp +39 -15
- data/ext/libsass/src/plugins.cpp +7 -7
- data/ext/libsass/src/plugins.hpp +8 -8
- data/ext/libsass/src/position.cpp +7 -26
- data/ext/libsass/src/position.hpp +44 -21
- data/ext/libsass/src/remove_placeholders.cpp +4 -4
- data/ext/libsass/src/remove_placeholders.hpp +3 -3
- data/ext/libsass/src/sass.cpp +16 -15
- data/ext/libsass/src/sass.hpp +9 -5
- data/ext/libsass/src/sass_context.cpp +52 -34
- data/ext/libsass/src/sass_values.cpp +8 -10
- 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 +22 -18
- data/ext/libsass/src/source_map.hpp +12 -9
- data/ext/libsass/src/units.cpp +19 -19
- data/ext/libsass/src/units.hpp +8 -8
- data/ext/libsass/src/utf8_string.cpp +9 -10
- data/ext/libsass/src/utf8_string.hpp +7 -6
- data/ext/libsass/src/util.cpp +38 -38
- data/ext/libsass/src/util.hpp +18 -18
- data/ext/libsass/src/util_string.cpp +13 -13
- data/ext/libsass/src/util_string.hpp +9 -8
- data/ext/libsass/src/values.cpp +12 -12
- data/lib/sassc/native.rb +3 -5
- data/lib/sassc/version.rb +1 -1
- data/test/native_test.rb +4 -4
- metadata +14 -5
- data/lib/sassc/native/lib_c.rb +0 -21
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
|
@@ -95,15 +95,15 @@ namespace Sass {
|
|
95
95
|
extern const double resolution_conversion_factors[3][3];
|
96
96
|
|
97
97
|
UnitType get_main_unit(const UnitClass unit);
|
98
|
-
enum Sass::UnitType string_to_unit(const
|
98
|
+
enum Sass::UnitType string_to_unit(const sass::string&);
|
99
99
|
const char* unit_to_string(Sass::UnitType unit);
|
100
100
|
enum Sass::UnitClass get_unit_type(Sass::UnitType unit);
|
101
|
-
|
102
|
-
|
101
|
+
sass::string get_unit_class(Sass::UnitType unit);
|
102
|
+
sass::string unit_to_class(const sass::string&);
|
103
103
|
// throws incompatibleUnits exceptions
|
104
|
-
double conversion_factor(const
|
104
|
+
double conversion_factor(const sass::string&, const sass::string&);
|
105
105
|
double conversion_factor(UnitType, UnitType, UnitClass, UnitClass);
|
106
|
-
double convert_units(const
|
106
|
+
double convert_units(const sass::string&, const sass::string&, int&, int&);
|
107
107
|
|
108
108
|
}
|
109
109
|
|
@@ -11,7 +11,6 @@
|
|
11
11
|
|
12
12
|
namespace Sass {
|
13
13
|
namespace UTF_8 {
|
14
|
-
using std::string;
|
15
14
|
|
16
15
|
// naming conventions:
|
17
16
|
// offset: raw byte offset (0 based)
|
@@ -19,25 +18,25 @@ namespace Sass {
|
|
19
18
|
// index: code point offset (1 based or negative)
|
20
19
|
|
21
20
|
// function that will count the number of code points (utf-8 characters) from the given beginning to the given end
|
22
|
-
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) {
|
23
22
|
return utf8::distance(str.begin() + start, str.begin() + end);
|
24
23
|
}
|
25
24
|
|
26
|
-
size_t code_point_count(const string& str) {
|
25
|
+
size_t code_point_count(const sass::string& str) {
|
27
26
|
return utf8::distance(str.begin(), str.end());
|
28
27
|
}
|
29
28
|
|
30
29
|
// function that will return the byte offset at a code point position
|
31
|
-
size_t offset_at_position(const string& str, size_t position) {
|
32
|
-
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();
|
33
32
|
utf8::advance(it, position, str.end());
|
34
33
|
return std::distance(str.begin(), it);
|
35
34
|
}
|
36
35
|
|
37
36
|
// function that returns number of bytes in a character at offset
|
38
|
-
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) {
|
39
38
|
// get iterator from string and forward by offset
|
40
|
-
string::const_iterator stop = str.begin() + offset;
|
39
|
+
sass::string::const_iterator stop = str.begin() + offset;
|
41
40
|
// check if beyond boundary
|
42
41
|
if (stop == str.end()) return 0;
|
43
42
|
// advance by one code point
|
@@ -78,9 +77,9 @@ namespace Sass {
|
|
78
77
|
using std::wstring;
|
79
78
|
|
80
79
|
// convert from utf16/wide string to utf8 string
|
81
|
-
string convert_from_utf16(const wstring& utf16)
|
80
|
+
sass::string convert_from_utf16(const wstring& utf16)
|
82
81
|
{
|
83
|
-
string utf8;
|
82
|
+
sass::string utf8;
|
84
83
|
// pre-allocate expected memory
|
85
84
|
utf8.reserve(sizeof(utf16)/2);
|
86
85
|
utf8::utf16to8(utf16.begin(), utf16.end(),
|
@@ -89,7 +88,7 @@ namespace Sass {
|
|
89
88
|
}
|
90
89
|
|
91
90
|
// convert from utf8 string to utf16/wide string
|
92
|
-
wstring convert_to_utf16(const string& utf8)
|
91
|
+
wstring convert_to_utf16(const sass::string& utf8)
|
93
92
|
{
|
94
93
|
wstring utf16;
|
95
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
@@ -76,7 +76,7 @@ namespace Sass {
|
|
76
76
|
free(arr);
|
77
77
|
}
|
78
78
|
|
79
|
-
char **copy_strings(const
|
79
|
+
char **copy_strings(const sass::vector<sass::string>& strings, char*** array, int skip) {
|
80
80
|
int num = static_cast<int>(strings.size()) - skip;
|
81
81
|
char** arr = (char**) calloc(num + 1, sizeof(char*));
|
82
82
|
if (arr == 0)
|
@@ -97,10 +97,10 @@ namespace Sass {
|
|
97
97
|
}
|
98
98
|
|
99
99
|
// read css string (handle multiline DELIM)
|
100
|
-
|
100
|
+
sass::string read_css_string(const sass::string& str, bool css)
|
101
101
|
{
|
102
102
|
if (!css) return str;
|
103
|
-
|
103
|
+
sass::string out("");
|
104
104
|
bool esc = false;
|
105
105
|
for (auto i : str) {
|
106
106
|
if (i == '\\') {
|
@@ -125,9 +125,9 @@ namespace Sass {
|
|
125
125
|
|
126
126
|
// double escape all escape sequences
|
127
127
|
// keep unescaped quotes and backslashes
|
128
|
-
|
128
|
+
sass::string evacuate_escapes(const sass::string& str)
|
129
129
|
{
|
130
|
-
|
130
|
+
sass::string out("");
|
131
131
|
bool esc = false;
|
132
132
|
for (auto i : str) {
|
133
133
|
if (i == '\\' && !esc) {
|
@@ -159,7 +159,7 @@ namespace Sass {
|
|
159
159
|
}
|
160
160
|
|
161
161
|
// bell characters are replaced with spaces
|
162
|
-
void newline_to_space(
|
162
|
+
void newline_to_space(sass::string& str)
|
163
163
|
{
|
164
164
|
std::replace(str.begin(), str.end(), '\n', ' ');
|
165
165
|
}
|
@@ -168,14 +168,14 @@ namespace Sass {
|
|
168
168
|
// 2. Replaces newlines with spaces.
|
169
169
|
//
|
170
170
|
// This method only considers LF and CRLF as newlines.
|
171
|
-
|
171
|
+
sass::string string_to_output(const sass::string& str)
|
172
172
|
{
|
173
|
-
|
173
|
+
sass::string result;
|
174
174
|
result.reserve(str.size());
|
175
175
|
std::size_t pos = 0;
|
176
176
|
while (true) {
|
177
177
|
const std::size_t newline = str.find_first_of("\n\r", pos);
|
178
|
-
if (newline ==
|
178
|
+
if (newline == sass::string::npos) break;
|
179
179
|
result.append(str, pos, newline - pos);
|
180
180
|
if (str[newline] == '\r') {
|
181
181
|
if (str[newline + 1] == '\n') {
|
@@ -191,17 +191,17 @@ namespace Sass {
|
|
191
191
|
}
|
192
192
|
result += ' ';
|
193
193
|
const std::size_t non_space = str.find_first_not_of(" \f\n\r\t\v", pos);
|
194
|
-
if (non_space !=
|
194
|
+
if (non_space != sass::string::npos) {
|
195
195
|
pos = non_space;
|
196
196
|
}
|
197
197
|
}
|
198
|
-
result.append(str, pos,
|
198
|
+
result.append(str, pos, sass::string::npos);
|
199
199
|
return result;
|
200
200
|
}
|
201
201
|
|
202
|
-
|
202
|
+
sass::string escape_string(const sass::string& str)
|
203
203
|
{
|
204
|
-
|
204
|
+
sass::string out;
|
205
205
|
out.reserve(str.size());
|
206
206
|
for (char c : str) {
|
207
207
|
switch (c) {
|
@@ -221,9 +221,9 @@ namespace Sass {
|
|
221
221
|
return out;
|
222
222
|
}
|
223
223
|
|
224
|
-
|
224
|
+
sass::string comment_to_compact_string(const sass::string& text)
|
225
225
|
{
|
226
|
-
|
226
|
+
sass::string str = "";
|
227
227
|
size_t has = 0;
|
228
228
|
char prev = 0;
|
229
229
|
bool clean = false;
|
@@ -270,10 +270,10 @@ namespace Sass {
|
|
270
270
|
return quote_mark;
|
271
271
|
}
|
272
272
|
|
273
|
-
|
273
|
+
sass::string read_hex_escapes(const sass::string& s)
|
274
274
|
{
|
275
275
|
|
276
|
-
|
276
|
+
sass::string result;
|
277
277
|
bool skipped = false;
|
278
278
|
|
279
279
|
for (size_t i = 0, L = s.length(); i < L; ++i) {
|
@@ -339,7 +339,7 @@ namespace Sass {
|
|
339
339
|
|
340
340
|
}
|
341
341
|
|
342
|
-
|
342
|
+
sass::string unquote(const sass::string& s, char* qd, bool keep_utf8_sequences, bool strict)
|
343
343
|
{
|
344
344
|
|
345
345
|
// not enough room for quotes
|
@@ -355,7 +355,7 @@ namespace Sass {
|
|
355
355
|
else if (*s.begin() == '\'' && *s.rbegin() == '\'') q = '\'';
|
356
356
|
else return s;
|
357
357
|
|
358
|
-
|
358
|
+
sass::string unq;
|
359
359
|
unq.reserve(s.length()-2);
|
360
360
|
|
361
361
|
for (size_t i = 1, L = s.length() - 1; i < L; ++i) {
|
@@ -414,7 +414,7 @@ namespace Sass {
|
|
414
414
|
// // don't be that strict
|
415
415
|
// return s;
|
416
416
|
// // this basically always means an internal error and not users fault
|
417
|
-
// error("Unescaped delimiter in string to unquote found. [" + s + "]",
|
417
|
+
// error("Unescaped delimiter in string to unquote found. [" + s + "]", SourceSpan("[UNQUOTE]"));
|
418
418
|
// }
|
419
419
|
else {
|
420
420
|
if (strict && !skipped) {
|
@@ -431,16 +431,16 @@ namespace Sass {
|
|
431
431
|
|
432
432
|
}
|
433
433
|
|
434
|
-
|
434
|
+
sass::string quote(const sass::string& s, char q)
|
435
435
|
{
|
436
436
|
|
437
437
|
// autodetect with fallback to given quote
|
438
438
|
q = detect_best_quotemark(s.c_str(), q);
|
439
439
|
|
440
440
|
// return an empty quoted string
|
441
|
-
if (s.empty()) return
|
441
|
+
if (s.empty()) return sass::string(2, q ? q : '"');
|
442
442
|
|
443
|
-
|
443
|
+
sass::string quoted;
|
444
444
|
quoted.reserve(s.length()+2);
|
445
445
|
quoted.push_back(q);
|
446
446
|
|
@@ -529,7 +529,7 @@ namespace Sass {
|
|
529
529
|
|
530
530
|
namespace Util {
|
531
531
|
|
532
|
-
bool isPrintable(
|
532
|
+
bool isPrintable(StyleRule* r, Sass_Output_Style style) {
|
533
533
|
if (r == NULL) {
|
534
534
|
return false;
|
535
535
|
}
|
@@ -547,11 +547,11 @@ namespace Sass {
|
|
547
547
|
bool hasPrintableChildBlocks = false;
|
548
548
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
549
549
|
Statement_Obj stm = b->at(i);
|
550
|
-
if (Cast<
|
550
|
+
if (Cast<AtRule>(stm)) {
|
551
551
|
return true;
|
552
552
|
} else if (Declaration* d = Cast<Declaration>(stm)) {
|
553
553
|
return isPrintable(d, style);
|
554
|
-
} else if (
|
554
|
+
} else if (ParentStatement* p = Cast<ParentStatement>(stm)) {
|
555
555
|
Block_Obj pChildBlock = p->block();
|
556
556
|
if (isPrintable(pChildBlock, style)) {
|
557
557
|
hasPrintableChildBlocks = true;
|
@@ -589,13 +589,13 @@ namespace Sass {
|
|
589
589
|
|
590
590
|
bool isPrintable(Declaration* d, Sass_Output_Style style)
|
591
591
|
{
|
592
|
-
|
592
|
+
ExpressionObj val = d->value();
|
593
593
|
if (String_Quoted_Obj sq = Cast<String_Quoted>(val)) return isPrintable(sq.ptr(), style);
|
594
594
|
if (String_Constant_Obj sc = Cast<String_Constant>(val)) return isPrintable(sc.ptr(), style);
|
595
595
|
return true;
|
596
596
|
}
|
597
597
|
|
598
|
-
bool isPrintable(
|
598
|
+
bool isPrintable(SupportsRule* f, Sass_Output_Style style) {
|
599
599
|
if (f == NULL) {
|
600
600
|
return false;
|
601
601
|
}
|
@@ -606,10 +606,10 @@ namespace Sass {
|
|
606
606
|
bool hasPrintableChildBlocks = false;
|
607
607
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
608
608
|
Statement_Obj stm = b->at(i);
|
609
|
-
if (Cast<Declaration>(stm) || Cast<
|
609
|
+
if (Cast<Declaration>(stm) || Cast<AtRule>(stm)) {
|
610
610
|
hasDeclarations = true;
|
611
611
|
}
|
612
|
-
else if (
|
612
|
+
else if (ParentStatement* b = Cast<ParentStatement>(stm)) {
|
613
613
|
Block_Obj pChildBlock = b->block();
|
614
614
|
if (!b->is_invisible()) {
|
615
615
|
if (isPrintable(pChildBlock, style)) {
|
@@ -634,19 +634,19 @@ namespace Sass {
|
|
634
634
|
if (m->empty()) return false;
|
635
635
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
636
636
|
Statement_Obj stm = b->at(i);
|
637
|
-
if (Cast<
|
637
|
+
if (Cast<AtRule>(stm)) return true;
|
638
638
|
else if (Cast<Declaration>(stm)) return true;
|
639
639
|
else if (Comment* c = Cast<Comment>(stm)) {
|
640
640
|
if (isPrintable(c, style)) {
|
641
641
|
return true;
|
642
642
|
}
|
643
643
|
}
|
644
|
-
else if (
|
644
|
+
else if (StyleRule* r = Cast<StyleRule>(stm)) {
|
645
645
|
if (isPrintable(r, style)) {
|
646
646
|
return true;
|
647
647
|
}
|
648
648
|
}
|
649
|
-
else if (
|
649
|
+
else if (SupportsRule* f = Cast<SupportsRule>(stm)) {
|
650
650
|
if (isPrintable(f, style)) {
|
651
651
|
return true;
|
652
652
|
}
|
@@ -656,7 +656,7 @@ namespace Sass {
|
|
656
656
|
return true;
|
657
657
|
}
|
658
658
|
}
|
659
|
-
else if (
|
659
|
+
else if (ParentStatement* b = Cast<ParentStatement>(stm)) {
|
660
660
|
if (isPrintable(b->block(), style)) {
|
661
661
|
return true;
|
662
662
|
}
|
@@ -686,7 +686,7 @@ namespace Sass {
|
|
686
686
|
|
687
687
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
688
688
|
Statement_Obj stm = b->at(i);
|
689
|
-
if (Cast<Declaration>(stm) || Cast<
|
689
|
+
if (Cast<Declaration>(stm) || Cast<AtRule>(stm)) {
|
690
690
|
return true;
|
691
691
|
}
|
692
692
|
else if (Comment* c = Cast<Comment>(stm)) {
|
@@ -694,12 +694,12 @@ namespace Sass {
|
|
694
694
|
return true;
|
695
695
|
}
|
696
696
|
}
|
697
|
-
else if (
|
697
|
+
else if (StyleRule* r = Cast<StyleRule>(stm)) {
|
698
698
|
if (isPrintable(r, style)) {
|
699
699
|
return true;
|
700
700
|
}
|
701
701
|
}
|
702
|
-
else if (
|
702
|
+
else if (SupportsRule* f = Cast<SupportsRule>(stm)) {
|
703
703
|
if (isPrintable(f, style)) {
|
704
704
|
return true;
|
705
705
|
}
|
@@ -709,7 +709,7 @@ namespace Sass {
|
|
709
709
|
return true;
|
710
710
|
}
|
711
711
|
}
|
712
|
-
else if (
|
712
|
+
else if (ParentStatement* b = Cast<ParentStatement>(stm)) {
|
713
713
|
if (isPrintable(b->block(), style)) {
|
714
714
|
return true;
|
715
715
|
}
|
data/ext/libsass/src/util.hpp
CHANGED
@@ -34,17 +34,17 @@ namespace Sass {
|
|
34
34
|
double sass_strtod(const char* str);
|
35
35
|
const char* safe_str(const char *, const char* = "");
|
36
36
|
void free_string_array(char **);
|
37
|
-
char **copy_strings(const
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
void newline_to_space(
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
char **copy_strings(const sass::vector<sass::string>&, char ***, int = 0);
|
38
|
+
sass::string read_css_string(const sass::string& str, bool css = true);
|
39
|
+
sass::string evacuate_escapes(const sass::string& str);
|
40
|
+
sass::string string_to_output(const sass::string& str);
|
41
|
+
sass::string comment_to_compact_string(const sass::string& text);
|
42
|
+
sass::string read_hex_escapes(const sass::string& str);
|
43
|
+
sass::string escape_string(const sass::string& str);
|
44
|
+
void newline_to_space(sass::string& str);
|
45
|
+
|
46
|
+
sass::string quote(const sass::string&, char q = 0);
|
47
|
+
sass::string unquote(const sass::string&, char* q = 0, bool keep_utf8_sequences = false, bool strict = true);
|
48
48
|
char detect_best_quotemark(const char* s, char qm = '"');
|
49
49
|
|
50
50
|
bool is_hex_doublet(double n);
|
@@ -63,21 +63,21 @@ namespace Sass {
|
|
63
63
|
|
64
64
|
// C++20 `starts_with` equivalent.
|
65
65
|
// See https://en.cppreference.com/w/cpp/string/basic_string/starts_with
|
66
|
-
inline bool starts_with(const
|
66
|
+
inline bool starts_with(const sass::string& str, const char* prefix, size_t prefix_len) {
|
67
67
|
return str.compare(0, prefix_len, prefix) == 0;
|
68
68
|
}
|
69
69
|
|
70
|
-
inline bool starts_with(const
|
70
|
+
inline bool starts_with(const sass::string& str, const char* prefix) {
|
71
71
|
return starts_with(str, prefix, std::strlen(prefix));
|
72
72
|
}
|
73
73
|
|
74
74
|
// C++20 `ends_with` equivalent.
|
75
75
|
// See https://en.cppreference.com/w/cpp/string/basic_string/ends_with
|
76
|
-
inline bool ends_with(const
|
76
|
+
inline bool ends_with(const sass::string& str, const sass::string& suffix) {
|
77
77
|
return suffix.size() <= str.size() && std::equal(suffix.rbegin(), suffix.rend(), str.rbegin());
|
78
78
|
}
|
79
79
|
|
80
|
-
inline bool ends_with(const
|
80
|
+
inline bool ends_with(const sass::string& str, const char* suffix, size_t suffix_len) {
|
81
81
|
if (suffix_len > str.size()) return false;
|
82
82
|
const char* suffix_it = suffix + suffix_len;
|
83
83
|
const char* str_it = str.c_str() + str.size();
|
@@ -85,14 +85,14 @@ namespace Sass {
|
|
85
85
|
return true;
|
86
86
|
}
|
87
87
|
|
88
|
-
inline bool ends_with(const
|
88
|
+
inline bool ends_with(const sass::string& str, const char* suffix) {
|
89
89
|
return ends_with(str, suffix, std::strlen(suffix));
|
90
90
|
}
|
91
91
|
|
92
92
|
namespace Util {
|
93
93
|
|
94
|
-
bool isPrintable(
|
95
|
-
bool isPrintable(
|
94
|
+
bool isPrintable(StyleRule* r, Sass_Output_Style style = NESTED);
|
95
|
+
bool isPrintable(SupportsRule* r, Sass_Output_Style style = NESTED);
|
96
96
|
bool isPrintable(CssMediaRule* r, Sass_Output_Style style = NESTED);
|
97
97
|
bool isPrintable(Comment* b, Sass_Output_Style style = NESTED);
|
98
98
|
bool isPrintable(Block_Obj b, Sass_Output_Style style = NESTED);
|