sassc 2.0.1 → 2.1.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +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
data/ext/libsass/src/emitter.cpp
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
#include "context.hpp"
|
4
4
|
#include "output.hpp"
|
5
5
|
#include "emitter.hpp"
|
6
|
+
#include "util_string.hpp"
|
6
7
|
#include "utf8_string.hpp"
|
7
8
|
|
8
9
|
namespace Sass {
|
@@ -47,11 +48,11 @@ namespace Sass {
|
|
47
48
|
void Emitter::set_filename(const std::string& str)
|
48
49
|
{ wbuf.smap.file = str; }
|
49
50
|
|
50
|
-
void Emitter::schedule_mapping(const
|
51
|
+
void Emitter::schedule_mapping(const AST_Node* node)
|
51
52
|
{ scheduled_mapping = node; }
|
52
|
-
void Emitter::add_open_mapping(const
|
53
|
+
void Emitter::add_open_mapping(const AST_Node* node)
|
53
54
|
{ wbuf.smap.add_open_mapping(node); }
|
54
|
-
void Emitter::add_close_mapping(const
|
55
|
+
void Emitter::add_close_mapping(const AST_Node* node)
|
55
56
|
{ wbuf.smap.add_close_mapping(node); }
|
56
57
|
ParserState Emitter::remap(const ParserState& pstate)
|
57
58
|
{ return wbuf.smap.remap(pstate); }
|
@@ -134,13 +135,13 @@ namespace Sass {
|
|
134
135
|
// write space/lf
|
135
136
|
flush_schedules();
|
136
137
|
|
137
|
-
if (in_comment
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
// account for data in source-maps
|
138
|
+
if (in_comment) {
|
139
|
+
std::string out = Util::normalize_newlines(text);
|
140
|
+
if (output_style() == COMPACT) {
|
141
|
+
out = comment_to_compact_string(out);
|
142
|
+
}
|
143
143
|
wbuf.smap.append(Offset(out));
|
144
|
+
wbuf.buffer += std::move(out);
|
144
145
|
} else {
|
145
146
|
// add to buffer
|
146
147
|
wbuf.buffer += text;
|
@@ -161,7 +162,7 @@ namespace Sass {
|
|
161
162
|
|
162
163
|
// append some text or token to the buffer
|
163
164
|
// this adds source-mappings for node start and end
|
164
|
-
void Emitter::append_token(const std::string& text, const
|
165
|
+
void Emitter::append_token(const std::string& text, const AST_Node* node)
|
165
166
|
{
|
166
167
|
flush_schedules();
|
167
168
|
add_open_mapping(node);
|
@@ -263,7 +264,7 @@ namespace Sass {
|
|
263
264
|
}
|
264
265
|
}
|
265
266
|
|
266
|
-
void Emitter::append_scope_opener(
|
267
|
+
void Emitter::append_scope_opener(AST_Node* node)
|
267
268
|
{
|
268
269
|
scheduled_linefeed = 0;
|
269
270
|
append_optional_space();
|
@@ -274,7 +275,7 @@ namespace Sass {
|
|
274
275
|
// append_optional_space();
|
275
276
|
++ indentation;
|
276
277
|
}
|
277
|
-
void Emitter::append_scope_closer(
|
278
|
+
void Emitter::append_scope_closer(AST_Node* node)
|
278
279
|
{
|
279
280
|
-- indentation;
|
280
281
|
scheduled_linefeed = 0;
|
data/ext/libsass/src/emitter.hpp
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
#ifndef SASS_EMITTER_H
|
2
2
|
#define SASS_EMITTER_H
|
3
3
|
|
4
|
-
|
4
|
+
// sass.hpp must go before all system headers to get the
|
5
|
+
// __EXTENSIONS__ fix on Solaris.
|
5
6
|
#include "sass.hpp"
|
7
|
+
|
8
|
+
#include <string>
|
9
|
+
|
6
10
|
#include "sass/base.h"
|
7
11
|
#include "source_map.hpp"
|
8
12
|
#include "ast_fwd_decl.hpp"
|
@@ -25,9 +29,9 @@ namespace Sass {
|
|
25
29
|
// proxy methods for source maps
|
26
30
|
void add_source_index(size_t idx);
|
27
31
|
void set_filename(const std::string& str);
|
28
|
-
void add_open_mapping(const
|
29
|
-
void add_close_mapping(const
|
30
|
-
void schedule_mapping(const
|
32
|
+
void add_open_mapping(const AST_Node* node);
|
33
|
+
void add_close_mapping(const AST_Node* node);
|
34
|
+
void schedule_mapping(const AST_Node* node);
|
31
35
|
std::string render_srcmap(Context &ctx);
|
32
36
|
ParserState remap(const ParserState& pstate);
|
33
37
|
|
@@ -37,8 +41,8 @@ namespace Sass {
|
|
37
41
|
size_t scheduled_space;
|
38
42
|
size_t scheduled_linefeed;
|
39
43
|
bool scheduled_delimiter;
|
40
|
-
|
41
|
-
|
44
|
+
const AST_Node* scheduled_crutch;
|
45
|
+
const AST_Node* scheduled_mapping;
|
42
46
|
|
43
47
|
public:
|
44
48
|
// output strings different in custom css properties
|
@@ -75,7 +79,7 @@ namespace Sass {
|
|
75
79
|
void append_wspace(const std::string& text);
|
76
80
|
// append some text or token to the buffer
|
77
81
|
// this adds source-mappings for node start and end
|
78
|
-
void append_token(const std::string& text, const
|
82
|
+
void append_token(const std::string& text, const AST_Node* node);
|
79
83
|
// query last appended character
|
80
84
|
char last_char();
|
81
85
|
|
@@ -86,8 +90,8 @@ namespace Sass {
|
|
86
90
|
void append_special_linefeed(void);
|
87
91
|
void append_optional_linefeed(void);
|
88
92
|
void append_mandatory_linefeed(void);
|
89
|
-
void append_scope_opener(
|
90
|
-
void append_scope_closer(
|
93
|
+
void append_scope_opener(AST_Node* node = 0);
|
94
|
+
void append_scope_closer(AST_Node* node = 0);
|
91
95
|
void append_comma_separator(void);
|
92
96
|
void append_colon_separator(void);
|
93
97
|
void append_delimiter(void);
|
@@ -206,6 +206,20 @@ namespace Sass {
|
|
206
206
|
}
|
207
207
|
};
|
208
208
|
|
209
|
+
// use array access for getter and setter functions
|
210
|
+
template <typename T>
|
211
|
+
T& Environment<T>::get(const std::string& key)
|
212
|
+
{
|
213
|
+
auto cur = this;
|
214
|
+
while (cur) {
|
215
|
+
if (cur->has_local(key)) {
|
216
|
+
return cur->get_local(key);
|
217
|
+
}
|
218
|
+
cur = cur->parent_;
|
219
|
+
}
|
220
|
+
return get_local(key);
|
221
|
+
}
|
222
|
+
|
209
223
|
// use array access for getter and setter functions
|
210
224
|
template <typename T>
|
211
225
|
T& Environment<T>::operator[](const std::string& key)
|
@@ -230,7 +244,7 @@ namespace Sass {
|
|
230
244
|
for (typename environment_map<std::string, T>::iterator i = local_frame_.begin(); i != local_frame_.end(); ++i) {
|
231
245
|
if (!ends_with(i->first, "[f]") && !ends_with(i->first, "[f]4") && !ends_with(i->first, "[f]2")) {
|
232
246
|
std::cerr << prefix << std::string(indent, ' ') << i->first << " " << i->second;
|
233
|
-
if (
|
247
|
+
if (Value* val = Cast<Value>(i->second))
|
234
248
|
{ std::cerr << " : " << val->to_string(); }
|
235
249
|
std::cerr << std::endl;
|
236
250
|
}
|
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
namespace Sass {
|
9
9
|
|
10
|
+
// this defeats the whole purpose of environment being templatable!!
|
10
11
|
typedef environment_map<std::string, AST_Node_Obj>::iterator EnvIter;
|
11
12
|
|
12
13
|
class EnvResult {
|
@@ -92,6 +93,10 @@ namespace Sass {
|
|
92
93
|
// include all scopes available
|
93
94
|
bool has(const std::string& key) const;
|
94
95
|
|
96
|
+
// look on the full stack for key
|
97
|
+
// include all scopes available
|
98
|
+
T& get(const std::string& key);
|
99
|
+
|
95
100
|
// look on the full stack for key
|
96
101
|
// include all scopes available
|
97
102
|
EnvResult find(const std::string& key);
|
@@ -107,6 +112,7 @@ namespace Sass {
|
|
107
112
|
|
108
113
|
// define typedef for our use case
|
109
114
|
typedef Environment<AST_Node_Obj> Env;
|
115
|
+
typedef std::vector<Env*> EnvStack;
|
110
116
|
|
111
117
|
}
|
112
118
|
|
@@ -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 "ast.hpp"
|
3
6
|
#include "prelexer.hpp"
|
4
7
|
#include "backtrace.hpp"
|
@@ -15,43 +18,38 @@ namespace Sass {
|
|
15
18
|
prefix("Error"), pstate(pstate), traces(traces)
|
16
19
|
{ }
|
17
20
|
|
18
|
-
InvalidSass::InvalidSass(ParserState pstate, Backtraces traces, std::string msg)
|
19
|
-
: Base(pstate, msg, traces)
|
21
|
+
InvalidSass::InvalidSass(ParserState pstate, Backtraces traces, std::string msg, char* owned_src)
|
22
|
+
: Base(pstate, msg, traces), owned_src(owned_src)
|
20
23
|
{ }
|
21
24
|
|
22
25
|
|
23
|
-
InvalidParent::InvalidParent(
|
26
|
+
InvalidParent::InvalidParent(Selector* parent, Backtraces traces, Selector* selector)
|
24
27
|
: Base(selector->pstate(), def_msg, traces), parent(parent), selector(selector)
|
25
28
|
{
|
26
|
-
msg = "Invalid parent selector for
|
27
|
-
|
28
|
-
|
29
|
-
msg += parent->to_string(Sass_Inspect_Options());
|
30
|
-
msg += "\"";
|
29
|
+
msg = "Invalid parent selector for "
|
30
|
+
"\"" + selector->to_string(Sass_Inspect_Options()) + "\": "
|
31
|
+
"\"" + parent->to_string(Sass_Inspect_Options()) + "\"";
|
31
32
|
}
|
32
33
|
|
33
|
-
InvalidVarKwdType::InvalidVarKwdType(ParserState pstate, Backtraces traces, std::string name, const
|
34
|
+
InvalidVarKwdType::InvalidVarKwdType(ParserState pstate, Backtraces traces, std::string name, const Argument* arg)
|
34
35
|
: Base(pstate, def_msg, traces), name(name), arg(arg)
|
35
36
|
{
|
36
|
-
msg = "Variable keyword argument map must have string keys.\n"
|
37
|
-
|
37
|
+
msg = "Variable keyword argument map must have string keys.\n" +
|
38
|
+
name + " is not a string in " + arg->to_string() + ".";
|
38
39
|
}
|
39
40
|
|
40
|
-
InvalidArgumentType::InvalidArgumentType(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string type, const
|
41
|
+
InvalidArgumentType::InvalidArgumentType(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string type, const Value* value)
|
41
42
|
: Base(pstate, def_msg, traces), fn(fn), arg(arg), type(type), value(value)
|
42
43
|
{
|
43
|
-
msg
|
44
|
+
msg = arg + ": \"";
|
44
45
|
if (value) msg += value->to_string(Sass_Inspect_Options());
|
45
|
-
msg += "\" is not a " + type;
|
46
|
-
msg += " for `" + fn + "'";
|
46
|
+
msg += "\" is not a " + type + " for `" + fn + "'";
|
47
47
|
}
|
48
48
|
|
49
49
|
MissingArgument::MissingArgument(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string fntype)
|
50
50
|
: Base(pstate, def_msg, traces), fn(fn), arg(arg), fntype(fntype)
|
51
51
|
{
|
52
|
-
msg
|
53
|
-
msg += " is missing argument ";
|
54
|
-
msg += arg + ".";
|
52
|
+
msg = fntype + " " + fn + " is missing argument " + arg + ".";
|
55
53
|
}
|
56
54
|
|
57
55
|
InvalidSyntax::InvalidSyntax(ParserState pstate, Backtraces traces, std::string msg)
|
@@ -65,87 +63,66 @@ namespace Sass {
|
|
65
63
|
DuplicateKeyError::DuplicateKeyError(Backtraces traces, const Map& dup, const Expression& org)
|
66
64
|
: Base(org.pstate(), def_msg, traces), dup(dup), org(org)
|
67
65
|
{
|
68
|
-
msg
|
69
|
-
msg += dup.get_duplicate_key()->inspect();
|
70
|
-
msg += " in map (";
|
71
|
-
msg += org.inspect();
|
72
|
-
msg += ").";
|
66
|
+
msg = "Duplicate key " + dup.get_duplicate_key()->inspect() + " in map (" + org.inspect() + ").";
|
73
67
|
}
|
74
68
|
|
75
69
|
TypeMismatch::TypeMismatch(Backtraces traces, const Expression& var, const std::string type)
|
76
70
|
: Base(var.pstate(), def_msg, traces), var(var), type(type)
|
77
71
|
{
|
78
|
-
msg
|
79
|
-
msg += " is not an ";
|
80
|
-
msg += type;
|
81
|
-
msg += ".";
|
72
|
+
msg = var.to_string() + " is not an " + type + ".";
|
82
73
|
}
|
83
74
|
|
84
75
|
InvalidValue::InvalidValue(Backtraces traces, const Expression& val)
|
85
76
|
: Base(val.pstate(), def_msg, traces), val(val)
|
86
77
|
{
|
87
|
-
msg
|
88
|
-
msg += " isn't a valid CSS value.";
|
78
|
+
msg = val.to_string() + " isn't a valid CSS value.";
|
89
79
|
}
|
90
80
|
|
91
81
|
StackError::StackError(Backtraces traces, const AST_Node& node)
|
92
82
|
: Base(node.pstate(), def_msg, traces), node(node)
|
93
83
|
{
|
94
|
-
msg
|
84
|
+
msg = "stack level too deep";
|
95
85
|
}
|
96
86
|
|
97
87
|
IncompatibleUnits::IncompatibleUnits(const Units& lhs, const Units& rhs)
|
98
88
|
{
|
99
|
-
msg
|
100
|
-
msg += rhs.unit();
|
101
|
-
msg += "' and '";
|
102
|
-
msg += lhs.unit();
|
103
|
-
msg += "'.";
|
89
|
+
msg = "Incompatible units: '" + rhs.unit() + "' and '" + lhs.unit() + "'.";
|
104
90
|
}
|
105
91
|
|
106
92
|
IncompatibleUnits::IncompatibleUnits(const UnitType lhs, const UnitType rhs)
|
107
93
|
{
|
108
|
-
msg
|
109
|
-
msg += unit_to_string(rhs);
|
110
|
-
msg += "' and '";
|
111
|
-
msg += unit_to_string(lhs);
|
112
|
-
msg += "'.";
|
94
|
+
msg = std::string("Incompatible units: '") + unit_to_string(rhs) + "' and '" + unit_to_string(lhs) + "'.";
|
113
95
|
}
|
114
96
|
|
115
|
-
AlphaChannelsNotEqual::AlphaChannelsNotEqual(
|
97
|
+
AlphaChannelsNotEqual::AlphaChannelsNotEqual(const Expression* lhs, const Expression* rhs, enum Sass_OP op)
|
116
98
|
: OperationError(), lhs(lhs), rhs(rhs), op(op)
|
117
99
|
{
|
118
|
-
msg
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
msg += ".";
|
100
|
+
msg = "Alpha channels must be equal: " +
|
101
|
+
lhs->to_string({ NESTED, 5 }) +
|
102
|
+
" " + sass_op_to_name(op) + " " +
|
103
|
+
rhs->to_string({ NESTED, 5 }) + ".";
|
123
104
|
}
|
124
105
|
|
125
106
|
ZeroDivisionError::ZeroDivisionError(const Expression& lhs, const Expression& rhs)
|
126
107
|
: OperationError(), lhs(lhs), rhs(rhs)
|
127
108
|
{
|
128
|
-
msg
|
109
|
+
msg = "divided by 0";
|
129
110
|
}
|
130
111
|
|
131
|
-
UndefinedOperation::UndefinedOperation(
|
112
|
+
UndefinedOperation::UndefinedOperation(const Expression* lhs, const Expression* rhs, enum Sass_OP op)
|
132
113
|
: OperationError(), lhs(lhs), rhs(rhs), op(op)
|
133
114
|
{
|
134
|
-
msg
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
115
|
+
msg = def_op_msg + ": \"" +
|
116
|
+
lhs->to_string({ NESTED, 5 }) +
|
117
|
+
" " + sass_op_to_name(op) + " " +
|
118
|
+
rhs->to_string({ TO_SASS, 5 }) +
|
119
|
+
"\".";
|
139
120
|
}
|
140
121
|
|
141
|
-
InvalidNullOperation::InvalidNullOperation(
|
122
|
+
InvalidNullOperation::InvalidNullOperation(const Expression* lhs, const Expression* rhs, enum Sass_OP op)
|
142
123
|
: UndefinedOperation(lhs, rhs, op)
|
143
124
|
{
|
144
|
-
msg
|
145
|
-
msg += lhs->inspect();
|
146
|
-
msg += " " + sass_op_to_name(op) + " ";
|
147
|
-
msg += rhs->inspect();
|
148
|
-
msg += "\".";
|
125
|
+
msg = def_op_null_msg + ": \"" + lhs->inspect() + " " + sass_op_to_name(op) + " " + rhs->inspect() + "\".";
|
149
126
|
}
|
150
127
|
|
151
128
|
SassValueError::SassValueError(Backtraces traces, ParserState pstate, OperationError& err)
|
@@ -4,6 +4,7 @@
|
|
4
4
|
#include <string>
|
5
5
|
#include <sstream>
|
6
6
|
#include <stdexcept>
|
7
|
+
#include "units.hpp"
|
7
8
|
#include "position.hpp"
|
8
9
|
#include "backtrace.hpp"
|
9
10
|
#include "ast_fwd_decl.hpp"
|
@@ -36,16 +37,28 @@ namespace Sass {
|
|
36
37
|
|
37
38
|
class InvalidSass : public Base {
|
38
39
|
public:
|
39
|
-
InvalidSass(
|
40
|
-
|
40
|
+
InvalidSass(InvalidSass& other) : Base(other), owned_src(other.owned_src) {
|
41
|
+
// Assumes that `this` will outlive `other`.
|
42
|
+
other.owned_src = nullptr;
|
43
|
+
}
|
44
|
+
|
45
|
+
// Required because the copy constructor's argument is not const.
|
46
|
+
// Can't use `std::move` here because we build on Visual Studio 2013.
|
47
|
+
InvalidSass(InvalidSass &&other) : Base(other), owned_src(other.owned_src) {
|
48
|
+
other.owned_src = nullptr;
|
49
|
+
}
|
50
|
+
|
51
|
+
InvalidSass(ParserState pstate, Backtraces traces, std::string msg, char* owned_src = nullptr);
|
52
|
+
virtual ~InvalidSass() throw() { sass_free_memory(owned_src); };
|
53
|
+
char *owned_src;
|
41
54
|
};
|
42
55
|
|
43
56
|
class InvalidParent : public Base {
|
44
57
|
protected:
|
45
|
-
|
46
|
-
|
58
|
+
Selector* parent;
|
59
|
+
Selector* selector;
|
47
60
|
public:
|
48
|
-
InvalidParent(
|
61
|
+
InvalidParent(Selector* parent, Backtraces traces, Selector* selector);
|
49
62
|
virtual ~InvalidParent() throw() {};
|
50
63
|
};
|
51
64
|
|
@@ -64,18 +77,18 @@ namespace Sass {
|
|
64
77
|
std::string fn;
|
65
78
|
std::string arg;
|
66
79
|
std::string type;
|
67
|
-
const
|
80
|
+
const Value* value;
|
68
81
|
public:
|
69
|
-
InvalidArgumentType(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string type, const
|
82
|
+
InvalidArgumentType(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string type, const Value* value = 0);
|
70
83
|
virtual ~InvalidArgumentType() throw() {};
|
71
84
|
};
|
72
85
|
|
73
86
|
class InvalidVarKwdType : public Base {
|
74
87
|
protected:
|
75
88
|
std::string name;
|
76
|
-
const
|
89
|
+
const Argument* arg;
|
77
90
|
public:
|
78
|
-
InvalidVarKwdType(ParserState pstate, Backtraces traces, std::string name, const
|
91
|
+
InvalidVarKwdType(ParserState pstate, Backtraces traces, std::string name, const Argument* arg = 0);
|
79
92
|
virtual ~InvalidVarKwdType() throw() {};
|
80
93
|
};
|
81
94
|
|
@@ -165,28 +178,28 @@ namespace Sass {
|
|
165
178
|
|
166
179
|
class UndefinedOperation : public OperationError {
|
167
180
|
protected:
|
168
|
-
|
169
|
-
|
181
|
+
const Expression* lhs;
|
182
|
+
const Expression* rhs;
|
170
183
|
const Sass_OP op;
|
171
184
|
public:
|
172
|
-
UndefinedOperation(
|
185
|
+
UndefinedOperation(const Expression* lhs, const Expression* rhs, enum Sass_OP op);
|
173
186
|
// virtual const char* errtype() const { return "Error"; }
|
174
187
|
virtual ~UndefinedOperation() throw() {};
|
175
188
|
};
|
176
189
|
|
177
190
|
class InvalidNullOperation : public UndefinedOperation {
|
178
191
|
public:
|
179
|
-
InvalidNullOperation(
|
192
|
+
InvalidNullOperation(const Expression* lhs, const Expression* rhs, enum Sass_OP op);
|
180
193
|
virtual ~InvalidNullOperation() throw() {};
|
181
194
|
};
|
182
195
|
|
183
196
|
class AlphaChannelsNotEqual : public OperationError {
|
184
197
|
protected:
|
185
|
-
|
186
|
-
|
198
|
+
const Expression* lhs;
|
199
|
+
const Expression* rhs;
|
187
200
|
const Sass_OP op;
|
188
201
|
public:
|
189
|
-
AlphaChannelsNotEqual(
|
202
|
+
AlphaChannelsNotEqual(const Expression* lhs, const Expression* rhs, enum Sass_OP op);
|
190
203
|
// virtual const char* errtype() const { return "Error"; }
|
191
204
|
virtual ~AlphaChannelsNotEqual() throw() {};
|
192
205
|
};
|