giga-lite-lib 0.0.1
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 +7 -0
- data/giga-lite-lib.gemspec +12 -0
- data/sassc-2.4.0/CHANGELOG.md +97 -0
- data/sassc-2.4.0/CODE_OF_CONDUCT.md +10 -0
- data/sassc-2.4.0/Gemfile +2 -0
- data/sassc-2.4.0/LICENSE.txt +22 -0
- data/sassc-2.4.0/README.md +68 -0
- data/sassc-2.4.0/Rakefile +51 -0
- data/sassc-2.4.0/ext/depend +4 -0
- data/sassc-2.4.0/ext/extconf.rb +92 -0
- data/sassc-2.4.0/ext/libsass/VERSION +1 -0
- data/sassc-2.4.0/ext/libsass/contrib/plugin.cpp +60 -0
- data/sassc-2.4.0/ext/libsass/include/sass/base.h +97 -0
- data/sassc-2.4.0/ext/libsass/include/sass/context.h +174 -0
- data/sassc-2.4.0/ext/libsass/include/sass/functions.h +139 -0
- data/sassc-2.4.0/ext/libsass/include/sass/values.h +145 -0
- data/sassc-2.4.0/ext/libsass/include/sass/version.h +12 -0
- data/sassc-2.4.0/ext/libsass/include/sass.h +15 -0
- data/sassc-2.4.0/ext/libsass/include/sass2scss.h +120 -0
- data/sassc-2.4.0/ext/libsass/src/MurmurHash2.hpp +91 -0
- data/sassc-2.4.0/ext/libsass/src/ast.cpp +953 -0
- data/sassc-2.4.0/ext/libsass/src/ast.hpp +1064 -0
- data/sassc-2.4.0/ext/libsass/src/ast2c.cpp +80 -0
- data/sassc-2.4.0/ext/libsass/src/ast2c.hpp +39 -0
- data/sassc-2.4.0/ext/libsass/src/ast_def_macros.hpp +140 -0
- data/sassc-2.4.0/ext/libsass/src/ast_fwd_decl.cpp +31 -0
- data/sassc-2.4.0/ext/libsass/src/ast_fwd_decl.hpp +274 -0
- data/sassc-2.4.0/ext/libsass/src/ast_helpers.hpp +292 -0
- data/sassc-2.4.0/ext/libsass/src/ast_sel_cmp.cpp +396 -0
- data/sassc-2.4.0/ext/libsass/src/ast_sel_super.cpp +539 -0
- data/sassc-2.4.0/ext/libsass/src/ast_sel_unify.cpp +275 -0
- data/sassc-2.4.0/ext/libsass/src/ast_sel_weave.cpp +616 -0
- data/sassc-2.4.0/ext/libsass/src/ast_selectors.cpp +1043 -0
- data/sassc-2.4.0/ext/libsass/src/ast_selectors.hpp +522 -0
- data/sassc-2.4.0/ext/libsass/src/ast_supports.cpp +114 -0
- data/sassc-2.4.0/ext/libsass/src/ast_supports.hpp +121 -0
- data/sassc-2.4.0/ext/libsass/src/ast_values.cpp +1154 -0
- data/sassc-2.4.0/ext/libsass/src/ast_values.hpp +498 -0
- data/sassc-2.4.0/ext/libsass/src/b64/cencode.h +32 -0
- data/sassc-2.4.0/ext/libsass/src/b64/encode.h +79 -0
- data/sassc-2.4.0/ext/libsass/src/backtrace.cpp +50 -0
- data/sassc-2.4.0/ext/libsass/src/backtrace.hpp +29 -0
- data/sassc-2.4.0/ext/libsass/src/base64vlq.cpp +47 -0
- data/sassc-2.4.0/ext/libsass/src/base64vlq.hpp +30 -0
- data/sassc-2.4.0/ext/libsass/src/bind.cpp +312 -0
- data/sassc-2.4.0/ext/libsass/src/bind.hpp +15 -0
- data/sassc-2.4.0/ext/libsass/src/c2ast.cpp +64 -0
- data/sassc-2.4.0/ext/libsass/src/c2ast.hpp +14 -0
- data/sassc-2.4.0/ext/libsass/src/c99func.c +54 -0
- data/sassc-2.4.0/ext/libsass/src/cencode.c +106 -0
- data/sassc-2.4.0/ext/libsass/src/check_nesting.cpp +393 -0
- data/sassc-2.4.0/ext/libsass/src/check_nesting.hpp +70 -0
- data/sassc-2.4.0/ext/libsass/src/color_maps.cpp +652 -0
- data/sassc-2.4.0/ext/libsass/src/color_maps.hpp +323 -0
- data/sassc-2.4.0/ext/libsass/src/constants.cpp +199 -0
- data/sassc-2.4.0/ext/libsass/src/constants.hpp +200 -0
- data/sassc-2.4.0/ext/libsass/src/context.cpp +863 -0
- data/sassc-2.4.0/ext/libsass/src/context.hpp +140 -0
- data/sassc-2.4.0/ext/libsass/src/cssize.cpp +521 -0
- data/sassc-2.4.0/ext/libsass/src/cssize.hpp +71 -0
- data/sassc-2.4.0/ext/libsass/src/dart_helpers.hpp +199 -0
- data/sassc-2.4.0/ext/libsass/src/debug.hpp +43 -0
- data/sassc-2.4.0/ext/libsass/src/debugger.hpp +963 -0
- data/sassc-2.4.0/ext/libsass/src/emitter.cpp +297 -0
- data/sassc-2.4.0/ext/libsass/src/emitter.hpp +101 -0
- data/sassc-2.4.0/ext/libsass/src/environment.cpp +260 -0
- data/sassc-2.4.0/ext/libsass/src/environment.hpp +124 -0
- data/sassc-2.4.0/ext/libsass/src/error_handling.cpp +233 -0
- data/sassc-2.4.0/ext/libsass/src/error_handling.hpp +239 -0
- data/sassc-2.4.0/ext/libsass/src/eval.cpp +1543 -0
- data/sassc-2.4.0/ext/libsass/src/eval.hpp +110 -0
- data/sassc-2.4.0/ext/libsass/src/eval_selectors.cpp +75 -0
- data/sassc-2.4.0/ext/libsass/src/expand.cpp +875 -0
- data/sassc-2.4.0/ext/libsass/src/expand.hpp +98 -0
- data/sassc-2.4.0/ext/libsass/src/extender.cpp +1188 -0
- data/sassc-2.4.0/ext/libsass/src/extender.hpp +399 -0
- data/sassc-2.4.0/ext/libsass/src/extension.cpp +43 -0
- data/sassc-2.4.0/ext/libsass/src/extension.hpp +89 -0
- data/sassc-2.4.0/ext/libsass/src/file.cpp +531 -0
- data/sassc-2.4.0/ext/libsass/src/file.hpp +124 -0
- data/sassc-2.4.0/ext/libsass/src/fn_colors.cpp +596 -0
- data/sassc-2.4.0/ext/libsass/src/fn_colors.hpp +85 -0
- data/sassc-2.4.0/ext/libsass/src/fn_lists.cpp +285 -0
- data/sassc-2.4.0/ext/libsass/src/fn_lists.hpp +34 -0
- data/sassc-2.4.0/ext/libsass/src/fn_maps.cpp +94 -0
- data/sassc-2.4.0/ext/libsass/src/fn_maps.hpp +30 -0
- data/sassc-2.4.0/ext/libsass/src/fn_miscs.cpp +244 -0
- data/sassc-2.4.0/ext/libsass/src/fn_miscs.hpp +40 -0
- data/sassc-2.4.0/ext/libsass/src/fn_numbers.cpp +227 -0
- data/sassc-2.4.0/ext/libsass/src/fn_numbers.hpp +45 -0
- data/sassc-2.4.0/ext/libsass/src/fn_selectors.cpp +205 -0
- data/sassc-2.4.0/ext/libsass/src/fn_selectors.hpp +35 -0
- data/sassc-2.4.0/ext/libsass/src/fn_strings.cpp +268 -0
- data/sassc-2.4.0/ext/libsass/src/fn_strings.hpp +34 -0
- data/sassc-2.4.0/ext/libsass/src/fn_utils.cpp +158 -0
- data/sassc-2.4.0/ext/libsass/src/fn_utils.hpp +62 -0
- data/sassc-2.4.0/ext/libsass/src/inspect.cpp +1125 -0
- data/sassc-2.4.0/ext/libsass/src/inspect.hpp +101 -0
- data/sassc-2.4.0/ext/libsass/src/json.cpp +1436 -0
- data/sassc-2.4.0/ext/libsass/src/json.hpp +117 -0
- data/sassc-2.4.0/ext/libsass/src/kwd_arg_macros.hpp +28 -0
- data/sassc-2.4.0/ext/libsass/src/lexer.cpp +122 -0
- data/sassc-2.4.0/ext/libsass/src/lexer.hpp +304 -0
- data/sassc-2.4.0/ext/libsass/src/listize.cpp +70 -0
- data/sassc-2.4.0/ext/libsass/src/listize.hpp +37 -0
- data/sassc-2.4.0/ext/libsass/src/mapping.hpp +19 -0
- data/sassc-2.4.0/ext/libsass/src/memory/allocator.cpp +48 -0
- data/sassc-2.4.0/ext/libsass/src/memory/allocator.hpp +138 -0
- data/sassc-2.4.0/ext/libsass/src/memory/config.hpp +20 -0
- data/sassc-2.4.0/ext/libsass/src/memory/memory_pool.hpp +186 -0
- data/sassc-2.4.0/ext/libsass/src/memory/shared_ptr.cpp +33 -0
- data/sassc-2.4.0/ext/libsass/src/memory/shared_ptr.hpp +332 -0
- data/sassc-2.4.0/ext/libsass/src/memory.hpp +12 -0
- data/sassc-2.4.0/ext/libsass/src/operation.hpp +223 -0
- data/sassc-2.4.0/ext/libsass/src/operators.cpp +267 -0
- data/sassc-2.4.0/ext/libsass/src/operators.hpp +30 -0
- data/sassc-2.4.0/ext/libsass/src/ordered_map.hpp +112 -0
- data/sassc-2.4.0/ext/libsass/src/output.cpp +320 -0
- data/sassc-2.4.0/ext/libsass/src/output.hpp +47 -0
- data/sassc-2.4.0/ext/libsass/src/parser.cpp +2965 -0
- data/sassc-2.4.0/ext/libsass/src/parser.hpp +394 -0
- data/sassc-2.4.0/ext/libsass/src/parser_selectors.cpp +189 -0
- data/sassc-2.4.0/ext/libsass/src/permutate.hpp +164 -0
- data/sassc-2.4.0/ext/libsass/src/plugins.cpp +188 -0
- data/sassc-2.4.0/ext/libsass/src/plugins.hpp +57 -0
- data/sassc-2.4.0/ext/libsass/src/position.cpp +165 -0
- data/sassc-2.4.0/ext/libsass/src/position.hpp +147 -0
- data/sassc-2.4.0/ext/libsass/src/prelexer.cpp +1780 -0
- data/sassc-2.4.0/ext/libsass/src/prelexer.hpp +484 -0
- data/sassc-2.4.0/ext/libsass/src/remove_placeholders.cpp +86 -0
- data/sassc-2.4.0/ext/libsass/src/remove_placeholders.hpp +37 -0
- data/sassc-2.4.0/ext/libsass/src/sass.cpp +156 -0
- data/sassc-2.4.0/ext/libsass/src/sass.hpp +147 -0
- data/sassc-2.4.0/ext/libsass/src/sass2scss.cpp +895 -0
- data/sassc-2.4.0/ext/libsass/src/sass_context.cpp +741 -0
- data/sassc-2.4.0/ext/libsass/src/sass_context.hpp +129 -0
- data/sassc-2.4.0/ext/libsass/src/sass_functions.cpp +210 -0
- data/sassc-2.4.0/ext/libsass/src/sass_functions.hpp +50 -0
- data/sassc-2.4.0/ext/libsass/src/sass_values.cpp +362 -0
- data/sassc-2.4.0/ext/libsass/src/sass_values.hpp +82 -0
- data/sassc-2.4.0/ext/libsass/src/settings.hpp +19 -0
- data/sassc-2.4.0/ext/libsass/src/source.cpp +69 -0
- data/sassc-2.4.0/ext/libsass/src/source.hpp +95 -0
- data/sassc-2.4.0/ext/libsass/src/source_data.hpp +32 -0
- data/sassc-2.4.0/ext/libsass/src/source_map.cpp +202 -0
- data/sassc-2.4.0/ext/libsass/src/source_map.hpp +65 -0
- data/sassc-2.4.0/ext/libsass/src/stylesheet.cpp +22 -0
- data/sassc-2.4.0/ext/libsass/src/stylesheet.hpp +57 -0
- data/sassc-2.4.0/ext/libsass/src/to_value.cpp +114 -0
- data/sassc-2.4.0/ext/libsass/src/to_value.hpp +46 -0
- data/sassc-2.4.0/ext/libsass/src/units.cpp +507 -0
- data/sassc-2.4.0/ext/libsass/src/units.hpp +110 -0
- data/sassc-2.4.0/ext/libsass/src/utf8/checked.h +336 -0
- data/sassc-2.4.0/ext/libsass/src/utf8/core.h +332 -0
- data/sassc-2.4.0/ext/libsass/src/utf8/unchecked.h +235 -0
- data/sassc-2.4.0/ext/libsass/src/utf8.h +34 -0
- data/sassc-2.4.0/ext/libsass/src/utf8_string.cpp +104 -0
- data/sassc-2.4.0/ext/libsass/src/utf8_string.hpp +38 -0
- data/sassc-2.4.0/ext/libsass/src/util.cpp +723 -0
- data/sassc-2.4.0/ext/libsass/src/util.hpp +105 -0
- data/sassc-2.4.0/ext/libsass/src/util_string.cpp +125 -0
- data/sassc-2.4.0/ext/libsass/src/util_string.hpp +73 -0
- data/sassc-2.4.0/ext/libsass/src/values.cpp +140 -0
- data/sassc-2.4.0/ext/libsass/src/values.hpp +12 -0
- data/sassc-2.4.0/lib/sassc/dependency.rb +17 -0
- data/sassc-2.4.0/lib/sassc/engine.rb +141 -0
- data/sassc-2.4.0/lib/sassc/error.rb +37 -0
- data/sassc-2.4.0/lib/sassc/functions_handler.rb +73 -0
- data/sassc-2.4.0/lib/sassc/import_handler.rb +50 -0
- data/sassc-2.4.0/lib/sassc/importer.rb +31 -0
- data/sassc-2.4.0/lib/sassc/native/native_context_api.rb +147 -0
- data/sassc-2.4.0/lib/sassc/native/native_functions_api.rb +159 -0
- data/sassc-2.4.0/lib/sassc/native/sass2scss_api.rb +10 -0
- data/sassc-2.4.0/lib/sassc/native/sass_input_style.rb +13 -0
- data/sassc-2.4.0/lib/sassc/native/sass_output_style.rb +12 -0
- data/sassc-2.4.0/lib/sassc/native/sass_value.rb +97 -0
- data/sassc-2.4.0/lib/sassc/native/string_list.rb +10 -0
- data/sassc-2.4.0/lib/sassc/native.rb +64 -0
- data/sassc-2.4.0/lib/sassc/sass_2_scss.rb +9 -0
- data/sassc-2.4.0/lib/sassc/script/functions.rb +8 -0
- data/sassc-2.4.0/lib/sassc/script/value/bool.rb +32 -0
- data/sassc-2.4.0/lib/sassc/script/value/color.rb +95 -0
- data/sassc-2.4.0/lib/sassc/script/value/list.rb +136 -0
- data/sassc-2.4.0/lib/sassc/script/value/map.rb +69 -0
- data/sassc-2.4.0/lib/sassc/script/value/number.rb +389 -0
- data/sassc-2.4.0/lib/sassc/script/value/string.rb +96 -0
- data/sassc-2.4.0/lib/sassc/script/value.rb +137 -0
- data/sassc-2.4.0/lib/sassc/script/value_conversion/base.rb +13 -0
- data/sassc-2.4.0/lib/sassc/script/value_conversion/bool.rb +13 -0
- data/sassc-2.4.0/lib/sassc/script/value_conversion/color.rb +18 -0
- data/sassc-2.4.0/lib/sassc/script/value_conversion/list.rb +25 -0
- data/sassc-2.4.0/lib/sassc/script/value_conversion/map.rb +21 -0
- data/sassc-2.4.0/lib/sassc/script/value_conversion/number.rb +13 -0
- data/sassc-2.4.0/lib/sassc/script/value_conversion/string.rb +17 -0
- data/sassc-2.4.0/lib/sassc/script/value_conversion.rb +69 -0
- data/sassc-2.4.0/lib/sassc/script.rb +17 -0
- data/sassc-2.4.0/lib/sassc/util/normalized_map.rb +117 -0
- data/sassc-2.4.0/lib/sassc/util.rb +231 -0
- data/sassc-2.4.0/lib/sassc/version.rb +5 -0
- data/sassc-2.4.0/lib/sassc.rb +57 -0
- data/sassc-2.4.0/sassc.gemspec +69 -0
- data/sassc-2.4.0/test/custom_importer_test.rb +127 -0
- data/sassc-2.4.0/test/engine_test.rb +314 -0
- data/sassc-2.4.0/test/error_test.rb +29 -0
- data/sassc-2.4.0/test/fixtures/paths.scss +10 -0
- data/sassc-2.4.0/test/functions_test.rb +340 -0
- data/sassc-2.4.0/test/native_test.rb +213 -0
- data/sassc-2.4.0/test/output_style_test.rb +107 -0
- data/sassc-2.4.0/test/sass_2_scss_test.rb +14 -0
- data/sassc-2.4.0/test/test_helper.rb +45 -0
- metadata +250 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
// sass.hpp must go before all system headers to get the
|
|
2
|
+
// __EXTENSIONS__ fix on Solaris.
|
|
3
|
+
#include "sass.hpp"
|
|
4
|
+
|
|
5
|
+
#include "ast.hpp"
|
|
6
|
+
#include "output.hpp"
|
|
7
|
+
#include "util.hpp"
|
|
8
|
+
|
|
9
|
+
namespace Sass {
|
|
10
|
+
|
|
11
|
+
Output::Output(Sass_Output_Options& opt)
|
|
12
|
+
: Inspect(Emitter(opt)),
|
|
13
|
+
charset(""),
|
|
14
|
+
top_nodes(0)
|
|
15
|
+
{}
|
|
16
|
+
|
|
17
|
+
Output::~Output() { }
|
|
18
|
+
|
|
19
|
+
void Output::fallback_impl(AST_Node* n)
|
|
20
|
+
{
|
|
21
|
+
return n->perform(this);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
void Output::operator()(Number* n)
|
|
25
|
+
{
|
|
26
|
+
// check for a valid unit here
|
|
27
|
+
// includes result for reporting
|
|
28
|
+
if (!n->is_valid_css_unit()) {
|
|
29
|
+
// should be handle in check_expression
|
|
30
|
+
throw Exception::InvalidValue({}, *n);
|
|
31
|
+
}
|
|
32
|
+
// use values to_string facility
|
|
33
|
+
sass::string res = n->to_string(opt);
|
|
34
|
+
// output the final token
|
|
35
|
+
append_token(res, n);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void Output::operator()(Import* imp)
|
|
39
|
+
{
|
|
40
|
+
top_nodes.push_back(imp);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void Output::operator()(Map* m)
|
|
44
|
+
{
|
|
45
|
+
// should be handle in check_expression
|
|
46
|
+
throw Exception::InvalidValue({}, *m);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
OutputBuffer Output::get_buffer(void)
|
|
50
|
+
{
|
|
51
|
+
|
|
52
|
+
Emitter emitter(opt);
|
|
53
|
+
Inspect inspect(emitter);
|
|
54
|
+
|
|
55
|
+
size_t size_nodes = top_nodes.size();
|
|
56
|
+
for (size_t i = 0; i < size_nodes; i++) {
|
|
57
|
+
top_nodes[i]->perform(&inspect);
|
|
58
|
+
inspect.append_mandatory_linefeed();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// flush scheduled outputs
|
|
62
|
+
// maybe omit semicolon if possible
|
|
63
|
+
inspect.finalize(wbuf.buffer.size() == 0);
|
|
64
|
+
// prepend buffer on top
|
|
65
|
+
prepend_output(inspect.output());
|
|
66
|
+
// make sure we end with a linefeed
|
|
67
|
+
if (!ends_with(wbuf.buffer, opt.linefeed)) {
|
|
68
|
+
// if the output is not completely empty
|
|
69
|
+
if (!wbuf.buffer.empty()) append_string(opt.linefeed);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// search for unicode char
|
|
73
|
+
for(const char& chr : wbuf.buffer) {
|
|
74
|
+
// skip all ascii chars
|
|
75
|
+
// static cast to unsigned to handle `char` being signed / unsigned
|
|
76
|
+
if (static_cast<unsigned>(chr) < 128) continue;
|
|
77
|
+
// declare the charset
|
|
78
|
+
if (output_style() != COMPRESSED)
|
|
79
|
+
charset = "@charset \"UTF-8\";"
|
|
80
|
+
+ sass::string(opt.linefeed);
|
|
81
|
+
else charset = "\xEF\xBB\xBF";
|
|
82
|
+
// abort search
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// add charset as first line, before comments and imports
|
|
87
|
+
if (!charset.empty()) prepend_string(charset);
|
|
88
|
+
|
|
89
|
+
return wbuf;
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
void Output::operator()(Comment* c)
|
|
94
|
+
{
|
|
95
|
+
// if (indentation && txt == "/**/") return;
|
|
96
|
+
bool important = c->is_important();
|
|
97
|
+
if (output_style() != COMPRESSED || important) {
|
|
98
|
+
if (buffer().size() == 0) {
|
|
99
|
+
top_nodes.push_back(c);
|
|
100
|
+
} else {
|
|
101
|
+
in_comment = true;
|
|
102
|
+
append_indentation();
|
|
103
|
+
c->text()->perform(this);
|
|
104
|
+
in_comment = false;
|
|
105
|
+
if (indentation == 0) {
|
|
106
|
+
append_mandatory_linefeed();
|
|
107
|
+
} else {
|
|
108
|
+
append_optional_linefeed();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
void Output::operator()(StyleRule* r)
|
|
115
|
+
{
|
|
116
|
+
Block_Obj b = r->block();
|
|
117
|
+
SelectorListObj s = r->selector();
|
|
118
|
+
|
|
119
|
+
if (!s || s->empty()) return;
|
|
120
|
+
|
|
121
|
+
// Filter out rulesets that aren't printable (process its children though)
|
|
122
|
+
if (!Util::isPrintable(r, output_style())) {
|
|
123
|
+
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
124
|
+
const Statement_Obj& stm = b->get(i);
|
|
125
|
+
if (Cast<ParentStatement>(stm)) {
|
|
126
|
+
if (!Cast<Declaration>(stm)) {
|
|
127
|
+
stm->perform(this);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (output_style() == NESTED) {
|
|
135
|
+
indentation += r->tabs();
|
|
136
|
+
}
|
|
137
|
+
if (opt.source_comments) {
|
|
138
|
+
sass::ostream ss;
|
|
139
|
+
append_indentation();
|
|
140
|
+
sass::string path(File::abs2rel(r->pstate().getPath()));
|
|
141
|
+
ss << "/* line " << r->pstate().getLine() << ", " << path << " */";
|
|
142
|
+
append_string(ss.str());
|
|
143
|
+
append_optional_linefeed();
|
|
144
|
+
}
|
|
145
|
+
scheduled_crutch = s;
|
|
146
|
+
if (s) s->perform(this);
|
|
147
|
+
append_scope_opener(b);
|
|
148
|
+
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
149
|
+
Statement_Obj stm = b->get(i);
|
|
150
|
+
bool bPrintExpression = true;
|
|
151
|
+
// Check print conditions
|
|
152
|
+
if (Declaration* dec = Cast<Declaration>(stm)) {
|
|
153
|
+
if (const String_Constant* valConst = Cast<String_Constant>(dec->value())) {
|
|
154
|
+
const sass::string& val = valConst->value();
|
|
155
|
+
if (const String_Quoted* qstr = Cast<const String_Quoted>(valConst)) {
|
|
156
|
+
if (!qstr->quote_mark() && val.empty()) {
|
|
157
|
+
bPrintExpression = false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else if (List* list = Cast<List>(dec->value())) {
|
|
162
|
+
bool all_invisible = true;
|
|
163
|
+
for (size_t list_i = 0, list_L = list->length(); list_i < list_L; ++list_i) {
|
|
164
|
+
Expression* item = list->get(list_i);
|
|
165
|
+
if (!item->is_invisible()) all_invisible = false;
|
|
166
|
+
}
|
|
167
|
+
if (all_invisible && !list->is_bracketed()) bPrintExpression = false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Print if OK
|
|
171
|
+
if (bPrintExpression) {
|
|
172
|
+
stm->perform(this);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (output_style() == NESTED) indentation -= r->tabs();
|
|
176
|
+
append_scope_closer(b);
|
|
177
|
+
|
|
178
|
+
}
|
|
179
|
+
void Output::operator()(Keyframe_Rule* r)
|
|
180
|
+
{
|
|
181
|
+
Block_Obj b = r->block();
|
|
182
|
+
Selector_Obj v = r->name();
|
|
183
|
+
|
|
184
|
+
if (!v.isNull()) {
|
|
185
|
+
v->perform(this);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (!b) {
|
|
189
|
+
append_colon_separator();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
append_scope_opener();
|
|
194
|
+
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
195
|
+
Statement_Obj stm = b->get(i);
|
|
196
|
+
stm->perform(this);
|
|
197
|
+
if (i < L - 1) append_special_linefeed();
|
|
198
|
+
}
|
|
199
|
+
append_scope_closer();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
void Output::operator()(SupportsRule* f)
|
|
203
|
+
{
|
|
204
|
+
if (f->is_invisible()) return;
|
|
205
|
+
|
|
206
|
+
SupportsConditionObj c = f->condition();
|
|
207
|
+
Block_Obj b = f->block();
|
|
208
|
+
|
|
209
|
+
// Filter out feature blocks that aren't printable (process its children though)
|
|
210
|
+
if (!Util::isPrintable(f, output_style())) {
|
|
211
|
+
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
212
|
+
Statement_Obj stm = b->get(i);
|
|
213
|
+
if (Cast<ParentStatement>(stm)) {
|
|
214
|
+
stm->perform(this);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (output_style() == NESTED) indentation += f->tabs();
|
|
221
|
+
append_indentation();
|
|
222
|
+
append_token("@supports", f);
|
|
223
|
+
append_mandatory_space();
|
|
224
|
+
c->perform(this);
|
|
225
|
+
append_scope_opener();
|
|
226
|
+
|
|
227
|
+
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
228
|
+
Statement_Obj stm = b->get(i);
|
|
229
|
+
stm->perform(this);
|
|
230
|
+
if (i < L - 1) append_special_linefeed();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (output_style() == NESTED) indentation -= f->tabs();
|
|
234
|
+
|
|
235
|
+
append_scope_closer();
|
|
236
|
+
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
void Output::operator()(CssMediaRule* rule)
|
|
240
|
+
{
|
|
241
|
+
// Avoid null pointer exception
|
|
242
|
+
if (rule == nullptr) return;
|
|
243
|
+
// Skip empty/invisible rule
|
|
244
|
+
if (rule->isInvisible()) return;
|
|
245
|
+
// Avoid null pointer exception
|
|
246
|
+
if (rule->block() == nullptr) return;
|
|
247
|
+
// Skip empty/invisible rule
|
|
248
|
+
if (rule->block()->isInvisible()) return;
|
|
249
|
+
// Skip if block is empty/invisible
|
|
250
|
+
if (Util::isPrintable(rule, output_style())) {
|
|
251
|
+
// Let inspect do its magic
|
|
252
|
+
Inspect::operator()(rule);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
void Output::operator()(AtRule* a)
|
|
257
|
+
{
|
|
258
|
+
sass::string kwd = a->keyword();
|
|
259
|
+
Selector_Obj s = a->selector();
|
|
260
|
+
ExpressionObj v = a->value();
|
|
261
|
+
Block_Obj b = a->block();
|
|
262
|
+
|
|
263
|
+
append_indentation();
|
|
264
|
+
append_token(kwd, a);
|
|
265
|
+
if (s) {
|
|
266
|
+
append_mandatory_space();
|
|
267
|
+
in_wrapped = true;
|
|
268
|
+
s->perform(this);
|
|
269
|
+
in_wrapped = false;
|
|
270
|
+
}
|
|
271
|
+
if (v) {
|
|
272
|
+
append_mandatory_space();
|
|
273
|
+
// ruby sass bug? should use options?
|
|
274
|
+
append_token(v->to_string(/* opt */), v);
|
|
275
|
+
}
|
|
276
|
+
if (!b) {
|
|
277
|
+
append_delimiter();
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (b->is_invisible() || b->length() == 0) {
|
|
282
|
+
append_optional_space();
|
|
283
|
+
return append_string("{}");
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
append_scope_opener();
|
|
287
|
+
|
|
288
|
+
bool format = kwd != "@font-face";;
|
|
289
|
+
|
|
290
|
+
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
|
291
|
+
Statement_Obj stm = b->get(i);
|
|
292
|
+
if (stm) stm->perform(this);
|
|
293
|
+
if (i < L - 1 && format) append_special_linefeed();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
append_scope_closer();
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
void Output::operator()(String_Quoted* s)
|
|
300
|
+
{
|
|
301
|
+
if (s->quote_mark()) {
|
|
302
|
+
append_token(quote(s->value(), s->quote_mark()), s);
|
|
303
|
+
} else if (!in_comment) {
|
|
304
|
+
append_token(string_to_output(s->value()), s);
|
|
305
|
+
} else {
|
|
306
|
+
append_token(s->value(), s);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
void Output::operator()(String_Constant* s)
|
|
311
|
+
{
|
|
312
|
+
sass::string value(s->value());
|
|
313
|
+
if (!in_comment && !in_custom_property) {
|
|
314
|
+
append_token(string_to_output(value), s);
|
|
315
|
+
} else {
|
|
316
|
+
append_token(value, s);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#ifndef SASS_OUTPUT_H
|
|
2
|
+
#define SASS_OUTPUT_H
|
|
3
|
+
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <vector>
|
|
6
|
+
|
|
7
|
+
#include "util.hpp"
|
|
8
|
+
#include "inspect.hpp"
|
|
9
|
+
#include "operation.hpp"
|
|
10
|
+
|
|
11
|
+
namespace Sass {
|
|
12
|
+
class Context;
|
|
13
|
+
|
|
14
|
+
class Output : public Inspect {
|
|
15
|
+
protected:
|
|
16
|
+
using Inspect::operator();
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
Output(Sass_Output_Options& opt);
|
|
20
|
+
virtual ~Output();
|
|
21
|
+
|
|
22
|
+
protected:
|
|
23
|
+
sass::string charset;
|
|
24
|
+
sass::vector<AST_Node*> top_nodes;
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
OutputBuffer get_buffer(void);
|
|
28
|
+
|
|
29
|
+
virtual void operator()(Map*);
|
|
30
|
+
virtual void operator()(StyleRule*);
|
|
31
|
+
virtual void operator()(SupportsRule*);
|
|
32
|
+
virtual void operator()(CssMediaRule*);
|
|
33
|
+
virtual void operator()(AtRule*);
|
|
34
|
+
virtual void operator()(Keyframe_Rule*);
|
|
35
|
+
virtual void operator()(Import*);
|
|
36
|
+
virtual void operator()(Comment*);
|
|
37
|
+
virtual void operator()(Number*);
|
|
38
|
+
virtual void operator()(String_Quoted*);
|
|
39
|
+
virtual void operator()(String_Constant*);
|
|
40
|
+
|
|
41
|
+
void fallback_impl(AST_Node* n);
|
|
42
|
+
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
#endif
|