sassc 1.11.4 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -2
- data/CODE_OF_CONDUCT.md +10 -0
- data/README.md +4 -1
- data/ext/libsass/.editorconfig +1 -1
- data/ext/libsass/.github/CONTRIBUTING.md +7 -7
- data/ext/libsass/.github/ISSUE_TEMPLATE.md +31 -6
- data/ext/libsass/.gitignore +3 -0
- data/ext/libsass/.travis.yml +37 -18
- data/ext/libsass/GNUmakefile.am +23 -37
- data/ext/libsass/Makefile +10 -6
- data/ext/libsass/Makefile.conf +3 -0
- data/ext/libsass/Readme.md +68 -63
- data/ext/libsass/appveyor.yml +7 -3
- data/ext/libsass/configure.ac +10 -14
- data/ext/libsass/docs/api-context-internal.md +29 -21
- data/ext/libsass/docs/api-context.md +26 -6
- data/ext/libsass/docs/api-doc.md +49 -16
- data/ext/libsass/docs/api-function-example.md +1 -1
- data/ext/libsass/docs/api-function.md +31 -7
- data/ext/libsass/docs/api-importer.md +19 -19
- data/ext/libsass/docs/api-value.md +4 -2
- data/ext/libsass/docs/build-on-windows.md +4 -4
- data/ext/libsass/docs/build-with-mingw.md +3 -3
- data/ext/libsass/docs/build.md +9 -9
- data/ext/libsass/docs/custom-functions-internal.md +10 -8
- data/ext/libsass/docs/implementations.md +20 -8
- data/ext/libsass/docs/unicode.md +16 -10
- data/ext/libsass/include/sass/base.h +0 -3
- data/ext/libsass/include/sass/context.h +20 -2
- data/ext/libsass/include/sass/functions.h +31 -0
- data/ext/libsass/include/sass/values.h +3 -1
- data/ext/libsass/include/sass/version.h +1 -1
- data/ext/libsass/include/sass/version.h.in +1 -1
- data/ext/libsass/include/sass2scss.h +1 -1
- data/ext/libsass/res/resource.rc +6 -6
- data/ext/libsass/script/ci-build-libsass +10 -5
- data/ext/libsass/script/ci-build-plugin +62 -0
- data/ext/libsass/script/ci-install-compiler +1 -1
- data/ext/libsass/script/ci-install-deps +4 -7
- data/ext/libsass/script/ci-report-coverage +13 -3
- data/ext/libsass/script/tap-driver +1 -1
- data/ext/libsass/script/tap-runner +1 -1
- data/ext/libsass/src/GNUmakefile.am +1 -1
- data/ext/libsass/src/ast.cpp +537 -762
- data/ext/libsass/src/ast.hpp +377 -419
- data/ext/libsass/src/ast_def_macros.hpp +26 -1
- data/ext/libsass/src/ast_fwd_decl.cpp +29 -0
- data/ext/libsass/src/ast_fwd_decl.hpp +94 -21
- data/ext/libsass/src/b64/encode.h +3 -1
- data/ext/libsass/src/backtrace.cpp +46 -0
- data/ext/libsass/src/backtrace.hpp +7 -54
- data/ext/libsass/src/bind.cpp +72 -50
- data/ext/libsass/src/bind.hpp +0 -1
- data/ext/libsass/src/cencode.c +6 -0
- data/ext/libsass/src/check_nesting.cpp +157 -135
- data/ext/libsass/src/check_nesting.hpp +11 -10
- data/ext/libsass/src/color_maps.cpp +10 -6
- data/ext/libsass/src/color_maps.hpp +6 -8
- data/ext/libsass/src/constants.cpp +4 -3
- data/ext/libsass/src/constants.hpp +4 -3
- data/ext/libsass/src/context.cpp +110 -47
- data/ext/libsass/src/context.hpp +11 -1
- data/ext/libsass/src/cssize.cpp +105 -94
- data/ext/libsass/src/cssize.hpp +4 -5
- data/ext/libsass/src/debugger.hpp +247 -244
- data/ext/libsass/src/emitter.cpp +30 -6
- data/ext/libsass/src/emitter.hpp +7 -0
- data/ext/libsass/src/environment.cpp +67 -16
- data/ext/libsass/src/environment.hpp +28 -7
- data/ext/libsass/src/error_handling.cpp +92 -64
- data/ext/libsass/src/error_handling.hpp +64 -43
- data/ext/libsass/src/eval.cpp +494 -544
- data/ext/libsass/src/eval.hpp +17 -23
- data/ext/libsass/src/expand.cpp +182 -154
- data/ext/libsass/src/expand.hpp +4 -5
- data/ext/libsass/src/extend.cpp +299 -291
- data/ext/libsass/src/extend.hpp +46 -11
- data/ext/libsass/src/file.cpp +103 -36
- data/ext/libsass/src/file.hpp +21 -4
- data/ext/libsass/src/functions.cpp +561 -312
- data/ext/libsass/src/functions.hpp +8 -5
- data/ext/libsass/src/inspect.cpp +108 -53
- data/ext/libsass/src/inspect.hpp +5 -2
- data/ext/libsass/src/lexer.cpp +15 -7
- data/ext/libsass/src/lexer.hpp +13 -4
- data/ext/libsass/src/listize.cpp +3 -2
- data/ext/libsass/src/listize.hpp +0 -1
- data/ext/libsass/src/memory/SharedPtr.cpp +16 -18
- data/ext/libsass/src/memory/SharedPtr.hpp +47 -43
- data/ext/libsass/src/node.cpp +34 -38
- data/ext/libsass/src/node.hpp +6 -8
- data/ext/libsass/src/operation.hpp +2 -2
- data/ext/libsass/src/operators.cpp +240 -0
- data/ext/libsass/src/operators.hpp +30 -0
- data/ext/libsass/src/output.cpp +22 -20
- data/ext/libsass/src/parser.cpp +719 -358
- data/ext/libsass/src/parser.hpp +57 -22
- data/ext/libsass/src/plugins.cpp +28 -10
- data/ext/libsass/src/position.cpp +21 -3
- data/ext/libsass/src/position.hpp +2 -1
- data/ext/libsass/src/prelexer.cpp +104 -19
- data/ext/libsass/src/prelexer.hpp +10 -3
- data/ext/libsass/src/remove_placeholders.cpp +9 -10
- data/ext/libsass/src/remove_placeholders.hpp +1 -5
- data/ext/libsass/src/sass.cpp +62 -4
- data/ext/libsass/src/sass.hpp +5 -2
- data/ext/libsass/src/sass_context.cpp +96 -58
- data/ext/libsass/src/sass_context.hpp +7 -5
- data/ext/libsass/src/sass_functions.cpp +63 -1
- data/ext/libsass/src/sass_functions.hpp +19 -1
- data/ext/libsass/src/sass_util.cpp +3 -3
- data/ext/libsass/src/sass_util.hpp +4 -4
- data/ext/libsass/src/sass_values.cpp +42 -39
- data/ext/libsass/src/sass_values.hpp +2 -1
- data/ext/libsass/src/source_map.cpp +16 -18
- data/ext/libsass/src/subset_map.cpp +6 -8
- data/ext/libsass/src/subset_map.hpp +6 -6
- data/ext/libsass/src/to_c.cpp +2 -2
- data/ext/libsass/src/to_value.cpp +8 -3
- data/ext/libsass/src/to_value.hpp +1 -0
- data/ext/libsass/src/units.cpp +349 -45
- data/ext/libsass/src/units.hpp +39 -22
- data/ext/libsass/src/utf8/checked.h +7 -0
- data/ext/libsass/src/utf8/unchecked.h +7 -0
- data/ext/libsass/src/utf8_string.cpp +1 -1
- data/ext/libsass/src/util.cpp +139 -45
- data/ext/libsass/src/util.hpp +4 -7
- data/ext/libsass/src/values.cpp +15 -23
- data/ext/libsass/win/libsass.sln +13 -2
- data/ext/libsass/win/libsass.sln.DotSettings +9 -0
- data/ext/libsass/win/libsass.targets +3 -0
- data/ext/libsass/win/libsass.vcxproj.filters +9 -0
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +1 -1
- data/test/native_test.rb +1 -1
- metadata +11 -4
@@ -8,13 +8,12 @@
|
|
8
8
|
#include "sass/functions.h"
|
9
9
|
|
10
10
|
#define BUILT_IN(name) Expression_Ptr \
|
11
|
-
name(Env& env, Env& d_env, Context& ctx, Signature sig, ParserState pstate,
|
11
|
+
name(Env& env, Env& d_env, Context& ctx, Signature sig, ParserState pstate, Backtraces traces, std::vector<Selector_List_Obj> selector_stack)
|
12
12
|
|
13
13
|
namespace Sass {
|
14
14
|
struct Backtrace;
|
15
|
-
typedef Environment<AST_Node_Obj> Env;
|
16
15
|
typedef const char* Signature;
|
17
|
-
typedef Expression_Ptr (*Native_Function)(Env&, Env&, Context&, Signature, ParserState,
|
16
|
+
typedef Expression_Ptr (*Native_Function)(Env&, Env&, Context&, Signature, ParserState, Backtraces, std::vector<Selector_List_Obj>);
|
18
17
|
|
19
18
|
Definition_Ptr make_native_function(Signature, Native_Function, Context& ctx);
|
20
19
|
Definition_Ptr make_c_function(Sass_Function_Entry c_func, Context& ctx);
|
@@ -89,7 +88,6 @@ namespace Sass {
|
|
89
88
|
extern Signature call_sig;
|
90
89
|
extern Signature not_sig;
|
91
90
|
extern Signature if_sig;
|
92
|
-
extern Signature image_url_sig;
|
93
91
|
extern Signature map_get_sig;
|
94
92
|
extern Signature map_merge_sig;
|
95
93
|
extern Signature map_remove_sig;
|
@@ -107,6 +105,9 @@ namespace Sass {
|
|
107
105
|
extern Signature is_superselector_sig;
|
108
106
|
extern Signature simple_selectors_sig;
|
109
107
|
extern Signature selector_parse_sig;
|
108
|
+
extern Signature is_bracketed_sig;
|
109
|
+
extern Signature content_exists_sig;
|
110
|
+
extern Signature get_function_sig;
|
110
111
|
|
111
112
|
BUILT_IN(rgb);
|
112
113
|
BUILT_IN(rgba_4);
|
@@ -171,7 +172,6 @@ namespace Sass {
|
|
171
172
|
BUILT_IN(call);
|
172
173
|
BUILT_IN(sass_not);
|
173
174
|
BUILT_IN(sass_if);
|
174
|
-
BUILT_IN(image_url);
|
175
175
|
BUILT_IN(map_get);
|
176
176
|
BUILT_IN(map_merge);
|
177
177
|
BUILT_IN(map_remove);
|
@@ -189,6 +189,9 @@ namespace Sass {
|
|
189
189
|
BUILT_IN(is_superselector);
|
190
190
|
BUILT_IN(simple_selectors);
|
191
191
|
BUILT_IN(selector_parse);
|
192
|
+
BUILT_IN(is_bracketed);
|
193
|
+
BUILT_IN(content_exists);
|
194
|
+
BUILT_IN(get_function);
|
192
195
|
}
|
193
196
|
}
|
194
197
|
|
data/ext/libsass/src/inspect.cpp
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
namespace Sass {
|
17
17
|
|
18
|
-
Inspect::Inspect(Emitter emi)
|
18
|
+
Inspect::Inspect(const Emitter& emi)
|
19
19
|
: Emitter(emi)
|
20
20
|
{ }
|
21
21
|
Inspect::~Inspect() { }
|
@@ -42,7 +42,9 @@ namespace Sass {
|
|
42
42
|
void Inspect::operator()(Ruleset_Ptr ruleset)
|
43
43
|
{
|
44
44
|
if (ruleset->selector()) {
|
45
|
+
opt.in_selector = true;
|
45
46
|
ruleset->selector()->perform(this);
|
47
|
+
opt.in_selector = false;
|
46
48
|
}
|
47
49
|
if (ruleset->block()) {
|
48
50
|
ruleset->block()->perform(this);
|
@@ -90,7 +92,7 @@ namespace Sass {
|
|
90
92
|
append_token("@at-root ", at_root_block);
|
91
93
|
append_mandatory_space();
|
92
94
|
if(at_root_block->expression()) at_root_block->expression()->perform(this);
|
93
|
-
at_root_block->block()->perform(this);
|
95
|
+
if(at_root_block->block()) at_root_block->block()->perform(this);
|
94
96
|
}
|
95
97
|
|
96
98
|
void Inspect::operator()(Directive_Ptr at_rule)
|
@@ -121,6 +123,8 @@ namespace Sass {
|
|
121
123
|
if (dec->value()->concrete_type() == Expression::NULL_VAL) return;
|
122
124
|
bool was_decl = in_declaration;
|
123
125
|
in_declaration = true;
|
126
|
+
LOCAL_FLAG(in_custom_property, dec->is_custom_property());
|
127
|
+
|
124
128
|
if (output_style() == NESTED)
|
125
129
|
indentation += dec->tabs();
|
126
130
|
append_indentation();
|
@@ -166,7 +170,7 @@ namespace Sass {
|
|
166
170
|
|
167
171
|
import->urls().front()->perform(this);
|
168
172
|
if (import->urls().size() == 1) {
|
169
|
-
if (
|
173
|
+
if (import->import_queries()) {
|
170
174
|
append_mandatory_space();
|
171
175
|
import->import_queries()->perform(this);
|
172
176
|
}
|
@@ -179,7 +183,7 @@ namespace Sass {
|
|
179
183
|
|
180
184
|
import->urls()[i]->perform(this);
|
181
185
|
if (import->urls().size() - 1 == i) {
|
182
|
-
if (
|
186
|
+
if (import->import_queries()) {
|
183
187
|
append_mandatory_space();
|
184
188
|
import->import_queries()->perform(this);
|
185
189
|
}
|
@@ -354,16 +358,27 @@ namespace Sass {
|
|
354
358
|
if (items_output) append_comma_separator();
|
355
359
|
key->perform(this);
|
356
360
|
append_colon_separator();
|
361
|
+
LOCAL_FLAG(in_space_array, true);
|
362
|
+
LOCAL_FLAG(in_comma_array, true);
|
357
363
|
map->at(key)->perform(this);
|
358
364
|
items_output = true;
|
359
365
|
}
|
360
366
|
append_string(")");
|
361
367
|
}
|
362
368
|
|
369
|
+
std::string Inspect::lbracket(List_Ptr list) {
|
370
|
+
return list->is_bracketed() ? "[" : "(";
|
371
|
+
}
|
372
|
+
|
373
|
+
std::string Inspect::rbracket(List_Ptr list) {
|
374
|
+
return list->is_bracketed() ? "]" : ")";
|
375
|
+
}
|
376
|
+
|
363
377
|
void Inspect::operator()(List_Ptr list)
|
364
378
|
{
|
365
|
-
if (output_style() == TO_SASS
|
366
|
-
append_string(
|
379
|
+
if (list->empty() && (output_style() == TO_SASS || list->is_bracketed())) {
|
380
|
+
append_string(lbracket(list));
|
381
|
+
append_string(rbracket(list));
|
367
382
|
return;
|
368
383
|
}
|
369
384
|
std::string sep(list->separator() == SASS_SPACE ? " " : ",");
|
@@ -374,19 +389,24 @@ namespace Sass {
|
|
374
389
|
|
375
390
|
bool was_space_array = in_space_array;
|
376
391
|
bool was_comma_array = in_comma_array;
|
392
|
+
// if the list is bracketed, always include the left bracket
|
393
|
+
if (list->is_bracketed()) {
|
394
|
+
append_string(lbracket(list));
|
395
|
+
}
|
377
396
|
// probably ruby sass eqivalent of element_needs_parens
|
378
|
-
if (output_style() == TO_SASS &&
|
397
|
+
else if (output_style() == TO_SASS &&
|
379
398
|
list->length() == 1 &&
|
380
399
|
!list->from_selector() &&
|
381
|
-
!
|
382
|
-
!
|
383
|
-
|
400
|
+
!Cast<List>(list->at(0)) &&
|
401
|
+
!Cast<Selector_List>(list->at(0))
|
402
|
+
) {
|
403
|
+
append_string(lbracket(list));
|
384
404
|
}
|
385
405
|
else if (!in_declaration && (list->separator() == SASS_HASH ||
|
386
406
|
(list->separator() == SASS_SPACE && in_space_array) ||
|
387
407
|
(list->separator() == SASS_COMMA && in_comma_array)
|
388
408
|
)) {
|
389
|
-
append_string(
|
409
|
+
append_string(lbracket(list));
|
390
410
|
}
|
391
411
|
|
392
412
|
if (list->separator() == SASS_SPACE) in_space_array = true;
|
@@ -399,7 +419,7 @@ namespace Sass {
|
|
399
419
|
if (output_style() != TO_SASS) {
|
400
420
|
if (list_item->is_invisible()) {
|
401
421
|
// this fixes an issue with "" in a list
|
402
|
-
if (!
|
422
|
+
if (!Cast<String_Constant>(list_item)) {
|
403
423
|
continue;
|
404
424
|
}
|
405
425
|
}
|
@@ -415,19 +435,29 @@ namespace Sass {
|
|
415
435
|
|
416
436
|
in_comma_array = was_comma_array;
|
417
437
|
in_space_array = was_space_array;
|
438
|
+
|
439
|
+
// if the list is bracketed, always include the right bracket
|
440
|
+
if (list->is_bracketed()) {
|
441
|
+
if (list->separator() == SASS_COMMA && list->size() == 1) {
|
442
|
+
append_string(",");
|
443
|
+
}
|
444
|
+
append_string(rbracket(list));
|
445
|
+
}
|
418
446
|
// probably ruby sass eqivalent of element_needs_parens
|
419
|
-
if (output_style() == TO_SASS &&
|
447
|
+
else if (output_style() == TO_SASS &&
|
420
448
|
list->length() == 1 &&
|
421
449
|
!list->from_selector() &&
|
422
|
-
!
|
423
|
-
!
|
424
|
-
|
450
|
+
!Cast<List>(list->at(0)) &&
|
451
|
+
!Cast<Selector_List>(list->at(0))
|
452
|
+
) {
|
453
|
+
append_string(",");
|
454
|
+
append_string(rbracket(list));
|
425
455
|
}
|
426
456
|
else if (!in_declaration && (list->separator() == SASS_HASH ||
|
427
457
|
(list->separator() == SASS_SPACE && in_space_array) ||
|
428
458
|
(list->separator() == SASS_COMMA && in_comma_array)
|
429
459
|
)) {
|
430
|
-
append_string(
|
460
|
+
append_string(rbracket(list));
|
431
461
|
}
|
432
462
|
|
433
463
|
}
|
@@ -443,7 +473,7 @@ namespace Sass {
|
|
443
473
|
expr->is_right_interpolant())
|
444
474
|
|
445
475
|
)) append_string(" ");
|
446
|
-
switch (expr->
|
476
|
+
switch (expr->optype()) {
|
447
477
|
case Sass_OP::AND: append_string("&&"); break;
|
448
478
|
case Sass_OP::OR: append_string("||"); break;
|
449
479
|
case Sass_OP::EQ: append_string("=="); break;
|
@@ -471,8 +501,9 @@ namespace Sass {
|
|
471
501
|
|
472
502
|
void Inspect::operator()(Unary_Expression_Ptr expr)
|
473
503
|
{
|
474
|
-
if (expr->
|
475
|
-
else
|
504
|
+
if (expr->optype() == Unary_Expression::PLUS) append_string("+");
|
505
|
+
else if (expr->optype() == Unary_Expression::SLASH) append_string("/");
|
506
|
+
else append_string("-");
|
476
507
|
expr->operand()->perform(this);
|
477
508
|
}
|
478
509
|
|
@@ -493,16 +524,14 @@ namespace Sass {
|
|
493
524
|
append_token(var->name(), var);
|
494
525
|
}
|
495
526
|
|
496
|
-
void Inspect::operator()(Textual_Ptr txt)
|
497
|
-
{
|
498
|
-
append_token(txt->value(), txt);
|
499
|
-
}
|
500
|
-
|
501
527
|
void Inspect::operator()(Number_Ptr n)
|
502
528
|
{
|
503
529
|
|
504
530
|
std::string res;
|
505
531
|
|
532
|
+
// reduce units
|
533
|
+
n->reduce();
|
534
|
+
|
506
535
|
// check if the fractional part of the value equals to zero
|
507
536
|
// neat trick from http://stackoverflow.com/a/1521682/1550314
|
508
537
|
// double int_part; bool is_int = modf(value, &int_part) == 0.0;
|
@@ -600,6 +629,11 @@ namespace Sass {
|
|
600
629
|
// maybe an unknown token
|
601
630
|
std::string name = c->disp();
|
602
631
|
|
632
|
+
if (opt.in_selector && name != "") {
|
633
|
+
append_token(name, c);
|
634
|
+
return;
|
635
|
+
}
|
636
|
+
|
603
637
|
// resolved color
|
604
638
|
std::string res_name = name;
|
605
639
|
|
@@ -624,6 +658,9 @@ namespace Sass {
|
|
624
658
|
}
|
625
659
|
|
626
660
|
std::stringstream hexlet;
|
661
|
+
// dart sass compressed all colors in regular css always
|
662
|
+
// ruby sass and libsass does it only when not delayed
|
663
|
+
// since color math is going to be removed, this can go too
|
627
664
|
bool compressed = opt.output_style == COMPRESSED;
|
628
665
|
hexlet << '#' << std::setw(1) << std::setfill('0');
|
629
666
|
// create a short color hexlet if there is any need for it
|
@@ -647,9 +684,6 @@ namespace Sass {
|
|
647
684
|
if (name != "") {
|
648
685
|
ss << name;
|
649
686
|
}
|
650
|
-
else if (r == 0 && g == 0 && b == 0 && a == 0) {
|
651
|
-
ss << "transparent";
|
652
|
-
}
|
653
687
|
else if (a >= 1) {
|
654
688
|
if (res_name != "") {
|
655
689
|
if (compressed && hexlet.str().size() < res_name.size()) {
|
@@ -744,9 +778,9 @@ namespace Sass {
|
|
744
778
|
{
|
745
779
|
append_token("not", sn);
|
746
780
|
append_mandatory_space();
|
747
|
-
if (sn->needs_parens(
|
781
|
+
if (sn->needs_parens(sn->condition())) append_string("(");
|
748
782
|
sn->condition()->perform(this);
|
749
|
-
if (sn->needs_parens(
|
783
|
+
if (sn->needs_parens(sn->condition())) append_string(")");
|
750
784
|
}
|
751
785
|
|
752
786
|
void Inspect::operator()(Supports_Declaration_Ptr sd)
|
@@ -766,7 +800,7 @@ namespace Sass {
|
|
766
800
|
void Inspect::operator()(Media_Query_Ptr mq)
|
767
801
|
{
|
768
802
|
size_t i = 0;
|
769
|
-
if (
|
803
|
+
if (mq->media_type()) {
|
770
804
|
if (mq->is_negated()) append_string("not ");
|
771
805
|
else if (mq->is_restricted()) append_string("only ");
|
772
806
|
mq->media_type()->perform(this);
|
@@ -798,12 +832,22 @@ namespace Sass {
|
|
798
832
|
|
799
833
|
void Inspect::operator()(At_Root_Query_Ptr ae)
|
800
834
|
{
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
835
|
+
if (ae->feature()) {
|
836
|
+
append_string("(");
|
837
|
+
ae->feature()->perform(this);
|
838
|
+
if (ae->value()) {
|
839
|
+
append_colon_separator();
|
840
|
+
ae->value()->perform(this);
|
841
|
+
}
|
842
|
+
append_string(")");
|
806
843
|
}
|
844
|
+
}
|
845
|
+
|
846
|
+
void Inspect::operator()(Function_Ptr f)
|
847
|
+
{
|
848
|
+
append_token("get-function", f);
|
849
|
+
append_string("(");
|
850
|
+
append_string(quote(f->name()));
|
807
851
|
append_string(")");
|
808
852
|
}
|
809
853
|
|
@@ -851,7 +895,7 @@ namespace Sass {
|
|
851
895
|
return;
|
852
896
|
}
|
853
897
|
if (a->value()->concrete_type() == Expression::STRING) {
|
854
|
-
String_Constant_Ptr s =
|
898
|
+
String_Constant_Ptr s = Cast<String_Constant>(a->value());
|
855
899
|
if (s) s->perform(this);
|
856
900
|
} else {
|
857
901
|
a->value()->perform(this);
|
@@ -877,7 +921,9 @@ namespace Sass {
|
|
877
921
|
|
878
922
|
void Inspect::operator()(Selector_Schema_Ptr s)
|
879
923
|
{
|
924
|
+
opt.in_selector = true;
|
880
925
|
s->contents()->perform(this);
|
926
|
+
opt.in_selector = false;
|
881
927
|
}
|
882
928
|
|
883
929
|
void Inspect::operator()(Parent_Selector_Ptr p)
|
@@ -919,11 +965,15 @@ namespace Sass {
|
|
919
965
|
append_token(s->ns_name(), s);
|
920
966
|
if (!s->matcher().empty()) {
|
921
967
|
append_string(s->matcher());
|
922
|
-
if (
|
968
|
+
if (s->value() && *s->value()) {
|
923
969
|
s->value()->perform(this);
|
924
970
|
}
|
925
971
|
}
|
926
972
|
add_close_mapping(s);
|
973
|
+
if (s->modifier() != 0) {
|
974
|
+
append_mandatory_space();
|
975
|
+
append_char(s->modifier());
|
976
|
+
}
|
927
977
|
append_string("]");
|
928
978
|
}
|
929
979
|
|
@@ -939,16 +989,20 @@ namespace Sass {
|
|
939
989
|
|
940
990
|
void Inspect::operator()(Wrapped_Selector_Ptr s)
|
941
991
|
{
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
992
|
+
if (s->name() == " ") {
|
993
|
+
append_string("");
|
994
|
+
} else {
|
995
|
+
bool was = in_wrapped;
|
996
|
+
in_wrapped = true;
|
997
|
+
append_token(s->name(), s);
|
998
|
+
append_string("(");
|
999
|
+
bool was_comma_array = in_comma_array;
|
1000
|
+
in_comma_array = false;
|
1001
|
+
s->selector()->perform(this);
|
1002
|
+
in_comma_array = was_comma_array;
|
1003
|
+
append_string(")");
|
1004
|
+
in_wrapped = was;
|
1005
|
+
}
|
952
1006
|
}
|
953
1007
|
|
954
1008
|
void Inspect::operator()(Compound_Selector_Ptr s)
|
@@ -1014,6 +1068,7 @@ namespace Sass {
|
|
1014
1068
|
if (tail) append_mandatory_space();
|
1015
1069
|
else append_optional_space();
|
1016
1070
|
break;
|
1071
|
+
default: break;
|
1017
1072
|
}
|
1018
1073
|
if (tail && comb != Complex_Selector::ANCESTOR_OF) {
|
1019
1074
|
if (c->has_line_break()) append_optional_linefeed();
|
@@ -1040,8 +1095,8 @@ namespace Sass {
|
|
1040
1095
|
bool was_comma_array = in_comma_array;
|
1041
1096
|
// probably ruby sass eqivalent of element_needs_parens
|
1042
1097
|
if (output_style() == TO_SASS && g->length() == 1 &&
|
1043
|
-
(!
|
1044
|
-
!
|
1098
|
+
(!Cast<List>((*g)[0]) &&
|
1099
|
+
!Cast<Selector_List>((*g)[0]))) {
|
1045
1100
|
append_string("(");
|
1046
1101
|
}
|
1047
1102
|
else if (!in_declaration && in_comma_array) {
|
@@ -1053,7 +1108,7 @@ namespace Sass {
|
|
1053
1108
|
for (size_t i = 0, L = g->length(); i < L; ++i) {
|
1054
1109
|
if (!in_wrapped && i == 0) append_indentation();
|
1055
1110
|
if ((*g)[i] == 0) continue;
|
1056
|
-
schedule_mapping(
|
1111
|
+
schedule_mapping(g->at(i)->last());
|
1057
1112
|
// add_open_mapping((*g)[i]->last());
|
1058
1113
|
(*g)[i]->perform(this);
|
1059
1114
|
// add_close_mapping((*g)[i]->last());
|
@@ -1066,8 +1121,8 @@ namespace Sass {
|
|
1066
1121
|
in_comma_array = was_comma_array;
|
1067
1122
|
// probably ruby sass eqivalent of element_needs_parens
|
1068
1123
|
if (output_style() == TO_SASS && g->length() == 1 &&
|
1069
|
-
(!
|
1070
|
-
!
|
1124
|
+
(!Cast<List>((*g)[0]) &&
|
1125
|
+
!Cast<Selector_List>((*g)[0]))) {
|
1071
1126
|
append_string(",)");
|
1072
1127
|
}
|
1073
1128
|
else if (!in_declaration && in_comma_array) {
|
data/ext/libsass/src/inspect.hpp
CHANGED
@@ -17,7 +17,7 @@ namespace Sass {
|
|
17
17
|
|
18
18
|
public:
|
19
19
|
|
20
|
-
Inspect(Emitter emi);
|
20
|
+
Inspect(const Emitter& emi);
|
21
21
|
virtual ~Inspect();
|
22
22
|
|
23
23
|
// statements
|
@@ -48,6 +48,7 @@ namespace Sass {
|
|
48
48
|
virtual void operator()(Content_Ptr);
|
49
49
|
// expressions
|
50
50
|
virtual void operator()(Map_Ptr);
|
51
|
+
virtual void operator()(Function_Ptr);
|
51
52
|
virtual void operator()(List_Ptr);
|
52
53
|
virtual void operator()(Binary_Expression_Ptr);
|
53
54
|
virtual void operator()(Unary_Expression_Ptr);
|
@@ -56,7 +57,6 @@ namespace Sass {
|
|
56
57
|
// virtual void operator()(Custom_Warning_Ptr);
|
57
58
|
// virtual void operator()(Custom_Error_Ptr);
|
58
59
|
virtual void operator()(Variable_Ptr);
|
59
|
-
virtual void operator()(Textual_Ptr);
|
60
60
|
virtual void operator()(Number_Ptr);
|
61
61
|
virtual void operator()(Color_Ptr);
|
62
62
|
virtual void operator()(Boolean_Ptr);
|
@@ -92,6 +92,9 @@ namespace Sass {
|
|
92
92
|
virtual void operator()(Complex_Selector_Ptr);
|
93
93
|
virtual void operator()(Selector_List_Ptr);
|
94
94
|
|
95
|
+
virtual std::string lbracket(List_Ptr);
|
96
|
+
virtual std::string rbracket(List_Ptr);
|
97
|
+
|
95
98
|
// template <typename U>
|
96
99
|
// void fallback(U x) { fallback_impl(reinterpret_cast<AST_Node_Ptr>(x)); }
|
97
100
|
};
|