sassc 1.7.1 → 1.8.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/ext/libsass/.gitignore +10 -6
- data/ext/libsass/.travis.yml +4 -1
- data/ext/libsass/GNUmakefile.am +88 -0
- data/ext/libsass/Makefile +157 -76
- data/ext/libsass/Makefile.conf +47 -0
- data/ext/libsass/Readme.md +13 -14
- data/ext/libsass/appveyor.yml +25 -41
- data/ext/libsass/configure.ac +20 -7
- data/ext/libsass/contrib/plugin.cpp +1 -1
- data/ext/libsass/include/sass.h +15 -0
- data/ext/libsass/{sass.h → include/sass/base.h} +17 -9
- data/ext/libsass/{sass_context.h → include/sass/context.h} +3 -1
- data/ext/libsass/{sass_functions.h → include/sass/functions.h} +4 -4
- data/ext/libsass/{sass_interface.h → include/sass/interface.h} +5 -2
- data/ext/libsass/{sass_values.h → include/sass/values.h} +15 -1
- data/ext/libsass/{sass_version.h → include/sass/version.h} +0 -0
- data/ext/libsass/{sass_version.h.in → include/sass/version.h.in} +0 -0
- data/ext/libsass/{sass2scss.h → include/sass2scss.h} +6 -7
- data/ext/libsass/m4/m4-ax_cxx_compile_stdcxx_11.m4 +167 -0
- data/ext/libsass/script/ci-build-libsass +67 -23
- data/ext/libsass/src/GNUmakefile.am +54 -0
- data/ext/libsass/src/ast.cpp +2029 -0
- data/ext/libsass/{ast.hpp → src/ast.hpp} +832 -660
- data/ext/libsass/src/ast_def_macros.hpp +47 -0
- data/ext/libsass/src/ast_factory.hpp +93 -0
- data/ext/libsass/{ast_fwd_decl.hpp → src/ast_fwd_decl.hpp} +9 -4
- data/ext/libsass/{b64 → src/b64}/cencode.h +1 -1
- data/ext/libsass/{b64 → src/b64}/encode.h +0 -0
- data/ext/libsass/{backtrace.hpp → src/backtrace.hpp} +9 -10
- data/ext/libsass/{base64vlq.cpp → src/base64vlq.cpp} +2 -2
- data/ext/libsass/{base64vlq.hpp → src/base64vlq.hpp} +1 -2
- data/ext/libsass/{bind.cpp → src/bind.cpp} +96 -59
- data/ext/libsass/{bind.hpp → src/bind.hpp} +1 -1
- data/ext/libsass/src/c99func.c +54 -0
- data/ext/libsass/{cencode.c → src/cencode.c} +5 -5
- data/ext/libsass/src/color_maps.cpp +643 -0
- data/ext/libsass/src/color_maps.hpp +333 -0
- data/ext/libsass/{constants.cpp → src/constants.cpp} +10 -1
- data/ext/libsass/{constants.hpp → src/constants.hpp} +7 -0
- data/ext/libsass/{context.cpp → src/context.cpp} +152 -122
- data/ext/libsass/src/context.hpp +150 -0
- data/ext/libsass/{cssize.cpp → src/cssize.cpp} +123 -109
- data/ext/libsass/{cssize.hpp → src/cssize.hpp} +9 -13
- data/ext/libsass/{debug.hpp → src/debug.hpp} +9 -9
- data/ext/libsass/src/debugger.hpp +683 -0
- data/ext/libsass/{emitter.cpp → src/emitter.cpp} +13 -13
- data/ext/libsass/{emitter.hpp → src/emitter.hpp} +10 -11
- data/ext/libsass/src/environment.cpp +184 -0
- data/ext/libsass/src/environment.hpp +92 -0
- data/ext/libsass/src/error_handling.cpp +46 -0
- data/ext/libsass/src/error_handling.hpp +34 -0
- data/ext/libsass/src/eval.cpp +1462 -0
- data/ext/libsass/src/eval.hpp +107 -0
- data/ext/libsass/src/expand.cpp +653 -0
- data/ext/libsass/{expand.hpp → src/expand.hpp} +17 -16
- data/ext/libsass/{extend.cpp → src/extend.cpp} +198 -139
- data/ext/libsass/{extend.hpp → src/extend.hpp} +7 -8
- data/ext/libsass/{file.cpp → src/file.cpp} +103 -57
- data/ext/libsass/{file.hpp → src/file.hpp} +23 -14
- data/ext/libsass/{functions.cpp → src/functions.cpp} +642 -333
- data/ext/libsass/{functions.hpp → src/functions.hpp} +17 -4
- data/ext/libsass/{inspect.cpp → src/inspect.cpp} +147 -260
- data/ext/libsass/{inspect.hpp → src/inspect.hpp} +7 -7
- data/ext/libsass/{json.cpp → src/json.cpp} +33 -43
- data/ext/libsass/{json.hpp → src/json.hpp} +1 -1
- data/ext/libsass/{kwd_arg_macros.hpp → src/kwd_arg_macros.hpp} +0 -0
- data/ext/libsass/{lexer.cpp → src/lexer.cpp} +28 -0
- data/ext/libsass/{lexer.hpp → src/lexer.hpp} +25 -10
- data/ext/libsass/{listize.cpp → src/listize.cpp} +17 -13
- data/ext/libsass/{listize.hpp → src/listize.hpp} +0 -2
- data/ext/libsass/{mapping.hpp → src/mapping.hpp} +0 -0
- data/ext/libsass/src/memory_manager.cpp +76 -0
- data/ext/libsass/src/memory_manager.hpp +48 -0
- data/ext/libsass/{node.cpp → src/node.cpp} +89 -18
- data/ext/libsass/{node.hpp → src/node.hpp} +5 -6
- data/ext/libsass/{operation.hpp → src/operation.hpp} +18 -12
- data/ext/libsass/{output.cpp → src/output.cpp} +47 -55
- data/ext/libsass/{output.hpp → src/output.hpp} +5 -4
- data/ext/libsass/src/parser.cpp +2529 -0
- data/ext/libsass/{parser.hpp → src/parser.hpp} +84 -60
- data/ext/libsass/{paths.hpp → src/paths.hpp} +10 -13
- data/ext/libsass/{plugins.cpp → src/plugins.cpp} +14 -17
- data/ext/libsass/{plugins.hpp → src/plugins.hpp} +10 -11
- data/ext/libsass/{position.cpp → src/position.cpp} +5 -6
- data/ext/libsass/{position.hpp → src/position.hpp} +19 -22
- data/ext/libsass/{prelexer.cpp → src/prelexer.cpp} +401 -53
- data/ext/libsass/{prelexer.hpp → src/prelexer.hpp} +50 -10
- data/ext/libsass/{remove_placeholders.cpp → src/remove_placeholders.cpp} +12 -16
- data/ext/libsass/{remove_placeholders.hpp → src/remove_placeholders.hpp} +1 -7
- data/ext/libsass/{sass.cpp → src/sass.cpp} +3 -5
- data/ext/libsass/{sass2scss.cpp → src/sass2scss.cpp} +51 -46
- data/ext/libsass/{sass_context.cpp → src/sass_context.cpp} +114 -112
- data/ext/libsass/{sass_functions.cpp → src/sass_functions.cpp} +11 -18
- data/ext/libsass/{sass_interface.cpp → src/sass_interface.cpp} +44 -81
- data/ext/libsass/{sass_util.cpp → src/sass_util.cpp} +26 -8
- data/ext/libsass/{sass_util.hpp → src/sass_util.hpp} +14 -18
- data/ext/libsass/{sass_values.cpp → src/sass_values.cpp} +91 -20
- data/ext/libsass/{source_map.cpp → src/source_map.cpp} +13 -13
- data/ext/libsass/{source_map.hpp → src/source_map.hpp} +9 -9
- data/ext/libsass/{subset_map.hpp → src/subset_map.hpp} +29 -31
- data/ext/libsass/{support → src/support}/libsass.pc.in +0 -0
- data/ext/libsass/src/to_c.cpp +73 -0
- data/ext/libsass/src/to_c.hpp +41 -0
- data/ext/libsass/src/to_string.cpp +47 -0
- data/ext/libsass/{to_string.hpp → src/to_string.hpp} +9 -7
- data/ext/libsass/src/to_value.cpp +109 -0
- data/ext/libsass/src/to_value.hpp +50 -0
- data/ext/libsass/{units.cpp → src/units.cpp} +56 -51
- data/ext/libsass/{units.hpp → src/units.hpp} +8 -9
- data/ext/libsass/{utf8.h → src/utf8.h} +0 -0
- data/ext/libsass/{utf8 → src/utf8}/checked.h +0 -0
- data/ext/libsass/{utf8 → src/utf8}/core.h +12 -12
- data/ext/libsass/{utf8 → src/utf8}/unchecked.h +0 -0
- data/ext/libsass/{utf8_string.cpp → src/utf8_string.cpp} +0 -0
- data/ext/libsass/{utf8_string.hpp → src/utf8_string.hpp} +6 -6
- data/ext/libsass/{util.cpp → src/util.cpp} +144 -86
- data/ext/libsass/src/util.hpp +59 -0
- data/ext/libsass/src/values.cpp +137 -0
- data/ext/libsass/src/values.hpp +12 -0
- data/ext/libsass/test/test_node.cpp +33 -33
- data/ext/libsass/test/test_paths.cpp +5 -6
- data/ext/libsass/test/test_selector_difference.cpp +4 -5
- data/ext/libsass/test/test_specificity.cpp +4 -5
- data/ext/libsass/test/test_subset_map.cpp +91 -91
- data/ext/libsass/test/test_superselector.cpp +11 -11
- data/ext/libsass/test/test_unification.cpp +4 -4
- data/ext/libsass/win/libsass.targets +101 -0
- data/ext/libsass/win/libsass.vcxproj +45 -127
- data/ext/libsass/win/libsass.vcxproj.filters +303 -0
- data/lib/sassc/import_handler.rb +1 -1
- data/lib/sassc/native/native_functions_api.rb +3 -3
- data/lib/sassc/version.rb +1 -1
- data/test/custom_importer_test.rb +1 -4
- data/test/functions_test.rb +3 -2
- data/test/native_test.rb +4 -3
- metadata +117 -110
- data/ext/libsass/Makefile.am +0 -146
- data/ext/libsass/ast.cpp +0 -945
- data/ext/libsass/ast_def_macros.hpp +0 -21
- data/ext/libsass/ast_factory.hpp +0 -92
- data/ext/libsass/color_names.hpp +0 -327
- data/ext/libsass/context.hpp +0 -157
- data/ext/libsass/contextualize.cpp +0 -148
- data/ext/libsass/contextualize.hpp +0 -46
- data/ext/libsass/contextualize_eval.cpp +0 -93
- data/ext/libsass/contextualize_eval.hpp +0 -44
- data/ext/libsass/debugger.hpp +0 -558
- data/ext/libsass/environment.hpp +0 -163
- data/ext/libsass/error_handling.cpp +0 -35
- data/ext/libsass/error_handling.hpp +0 -32
- data/ext/libsass/eval.cpp +0 -1392
- data/ext/libsass/eval.hpp +0 -88
- data/ext/libsass/expand.cpp +0 -575
- data/ext/libsass/memory_manager.hpp +0 -57
- data/ext/libsass/parser.cpp +0 -2403
- data/ext/libsass/posix/getopt.c +0 -562
- data/ext/libsass/posix/getopt.h +0 -95
- data/ext/libsass/to_c.cpp +0 -61
- data/ext/libsass/to_c.hpp +0 -44
- data/ext/libsass/to_string.cpp +0 -34
- data/ext/libsass/util.hpp +0 -54
- data/ext/libsass/win/libsass.filters +0 -312
@@ -0,0 +1,333 @@
|
|
1
|
+
#ifndef SASS_COLOR_MAPS_H
|
2
|
+
#define SASS_COLOR_MAPS_H
|
3
|
+
|
4
|
+
#include <map>
|
5
|
+
#include "ast.hpp"
|
6
|
+
|
7
|
+
namespace Sass {
|
8
|
+
|
9
|
+
struct map_cmp_str
|
10
|
+
{
|
11
|
+
bool operator()(char const *a, char const *b) const
|
12
|
+
{
|
13
|
+
return std::strcmp(a, b) < 0;
|
14
|
+
}
|
15
|
+
};
|
16
|
+
|
17
|
+
namespace ColorNames
|
18
|
+
{
|
19
|
+
extern const char aliceblue[];
|
20
|
+
extern const char antiquewhite[];
|
21
|
+
extern const char cyan[];
|
22
|
+
extern const char aqua[];
|
23
|
+
extern const char aquamarine[];
|
24
|
+
extern const char azure[];
|
25
|
+
extern const char beige[];
|
26
|
+
extern const char bisque[];
|
27
|
+
extern const char black[];
|
28
|
+
extern const char blanchedalmond[];
|
29
|
+
extern const char blue[];
|
30
|
+
extern const char blueviolet[];
|
31
|
+
extern const char brown[];
|
32
|
+
extern const char burlywood[];
|
33
|
+
extern const char cadetblue[];
|
34
|
+
extern const char chartreuse[];
|
35
|
+
extern const char chocolate[];
|
36
|
+
extern const char coral[];
|
37
|
+
extern const char cornflowerblue[];
|
38
|
+
extern const char cornsilk[];
|
39
|
+
extern const char crimson[];
|
40
|
+
extern const char darkblue[];
|
41
|
+
extern const char darkcyan[];
|
42
|
+
extern const char darkgoldenrod[];
|
43
|
+
extern const char darkgray[];
|
44
|
+
extern const char darkgrey[];
|
45
|
+
extern const char darkgreen[];
|
46
|
+
extern const char darkkhaki[];
|
47
|
+
extern const char darkmagenta[];
|
48
|
+
extern const char darkolivegreen[];
|
49
|
+
extern const char darkorange[];
|
50
|
+
extern const char darkorchid[];
|
51
|
+
extern const char darkred[];
|
52
|
+
extern const char darksalmon[];
|
53
|
+
extern const char darkseagreen[];
|
54
|
+
extern const char darkslateblue[];
|
55
|
+
extern const char darkslategray[];
|
56
|
+
extern const char darkslategrey[];
|
57
|
+
extern const char darkturquoise[];
|
58
|
+
extern const char darkviolet[];
|
59
|
+
extern const char deeppink[];
|
60
|
+
extern const char deepskyblue[];
|
61
|
+
extern const char dimgray[];
|
62
|
+
extern const char dimgrey[];
|
63
|
+
extern const char dodgerblue[];
|
64
|
+
extern const char firebrick[];
|
65
|
+
extern const char floralwhite[];
|
66
|
+
extern const char forestgreen[];
|
67
|
+
extern const char magenta[];
|
68
|
+
extern const char fuchsia[];
|
69
|
+
extern const char gainsboro[];
|
70
|
+
extern const char ghostwhite[];
|
71
|
+
extern const char gold[];
|
72
|
+
extern const char goldenrod[];
|
73
|
+
extern const char gray[];
|
74
|
+
extern const char grey[];
|
75
|
+
extern const char green[];
|
76
|
+
extern const char greenyellow[];
|
77
|
+
extern const char honeydew[];
|
78
|
+
extern const char hotpink[];
|
79
|
+
extern const char indianred[];
|
80
|
+
extern const char indigo[];
|
81
|
+
extern const char ivory[];
|
82
|
+
extern const char khaki[];
|
83
|
+
extern const char lavender[];
|
84
|
+
extern const char lavenderblush[];
|
85
|
+
extern const char lawngreen[];
|
86
|
+
extern const char lemonchiffon[];
|
87
|
+
extern const char lightblue[];
|
88
|
+
extern const char lightcoral[];
|
89
|
+
extern const char lightcyan[];
|
90
|
+
extern const char lightgoldenrodyellow[];
|
91
|
+
extern const char lightgray[];
|
92
|
+
extern const char lightgrey[];
|
93
|
+
extern const char lightgreen[];
|
94
|
+
extern const char lightpink[];
|
95
|
+
extern const char lightsalmon[];
|
96
|
+
extern const char lightseagreen[];
|
97
|
+
extern const char lightskyblue[];
|
98
|
+
extern const char lightslategray[];
|
99
|
+
extern const char lightslategrey[];
|
100
|
+
extern const char lightsteelblue[];
|
101
|
+
extern const char lightyellow[];
|
102
|
+
extern const char lime[];
|
103
|
+
extern const char limegreen[];
|
104
|
+
extern const char linen[];
|
105
|
+
extern const char maroon[];
|
106
|
+
extern const char mediumaquamarine[];
|
107
|
+
extern const char mediumblue[];
|
108
|
+
extern const char mediumorchid[];
|
109
|
+
extern const char mediumpurple[];
|
110
|
+
extern const char mediumseagreen[];
|
111
|
+
extern const char mediumslateblue[];
|
112
|
+
extern const char mediumspringgreen[];
|
113
|
+
extern const char mediumturquoise[];
|
114
|
+
extern const char mediumvioletred[];
|
115
|
+
extern const char midnightblue[];
|
116
|
+
extern const char mintcream[];
|
117
|
+
extern const char mistyrose[];
|
118
|
+
extern const char moccasin[];
|
119
|
+
extern const char navajowhite[];
|
120
|
+
extern const char navy[];
|
121
|
+
extern const char oldlace[];
|
122
|
+
extern const char olive[];
|
123
|
+
extern const char olivedrab[];
|
124
|
+
extern const char orange[];
|
125
|
+
extern const char orangered[];
|
126
|
+
extern const char orchid[];
|
127
|
+
extern const char palegoldenrod[];
|
128
|
+
extern const char palegreen[];
|
129
|
+
extern const char paleturquoise[];
|
130
|
+
extern const char palevioletred[];
|
131
|
+
extern const char papayawhip[];
|
132
|
+
extern const char peachpuff[];
|
133
|
+
extern const char peru[];
|
134
|
+
extern const char pink[];
|
135
|
+
extern const char plum[];
|
136
|
+
extern const char powderblue[];
|
137
|
+
extern const char purple[];
|
138
|
+
extern const char red[];
|
139
|
+
extern const char rosybrown[];
|
140
|
+
extern const char royalblue[];
|
141
|
+
extern const char saddlebrown[];
|
142
|
+
extern const char salmon[];
|
143
|
+
extern const char sandybrown[];
|
144
|
+
extern const char seagreen[];
|
145
|
+
extern const char seashell[];
|
146
|
+
extern const char sienna[];
|
147
|
+
extern const char silver[];
|
148
|
+
extern const char skyblue[];
|
149
|
+
extern const char slateblue[];
|
150
|
+
extern const char slategray[];
|
151
|
+
extern const char slategrey[];
|
152
|
+
extern const char snow[];
|
153
|
+
extern const char springgreen[];
|
154
|
+
extern const char steelblue[];
|
155
|
+
extern const char tan[];
|
156
|
+
extern const char teal[];
|
157
|
+
extern const char thistle[];
|
158
|
+
extern const char tomato[];
|
159
|
+
extern const char turquoise[];
|
160
|
+
extern const char violet[];
|
161
|
+
extern const char wheat[];
|
162
|
+
extern const char white[];
|
163
|
+
extern const char whitesmoke[];
|
164
|
+
extern const char yellow[];
|
165
|
+
extern const char yellowgreen[];
|
166
|
+
extern const char rebeccapurple[];
|
167
|
+
extern const char transparent[];
|
168
|
+
}
|
169
|
+
|
170
|
+
namespace Colors {
|
171
|
+
extern const Color aliceblue;
|
172
|
+
extern const Color antiquewhite;
|
173
|
+
extern const Color cyan;
|
174
|
+
extern const Color aqua;
|
175
|
+
extern const Color aquamarine;
|
176
|
+
extern const Color azure;
|
177
|
+
extern const Color beige;
|
178
|
+
extern const Color bisque;
|
179
|
+
extern const Color black;
|
180
|
+
extern const Color blanchedalmond;
|
181
|
+
extern const Color blue;
|
182
|
+
extern const Color blueviolet;
|
183
|
+
extern const Color brown;
|
184
|
+
extern const Color burlywood;
|
185
|
+
extern const Color cadetblue;
|
186
|
+
extern const Color chartreuse;
|
187
|
+
extern const Color chocolate;
|
188
|
+
extern const Color coral;
|
189
|
+
extern const Color cornflowerblue;
|
190
|
+
extern const Color cornsilk;
|
191
|
+
extern const Color crimson;
|
192
|
+
extern const Color darkblue;
|
193
|
+
extern const Color darkcyan;
|
194
|
+
extern const Color darkgoldenrod;
|
195
|
+
extern const Color darkgray;
|
196
|
+
extern const Color darkgrey;
|
197
|
+
extern const Color darkgreen;
|
198
|
+
extern const Color darkkhaki;
|
199
|
+
extern const Color darkmagenta;
|
200
|
+
extern const Color darkolivegreen;
|
201
|
+
extern const Color darkorange;
|
202
|
+
extern const Color darkorchid;
|
203
|
+
extern const Color darkred;
|
204
|
+
extern const Color darksalmon;
|
205
|
+
extern const Color darkseagreen;
|
206
|
+
extern const Color darkslateblue;
|
207
|
+
extern const Color darkslategray;
|
208
|
+
extern const Color darkslategrey;
|
209
|
+
extern const Color darkturquoise;
|
210
|
+
extern const Color darkviolet;
|
211
|
+
extern const Color deeppink;
|
212
|
+
extern const Color deepskyblue;
|
213
|
+
extern const Color dimgray;
|
214
|
+
extern const Color dimgrey;
|
215
|
+
extern const Color dodgerblue;
|
216
|
+
extern const Color firebrick;
|
217
|
+
extern const Color floralwhite;
|
218
|
+
extern const Color forestgreen;
|
219
|
+
extern const Color magenta;
|
220
|
+
extern const Color fuchsia;
|
221
|
+
extern const Color gainsboro;
|
222
|
+
extern const Color ghostwhite;
|
223
|
+
extern const Color gold;
|
224
|
+
extern const Color goldenrod;
|
225
|
+
extern const Color gray;
|
226
|
+
extern const Color grey;
|
227
|
+
extern const Color green;
|
228
|
+
extern const Color greenyellow;
|
229
|
+
extern const Color honeydew;
|
230
|
+
extern const Color hotpink;
|
231
|
+
extern const Color indianred;
|
232
|
+
extern const Color indigo;
|
233
|
+
extern const Color ivory;
|
234
|
+
extern const Color khaki;
|
235
|
+
extern const Color lavender;
|
236
|
+
extern const Color lavenderblush;
|
237
|
+
extern const Color lawngreen;
|
238
|
+
extern const Color lemonchiffon;
|
239
|
+
extern const Color lightblue;
|
240
|
+
extern const Color lightcoral;
|
241
|
+
extern const Color lightcyan;
|
242
|
+
extern const Color lightgoldenrodyellow;
|
243
|
+
extern const Color lightgray;
|
244
|
+
extern const Color lightgrey;
|
245
|
+
extern const Color lightgreen;
|
246
|
+
extern const Color lightpink;
|
247
|
+
extern const Color lightsalmon;
|
248
|
+
extern const Color lightseagreen;
|
249
|
+
extern const Color lightskyblue;
|
250
|
+
extern const Color lightslategray;
|
251
|
+
extern const Color lightslategrey;
|
252
|
+
extern const Color lightsteelblue;
|
253
|
+
extern const Color lightyellow;
|
254
|
+
extern const Color lime;
|
255
|
+
extern const Color limegreen;
|
256
|
+
extern const Color linen;
|
257
|
+
extern const Color maroon;
|
258
|
+
extern const Color mediumaquamarine;
|
259
|
+
extern const Color mediumblue;
|
260
|
+
extern const Color mediumorchid;
|
261
|
+
extern const Color mediumpurple;
|
262
|
+
extern const Color mediumseagreen;
|
263
|
+
extern const Color mediumslateblue;
|
264
|
+
extern const Color mediumspringgreen;
|
265
|
+
extern const Color mediumturquoise;
|
266
|
+
extern const Color mediumvioletred;
|
267
|
+
extern const Color midnightblue;
|
268
|
+
extern const Color mintcream;
|
269
|
+
extern const Color mistyrose;
|
270
|
+
extern const Color moccasin;
|
271
|
+
extern const Color navajowhite;
|
272
|
+
extern const Color navy;
|
273
|
+
extern const Color oldlace;
|
274
|
+
extern const Color olive;
|
275
|
+
extern const Color olivedrab;
|
276
|
+
extern const Color orange;
|
277
|
+
extern const Color orangered;
|
278
|
+
extern const Color orchid;
|
279
|
+
extern const Color palegoldenrod;
|
280
|
+
extern const Color palegreen;
|
281
|
+
extern const Color paleturquoise;
|
282
|
+
extern const Color palevioletred;
|
283
|
+
extern const Color papayawhip;
|
284
|
+
extern const Color peachpuff;
|
285
|
+
extern const Color peru;
|
286
|
+
extern const Color pink;
|
287
|
+
extern const Color plum;
|
288
|
+
extern const Color powderblue;
|
289
|
+
extern const Color purple;
|
290
|
+
extern const Color red;
|
291
|
+
extern const Color rosybrown;
|
292
|
+
extern const Color royalblue;
|
293
|
+
extern const Color saddlebrown;
|
294
|
+
extern const Color salmon;
|
295
|
+
extern const Color sandybrown;
|
296
|
+
extern const Color seagreen;
|
297
|
+
extern const Color seashell;
|
298
|
+
extern const Color sienna;
|
299
|
+
extern const Color silver;
|
300
|
+
extern const Color skyblue;
|
301
|
+
extern const Color slateblue;
|
302
|
+
extern const Color slategray;
|
303
|
+
extern const Color slategrey;
|
304
|
+
extern const Color snow;
|
305
|
+
extern const Color springgreen;
|
306
|
+
extern const Color steelblue;
|
307
|
+
extern const Color tan;
|
308
|
+
extern const Color teal;
|
309
|
+
extern const Color thistle;
|
310
|
+
extern const Color tomato;
|
311
|
+
extern const Color turquoise;
|
312
|
+
extern const Color violet;
|
313
|
+
extern const Color wheat;
|
314
|
+
extern const Color white;
|
315
|
+
extern const Color whitesmoke;
|
316
|
+
extern const Color yellow;
|
317
|
+
extern const Color yellowgreen;
|
318
|
+
extern const Color rebeccapurple;
|
319
|
+
extern const Color transparent;
|
320
|
+
}
|
321
|
+
|
322
|
+
extern const std::map<const int, const char*> colors_to_names;
|
323
|
+
extern const std::map<const char*, const Color*, map_cmp_str> names_to_colors;
|
324
|
+
|
325
|
+
extern const Color* name_to_color(const char*);
|
326
|
+
extern const Color* name_to_color(const std::string&);
|
327
|
+
extern const char* color_to_name(const int);
|
328
|
+
extern const char* color_to_name(const Color&);
|
329
|
+
extern const char* color_to_name(const double);
|
330
|
+
|
331
|
+
}
|
332
|
+
|
333
|
+
#endif
|
@@ -79,6 +79,7 @@ namespace Sass {
|
|
79
79
|
extern const char only_kwd[] = "only";
|
80
80
|
extern const char rgb_kwd[] = "rgb(";
|
81
81
|
extern const char url_kwd[] = "url(";
|
82
|
+
// extern const char url_prefix_kwd[] = "url-prefix(";
|
82
83
|
extern const char important_kwd[] = "important";
|
83
84
|
extern const char pseudo_not_kwd[] = ":not(";
|
84
85
|
extern const char even_kwd[] = "even";
|
@@ -140,11 +141,19 @@ namespace Sass {
|
|
140
141
|
extern const char arglist_name[] = "arglist";
|
141
142
|
|
142
143
|
// constants for uri parsing (RFC 3986 Appendix A.)
|
143
|
-
extern const char uri_chars[] = "
|
144
|
+
extern const char uri_chars[] = ":;/?!%&#@|[]{}'`^\"*+-.,_=~";
|
145
|
+
extern const char real_uri_chars[] = "#%&";
|
144
146
|
|
145
147
|
// some specific constant character classes
|
146
148
|
// they must be static to be useable by lexer
|
147
149
|
extern const char static_ops[] = "*/%";
|
150
|
+
// some character classes for the parser
|
151
|
+
extern const char selector_list_delims[] = "){};!";
|
152
|
+
extern const char complex_selector_delims[] = ",){};!";
|
153
|
+
extern const char selector_combinator_ops[] = "+~>";
|
154
|
+
// optional modifiers for alternative compare context
|
155
|
+
extern const char attribute_compare_modifiers[] = "~|^$*";
|
156
|
+
extern const char selector_lookahead_ops[] = "*&%,()[]";
|
148
157
|
|
149
158
|
// byte order marks
|
150
159
|
// (taken from http://en.wikipedia.org/wiki/Byte_order_mark)
|
@@ -80,6 +80,7 @@ namespace Sass {
|
|
80
80
|
extern const char only_kwd[];
|
81
81
|
extern const char rgb_kwd[];
|
82
82
|
extern const char url_kwd[];
|
83
|
+
// extern const char url_prefix_kwd[];
|
83
84
|
extern const char image_url_kwd[];
|
84
85
|
extern const char important_kwd[];
|
85
86
|
extern const char pseudo_not_kwd[];
|
@@ -144,10 +145,16 @@ namespace Sass {
|
|
144
145
|
|
145
146
|
// constants for uri parsing (RFC 3986 Appendix A.)
|
146
147
|
extern const char uri_chars[];
|
148
|
+
extern const char real_uri_chars[];
|
147
149
|
|
148
150
|
// some specific constant character classes
|
149
151
|
// they must be static to be useable by lexer
|
150
152
|
extern const char static_ops[];
|
153
|
+
extern const char selector_list_delims[];
|
154
|
+
extern const char complex_selector_delims[];
|
155
|
+
extern const char selector_combinator_ops[];
|
156
|
+
extern const char attribute_compare_modifiers[];
|
157
|
+
extern const char selector_lookahead_ops[];
|
151
158
|
|
152
159
|
// byte order marks
|
153
160
|
// (taken from http://en.wikipedia.org/wiki/Byte_order_mark)
|
@@ -23,13 +23,10 @@
|
|
23
23
|
#include "output.hpp"
|
24
24
|
#include "expand.hpp"
|
25
25
|
#include "eval.hpp"
|
26
|
-
#include "contextualize.hpp"
|
27
|
-
#include "contextualize_eval.hpp"
|
28
26
|
#include "cssize.hpp"
|
29
27
|
#include "listize.hpp"
|
30
28
|
#include "extend.hpp"
|
31
29
|
#include "remove_placeholders.hpp"
|
32
|
-
#include "color_names.hpp"
|
33
30
|
#include "functions.hpp"
|
34
31
|
#include "backtrace.hpp"
|
35
32
|
#include "sass2scss.h"
|
@@ -40,10 +37,8 @@ namespace Sass {
|
|
40
37
|
using namespace Constants;
|
41
38
|
using namespace File;
|
42
39
|
using namespace Sass;
|
43
|
-
using std::cerr;
|
44
|
-
using std::endl;
|
45
40
|
|
46
|
-
Sass_Queued::Sass_Queued(const string& load_path, const string& abs_path, const char* source)
|
41
|
+
Sass_Queued::Sass_Queued(const std::string& load_path, const std::string& abs_path, const char* source)
|
47
42
|
{
|
48
43
|
this->load_path = load_path;
|
49
44
|
this->abs_path = abs_path;
|
@@ -56,19 +51,20 @@ namespace Sass {
|
|
56
51
|
Context::Context(Context::Data initializers)
|
57
52
|
: // Output(this),
|
58
53
|
head_imports(0),
|
59
|
-
mem(Memory_Manager
|
54
|
+
mem(Memory_Manager()),
|
60
55
|
c_options (initializers.c_options()),
|
61
56
|
c_compiler (initializers.c_compiler()),
|
62
57
|
source_c_str (initializers.source_c_str()),
|
63
|
-
sources (vector<
|
58
|
+
sources (std::vector<char*>()),
|
59
|
+
strings (std::vector<char*>()),
|
64
60
|
plugin_paths (initializers.plugin_paths()),
|
65
61
|
include_paths (initializers.include_paths()),
|
66
|
-
queue (vector<Sass_Queued>()),
|
67
|
-
style_sheets (map<string, Block*>()),
|
62
|
+
queue (std::vector<Sass_Queued>()),
|
63
|
+
style_sheets (std::map<std::string, Block*>()),
|
68
64
|
emitter (this),
|
69
|
-
c_headers (vector<Sass_Importer_Entry>()),
|
70
|
-
c_importers (vector<Sass_Importer_Entry>()),
|
71
|
-
c_functions (vector<Sass_Function_Entry>()),
|
65
|
+
c_headers (std::vector<Sass_Importer_Entry>()),
|
66
|
+
c_importers (std::vector<Sass_Importer_Entry>()),
|
67
|
+
c_functions (std::vector<Sass_Function_Entry>()),
|
72
68
|
indent (initializers.indent()),
|
73
69
|
linefeed (initializers.linefeed()),
|
74
70
|
input_path (make_canonical_path(initializers.input_path())),
|
@@ -81,11 +77,9 @@ namespace Sass {
|
|
81
77
|
source_map_contents (initializers.source_map_contents()),
|
82
78
|
omit_source_map_url (initializers.omit_source_map_url()),
|
83
79
|
is_indented_syntax_src (initializers.is_indented_syntax_src()),
|
84
|
-
names_to_colors (map<string, Color*>()),
|
85
|
-
colors_to_names (map<int, string>()),
|
86
80
|
precision (initializers.precision()),
|
87
81
|
plugins(),
|
88
|
-
subset_map (Subset_Map<string, pair<Complex_Selector*, Compound_Selector*> >())
|
82
|
+
subset_map (Subset_Map<std::string, std::pair<Complex_Selector*, Compound_Selector*> >())
|
89
83
|
{
|
90
84
|
|
91
85
|
cwd = get_cwd();
|
@@ -101,8 +95,6 @@ namespace Sass {
|
|
101
95
|
collect_plugin_paths(initializers.plugin_paths_c_str());
|
102
96
|
// collect_plugin_paths(initializers.plugin_paths_array());
|
103
97
|
|
104
|
-
setup_color_map();
|
105
|
-
|
106
98
|
for (size_t i = 0, S = plugin_paths.size(); i < S; ++i) {
|
107
99
|
plugins.load_plugins(plugin_paths[i]);
|
108
100
|
}
|
@@ -119,9 +111,9 @@ namespace Sass {
|
|
119
111
|
|
120
112
|
sort (c_headers.begin(), c_headers.end(), sort_importers);
|
121
113
|
sort (c_importers.begin(), c_importers.end(), sort_importers);
|
122
|
-
string entry_point = initializers.entry_point();
|
114
|
+
std::string entry_point = initializers.entry_point();
|
123
115
|
if (!entry_point.empty()) {
|
124
|
-
string result(add_file(entry_point));
|
116
|
+
std::string result(add_file(entry_point, true));
|
125
117
|
if (result.empty()) {
|
126
118
|
throw "File to read not found or unreadable: " + entry_point;
|
127
119
|
}
|
@@ -150,34 +142,16 @@ namespace Sass {
|
|
150
142
|
|
151
143
|
Context::~Context()
|
152
144
|
{
|
153
|
-
//
|
154
|
-
|
145
|
+
// make sure we free the source even if not processed!
|
146
|
+
if (sources.size() == 0 && source_c_str) free(source_c_str);
|
155
147
|
// sources are allocated by strdup or malloc (overtaken from C code)
|
156
|
-
for (size_t i = 0; i < sources.size(); ++i) free(
|
157
|
-
//
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
size_t i = 0;
|
164
|
-
while (color_names[i]) {
|
165
|
-
string name(color_names[i]);
|
166
|
-
Color* value = new (mem) Color(ParserState("[COLOR TABLE]"),
|
167
|
-
color_values[i*4],
|
168
|
-
color_values[i*4+1],
|
169
|
-
color_values[i*4+2],
|
170
|
-
color_values[i*4+3]);
|
171
|
-
names_to_colors[name] = value;
|
172
|
-
// only map fully opaque colors
|
173
|
-
if (color_values[i*4+3] >= 1) {
|
174
|
-
int numval = static_cast<int>(color_values[i*4])*0x10000;
|
175
|
-
numval += static_cast<int>(color_values[i*4+1])*0x100;
|
176
|
-
numval += static_cast<int>(color_values[i*4+2]);
|
177
|
-
colors_to_names[numval] = name;
|
178
|
-
}
|
179
|
-
++i;
|
180
|
-
}
|
148
|
+
for (size_t i = 0; i < sources.size(); ++i) free(sources[i]);
|
149
|
+
// free all strings we kept alive during compiler execution
|
150
|
+
for (size_t n = 0; n < strings.size(); ++n) free(strings[n]);
|
151
|
+
// everything that gets put into sources will be freed by us
|
152
|
+
for (size_t m = 0; m < import_stack.size(); ++m) sass_delete_import(import_stack[m]);
|
153
|
+
// clear inner structures (vectors) and input source
|
154
|
+
sources.clear(); import_stack.clear(); source_c_str = 0;
|
181
155
|
}
|
182
156
|
|
183
157
|
void Context::collect_include_paths(const char* paths_str)
|
@@ -188,7 +162,7 @@ namespace Sass {
|
|
188
162
|
const char* end = Prelexer::find_first<PATH_SEP>(beg);
|
189
163
|
|
190
164
|
while (end) {
|
191
|
-
string path(beg, end - beg);
|
165
|
+
std::string path(beg, end - beg);
|
192
166
|
if (!path.empty()) {
|
193
167
|
if (*path.rbegin() != '/') path += '/';
|
194
168
|
include_paths.push_back(path);
|
@@ -197,7 +171,7 @@ namespace Sass {
|
|
197
171
|
end = Prelexer::find_first<PATH_SEP>(beg);
|
198
172
|
}
|
199
173
|
|
200
|
-
string path(beg);
|
174
|
+
std::string path(beg);
|
201
175
|
if (!path.empty()) {
|
202
176
|
if (*path.rbegin() != '/') path += '/';
|
203
177
|
include_paths.push_back(path);
|
@@ -222,7 +196,7 @@ namespace Sass {
|
|
222
196
|
const char* end = Prelexer::find_first<PATH_SEP>(beg);
|
223
197
|
|
224
198
|
while (end) {
|
225
|
-
string path(beg, end - beg);
|
199
|
+
std::string path(beg, end - beg);
|
226
200
|
if (!path.empty()) {
|
227
201
|
if (*path.rbegin() != '/') path += '/';
|
228
202
|
plugin_paths.push_back(path);
|
@@ -231,7 +205,7 @@ namespace Sass {
|
|
231
205
|
end = Prelexer::find_first<PATH_SEP>(beg);
|
232
206
|
}
|
233
207
|
|
234
|
-
string path(beg);
|
208
|
+
std::string path(beg);
|
235
209
|
if (!path.empty()) {
|
236
210
|
if (*path.rbegin() != '/') path += '/';
|
237
211
|
plugin_paths.push_back(path);
|
@@ -247,7 +221,7 @@ namespace Sass {
|
|
247
221
|
}
|
248
222
|
}
|
249
223
|
}
|
250
|
-
void Context::add_source(string load_path, string abs_path,
|
224
|
+
void Context::add_source(std::string load_path, std::string abs_path, char* contents)
|
251
225
|
{
|
252
226
|
sources.push_back(contents);
|
253
227
|
included_files.push_back(abs_path);
|
@@ -257,33 +231,51 @@ namespace Sass {
|
|
257
231
|
}
|
258
232
|
|
259
233
|
// Add a new import file to the context
|
260
|
-
string Context::add_file(const string& file)
|
234
|
+
std::string Context::add_file(const std::string& file, bool delay)
|
261
235
|
{
|
262
236
|
using namespace File;
|
263
|
-
string path(make_canonical_path(file));
|
264
|
-
string resolved(find_file(path, include_paths));
|
237
|
+
std::string path(make_canonical_path(file));
|
238
|
+
std::string resolved(find_file(path, include_paths));
|
265
239
|
if (resolved == "") return resolved;
|
266
240
|
if (char* contents = read_file(resolved)) {
|
267
241
|
add_source(path, resolved, contents);
|
268
242
|
style_sheets[path] = 0;
|
243
|
+
if (delay == false) {
|
244
|
+
size_t i = queue.size() - 1;
|
245
|
+
process_queue_entry(queue[i], i);
|
246
|
+
}
|
269
247
|
return path;
|
270
248
|
}
|
271
|
-
return string("");
|
249
|
+
return std::string("");
|
272
250
|
}
|
273
251
|
|
274
252
|
// Add a new import file to the context
|
275
253
|
// This has some previous directory context
|
276
|
-
string Context::add_file(const string& base, const string& file)
|
254
|
+
std::string Context::add_file(const std::string& base, const std::string& file, ParserState pstate)
|
277
255
|
{
|
278
256
|
using namespace File;
|
279
|
-
string path(make_canonical_path(file));
|
280
|
-
string base_file(join_paths(base, path));
|
281
|
-
string resolved(resolve_file(base_file));
|
257
|
+
std::string path(make_canonical_path(file));
|
258
|
+
std::string base_file(join_paths(base, path));
|
282
259
|
if (style_sheets.count(base_file)) return base_file;
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
260
|
+
std::vector<Sass_Queued> resolved(resolve_file(base, path));
|
261
|
+
if (resolved.size() > 1) {
|
262
|
+
std::stringstream msg_stream;
|
263
|
+
msg_stream << "It's not clear which file to import for ";
|
264
|
+
msg_stream << "'@import \"" << file << "\"'." << "\n";
|
265
|
+
msg_stream << "Candidates:" << "\n";
|
266
|
+
for (size_t i = 0, L = resolved.size(); i < L; ++i)
|
267
|
+
{ msg_stream << " " << resolved[i].load_path << "\n"; }
|
268
|
+
msg_stream << "Please delete or rename all but one of these files." << "\n";
|
269
|
+
error(msg_stream.str(), pstate);
|
270
|
+
}
|
271
|
+
if (resolved.size()) {
|
272
|
+
if (char* contents = read_file(resolved[0].abs_path)) {
|
273
|
+
add_source(base_file, resolved[0].abs_path, contents);
|
274
|
+
style_sheets[base_file] = 0;
|
275
|
+
size_t i = queue.size() - 1;
|
276
|
+
process_queue_entry(queue[i], i);
|
277
|
+
return base_file;
|
278
|
+
}
|
287
279
|
}
|
288
280
|
// now go the regular code path
|
289
281
|
return add_file(path);
|
@@ -291,7 +283,7 @@ namespace Sass {
|
|
291
283
|
|
292
284
|
void register_function(Context&, Signature sig, Native_Function f, Env* env);
|
293
285
|
void register_function(Context&, Signature sig, Native_Function f, size_t arity, Env* env);
|
294
|
-
void register_overload_stub(Context&, string name, Env* env);
|
286
|
+
void register_overload_stub(Context&, std::string name, Env* env);
|
295
287
|
void register_built_in_functions(Context&, Env* env);
|
296
288
|
void register_c_functions(Context&, Env* env, Sass_Function_List);
|
297
289
|
void register_c_function(Context&, Env* env, Sass_Function_Entry);
|
@@ -302,55 +294,80 @@ namespace Sass {
|
|
302
294
|
root->perform(&emitter);
|
303
295
|
emitter.finalize();
|
304
296
|
OutputBuffer emitted = emitter.get_buffer();
|
305
|
-
string output = emitted.buffer;
|
306
|
-
if (
|
307
|
-
|
297
|
+
std::string output = emitted.buffer;
|
298
|
+
if (!omit_source_map_url) {
|
299
|
+
if (source_map_embed) {
|
300
|
+
output += linefeed + format_embedded_source_map();
|
301
|
+
}
|
302
|
+
else if (source_map_file != "") {
|
303
|
+
output += linefeed + format_source_mapping_url(source_map_file);
|
304
|
+
}
|
308
305
|
}
|
309
306
|
return sass_strdup(output.c_str());
|
310
307
|
}
|
311
308
|
|
309
|
+
void Context::process_queue_entry(Sass_Queued& entry, size_t i)
|
310
|
+
{
|
311
|
+
if (style_sheets[queue[i].load_path]) return;
|
312
|
+
Sass_Import_Entry import = sass_make_import(
|
313
|
+
queue[i].load_path.c_str(),
|
314
|
+
queue[i].abs_path.c_str(),
|
315
|
+
0, 0
|
316
|
+
);
|
317
|
+
import_stack.push_back(import);
|
318
|
+
// keep a copy of the path around (for parser states)
|
319
|
+
strings.push_back(sass_strdup(queue[i].abs_path.c_str()));
|
320
|
+
ParserState pstate(strings.back(), queue[i].source, i);
|
321
|
+
Parser p(Parser::from_c_str(queue[i].source, *this, pstate));
|
322
|
+
Block* ast = p.parse();
|
323
|
+
sass_delete_import(import_stack.back());
|
324
|
+
import_stack.pop_back();
|
325
|
+
// ToDo: we store by load_path, which can lead
|
326
|
+
// to duplicates if importer reports the same path
|
327
|
+
// Maybe we should add an error for duplicates!?
|
328
|
+
style_sheets[queue[i].load_path] = ast;
|
329
|
+
}
|
330
|
+
|
312
331
|
Block* Context::parse_file()
|
313
332
|
{
|
314
333
|
Block* root = 0;
|
315
334
|
for (size_t i = 0; i < queue.size(); ++i) {
|
316
|
-
|
317
|
-
|
318
|
-
queue[i].abs_path.c_str(),
|
319
|
-
0, 0
|
320
|
-
);
|
321
|
-
import_stack.push_back(import);
|
322
|
-
Parser p(Parser::from_c_str(queue[i].source, *this, ParserState(queue[i].abs_path, queue[i].source, i)));
|
323
|
-
Block* ast = p.parse();
|
324
|
-
sass_delete_import(import_stack.back());
|
325
|
-
import_stack.pop_back();
|
326
|
-
if (i == 0) root = ast;
|
327
|
-
style_sheets[queue[i].load_path] = ast;
|
335
|
+
process_queue_entry(queue[i], i);
|
336
|
+
if (i == 0) root = style_sheets[queue[i].load_path];
|
328
337
|
}
|
329
338
|
if (root == 0) return 0;
|
330
|
-
|
339
|
+
|
340
|
+
Env global; // create root environment
|
341
|
+
// register built-in functions on env
|
342
|
+
register_built_in_functions(*this, &global);
|
343
|
+
// register custom functions (defined via C-API)
|
344
|
+
for (size_t i = 0, S = c_functions.size(); i < S; ++i)
|
345
|
+
{ register_c_function(*this, &global, c_functions[i]); }
|
346
|
+
// create initial backtrace entry
|
331
347
|
Backtrace backtrace(0, ParserState("", 0), "");
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
Contextualize contextualize(*this, &tge, &backtrace);
|
337
|
-
Listize listize(*this);
|
338
|
-
Eval eval(*this, &contextualize, &listize, &tge, &backtrace);
|
339
|
-
Contextualize_Eval contextualize_eval(*this, &eval, &tge, &backtrace);
|
340
|
-
Expand expand(*this, &eval, &contextualize_eval, &tge, &backtrace);
|
341
|
-
Cssize cssize(*this, &tge, &backtrace);
|
348
|
+
// create crtp visitor objects
|
349
|
+
Expand expand(*this, &global, &backtrace);
|
350
|
+
Cssize cssize(*this, &backtrace);
|
351
|
+
// expand and eval the tree
|
342
352
|
root = root->perform(&expand)->block();
|
353
|
+
// merge and bubble certain rules
|
343
354
|
root = root->perform(&cssize)->block();
|
355
|
+
// should we extend something?
|
344
356
|
if (!subset_map.empty()) {
|
357
|
+
// create crtp visitor object
|
345
358
|
Extend extend(*this, subset_map);
|
359
|
+
// extend tree nodes
|
346
360
|
root->perform(&extend);
|
347
361
|
}
|
348
362
|
|
363
|
+
// clean up by removing empty placeholders
|
364
|
+
// ToDo: maybe we can do this somewhere else?
|
349
365
|
Remove_Placeholders remove_placeholders(*this);
|
350
366
|
root->perform(&remove_placeholders);
|
351
|
-
|
367
|
+
// return processed tree
|
352
368
|
return root;
|
353
369
|
}
|
370
|
+
// EO parse_file
|
354
371
|
|
355
372
|
Block* Context::parse_string()
|
356
373
|
{
|
@@ -359,10 +376,12 @@ namespace Sass {
|
|
359
376
|
if(is_indented_syntax_src) {
|
360
377
|
char * contents = sass2scss(source_c_str, SASS2SCSS_PRETTIFY_1 | SASS2SCSS_KEEP_COMMENT);
|
361
378
|
add_source(input_path, input_path, contents);
|
362
|
-
|
379
|
+
free(source_c_str);
|
363
380
|
return parse_file();
|
364
381
|
}
|
365
382
|
add_source(input_path, input_path, source_c_str);
|
383
|
+
size_t idx = queue.size() - 1;
|
384
|
+
process_queue_entry(queue[idx], idx);
|
366
385
|
return parse_file();
|
367
386
|
}
|
368
387
|
|
@@ -378,18 +397,21 @@ namespace Sass {
|
|
378
397
|
return compile_block(parse_string());
|
379
398
|
}
|
380
399
|
|
381
|
-
string Context::
|
400
|
+
std::string Context::format_embedded_source_map()
|
382
401
|
{
|
383
|
-
string
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
402
|
+
std::string map = emitter.generate_source_map(*this);
|
403
|
+
std::istringstream is( map );
|
404
|
+
std::ostringstream buffer;
|
405
|
+
base64::encoder E;
|
406
|
+
E.encode(is, buffer);
|
407
|
+
std::string url = "data:application/json;base64," + buffer.str();
|
408
|
+
url.erase(url.size() - 1);
|
409
|
+
return "/*# sourceMappingURL=" + url + " */";
|
410
|
+
}
|
411
|
+
|
412
|
+
std::string Context::format_source_mapping_url(const std::string& file)
|
413
|
+
{
|
414
|
+
std::string url = resolve_relative_path(file, output_path, cwd);
|
393
415
|
return "/*# sourceMappingURL=" + url + " */";
|
394
416
|
}
|
395
417
|
|
@@ -397,25 +419,27 @@ namespace Sass {
|
|
397
419
|
{
|
398
420
|
if (source_map_file == "") return 0;
|
399
421
|
char* result = 0;
|
400
|
-
string map = emitter.generate_source_map(*this);
|
422
|
+
std::string map = emitter.generate_source_map(*this);
|
401
423
|
result = sass_strdup(map.c_str());
|
402
424
|
return result;
|
403
425
|
}
|
404
426
|
|
405
427
|
|
406
|
-
|
428
|
+
// for data context we want to start after "stdin"
|
429
|
+
// we probably always want to skip the header includes?
|
430
|
+
std::vector<std::string> Context::get_included_files(bool skip, size_t headers)
|
407
431
|
{
|
408
|
-
vector
|
432
|
+
// create a copy of the vector for manupulations
|
433
|
+
std::vector<std::string> includes = included_files;
|
409
434
|
if (includes.size() == 0) return includes;
|
410
|
-
|
411
|
-
includes.erase( includes.begin(), includes.begin() +
|
435
|
+
if (skip) { includes.erase( includes.begin(), includes.begin() + 1 + headers); }
|
436
|
+
else { includes.erase( includes.begin() + 1, includes.begin() + 1 + headers); }
|
412
437
|
includes.erase( std::unique( includes.begin(), includes.end() ), includes.end() );
|
413
|
-
|
414
|
-
// includes.erase( std::remove( includes.begin(), includes.end(), "stdin" ), includes.end() );
|
438
|
+
std::sort( includes.begin() + (skip ? 0 : 1), includes.end() );
|
415
439
|
return includes;
|
416
440
|
}
|
417
441
|
|
418
|
-
string Context::get_cwd()
|
442
|
+
std::string Context::get_cwd()
|
419
443
|
{
|
420
444
|
return Sass::File::get_cwd();
|
421
445
|
}
|
@@ -430,21 +454,21 @@ namespace Sass {
|
|
430
454
|
void register_function(Context& ctx, Signature sig, Native_Function f, size_t arity, Env* env)
|
431
455
|
{
|
432
456
|
Definition* def = make_native_function(sig, f, ctx);
|
433
|
-
stringstream ss;
|
457
|
+
std::stringstream ss;
|
434
458
|
ss << def->name() << "[f]" << arity;
|
435
459
|
def->environment(env);
|
436
460
|
(*env)[ss.str()] = def;
|
437
461
|
}
|
438
462
|
|
439
|
-
void register_overload_stub(Context& ctx, string name, Env* env)
|
463
|
+
void register_overload_stub(Context& ctx, std::string name, Env* env)
|
440
464
|
{
|
441
|
-
Definition* stub =
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
465
|
+
Definition* stub = SASS_MEMORY_NEW(ctx.mem, Definition,
|
466
|
+
ParserState("[built-in function]"),
|
467
|
+
0,
|
468
|
+
name,
|
469
|
+
0,
|
470
|
+
0,
|
471
|
+
true);
|
448
472
|
(*env)[name + "[f]"] = stub;
|
449
473
|
}
|
450
474
|
|
@@ -540,7 +564,14 @@ namespace Sass {
|
|
540
564
|
register_function(ctx, inspect_sig, inspect, env);
|
541
565
|
register_function(ctx, unique_id_sig, unique_id, env);
|
542
566
|
// Selector functions
|
567
|
+
register_function(ctx, selector_nest_sig, selector_nest, env);
|
568
|
+
register_function(ctx, selector_append_sig, selector_append, env);
|
569
|
+
register_function(ctx, selector_extend_sig, selector_extend, env);
|
570
|
+
register_function(ctx, selector_replace_sig, selector_replace, env);
|
571
|
+
register_function(ctx, selector_unify_sig, selector_unify, env);
|
543
572
|
register_function(ctx, is_superselector_sig, is_superselector, env);
|
573
|
+
register_function(ctx, simple_selectors_sig, simple_selectors, env);
|
574
|
+
register_function(ctx, selector_parse_sig, selector_parse, env);
|
544
575
|
}
|
545
576
|
|
546
577
|
void register_c_functions(Context& ctx, Env* env, Sass_Function_List descrs)
|
@@ -557,5 +588,4 @@ namespace Sass {
|
|
557
588
|
(*env)[def->name() + "[f]"] = def;
|
558
589
|
}
|
559
590
|
|
560
|
-
|
561
591
|
}
|