sassc 2.0.1 → 2.1.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitmodules +1 -1
- data/.travis.yml +7 -3
- data/CHANGELOG.md +3 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/README.md +1 -1
- data/Rakefile +23 -8
- data/ext/extconf.rb +39 -0
- data/ext/libsass/.gitignore +1 -0
- data/ext/libsass/GNUmakefile.am +23 -39
- data/ext/libsass/Makefile +56 -91
- data/ext/libsass/Makefile.conf +16 -2
- data/ext/libsass/configure.ac +8 -12
- data/ext/libsass/include/sass/base.h +1 -0
- data/ext/libsass/include/sass/context.h +1 -1
- data/ext/libsass/src/GNUmakefile.am +1 -5
- data/ext/libsass/src/ast.cpp +747 -2010
- data/ext/libsass/src/ast.hpp +239 -2383
- 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 +62 -10
- data/ext/libsass/src/ast_fwd_decl.cpp +1 -0
- data/ext/libsass/src/ast_fwd_decl.hpp +43 -165
- data/ext/libsass/src/ast_sel_cmp.cpp +909 -0
- data/ext/libsass/src/ast_sel_unify.cpp +280 -0
- data/ext/libsass/src/ast_selectors.cpp +1475 -0
- data/ext/libsass/src/ast_selectors.hpp +568 -0
- data/ext/libsass/src/ast_supports.cpp +130 -0
- data/ext/libsass/src/ast_supports.hpp +121 -0
- data/ext/libsass/src/ast_values.cpp +967 -0
- data/ext/libsass/src/ast_values.hpp +489 -0
- data/ext/libsass/src/backtrace.cpp +4 -0
- data/ext/libsass/src/base64vlq.cpp +3 -0
- data/ext/libsass/src/bind.cpp +18 -17
- 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 +2 -2
- data/ext/libsass/src/check_nesting.cpp +52 -56
- data/ext/libsass/src/check_nesting.hpp +35 -34
- data/ext/libsass/src/color_maps.cpp +156 -153
- data/ext/libsass/src/color_maps.hpp +152 -152
- data/ext/libsass/src/constants.cpp +15 -0
- data/ext/libsass/src/constants.hpp +13 -0
- data/ext/libsass/src/context.cpp +24 -14
- data/ext/libsass/src/context.hpp +6 -6
- data/ext/libsass/src/cssize.cpp +69 -71
- data/ext/libsass/src/cssize.hpp +50 -50
- data/ext/libsass/src/debugger.hpp +117 -110
- data/ext/libsass/src/emitter.cpp +13 -12
- data/ext/libsass/src/emitter.hpp +13 -9
- data/ext/libsass/src/environment.cpp +15 -1
- data/ext/libsass/src/environment.hpp +6 -0
- data/ext/libsass/src/error_handling.cpp +36 -59
- data/ext/libsass/src/error_handling.hpp +29 -16
- data/ext/libsass/src/eval.cpp +302 -323
- data/ext/libsass/src/eval.hpp +64 -55
- data/ext/libsass/src/expand.cpp +94 -88
- data/ext/libsass/src/expand.hpp +33 -37
- data/ext/libsass/src/extend.cpp +38 -36
- data/ext/libsass/src/extend.hpp +15 -15
- data/ext/libsass/src/file.cpp +34 -2
- data/ext/libsass/src/fn_colors.cpp +594 -0
- data/ext/libsass/src/fn_colors.hpp +85 -0
- data/ext/libsass/src/fn_lists.cpp +284 -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 +256 -0
- data/ext/libsass/src/fn_miscs.hpp +40 -0
- data/ext/libsass/src/fn_numbers.cpp +220 -0
- data/ext/libsass/src/fn_numbers.hpp +45 -0
- data/ext/libsass/src/fn_selectors.cpp +235 -0
- data/ext/libsass/src/fn_selectors.hpp +35 -0
- data/ext/libsass/src/fn_strings.cpp +254 -0
- data/ext/libsass/src/fn_strings.hpp +34 -0
- data/ext/libsass/src/fn_utils.cpp +156 -0
- data/ext/libsass/src/fn_utils.hpp +56 -0
- data/ext/libsass/src/inspect.cpp +101 -152
- data/ext/libsass/src/inspect.hpp +69 -73
- data/ext/libsass/src/json.cpp +2 -2
- data/ext/libsass/src/lexer.cpp +6 -3
- data/ext/libsass/src/listize.cpp +9 -11
- data/ext/libsass/src/listize.hpp +11 -7
- data/ext/libsass/src/memory/SharedPtr.cpp +2 -83
- data/ext/libsass/src/memory/SharedPtr.hpp +127 -143
- data/ext/libsass/src/node.cpp +13 -10
- data/ext/libsass/src/node.hpp +3 -3
- data/ext/libsass/src/operation.hpp +184 -144
- data/ext/libsass/src/operators.cpp +43 -17
- data/ext/libsass/src/operators.hpp +5 -5
- data/ext/libsass/src/output.cpp +21 -18
- data/ext/libsass/src/output.hpp +14 -21
- data/ext/libsass/src/parser.cpp +215 -183
- data/ext/libsass/src/parser.hpp +28 -24
- data/ext/libsass/src/plugins.cpp +5 -1
- data/ext/libsass/src/position.cpp +3 -0
- data/ext/libsass/src/prelexer.cpp +9 -3
- data/ext/libsass/src/prelexer.hpp +9 -9
- data/ext/libsass/src/remove_placeholders.cpp +14 -11
- data/ext/libsass/src/remove_placeholders.hpp +8 -9
- data/ext/libsass/src/sass.cpp +9 -3
- data/ext/libsass/src/sass.hpp +12 -9
- data/ext/libsass/src/sass2scss.cpp +45 -14
- data/ext/libsass/src/sass_context.cpp +18 -15
- data/ext/libsass/src/sass_functions.cpp +6 -3
- data/ext/libsass/src/sass_functions.hpp +1 -1
- data/ext/libsass/src/sass_util.cpp +3 -0
- data/ext/libsass/src/sass_values.cpp +21 -13
- data/ext/libsass/src/source_map.cpp +5 -2
- data/ext/libsass/src/source_map.hpp +2 -2
- data/ext/libsass/src/subset_map.cpp +4 -1
- data/ext/libsass/src/to_value.cpp +23 -21
- data/ext/libsass/src/to_value.hpp +18 -22
- data/ext/libsass/src/units.cpp +4 -0
- data/ext/libsass/src/units.hpp +1 -0
- 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 +3 -0
- data/ext/libsass/src/util.cpp +67 -75
- data/ext/libsass/src/util.hpp +64 -19
- data/ext/libsass/src/util_string.cpp +75 -0
- data/ext/libsass/src/util_string.hpp +19 -0
- data/ext/libsass/src/values.cpp +22 -13
- data/ext/libsass/src/values.hpp +2 -2
- data/ext/libsass/win/libsass.targets +30 -4
- data/ext/libsass/win/libsass.vcxproj.filters +82 -4
- data/lib/sassc.rb +24 -0
- data/lib/sassc/engine.rb +2 -2
- data/lib/sassc/native.rb +8 -1
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +19 -11
- data/test/engine_test.rb +26 -1
- data/test/native_test.rb +1 -1
- metadata +66 -72
- data/ext/Rakefile +0 -3
- data/ext/libsass/.github/CONTRIBUTING.md +0 -65
- data/ext/libsass/.github/ISSUE_TEMPLATE.md +0 -54
- data/ext/libsass/.travis.yml +0 -64
- data/ext/libsass/Readme.md +0 -104
- data/ext/libsass/SECURITY.md +0 -10
- data/ext/libsass/appveyor.yml +0 -91
- 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/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/functions.cpp +0 -2234
- data/ext/libsass/src/functions.hpp +0 -198
- 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/lib/tasks/libsass.rb +0 -33
@@ -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 <cstring>
|
3
6
|
#include <stdexcept>
|
4
7
|
#include <sstream>
|
@@ -67,23 +70,23 @@ namespace Sass {
|
|
67
70
|
}
|
68
71
|
|
69
72
|
// now create the code trace (ToDo: maybe have util functions?)
|
70
|
-
if (e.pstate.line != std::string::npos &&
|
73
|
+
if (e.pstate.line != std::string::npos &&
|
74
|
+
e.pstate.column != std::string::npos &&
|
75
|
+
e.pstate.src != nullptr) {
|
71
76
|
size_t lines = e.pstate.line;
|
72
|
-
const char* line_beg = e.pstate.src;
|
73
77
|
// scan through src until target line
|
74
78
|
// move line_beg pointer to line start
|
75
|
-
|
79
|
+
const char* line_beg;
|
80
|
+
for (line_beg = e.pstate.src; *line_beg != '\0'; ++line_beg) {
|
81
|
+
if (lines == 0) break;
|
76
82
|
if (*line_beg == '\n') --lines;
|
77
|
-
utf8::unchecked::next(line_beg);
|
78
83
|
}
|
79
|
-
const char* line_end = line_beg;
|
80
84
|
// move line_end before next newline character
|
81
|
-
|
82
|
-
|
83
|
-
if (*line_end == '\r') break;
|
84
|
-
utf8::unchecked::next(line_end);
|
85
|
+
const char* line_end;
|
86
|
+
for (line_end = line_beg; *line_end != '\0'; ++line_end) {
|
87
|
+
if (*line_end == '\n' || *line_end == '\r') break;
|
85
88
|
}
|
86
|
-
if (
|
89
|
+
if (*line_end != '\0') ++line_end;
|
87
90
|
size_t line_len = line_end - line_beg;
|
88
91
|
size_t move_in = 0; size_t shorten = 0;
|
89
92
|
size_t left_chars = 42; size_t max_chars = 76;
|
@@ -212,7 +215,7 @@ namespace Sass {
|
|
212
215
|
{
|
213
216
|
|
214
217
|
// assert valid pointer
|
215
|
-
if (compiler == 0) return
|
218
|
+
if (compiler == 0) return {};
|
216
219
|
// The cpp context must be set by now
|
217
220
|
Context* cpp_ctx = compiler->cpp_ctx;
|
218
221
|
Sass_Context* c_ctx = compiler->c_ctx;
|
@@ -233,7 +236,7 @@ namespace Sass {
|
|
233
236
|
// dispatch parse call
|
234
237
|
Block_Obj root(cpp_ctx->parse());
|
235
238
|
// abort on errors
|
236
|
-
if (!root) return
|
239
|
+
if (!root) return {};
|
237
240
|
|
238
241
|
// skip all prefixed files? (ToDo: check srcmap)
|
239
242
|
// IMO source-maps should point to headers already
|
@@ -253,7 +256,7 @@ namespace Sass {
|
|
253
256
|
catch (...) { handle_errors(c_ctx); }
|
254
257
|
|
255
258
|
// error
|
256
|
-
return
|
259
|
+
return {};
|
257
260
|
|
258
261
|
}
|
259
262
|
|
@@ -381,7 +384,7 @@ extern "C" {
|
|
381
384
|
|
382
385
|
inline void init_options (struct Sass_Options* options)
|
383
386
|
{
|
384
|
-
options->precision =
|
387
|
+
options->precision = 10;
|
385
388
|
options->indent = " ";
|
386
389
|
options->linefeed = LFEED;
|
387
390
|
}
|
@@ -617,7 +620,7 @@ extern "C" {
|
|
617
620
|
if (cpp_ctx) delete(cpp_ctx);
|
618
621
|
compiler->cpp_ctx = NULL;
|
619
622
|
compiler->c_ctx = NULL;
|
620
|
-
compiler->root =
|
623
|
+
compiler->root = {};
|
621
624
|
free(compiler);
|
622
625
|
}
|
623
626
|
|
@@ -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 <cstring>
|
3
6
|
#include "util.hpp"
|
4
7
|
#include "context.hpp"
|
@@ -167,21 +170,21 @@ extern "C" {
|
|
167
170
|
|
168
171
|
// Getters and Setters for environments (lexical, local and global)
|
169
172
|
union Sass_Value* ADDCALL sass_env_get_lexical (Sass_Env_Frame env, const char* name) {
|
170
|
-
|
173
|
+
Expression* ex = Cast<Expression>((*env->frame)[name]);
|
171
174
|
return ex != NULL ? ast_node_to_sass_value(ex) : NULL;
|
172
175
|
}
|
173
176
|
void ADDCALL sass_env_set_lexical (Sass_Env_Frame env, const char* name, union Sass_Value* val) {
|
174
177
|
(*env->frame)[name] = sass_value_to_ast_node(val);
|
175
178
|
}
|
176
179
|
union Sass_Value* ADDCALL sass_env_get_local (Sass_Env_Frame env, const char* name) {
|
177
|
-
|
180
|
+
Expression* ex = Cast<Expression>(env->frame->get_local(name));
|
178
181
|
return ex != NULL ? ast_node_to_sass_value(ex) : NULL;
|
179
182
|
}
|
180
183
|
void ADDCALL sass_env_set_local (Sass_Env_Frame env, const char* name, union Sass_Value* val) {
|
181
184
|
env->frame->set_local(name, sass_value_to_ast_node(val));
|
182
185
|
}
|
183
186
|
union Sass_Value* ADDCALL sass_env_get_global (Sass_Env_Frame env, const char* name) {
|
184
|
-
|
187
|
+
Expression* ex = Cast<Expression>(env->frame->get_global(name));
|
185
188
|
return ex != NULL ? ast_node_to_sass_value(ex) : NULL;
|
186
189
|
}
|
187
190
|
void ADDCALL sass_env_set_global (Sass_Env_Frame env, const char* name, union Sass_Value* val) {
|
@@ -1,4 +1,7 @@
|
|
1
|
+
// sass.hpp must go before all system headers to get the
|
2
|
+
// __EXTENSIONS__ fix on Solaris.
|
1
3
|
#include "sass.hpp"
|
4
|
+
|
2
5
|
#include <cstdlib>
|
3
6
|
#include <cstring>
|
4
7
|
#include "util.hpp"
|
@@ -290,7 +293,7 @@ extern "C" {
|
|
290
293
|
union Sass_Value* ADDCALL sass_value_op (enum Sass_OP op, const union Sass_Value* a, const union Sass_Value* b)
|
291
294
|
{
|
292
295
|
|
293
|
-
Sass::
|
296
|
+
Sass::Value_Obj rv;
|
294
297
|
|
295
298
|
try {
|
296
299
|
|
@@ -312,28 +315,34 @@ extern "C" {
|
|
312
315
|
}
|
313
316
|
|
314
317
|
if (sass_value_is_number(a) && sass_value_is_number(b)) {
|
315
|
-
|
316
|
-
|
318
|
+
const Number* l_n = Cast<Number>(lhs);
|
319
|
+
const Number* r_n = Cast<Number>(rhs);
|
317
320
|
rv = Operators::op_numbers(op, *l_n, *r_n, options, l_n->pstate());
|
318
321
|
}
|
319
322
|
else if (sass_value_is_number(a) && sass_value_is_color(a)) {
|
320
|
-
|
321
|
-
|
323
|
+
const Number* l_n = Cast<Number>(lhs);
|
324
|
+
// Direct HSLA operations are not supported
|
325
|
+
// All color maths will be deprecated anyway
|
326
|
+
Color_RGBA_Obj r_c = Cast<Color>(rhs)->toRGBA();
|
322
327
|
rv = Operators::op_number_color(op, *l_n, *r_c, options, l_n->pstate());
|
323
328
|
}
|
324
329
|
else if (sass_value_is_color(a) && sass_value_is_number(b)) {
|
325
|
-
|
326
|
-
|
330
|
+
// Direct HSLA operations are not supported
|
331
|
+
// All color maths will be deprecated anyway
|
332
|
+
Color_RGBA_Obj l_c = Cast<Color>(lhs)->toRGBA();
|
333
|
+
const Number* r_n = Cast<Number>(rhs);
|
327
334
|
rv = Operators::op_color_number(op, *l_c, *r_n, options, l_c->pstate());
|
328
335
|
}
|
329
336
|
else if (sass_value_is_color(a) && sass_value_is_color(b)) {
|
330
|
-
|
331
|
-
|
337
|
+
// Direct HSLA operations are not supported
|
338
|
+
// All color maths will be deprecated anyway
|
339
|
+
Color_RGBA_Obj l_c = Cast<Color>(lhs)->toRGBA();
|
340
|
+
Color_RGBA_Obj r_c = Cast<Color>(rhs)->toRGBA();
|
332
341
|
rv = Operators::op_colors(op, *l_c, *r_c, options, l_c->pstate());
|
333
342
|
}
|
334
343
|
else /* convert other stuff to string and apply operation */ {
|
335
|
-
|
336
|
-
|
344
|
+
Value* l_v = Cast<Value>(lhs);
|
345
|
+
Value* r_v = Cast<Value>(rhs);
|
337
346
|
rv = Operators::op_strings(op, *l_v, *r_v, options, l_v->pstate());
|
338
347
|
}
|
339
348
|
|
@@ -341,8 +350,7 @@ extern "C" {
|
|
341
350
|
if (!rv) return sass_make_error("invalid return value");
|
342
351
|
|
343
352
|
// convert result back to ast node
|
344
|
-
return ast_node_to_sass_value(rv);
|
345
|
-
|
353
|
+
return ast_node_to_sass_value(rv.ptr());
|
346
354
|
}
|
347
355
|
|
348
356
|
// simply pass the error message back to the caller for now
|
@@ -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 <sstream>
|
4
7
|
#include <iostream>
|
@@ -170,12 +173,12 @@ namespace Sass {
|
|
170
173
|
current_position += offset;
|
171
174
|
}
|
172
175
|
|
173
|
-
void SourceMap::add_open_mapping(const
|
176
|
+
void SourceMap::add_open_mapping(const AST_Node* node)
|
174
177
|
{
|
175
178
|
mappings.push_back(Mapping(node->pstate(), current_position));
|
176
179
|
}
|
177
180
|
|
178
|
-
void SourceMap::add_close_mapping(const
|
181
|
+
void SourceMap::add_close_mapping(const AST_Node* node)
|
179
182
|
{
|
180
183
|
mappings.push_back(Mapping(node->pstate() + node->pstate().offset, current_position));
|
181
184
|
}
|
@@ -28,8 +28,8 @@ namespace Sass {
|
|
28
28
|
void prepend(const Offset& offset);
|
29
29
|
void append(const OutputBuffer& out);
|
30
30
|
void prepend(const OutputBuffer& out);
|
31
|
-
void add_open_mapping(const
|
32
|
-
void add_close_mapping(const
|
31
|
+
void add_open_mapping(const AST_Node* node);
|
32
|
+
void add_close_mapping(const AST_Node* node);
|
33
33
|
|
34
34
|
std::string render_srcmap(Context &ctx);
|
35
35
|
ParserState remap(const ParserState& pstate);
|
@@ -1,60 +1,62 @@
|
|
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 "ast.hpp"
|
3
6
|
#include "to_value.hpp"
|
4
7
|
|
5
8
|
namespace Sass {
|
6
9
|
|
7
|
-
Value_Ptr To_Value::fallback_impl(AST_Node_Ptr n)
|
8
|
-
{
|
9
|
-
// throw a runtime error if this happens
|
10
|
-
// we want a well defined set of possible nodes
|
11
|
-
throw std::runtime_error("invalid node for to_value");
|
12
|
-
}
|
13
|
-
|
14
10
|
// Custom_Error is a valid value
|
15
|
-
|
11
|
+
Value* To_Value::operator()(Custom_Error* e)
|
16
12
|
{
|
17
13
|
return e;
|
18
14
|
}
|
19
15
|
|
20
16
|
// Custom_Warning is a valid value
|
21
|
-
|
17
|
+
Value* To_Value::operator()(Custom_Warning* w)
|
22
18
|
{
|
23
19
|
return w;
|
24
20
|
}
|
25
21
|
|
26
22
|
// Boolean is a valid value
|
27
|
-
|
23
|
+
Value* To_Value::operator()(Boolean* b)
|
28
24
|
{
|
29
25
|
return b;
|
30
26
|
}
|
31
27
|
|
32
28
|
// Number is a valid value
|
33
|
-
|
29
|
+
Value* To_Value::operator()(Number* n)
|
34
30
|
{
|
35
31
|
return n;
|
36
32
|
}
|
37
33
|
|
38
34
|
// Color is a valid value
|
39
|
-
|
35
|
+
Value* To_Value::operator()(Color_RGBA* c)
|
36
|
+
{
|
37
|
+
return c;
|
38
|
+
}
|
39
|
+
|
40
|
+
// Color is a valid value
|
41
|
+
Value* To_Value::operator()(Color_HSLA* c)
|
40
42
|
{
|
41
43
|
return c;
|
42
44
|
}
|
43
45
|
|
44
46
|
// String_Constant is a valid value
|
45
|
-
|
47
|
+
Value* To_Value::operator()(String_Constant* s)
|
46
48
|
{
|
47
49
|
return s;
|
48
50
|
}
|
49
51
|
|
50
52
|
// String_Quoted is a valid value
|
51
|
-
|
53
|
+
Value* To_Value::operator()(String_Quoted* s)
|
52
54
|
{
|
53
55
|
return s;
|
54
56
|
}
|
55
57
|
|
56
58
|
// List is a valid value
|
57
|
-
|
59
|
+
Value* To_Value::operator()(List* l)
|
58
60
|
{
|
59
61
|
List_Obj ll = SASS_MEMORY_NEW(List,
|
60
62
|
l->pstate(),
|
@@ -69,32 +71,32 @@ namespace Sass {
|
|
69
71
|
}
|
70
72
|
|
71
73
|
// Map is a valid value
|
72
|
-
|
74
|
+
Value* To_Value::operator()(Map* m)
|
73
75
|
{
|
74
76
|
return m;
|
75
77
|
}
|
76
78
|
|
77
79
|
// Null is a valid value
|
78
|
-
|
80
|
+
Value* To_Value::operator()(Null* n)
|
79
81
|
{
|
80
82
|
return n;
|
81
83
|
}
|
82
84
|
|
83
85
|
// Function is a valid value
|
84
|
-
|
86
|
+
Value* To_Value::operator()(Function* n)
|
85
87
|
{
|
86
88
|
return n;
|
87
89
|
}
|
88
90
|
|
89
91
|
// Argument returns its value
|
90
|
-
|
92
|
+
Value* To_Value::operator()(Argument* arg)
|
91
93
|
{
|
92
94
|
if (!arg->name().empty()) return 0;
|
93
95
|
return arg->value()->perform(this);
|
94
96
|
}
|
95
97
|
|
96
98
|
// Selector_List is converted to a string
|
97
|
-
|
99
|
+
Value* To_Value::operator()(Selector_List* s)
|
98
100
|
{
|
99
101
|
return SASS_MEMORY_NEW(String_Quoted,
|
100
102
|
s->pstate(),
|
@@ -102,7 +104,7 @@ namespace Sass {
|
|
102
104
|
}
|
103
105
|
|
104
106
|
// Binary_Expression is converted to a string
|
105
|
-
|
107
|
+
Value* To_Value::operator()(Binary_Expression* s)
|
106
108
|
{
|
107
109
|
return SASS_MEMORY_NEW(String_Quoted,
|
108
110
|
s->pstate(),
|
@@ -7,9 +7,7 @@
|
|
7
7
|
|
8
8
|
namespace Sass {
|
9
9
|
|
10
|
-
class To_Value : public Operation_CRTP<
|
11
|
-
|
12
|
-
Value_Ptr fallback_impl(AST_Node_Ptr n);
|
10
|
+
class To_Value : public Operation_CRTP<Value*, To_Value> {
|
13
11
|
|
14
12
|
private:
|
15
13
|
|
@@ -21,28 +19,26 @@ namespace Sass {
|
|
21
19
|
: ctx(ctx)
|
22
20
|
{ }
|
23
21
|
~To_Value() { }
|
24
|
-
using Operation<
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
22
|
+
using Operation<Value*>::operator();
|
23
|
+
|
24
|
+
Value* operator()(Argument*);
|
25
|
+
Value* operator()(Boolean*);
|
26
|
+
Value* operator()(Number*);
|
27
|
+
Value* operator()(Color_RGBA*);
|
28
|
+
Value* operator()(Color_HSLA*);
|
29
|
+
Value* operator()(String_Constant*);
|
30
|
+
Value* operator()(String_Quoted*);
|
31
|
+
Value* operator()(Custom_Warning*);
|
32
|
+
Value* operator()(Custom_Error*);
|
33
|
+
Value* operator()(List*);
|
34
|
+
Value* operator()(Map*);
|
35
|
+
Value* operator()(Null*);
|
36
|
+
Value* operator()(Function*);
|
38
37
|
|
39
38
|
// convert to string via `To_String`
|
40
|
-
|
41
|
-
|
39
|
+
Value* operator()(Selector_List*);
|
40
|
+
Value* operator()(Binary_Expression*);
|
42
41
|
|
43
|
-
// fallback throws error
|
44
|
-
template <typename U>
|
45
|
-
Value_Ptr fallback(U x) { return fallback_impl(x); }
|
46
42
|
};
|
47
43
|
|
48
44
|
}
|
data/ext/libsass/src/units.cpp
CHANGED