sassc 2.0.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.gitmodules +1 -1
- data/.travis.yml +9 -3
- data/CHANGELOG.md +36 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/README.md +1 -1
- data/Rakefile +43 -7
- data/ext/depend +4 -0
- data/ext/extconf.rb +92 -0
- data/ext/libsass/VERSION +1 -0
- data/ext/libsass/include/sass/base.h +9 -1
- data/ext/libsass/include/sass/context.h +5 -1
- data/ext/libsass/src/MurmurHash2.hpp +91 -0
- data/ext/libsass/src/ast.cpp +755 -2028
- data/ext/libsass/src/ast.hpp +492 -2477
- 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 +70 -10
- data/ext/libsass/src/ast_fwd_decl.cpp +5 -3
- data/ext/libsass/src/ast_fwd_decl.hpp +107 -296
- data/ext/libsass/src/ast_helpers.hpp +292 -0
- data/ext/libsass/src/ast_sel_cmp.cpp +396 -0
- data/ext/libsass/src/ast_sel_super.cpp +539 -0
- data/ext/libsass/src/ast_sel_unify.cpp +275 -0
- data/ext/libsass/src/ast_sel_weave.cpp +616 -0
- data/ext/libsass/src/ast_selectors.cpp +1043 -0
- data/ext/libsass/src/ast_selectors.hpp +522 -0
- data/ext/libsass/src/ast_supports.cpp +114 -0
- data/ext/libsass/src/ast_supports.hpp +121 -0
- data/ext/libsass/src/ast_values.cpp +1154 -0
- data/ext/libsass/src/ast_values.hpp +498 -0
- data/ext/libsass/src/backtrace.cpp +11 -7
- data/ext/libsass/src/backtrace.hpp +5 -5
- data/ext/libsass/src/base64vlq.cpp +5 -2
- data/ext/libsass/src/base64vlq.hpp +1 -1
- data/ext/libsass/src/bind.cpp +35 -34
- 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 +4 -6
- data/ext/libsass/src/check_nesting.cpp +83 -88
- data/ext/libsass/src/check_nesting.hpp +39 -34
- data/ext/libsass/src/color_maps.cpp +168 -164
- data/ext/libsass/src/color_maps.hpp +152 -160
- data/ext/libsass/src/constants.cpp +20 -0
- data/ext/libsass/src/constants.hpp +19 -0
- data/ext/libsass/src/context.cpp +104 -121
- data/ext/libsass/src/context.hpp +43 -55
- data/ext/libsass/src/cssize.cpp +103 -188
- data/ext/libsass/src/cssize.hpp +45 -51
- data/ext/libsass/src/dart_helpers.hpp +199 -0
- data/ext/libsass/src/debugger.hpp +524 -361
- data/ext/libsass/src/emitter.cpp +26 -26
- data/ext/libsass/src/emitter.hpp +20 -18
- data/ext/libsass/src/environment.cpp +41 -27
- data/ext/libsass/src/environment.hpp +33 -22
- data/ext/libsass/src/error_handling.cpp +92 -94
- data/ext/libsass/src/error_handling.hpp +73 -50
- data/ext/libsass/src/eval.cpp +380 -515
- data/ext/libsass/src/eval.hpp +64 -57
- data/ext/libsass/src/eval_selectors.cpp +75 -0
- data/ext/libsass/src/expand.cpp +322 -263
- data/ext/libsass/src/expand.hpp +55 -39
- data/ext/libsass/src/extender.cpp +1188 -0
- data/ext/libsass/src/extender.hpp +399 -0
- data/ext/libsass/src/extension.cpp +43 -0
- data/ext/libsass/src/extension.hpp +89 -0
- data/ext/libsass/src/file.cpp +134 -88
- data/ext/libsass/src/file.hpp +28 -37
- data/ext/libsass/src/fn_colors.cpp +596 -0
- data/ext/libsass/src/fn_colors.hpp +85 -0
- data/ext/libsass/src/fn_lists.cpp +285 -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 +244 -0
- data/ext/libsass/src/fn_miscs.hpp +40 -0
- data/ext/libsass/src/fn_numbers.cpp +227 -0
- data/ext/libsass/src/fn_numbers.hpp +45 -0
- data/ext/libsass/src/fn_selectors.cpp +205 -0
- data/ext/libsass/src/fn_selectors.hpp +35 -0
- data/ext/libsass/src/fn_strings.cpp +268 -0
- data/ext/libsass/src/fn_strings.hpp +34 -0
- data/ext/libsass/src/fn_utils.cpp +158 -0
- data/ext/libsass/src/fn_utils.hpp +62 -0
- data/ext/libsass/src/inspect.cpp +253 -266
- data/ext/libsass/src/inspect.hpp +72 -74
- data/ext/libsass/src/json.cpp +2 -2
- data/ext/libsass/src/lexer.cpp +25 -84
- data/ext/libsass/src/lexer.hpp +5 -16
- data/ext/libsass/src/listize.cpp +27 -43
- data/ext/libsass/src/listize.hpp +14 -11
- data/ext/libsass/src/mapping.hpp +1 -0
- data/ext/libsass/src/memory.hpp +12 -0
- data/ext/libsass/src/memory/allocator.cpp +48 -0
- data/ext/libsass/src/memory/allocator.hpp +138 -0
- data/ext/libsass/src/memory/config.hpp +20 -0
- data/ext/libsass/src/memory/memory_pool.hpp +186 -0
- data/ext/libsass/src/memory/shared_ptr.cpp +33 -0
- data/ext/libsass/src/memory/shared_ptr.hpp +332 -0
- data/ext/libsass/src/operation.hpp +193 -143
- data/ext/libsass/src/operators.cpp +56 -29
- data/ext/libsass/src/operators.hpp +11 -11
- data/ext/libsass/src/ordered_map.hpp +112 -0
- data/ext/libsass/src/output.cpp +59 -75
- data/ext/libsass/src/output.hpp +15 -22
- data/ext/libsass/src/parser.cpp +662 -818
- data/ext/libsass/src/parser.hpp +96 -100
- data/ext/libsass/src/parser_selectors.cpp +189 -0
- data/ext/libsass/src/permutate.hpp +164 -0
- data/ext/libsass/src/plugins.cpp +12 -8
- data/ext/libsass/src/plugins.hpp +8 -8
- data/ext/libsass/src/position.cpp +10 -26
- data/ext/libsass/src/position.hpp +44 -21
- data/ext/libsass/src/prelexer.cpp +14 -8
- data/ext/libsass/src/prelexer.hpp +9 -9
- data/ext/libsass/src/remove_placeholders.cpp +59 -57
- data/ext/libsass/src/remove_placeholders.hpp +20 -18
- data/ext/libsass/src/sass.cpp +25 -18
- data/ext/libsass/src/sass.hpp +22 -14
- data/ext/libsass/src/sass2scss.cpp +49 -18
- data/ext/libsass/src/sass_context.cpp +104 -132
- data/ext/libsass/src/sass_context.hpp +2 -2
- data/ext/libsass/src/sass_functions.cpp +7 -4
- data/ext/libsass/src/sass_functions.hpp +1 -1
- data/ext/libsass/src/sass_values.cpp +26 -21
- data/ext/libsass/src/settings.hpp +19 -0
- data/ext/libsass/src/source.cpp +69 -0
- data/ext/libsass/src/source.hpp +95 -0
- data/ext/libsass/src/source_data.hpp +32 -0
- data/ext/libsass/src/source_map.cpp +27 -20
- data/ext/libsass/src/source_map.hpp +14 -11
- data/ext/libsass/src/stylesheet.cpp +22 -0
- data/ext/libsass/src/stylesheet.hpp +57 -0
- data/ext/libsass/src/to_value.cpp +24 -22
- data/ext/libsass/src/to_value.hpp +18 -22
- data/ext/libsass/src/units.cpp +28 -22
- data/ext/libsass/src/units.hpp +9 -8
- 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 +12 -10
- data/ext/libsass/src/utf8_string.hpp +7 -6
- data/ext/libsass/src/util.cpp +97 -107
- data/ext/libsass/src/util.hpp +74 -30
- data/ext/libsass/src/util_string.cpp +125 -0
- data/ext/libsass/src/util_string.hpp +73 -0
- data/ext/libsass/src/values.cpp +33 -24
- data/ext/libsass/src/values.hpp +2 -2
- data/lib/sassc.rb +24 -0
- data/lib/sassc/engine.rb +7 -5
- data/lib/sassc/functions_handler.rb +11 -13
- data/lib/sassc/native.rb +10 -9
- data/lib/sassc/native/native_functions_api.rb +0 -5
- data/lib/sassc/script.rb +4 -6
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +32 -12
- data/test/engine_test.rb +32 -2
- data/test/functions_test.rb +38 -1
- data/test/native_test.rb +4 -4
- metadata +95 -109
- data/ext/Rakefile +0 -3
- data/ext/libsass/.editorconfig +0 -15
- data/ext/libsass/.gitattributes +0 -2
- data/ext/libsass/.github/CONTRIBUTING.md +0 -65
- data/ext/libsass/.github/ISSUE_TEMPLATE.md +0 -54
- data/ext/libsass/.gitignore +0 -85
- data/ext/libsass/.travis.yml +0 -64
- data/ext/libsass/COPYING +0 -25
- data/ext/libsass/GNUmakefile.am +0 -88
- data/ext/libsass/INSTALL +0 -1
- data/ext/libsass/LICENSE +0 -25
- data/ext/libsass/Makefile +0 -351
- data/ext/libsass/Makefile.conf +0 -55
- data/ext/libsass/Readme.md +0 -104
- data/ext/libsass/SECURITY.md +0 -10
- data/ext/libsass/appveyor.yml +0 -91
- data/ext/libsass/configure.ac +0 -138
- data/ext/libsass/contrib/libsass.spec +0 -66
- 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/include/sass/version.h.in +0 -12
- data/ext/libsass/m4/.gitkeep +0 -0
- data/ext/libsass/m4/m4-ax_cxx_compile_stdcxx_11.m4 +0 -167
- data/ext/libsass/res/resource.rc +0 -35
- 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/GNUmakefile.am +0 -54
- data/ext/libsass/src/extend.cpp +0 -2130
- data/ext/libsass/src/extend.hpp +0 -86
- data/ext/libsass/src/functions.cpp +0 -2234
- data/ext/libsass/src/functions.hpp +0 -198
- data/ext/libsass/src/memory/SharedPtr.cpp +0 -114
- data/ext/libsass/src/memory/SharedPtr.hpp +0 -206
- data/ext/libsass/src/node.cpp +0 -319
- data/ext/libsass/src/node.hpp +0 -118
- data/ext/libsass/src/paths.hpp +0 -71
- data/ext/libsass/src/sass_util.cpp +0 -149
- data/ext/libsass/src/sass_util.hpp +0 -256
- data/ext/libsass/src/subset_map.cpp +0 -55
- data/ext/libsass/src/subset_map.hpp +0 -76
- data/ext/libsass/src/support/libsass.pc.in +0 -11
- 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/ext/libsass/version.sh +0 -10
- data/ext/libsass/win/libsass.sln +0 -39
- data/ext/libsass/win/libsass.sln.DotSettings +0 -9
- data/ext/libsass/win/libsass.targets +0 -118
- data/ext/libsass/win/libsass.vcxproj +0 -188
- data/ext/libsass/win/libsass.vcxproj.filters +0 -357
- data/lib/sassc/native/lib_c.rb +0 -21
- 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 "ast.hpp"
|
3
6
|
#include "prelexer.hpp"
|
4
7
|
#include "backtrace.hpp"
|
@@ -10,196 +13,191 @@ namespace Sass {
|
|
10
13
|
|
11
14
|
namespace Exception {
|
12
15
|
|
13
|
-
Base::Base(
|
14
|
-
: std::runtime_error(msg), msg(msg),
|
16
|
+
Base::Base(SourceSpan pstate, sass::string msg, Backtraces traces)
|
17
|
+
: std::runtime_error(msg.c_str()), msg(msg),
|
15
18
|
prefix("Error"), pstate(pstate), traces(traces)
|
16
19
|
{ }
|
17
20
|
|
18
|
-
InvalidSass::InvalidSass(
|
21
|
+
InvalidSass::InvalidSass(SourceSpan pstate, Backtraces traces, sass::string msg)
|
19
22
|
: Base(pstate, msg, traces)
|
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(
|
34
|
+
InvalidVarKwdType::InvalidVarKwdType(SourceSpan pstate, Backtraces traces, sass::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(
|
41
|
+
InvalidArgumentType::InvalidArgumentType(SourceSpan pstate, Backtraces traces, sass::string fn, sass::string arg, sass::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
|
-
MissingArgument::MissingArgument(
|
49
|
+
MissingArgument::MissingArgument(SourceSpan pstate, Backtraces traces, sass::string fn, sass::string arg, sass::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
|
-
InvalidSyntax::InvalidSyntax(
|
55
|
+
InvalidSyntax::InvalidSyntax(SourceSpan pstate, Backtraces traces, sass::string msg)
|
58
56
|
: Base(pstate, msg, traces)
|
59
57
|
{ }
|
60
58
|
|
61
|
-
NestingLimitError::NestingLimitError(
|
59
|
+
NestingLimitError::NestingLimitError(SourceSpan pstate, Backtraces traces, sass::string msg)
|
62
60
|
: Base(pstate, msg, traces)
|
63
61
|
{ }
|
64
62
|
|
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
|
-
TypeMismatch::TypeMismatch(Backtraces traces, const Expression& var, const
|
69
|
+
TypeMismatch::TypeMismatch(Backtraces traces, const Expression& var, const sass::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 = sass::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
|
-
SassValueError::SassValueError(Backtraces traces,
|
128
|
+
SassValueError::SassValueError(Backtraces traces, SourceSpan pstate, OperationError& err)
|
152
129
|
: Base(pstate, err.what(), traces)
|
153
130
|
{
|
154
131
|
msg = err.what();
|
155
132
|
prefix = err.errtype();
|
156
133
|
}
|
157
134
|
|
135
|
+
TopLevelParent::TopLevelParent(Backtraces traces, SourceSpan pstate)
|
136
|
+
: Base(pstate, "Top-level selectors may not contain the parent selector \"&\".", traces)
|
137
|
+
{
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
UnsatisfiedExtend::UnsatisfiedExtend(Backtraces traces, Extension extension)
|
142
|
+
: Base(extension.target->pstate(), "The target selector was not found.\n"
|
143
|
+
"Use \"@extend " + extension.target->to_string() + " !optional\" to avoid this error.", traces)
|
144
|
+
{
|
145
|
+
|
146
|
+
}
|
147
|
+
|
148
|
+
ExtendAcrossMedia::ExtendAcrossMedia(Backtraces traces, Extension extension)
|
149
|
+
: Base(extension.target->pstate(), "You may not @extend selectors across media queries.\n"
|
150
|
+
"Use \"@extend " + extension.target->to_string() + " !optional\" to avoid this error.", traces)
|
151
|
+
{
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
|
158
156
|
}
|
159
157
|
|
160
158
|
|
161
|
-
void warn(
|
159
|
+
void warn(sass::string msg, SourceSpan pstate)
|
162
160
|
{
|
163
161
|
std::cerr << "Warning: " << msg << std::endl;
|
164
162
|
}
|
165
163
|
|
166
|
-
void warning(
|
164
|
+
void warning(sass::string msg, SourceSpan pstate)
|
167
165
|
{
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
166
|
+
sass::string cwd(Sass::File::get_cwd());
|
167
|
+
sass::string abs_path(Sass::File::rel2abs(pstate.getPath(), cwd, cwd));
|
168
|
+
sass::string rel_path(Sass::File::abs2rel(pstate.getPath(), cwd, cwd));
|
169
|
+
sass::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.getPath()));
|
172
170
|
|
173
|
-
std::cerr << "WARNING on line " << pstate.
|
171
|
+
std::cerr << "WARNING on line " << pstate.getLine() << ", column " << pstate.getColumn() << " of " << output_path << ":" << std::endl;
|
174
172
|
std::cerr << msg << std::endl << std::endl;
|
175
173
|
}
|
176
174
|
|
177
|
-
void warn(
|
175
|
+
void warn(sass::string msg, SourceSpan pstate, Backtrace* bt)
|
178
176
|
{
|
179
177
|
warn(msg, pstate);
|
180
178
|
}
|
181
179
|
|
182
|
-
void deprecated_function(
|
180
|
+
void deprecated_function(sass::string msg, SourceSpan pstate)
|
183
181
|
{
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
182
|
+
sass::string cwd(Sass::File::get_cwd());
|
183
|
+
sass::string abs_path(Sass::File::rel2abs(pstate.getPath(), cwd, cwd));
|
184
|
+
sass::string rel_path(Sass::File::abs2rel(pstate.getPath(), cwd, cwd));
|
185
|
+
sass::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.getPath()));
|
188
186
|
|
189
187
|
std::cerr << "DEPRECATION WARNING: " << msg << std::endl;
|
190
188
|
std::cerr << "will be an error in future versions of Sass." << std::endl;
|
191
|
-
std::cerr << " on line " << pstate.
|
189
|
+
std::cerr << " on line " << pstate.getLine() << " of " << output_path << std::endl;
|
192
190
|
}
|
193
191
|
|
194
|
-
void deprecated(
|
192
|
+
void deprecated(sass::string msg, sass::string msg2, bool with_column, SourceSpan pstate)
|
195
193
|
{
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
194
|
+
sass::string cwd(Sass::File::get_cwd());
|
195
|
+
sass::string abs_path(Sass::File::rel2abs(pstate.getPath(), cwd, cwd));
|
196
|
+
sass::string rel_path(Sass::File::abs2rel(pstate.getPath(), cwd, cwd));
|
197
|
+
sass::string output_path(Sass::File::path_for_console(rel_path, pstate.getPath(), pstate.getPath()));
|
200
198
|
|
201
|
-
std::cerr << "DEPRECATION WARNING on line " << pstate.
|
202
|
-
if (with_column) std::cerr << ", column " << pstate.column + pstate.offset.column + 1;
|
199
|
+
std::cerr << "DEPRECATION WARNING on line " << pstate.getLine();
|
200
|
+
// if (with_column) std::cerr << ", column " << pstate.column + pstate.offset.column + 1;
|
203
201
|
if (output_path.length()) std::cerr << " of " << output_path;
|
204
202
|
std::cerr << ":" << std::endl;
|
205
203
|
std::cerr << msg << std::endl;
|
@@ -207,26 +205,26 @@ namespace Sass {
|
|
207
205
|
std::cerr << std::endl;
|
208
206
|
}
|
209
207
|
|
210
|
-
void deprecated_bind(
|
208
|
+
void deprecated_bind(sass::string msg, SourceSpan pstate)
|
211
209
|
{
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
210
|
+
sass::string cwd(Sass::File::get_cwd());
|
211
|
+
sass::string abs_path(Sass::File::rel2abs(pstate.getPath(), cwd, cwd));
|
212
|
+
sass::string rel_path(Sass::File::abs2rel(pstate.getPath(), cwd, cwd));
|
213
|
+
sass::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.getPath()));
|
216
214
|
|
217
215
|
std::cerr << "WARNING: " << msg << std::endl;
|
218
|
-
std::cerr << " on line " << pstate.
|
216
|
+
std::cerr << " on line " << pstate.getLine() << " of " << output_path << std::endl;
|
219
217
|
std::cerr << "This will be an error in future versions of Sass." << std::endl;
|
220
218
|
}
|
221
219
|
|
222
220
|
// should be replaced with error with backtraces
|
223
|
-
void coreError(
|
221
|
+
void coreError(sass::string msg, SourceSpan pstate)
|
224
222
|
{
|
225
223
|
Backtraces traces;
|
226
224
|
throw Exception::InvalidSyntax(pstate, traces, msg);
|
227
225
|
}
|
228
226
|
|
229
|
-
void error(
|
227
|
+
void error(sass::string msg, SourceSpan pstate, Backtraces& traces)
|
230
228
|
{
|
231
229
|
traces.push_back(Backtrace(pstate));
|
232
230
|
throw Exception::InvalidSyntax(pstate, traces, msg);
|
@@ -1,9 +1,14 @@
|
|
1
1
|
#ifndef SASS_ERROR_HANDLING_H
|
2
2
|
#define SASS_ERROR_HANDLING_H
|
3
3
|
|
4
|
+
// sass.hpp must go before all system headers to get the
|
5
|
+
// __EXTENSIONS__ fix on Solaris.
|
6
|
+
#include "sass.hpp"
|
7
|
+
|
4
8
|
#include <string>
|
5
9
|
#include <sstream>
|
6
10
|
#include <stdexcept>
|
11
|
+
#include "units.hpp"
|
7
12
|
#include "position.hpp"
|
8
13
|
#include "backtrace.hpp"
|
9
14
|
#include "ast_fwd_decl.hpp"
|
@@ -15,20 +20,20 @@ namespace Sass {
|
|
15
20
|
|
16
21
|
namespace Exception {
|
17
22
|
|
18
|
-
const
|
19
|
-
const
|
20
|
-
const
|
21
|
-
const
|
23
|
+
const sass::string def_msg = "Invalid sass detected";
|
24
|
+
const sass::string def_op_msg = "Undefined operation";
|
25
|
+
const sass::string def_op_null_msg = "Invalid null operation";
|
26
|
+
const sass::string def_nesting_limit = "Code too deeply nested";
|
22
27
|
|
23
28
|
class Base : public std::runtime_error {
|
24
29
|
protected:
|
25
|
-
|
26
|
-
|
30
|
+
sass::string msg;
|
31
|
+
sass::string prefix;
|
27
32
|
public:
|
28
|
-
|
33
|
+
SourceSpan pstate;
|
29
34
|
Backtraces traces;
|
30
35
|
public:
|
31
|
-
Base(
|
36
|
+
Base(SourceSpan pstate, sass::string msg, Backtraces traces);
|
32
37
|
virtual const char* errtype() const { return prefix.c_str(); }
|
33
38
|
virtual const char* what() const throw() { return msg.c_str(); }
|
34
39
|
virtual ~Base() throw() {};
|
@@ -36,58 +41,58 @@ namespace Sass {
|
|
36
41
|
|
37
42
|
class InvalidSass : public Base {
|
38
43
|
public:
|
39
|
-
InvalidSass(
|
44
|
+
InvalidSass(SourceSpan pstate, Backtraces traces, sass::string msg);
|
40
45
|
virtual ~InvalidSass() throw() {};
|
41
46
|
};
|
42
47
|
|
43
48
|
class InvalidParent : public Base {
|
44
49
|
protected:
|
45
|
-
|
46
|
-
|
50
|
+
Selector* parent;
|
51
|
+
Selector* selector;
|
47
52
|
public:
|
48
|
-
InvalidParent(
|
53
|
+
InvalidParent(Selector* parent, Backtraces traces, Selector* selector);
|
49
54
|
virtual ~InvalidParent() throw() {};
|
50
55
|
};
|
51
56
|
|
52
57
|
class MissingArgument : public Base {
|
53
58
|
protected:
|
54
|
-
|
55
|
-
|
56
|
-
|
59
|
+
sass::string fn;
|
60
|
+
sass::string arg;
|
61
|
+
sass::string fntype;
|
57
62
|
public:
|
58
|
-
MissingArgument(
|
63
|
+
MissingArgument(SourceSpan pstate, Backtraces traces, sass::string fn, sass::string arg, sass::string fntype);
|
59
64
|
virtual ~MissingArgument() throw() {};
|
60
65
|
};
|
61
66
|
|
62
67
|
class InvalidArgumentType : public Base {
|
63
68
|
protected:
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
const
|
69
|
+
sass::string fn;
|
70
|
+
sass::string arg;
|
71
|
+
sass::string type;
|
72
|
+
const Value* value;
|
68
73
|
public:
|
69
|
-
InvalidArgumentType(
|
74
|
+
InvalidArgumentType(SourceSpan pstate, Backtraces traces, sass::string fn, sass::string arg, sass::string type, const Value* value = 0);
|
70
75
|
virtual ~InvalidArgumentType() throw() {};
|
71
76
|
};
|
72
77
|
|
73
78
|
class InvalidVarKwdType : public Base {
|
74
79
|
protected:
|
75
|
-
|
76
|
-
const
|
80
|
+
sass::string name;
|
81
|
+
const Argument* arg;
|
77
82
|
public:
|
78
|
-
InvalidVarKwdType(
|
83
|
+
InvalidVarKwdType(SourceSpan pstate, Backtraces traces, sass::string name, const Argument* arg = 0);
|
79
84
|
virtual ~InvalidVarKwdType() throw() {};
|
80
85
|
};
|
81
86
|
|
82
87
|
class InvalidSyntax : public Base {
|
83
88
|
public:
|
84
|
-
InvalidSyntax(
|
89
|
+
InvalidSyntax(SourceSpan pstate, Backtraces traces, sass::string msg);
|
85
90
|
virtual ~InvalidSyntax() throw() {};
|
86
91
|
};
|
87
92
|
|
88
93
|
class NestingLimitError : public Base {
|
89
94
|
public:
|
90
|
-
NestingLimitError(
|
95
|
+
NestingLimitError(SourceSpan pstate, Backtraces traces, sass::string msg = def_nesting_limit);
|
91
96
|
virtual ~NestingLimitError() throw() {};
|
92
97
|
};
|
93
98
|
|
@@ -104,9 +109,9 @@ namespace Sass {
|
|
104
109
|
class TypeMismatch : public Base {
|
105
110
|
protected:
|
106
111
|
const Expression& var;
|
107
|
-
const
|
112
|
+
const sass::string type;
|
108
113
|
public:
|
109
|
-
TypeMismatch(Backtraces traces, const Expression& var, const
|
114
|
+
TypeMismatch(Backtraces traces, const Expression& var, const sass::string type);
|
110
115
|
virtual const char* errtype() const { return "Error"; }
|
111
116
|
virtual ~TypeMismatch() throw() {};
|
112
117
|
};
|
@@ -132,10 +137,10 @@ namespace Sass {
|
|
132
137
|
/* common virtual base class (has no pstate or trace) */
|
133
138
|
class OperationError : public std::runtime_error {
|
134
139
|
protected:
|
135
|
-
|
140
|
+
sass::string msg;
|
136
141
|
public:
|
137
|
-
OperationError(
|
138
|
-
: std::runtime_error(msg), msg(msg)
|
142
|
+
OperationError(sass::string msg = def_op_msg)
|
143
|
+
: std::runtime_error(msg.c_str()), msg(msg)
|
139
144
|
{};
|
140
145
|
public:
|
141
146
|
virtual const char* errtype() const { return "Error"; }
|
@@ -165,51 +170,69 @@ namespace Sass {
|
|
165
170
|
|
166
171
|
class UndefinedOperation : public OperationError {
|
167
172
|
protected:
|
168
|
-
|
169
|
-
|
173
|
+
const Expression* lhs;
|
174
|
+
const Expression* rhs;
|
170
175
|
const Sass_OP op;
|
171
176
|
public:
|
172
|
-
UndefinedOperation(
|
177
|
+
UndefinedOperation(const Expression* lhs, const Expression* rhs, enum Sass_OP op);
|
173
178
|
// virtual const char* errtype() const { return "Error"; }
|
174
179
|
virtual ~UndefinedOperation() throw() {};
|
175
180
|
};
|
176
181
|
|
177
182
|
class InvalidNullOperation : public UndefinedOperation {
|
178
183
|
public:
|
179
|
-
InvalidNullOperation(
|
184
|
+
InvalidNullOperation(const Expression* lhs, const Expression* rhs, enum Sass_OP op);
|
180
185
|
virtual ~InvalidNullOperation() throw() {};
|
181
186
|
};
|
182
187
|
|
183
188
|
class AlphaChannelsNotEqual : public OperationError {
|
184
189
|
protected:
|
185
|
-
|
186
|
-
|
190
|
+
const Expression* lhs;
|
191
|
+
const Expression* rhs;
|
187
192
|
const Sass_OP op;
|
188
193
|
public:
|
189
|
-
AlphaChannelsNotEqual(
|
194
|
+
AlphaChannelsNotEqual(const Expression* lhs, const Expression* rhs, enum Sass_OP op);
|
190
195
|
// virtual const char* errtype() const { return "Error"; }
|
191
196
|
virtual ~AlphaChannelsNotEqual() throw() {};
|
192
197
|
};
|
193
198
|
|
194
199
|
class SassValueError : public Base {
|
195
|
-
|
196
|
-
|
197
|
-
|
200
|
+
public:
|
201
|
+
SassValueError(Backtraces traces, SourceSpan pstate, OperationError& err);
|
202
|
+
virtual ~SassValueError() throw() {};
|
203
|
+
};
|
204
|
+
|
205
|
+
class TopLevelParent : public Base {
|
206
|
+
public:
|
207
|
+
TopLevelParent(Backtraces traces, SourceSpan pstate);
|
208
|
+
virtual ~TopLevelParent() throw() {};
|
209
|
+
};
|
210
|
+
|
211
|
+
class UnsatisfiedExtend : public Base {
|
212
|
+
public:
|
213
|
+
UnsatisfiedExtend(Backtraces traces, Extension extension);
|
214
|
+
virtual ~UnsatisfiedExtend() throw() {};
|
215
|
+
};
|
216
|
+
|
217
|
+
class ExtendAcrossMedia : public Base {
|
218
|
+
public:
|
219
|
+
ExtendAcrossMedia(Backtraces traces, Extension extension);
|
220
|
+
virtual ~ExtendAcrossMedia() throw() {};
|
198
221
|
};
|
199
222
|
|
200
223
|
}
|
201
224
|
|
202
|
-
void warn(
|
203
|
-
void warn(
|
204
|
-
void warning(
|
225
|
+
void warn(sass::string msg, SourceSpan pstate);
|
226
|
+
void warn(sass::string msg, SourceSpan pstate, Backtrace* bt);
|
227
|
+
void warning(sass::string msg, SourceSpan pstate);
|
205
228
|
|
206
|
-
void deprecated_function(
|
207
|
-
void deprecated(
|
208
|
-
void deprecated_bind(
|
209
|
-
// void deprecated(
|
229
|
+
void deprecated_function(sass::string msg, SourceSpan pstate);
|
230
|
+
void deprecated(sass::string msg, sass::string msg2, bool with_column, SourceSpan pstate);
|
231
|
+
void deprecated_bind(sass::string msg, SourceSpan pstate);
|
232
|
+
// void deprecated(sass::string msg, SourceSpan pstate, Backtrace* bt);
|
210
233
|
|
211
|
-
void coreError(
|
212
|
-
void error(
|
234
|
+
void coreError(sass::string msg, SourceSpan pstate);
|
235
|
+
void error(sass::string msg, SourceSpan pstate, Backtraces& traces);
|
213
236
|
|
214
237
|
}
|
215
238
|
|