sassc 0.0.9 → 0.0.10
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/Rakefile +1 -1
- data/ext/libsass/.gitignore +13 -6
- data/ext/libsass/Makefile +42 -26
- data/ext/libsass/Makefile.am +43 -30
- data/ext/libsass/Readme.md +4 -2
- data/ext/libsass/appveyor.yml +10 -14
- data/ext/libsass/ast.cpp +54 -44
- data/ext/libsass/ast.hpp +404 -236
- data/ext/libsass/ast_def_macros.hpp +5 -0
- data/ext/libsass/ast_factory.hpp +6 -3
- data/ext/libsass/ast_fwd_decl.hpp +12 -0
- data/ext/libsass/b64/encode.h +2 -2
- data/ext/libsass/backtrace.hpp +13 -17
- data/ext/libsass/base64vlq.hpp +4 -1
- data/ext/libsass/bind.cpp +12 -15
- data/ext/libsass/bind.hpp +6 -6
- data/ext/libsass/color_names.hpp +4 -1
- data/ext/libsass/configure.ac +7 -21
- data/ext/libsass/constants.cpp +6 -4
- data/ext/libsass/constants.hpp +10 -4
- data/ext/libsass/context.cpp +89 -58
- data/ext/libsass/context.hpp +28 -35
- data/ext/libsass/contextualize.cpp +20 -10
- data/ext/libsass/contextualize.hpp +8 -23
- data/ext/libsass/contrib/libsass.spec +66 -0
- data/ext/libsass/cssize.cpp +547 -0
- data/ext/libsass/cssize.hpp +82 -0
- data/ext/libsass/debug.hpp +3 -3
- data/ext/libsass/debugger.hpp +358 -0
- data/ext/libsass/emitter.cpp +255 -0
- data/ext/libsass/emitter.hpp +83 -0
- data/ext/libsass/environment.hpp +7 -3
- data/ext/libsass/error_handling.cpp +11 -14
- data/ext/libsass/error_handling.hpp +9 -7
- data/ext/libsass/eval.cpp +253 -161
- data/ext/libsass/eval.hpp +13 -13
- data/ext/libsass/expand.cpp +135 -64
- data/ext/libsass/expand.hpp +11 -13
- data/ext/libsass/extend.cpp +66 -20
- data/ext/libsass/extend.hpp +6 -11
- data/ext/libsass/file.cpp +31 -26
- data/ext/libsass/file.hpp +6 -1
- data/ext/libsass/functions.cpp +270 -287
- data/ext/libsass/functions.hpp +8 -11
- data/ext/libsass/inspect.cpp +385 -255
- data/ext/libsass/inspect.hpp +15 -26
- data/ext/libsass/kwd_arg_macros.hpp +5 -0
- data/ext/libsass/mapping.hpp +4 -3
- data/ext/libsass/memory_manager.hpp +5 -2
- data/ext/libsass/node.cpp +50 -50
- data/ext/libsass/node.hpp +26 -27
- data/ext/libsass/operation.hpp +15 -4
- data/ext/libsass/output.cpp +401 -0
- data/ext/libsass/output.hpp +56 -0
- data/ext/libsass/parser.cpp +573 -399
- data/ext/libsass/parser.hpp +122 -88
- data/ext/libsass/paths.hpp +7 -2
- data/ext/libsass/plugins.cpp +155 -0
- data/ext/libsass/plugins.hpp +56 -0
- data/ext/libsass/position.cpp +128 -0
- data/ext/libsass/position.hpp +108 -11
- data/ext/libsass/prelexer.cpp +184 -110
- data/ext/libsass/prelexer.hpp +131 -24
- data/ext/libsass/remove_placeholders.cpp +1 -1
- data/ext/libsass/remove_placeholders.hpp +6 -6
- data/ext/libsass/sass.cpp +3 -3
- data/ext/libsass/sass.h +12 -4
- data/ext/libsass/sass2scss.cpp +3 -2
- data/ext/libsass/sass2scss.h +5 -0
- data/ext/libsass/sass_context.cpp +136 -37
- data/ext/libsass/sass_context.h +19 -10
- data/ext/libsass/sass_functions.cpp +29 -2
- data/ext/libsass/sass_functions.h +8 -2
- data/ext/libsass/sass_interface.cpp +32 -23
- data/ext/libsass/sass_interface.h +9 -4
- data/ext/libsass/sass_util.cpp +19 -23
- data/ext/libsass/sass_util.hpp +28 -27
- data/ext/libsass/sass_values.cpp +6 -4
- data/ext/libsass/sass_values.h +3 -3
- data/ext/libsass/script/ci-build-libsass +13 -1
- data/ext/libsass/script/ci-report-coverage +2 -1
- data/ext/libsass/source_map.cpp +79 -28
- data/ext/libsass/source_map.hpp +35 -16
- data/ext/libsass/subset_map.hpp +6 -4
- data/ext/libsass/to_c.hpp +4 -4
- data/ext/libsass/to_string.cpp +13 -8
- data/ext/libsass/to_string.hpp +6 -4
- data/ext/libsass/units.cpp +2 -1
- data/ext/libsass/units.hpp +6 -1
- data/ext/libsass/utf8_string.cpp +0 -5
- data/ext/libsass/utf8_string.hpp +3 -2
- data/ext/libsass/util.cpp +461 -49
- data/ext/libsass/util.hpp +34 -13
- data/ext/libsass/version.sh +10 -0
- data/ext/libsass/win/libsass.filters +20 -11
- data/ext/libsass/win/libsass.vcxproj +11 -8
- data/lib/sassc/importer.rb +1 -8
- data/lib/sassc/native.rb +7 -0
- data/lib/sassc/native/native_context_api.rb +5 -5
- data/lib/sassc/version.rb +1 -1
- data/test/native_test.rb +1 -1
- metadata +14 -10
- data/ext/libsass/copy_c_str.cpp +0 -13
- data/ext/libsass/copy_c_str.hpp +0 -5
- data/ext/libsass/output_compressed.cpp +0 -401
- data/ext/libsass/output_compressed.hpp +0 -95
- data/ext/libsass/output_nested.cpp +0 -364
- data/ext/libsass/output_nested.hpp +0 -108
- data/ext/libsass/test-driver +0 -127
- data/ext/libsass/token.hpp +0 -32
data/ext/libsass/context.cpp
CHANGED
|
@@ -4,40 +4,40 @@
|
|
|
4
4
|
#define PATH_SEP ':'
|
|
5
5
|
#endif
|
|
6
6
|
|
|
7
|
-
#ifndef SASS_AST
|
|
8
7
|
#include "ast.hpp"
|
|
9
|
-
#
|
|
10
|
-
|
|
8
|
+
#include "util.hpp"
|
|
9
|
+
#include "sass.h"
|
|
11
10
|
#include "context.hpp"
|
|
11
|
+
#include "plugins.hpp"
|
|
12
12
|
#include "constants.hpp"
|
|
13
13
|
#include "parser.hpp"
|
|
14
14
|
#include "file.hpp"
|
|
15
15
|
#include "inspect.hpp"
|
|
16
|
-
#include "
|
|
17
|
-
#include "output_compressed.hpp"
|
|
16
|
+
#include "output.hpp"
|
|
18
17
|
#include "expand.hpp"
|
|
19
18
|
#include "eval.hpp"
|
|
20
19
|
#include "contextualize.hpp"
|
|
20
|
+
#include "cssize.hpp"
|
|
21
21
|
#include "extend.hpp"
|
|
22
22
|
#include "remove_placeholders.hpp"
|
|
23
|
-
#include "copy_c_str.hpp"
|
|
24
23
|
#include "color_names.hpp"
|
|
25
24
|
#include "functions.hpp"
|
|
26
25
|
#include "backtrace.hpp"
|
|
27
26
|
#include "sass2scss.h"
|
|
28
|
-
|
|
29
|
-
#ifndef SASS_PRELEXER
|
|
30
27
|
#include "prelexer.hpp"
|
|
31
|
-
#
|
|
28
|
+
#include "emitter.hpp"
|
|
32
29
|
|
|
33
|
-
#include <
|
|
34
|
-
#include <
|
|
30
|
+
#include <string>
|
|
31
|
+
#include <cstdlib>
|
|
35
32
|
#include <cstring>
|
|
33
|
+
#include <iomanip>
|
|
36
34
|
#include <sstream>
|
|
35
|
+
#include <iostream>
|
|
37
36
|
|
|
38
37
|
namespace Sass {
|
|
39
38
|
using namespace Constants;
|
|
40
39
|
using namespace File;
|
|
40
|
+
using namespace Sass;
|
|
41
41
|
using std::cerr;
|
|
42
42
|
using std::endl;
|
|
43
43
|
|
|
@@ -50,20 +50,24 @@ namespace Sass {
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
Context::Context(Context::Data initializers)
|
|
53
|
-
:
|
|
53
|
+
: // Output(this),
|
|
54
|
+
mem(Memory_Manager<AST_Node>()),
|
|
54
55
|
source_c_str (initializers.source_c_str()),
|
|
55
56
|
sources (vector<const char*>()),
|
|
57
|
+
plugin_paths (initializers.plugin_paths()),
|
|
56
58
|
include_paths (initializers.include_paths()),
|
|
57
59
|
queue (vector<Sass_Queued>()),
|
|
58
60
|
style_sheets (map<string, Block*>()),
|
|
59
|
-
|
|
61
|
+
emitter (this),
|
|
60
62
|
c_functions (vector<Sass_C_Function_Callback>()),
|
|
61
|
-
|
|
63
|
+
indent (initializers.indent()),
|
|
64
|
+
linefeed (initializers.linefeed()),
|
|
62
65
|
input_path (make_canonical_path(initializers.input_path())),
|
|
63
66
|
output_path (make_canonical_path(initializers.output_path())),
|
|
64
67
|
source_comments (initializers.source_comments()),
|
|
65
68
|
output_style (initializers.output_style()),
|
|
66
69
|
source_map_file (make_canonical_path(initializers.source_map_file())),
|
|
70
|
+
source_map_root (initializers.source_map_root()), // pass-through
|
|
67
71
|
source_map_embed (initializers.source_map_embed()),
|
|
68
72
|
source_map_contents (initializers.source_map_contents()),
|
|
69
73
|
omit_source_map_url (initializers.omit_source_map_url()),
|
|
@@ -72,9 +76,10 @@ namespace Sass {
|
|
|
72
76
|
names_to_colors (map<string, Color*>()),
|
|
73
77
|
colors_to_names (map<int, string>()),
|
|
74
78
|
precision (initializers.precision()),
|
|
75
|
-
|
|
79
|
+
plugins(),
|
|
76
80
|
subset_map (Subset_Map<string, pair<Complex_Selector*, Compound_Selector*> >())
|
|
77
81
|
{
|
|
82
|
+
|
|
78
83
|
cwd = get_cwd();
|
|
79
84
|
|
|
80
85
|
// enforce some safe defaults
|
|
@@ -85,9 +90,19 @@ namespace Sass {
|
|
|
85
90
|
include_paths.push_back(cwd);
|
|
86
91
|
collect_include_paths(initializers.include_paths_c_str());
|
|
87
92
|
collect_include_paths(initializers.include_paths_array());
|
|
93
|
+
collect_plugin_paths(initializers.plugin_paths_c_str());
|
|
94
|
+
collect_plugin_paths(initializers.plugin_paths_array());
|
|
88
95
|
|
|
89
96
|
setup_color_map();
|
|
90
97
|
|
|
98
|
+
for (size_t i = 0, S = plugin_paths.size(); i < S; ++i) {
|
|
99
|
+
plugins.load_plugins(plugin_paths[i]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
for(auto fn : plugins.get_functions()) {
|
|
103
|
+
c_functions.push_back(fn);
|
|
104
|
+
}
|
|
105
|
+
|
|
91
106
|
string entry_point = initializers.entry_point();
|
|
92
107
|
if (!entry_point.empty()) {
|
|
93
108
|
string result(add_file(entry_point));
|
|
@@ -95,6 +110,9 @@ namespace Sass {
|
|
|
95
110
|
throw "File to read not found or unreadable: " + entry_point;
|
|
96
111
|
}
|
|
97
112
|
}
|
|
113
|
+
|
|
114
|
+
emitter.set_filename(output_path);
|
|
115
|
+
|
|
98
116
|
}
|
|
99
117
|
|
|
100
118
|
Context::~Context()
|
|
@@ -110,7 +128,7 @@ namespace Sass {
|
|
|
110
128
|
size_t i = 0;
|
|
111
129
|
while (color_names[i]) {
|
|
112
130
|
string name(color_names[i]);
|
|
113
|
-
Color* value = new (mem) Color("[COLOR TABLE]"
|
|
131
|
+
Color* value = new (mem) Color(ParserState("[COLOR TABLE]"),
|
|
114
132
|
color_values[i*4],
|
|
115
133
|
color_values[i*4+1],
|
|
116
134
|
color_values[i*4+2],
|
|
@@ -118,9 +136,9 @@ namespace Sass {
|
|
|
118
136
|
names_to_colors[name] = value;
|
|
119
137
|
// only map fully opaque colors
|
|
120
138
|
if (color_values[i*4+3] >= 1) {
|
|
121
|
-
int numval = color_values[i*4]*0x10000;
|
|
122
|
-
numval += color_values[i*4+1]*0x100;
|
|
123
|
-
numval += color_values[i*4+2];
|
|
139
|
+
int numval = static_cast<int>(color_values[i*4])*0x10000;
|
|
140
|
+
numval += static_cast<int>(color_values[i*4+1])*0x100;
|
|
141
|
+
numval += static_cast<int>(color_values[i*4+2]);
|
|
124
142
|
colors_to_names[numval] = name;
|
|
125
143
|
}
|
|
126
144
|
++i;
|
|
@@ -154,7 +172,6 @@ namespace Sass {
|
|
|
154
172
|
|
|
155
173
|
void Context::collect_include_paths(const char** paths_array)
|
|
156
174
|
{
|
|
157
|
-
if (*include_paths.back().rbegin() != '/') include_paths.back() += '/';
|
|
158
175
|
if (paths_array) {
|
|
159
176
|
for (size_t i = 0; paths_array[i]; i++) {
|
|
160
177
|
collect_include_paths(paths_array[i]);
|
|
@@ -162,12 +179,45 @@ namespace Sass {
|
|
|
162
179
|
}
|
|
163
180
|
}
|
|
164
181
|
|
|
182
|
+
void Context::collect_plugin_paths(const char* paths_str)
|
|
183
|
+
{
|
|
184
|
+
|
|
185
|
+
if (paths_str) {
|
|
186
|
+
const char* beg = paths_str;
|
|
187
|
+
const char* end = Prelexer::find_first<PATH_SEP>(beg);
|
|
188
|
+
|
|
189
|
+
while (end) {
|
|
190
|
+
string path(beg, end - beg);
|
|
191
|
+
if (!path.empty()) {
|
|
192
|
+
if (*path.rbegin() != '/') path += '/';
|
|
193
|
+
plugin_paths.push_back(path);
|
|
194
|
+
}
|
|
195
|
+
beg = end + 1;
|
|
196
|
+
end = Prelexer::find_first<PATH_SEP>(beg);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
string path(beg);
|
|
200
|
+
if (!path.empty()) {
|
|
201
|
+
if (*path.rbegin() != '/') path += '/';
|
|
202
|
+
plugin_paths.push_back(path);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
void Context::collect_plugin_paths(const char** paths_array)
|
|
208
|
+
{
|
|
209
|
+
if (paths_array) {
|
|
210
|
+
for (size_t i = 0; paths_array[i]; i++) {
|
|
211
|
+
collect_plugin_paths(paths_array[i]);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
165
215
|
void Context::add_source(string load_path, string abs_path, const char* contents)
|
|
166
216
|
{
|
|
167
217
|
sources.push_back(contents);
|
|
168
218
|
included_files.push_back(abs_path);
|
|
169
219
|
queue.push_back(Sass_Queued(load_path, abs_path, contents));
|
|
170
|
-
|
|
220
|
+
emitter.add_source_index(sources.size() - 1);
|
|
171
221
|
include_links.push_back(resolve_relative_path(abs_path, source_map_file, cwd));
|
|
172
222
|
}
|
|
173
223
|
|
|
@@ -226,31 +276,15 @@ namespace Sass {
|
|
|
226
276
|
|
|
227
277
|
char* Context::compile_block(Block* root)
|
|
228
278
|
{
|
|
229
|
-
char* result = 0;
|
|
230
279
|
if (!root) return 0;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
output += format_source_mapping_url(source_map_file);
|
|
238
|
-
}
|
|
239
|
-
result = copy_c_str(output.c_str());
|
|
240
|
-
} break;
|
|
241
|
-
|
|
242
|
-
default: {
|
|
243
|
-
Output_Nested output_nested(source_comments, this);
|
|
244
|
-
root->perform(&output_nested);
|
|
245
|
-
string output = output_nested.get_buffer();
|
|
246
|
-
if (source_map_file != "" && !omit_source_map_url) {
|
|
247
|
-
output += "\n" + format_source_mapping_url(source_map_file);
|
|
248
|
-
}
|
|
249
|
-
result = copy_c_str(output.c_str());
|
|
250
|
-
|
|
251
|
-
} break;
|
|
280
|
+
root->perform(&emitter);
|
|
281
|
+
emitter.finalize();
|
|
282
|
+
OutputBuffer emitted = emitter.get_buffer();
|
|
283
|
+
string output = emitted.buffer;
|
|
284
|
+
if (source_map_file != "" && !omit_source_map_url) {
|
|
285
|
+
output += linefeed + format_source_mapping_url(source_map_file);
|
|
252
286
|
}
|
|
253
|
-
return
|
|
287
|
+
return sass_strdup(output.c_str());
|
|
254
288
|
}
|
|
255
289
|
|
|
256
290
|
Block* Context::parse_file()
|
|
@@ -263,7 +297,7 @@ namespace Sass {
|
|
|
263
297
|
0, 0
|
|
264
298
|
);
|
|
265
299
|
import_stack.push_back(import);
|
|
266
|
-
Parser p(Parser::from_c_str(queue[i].source, *this, queue[i].abs_path,
|
|
300
|
+
Parser p(Parser::from_c_str(queue[i].source, *this, ParserState(queue[i].abs_path, i)));
|
|
267
301
|
Block* ast = p.parse();
|
|
268
302
|
sass_delete_import(import_stack.back());
|
|
269
303
|
import_stack.pop_back();
|
|
@@ -272,7 +306,7 @@ namespace Sass {
|
|
|
272
306
|
}
|
|
273
307
|
if (root == 0) return 0;
|
|
274
308
|
Env tge;
|
|
275
|
-
Backtrace backtrace(0, "",
|
|
309
|
+
Backtrace backtrace(0, ParserState("", 0), "");
|
|
276
310
|
register_built_in_functions(*this, &tge);
|
|
277
311
|
for (size_t i = 0, S = c_functions.size(); i < S; ++i) {
|
|
278
312
|
register_c_function(*this, &tge, c_functions[i]);
|
|
@@ -280,10 +314,9 @@ namespace Sass {
|
|
|
280
314
|
Eval eval(*this, &tge, &backtrace);
|
|
281
315
|
Contextualize contextualize(*this, &eval, &tge, &backtrace);
|
|
282
316
|
Expand expand(*this, &eval, &contextualize, &tge, &backtrace);
|
|
283
|
-
|
|
284
|
-
// Output_Nested output_nested(*this);
|
|
285
|
-
|
|
317
|
+
Cssize cssize(*this, &tge, &backtrace);
|
|
286
318
|
root = root->perform(&expand)->block();
|
|
319
|
+
root = root->perform(&cssize)->block();
|
|
287
320
|
if (!subset_map.empty()) {
|
|
288
321
|
Extend extend(*this, subset_map);
|
|
289
322
|
root->perform(&extend);
|
|
@@ -300,11 +333,12 @@ namespace Sass {
|
|
|
300
333
|
if (!source_c_str) return 0;
|
|
301
334
|
queue.clear();
|
|
302
335
|
if(is_indented_syntax_src) {
|
|
303
|
-
char * contents = sass2scss(source_c_str, SASS2SCSS_PRETTIFY_1);
|
|
336
|
+
char * contents = sass2scss(source_c_str, SASS2SCSS_PRETTIFY_1 | SASS2SCSS_KEEP_COMMENT);
|
|
304
337
|
add_source(input_path, input_path, contents);
|
|
338
|
+
delete [] source_c_str;
|
|
305
339
|
return parse_file();
|
|
306
340
|
}
|
|
307
|
-
add_source(input_path, input_path,
|
|
341
|
+
add_source(input_path, input_path, source_c_str);
|
|
308
342
|
return parse_file();
|
|
309
343
|
}
|
|
310
344
|
|
|
@@ -324,7 +358,7 @@ namespace Sass {
|
|
|
324
358
|
{
|
|
325
359
|
string url = resolve_relative_path(file, output_path, cwd);
|
|
326
360
|
if (source_map_embed) {
|
|
327
|
-
string map =
|
|
361
|
+
string map = emitter.generate_source_map(*this);
|
|
328
362
|
istringstream is( map );
|
|
329
363
|
ostringstream buffer;
|
|
330
364
|
base64::encoder E;
|
|
@@ -339,8 +373,8 @@ namespace Sass {
|
|
|
339
373
|
{
|
|
340
374
|
if (source_map_file == "") return 0;
|
|
341
375
|
char* result = 0;
|
|
342
|
-
string map =
|
|
343
|
-
result =
|
|
376
|
+
string map = emitter.generate_source_map(*this);
|
|
377
|
+
result = sass_strdup(map.c_str());
|
|
344
378
|
return result;
|
|
345
379
|
}
|
|
346
380
|
|
|
@@ -378,8 +412,7 @@ namespace Sass {
|
|
|
378
412
|
|
|
379
413
|
void register_overload_stub(Context& ctx, string name, Env* env)
|
|
380
414
|
{
|
|
381
|
-
Definition* stub = new (ctx.mem) Definition("[built-in function]",
|
|
382
|
-
Position(),
|
|
415
|
+
Definition* stub = new (ctx.mem) Definition(ParserState("[built-in function]"),
|
|
383
416
|
0,
|
|
384
417
|
name,
|
|
385
418
|
0,
|
|
@@ -477,8 +510,6 @@ namespace Sass {
|
|
|
477
510
|
// Boolean Functions
|
|
478
511
|
register_function(ctx, not_sig, sass_not, env);
|
|
479
512
|
register_function(ctx, if_sig, sass_if, env);
|
|
480
|
-
// Path Functions
|
|
481
|
-
register_function(ctx, image_url_sig, image_url, env);
|
|
482
513
|
// Misc Functions
|
|
483
514
|
register_function(ctx, inspect_sig, inspect, env);
|
|
484
515
|
register_function(ctx, unique_id_sig, unique_id, env);
|
data/ext/libsass/context.hpp
CHANGED
|
@@ -1,47 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
#ifndef SASS_CONTEXT_H
|
|
2
|
+
#define SASS_CONTEXT_H
|
|
2
3
|
|
|
3
4
|
#include <string>
|
|
4
5
|
#include <vector>
|
|
5
6
|
#include <map>
|
|
6
|
-
#include "kwd_arg_macros.hpp"
|
|
7
7
|
|
|
8
|
-
#
|
|
9
|
-
#include "
|
|
10
|
-
#endif
|
|
8
|
+
#define BUFFERSIZE 255
|
|
9
|
+
#include "b64/encode.h"
|
|
11
10
|
|
|
12
|
-
#
|
|
11
|
+
#include "ast_fwd_decl.hpp"
|
|
12
|
+
#include "kwd_arg_macros.hpp"
|
|
13
|
+
#include "memory_manager.hpp"
|
|
13
14
|
#include "environment.hpp"
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
#ifndef SASS_SOURCE_MAP
|
|
17
15
|
#include "source_map.hpp"
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
#ifndef SASS_SUBSET_MAP
|
|
21
16
|
#include "subset_map.hpp"
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
#define BUFFERSIZE 255
|
|
25
|
-
#include "b64/encode.h"
|
|
26
|
-
|
|
17
|
+
#include "output.hpp"
|
|
18
|
+
#include "plugins.hpp"
|
|
27
19
|
#include "sass_functions.h"
|
|
28
20
|
|
|
29
21
|
struct Sass_C_Function_Descriptor;
|
|
30
22
|
|
|
31
23
|
namespace Sass {
|
|
32
24
|
using namespace std;
|
|
33
|
-
class AST_Node;
|
|
34
|
-
class Block;
|
|
35
|
-
class Expression;
|
|
36
|
-
class Color;
|
|
37
|
-
struct Backtrace;
|
|
38
|
-
// typedef const char* Signature;
|
|
39
|
-
// struct Context;
|
|
40
|
-
// typedef Environment<AST_Node*> Env;
|
|
41
|
-
// typedef Expression* (*Native_Function)(Env&, Context&, Signature, string, size_t);
|
|
42
|
-
|
|
43
|
-
enum Output_Style { NESTED, EXPANDED, COMPACT, COMPRESSED, FORMATTED };
|
|
44
|
-
|
|
45
25
|
struct Sass_Queued {
|
|
46
26
|
string abs_path;
|
|
47
27
|
string load_path;
|
|
@@ -50,7 +30,8 @@ namespace Sass {
|
|
|
50
30
|
Sass_Queued(const string& load_path, const string& abs_path, const char* source);
|
|
51
31
|
};
|
|
52
32
|
|
|
53
|
-
|
|
33
|
+
class Context {
|
|
34
|
+
public:
|
|
54
35
|
Memory_Manager<AST_Node> mem;
|
|
55
36
|
|
|
56
37
|
const char* source_c_str;
|
|
@@ -64,18 +45,22 @@ namespace Sass {
|
|
|
64
45
|
vector<string> include_links;
|
|
65
46
|
// vectors above have same size
|
|
66
47
|
|
|
48
|
+
vector<string> plugin_paths; // relative paths to load plugins
|
|
67
49
|
vector<string> include_paths; // lookup paths for includes
|
|
68
50
|
vector<Sass_Queued> queue; // queue of files to be parsed
|
|
69
51
|
map<string, Block*> style_sheets; // map of paths to ASTs
|
|
70
|
-
SourceMap source_map;
|
|
52
|
+
// SourceMap source_map;
|
|
53
|
+
Output emitter;
|
|
71
54
|
vector<Sass_C_Function_Callback> c_functions;
|
|
72
55
|
|
|
73
|
-
string
|
|
56
|
+
string indent; // String to be used for indentation
|
|
57
|
+
string linefeed; // String to be used for line feeds
|
|
74
58
|
string input_path; // for relative paths in src-map
|
|
75
59
|
string output_path; // for relative paths to the output
|
|
76
60
|
bool source_comments; // for inline debug comments in css output
|
|
77
61
|
Output_Style output_style; // output style for the generated css code
|
|
78
62
|
string source_map_file; // path to source map file (enables feature)
|
|
63
|
+
string source_map_root; // path for sourceRoot property (pass-through)
|
|
79
64
|
bool source_map_embed; // embed in sourceMappingUrl (as data-url)
|
|
80
65
|
bool source_map_contents; // insert included contents into source map
|
|
81
66
|
bool omit_source_map_url; // disable source map comment in css output
|
|
@@ -89,24 +74,27 @@ namespace Sass {
|
|
|
89
74
|
map<int, string> colors_to_names;
|
|
90
75
|
|
|
91
76
|
size_t precision; // precision for outputting fractional numbers
|
|
92
|
-
bool _skip_source_map_update; // status flag to skip source map updates
|
|
93
77
|
|
|
94
78
|
KWD_ARG_SET(Data) {
|
|
95
79
|
KWD_ARG(Data, const char*, source_c_str);
|
|
96
80
|
KWD_ARG(Data, string, entry_point);
|
|
97
81
|
KWD_ARG(Data, string, input_path);
|
|
98
82
|
KWD_ARG(Data, string, output_path);
|
|
99
|
-
KWD_ARG(Data, string,
|
|
83
|
+
KWD_ARG(Data, string, indent);
|
|
84
|
+
KWD_ARG(Data, string, linefeed);
|
|
100
85
|
KWD_ARG(Data, const char*, include_paths_c_str);
|
|
86
|
+
KWD_ARG(Data, const char*, plugin_paths_c_str);
|
|
101
87
|
KWD_ARG(Data, const char**, include_paths_array);
|
|
88
|
+
KWD_ARG(Data, const char**, plugin_paths_array);
|
|
102
89
|
KWD_ARG(Data, vector<string>, include_paths);
|
|
90
|
+
KWD_ARG(Data, vector<string>, plugin_paths);
|
|
103
91
|
KWD_ARG(Data, bool, source_comments);
|
|
104
92
|
KWD_ARG(Data, Output_Style, output_style);
|
|
105
93
|
KWD_ARG(Data, string, source_map_file);
|
|
94
|
+
KWD_ARG(Data, string, source_map_root);
|
|
106
95
|
KWD_ARG(Data, bool, omit_source_map_url);
|
|
107
96
|
KWD_ARG(Data, bool, is_indented_syntax_src);
|
|
108
97
|
KWD_ARG(Data, size_t, precision);
|
|
109
|
-
KWD_ARG(Data, bool, _skip_source_map_update);
|
|
110
98
|
KWD_ARG(Data, bool, source_map_embed);
|
|
111
99
|
KWD_ARG(Data, bool, source_map_contents);
|
|
112
100
|
KWD_ARG(Data, Sass_C_Import_Callback, importer);
|
|
@@ -132,11 +120,14 @@ namespace Sass {
|
|
|
132
120
|
vector<string> get_included_files(size_t skip = 0);
|
|
133
121
|
|
|
134
122
|
private:
|
|
123
|
+
void collect_plugin_paths(const char* paths_str);
|
|
124
|
+
void collect_plugin_paths(const char** paths_array);
|
|
135
125
|
void collect_include_paths(const char* paths_str);
|
|
136
126
|
void collect_include_paths(const char** paths_array);
|
|
137
127
|
string format_source_mapping_url(const string& file);
|
|
138
128
|
|
|
139
129
|
string cwd;
|
|
130
|
+
Plugins plugins;
|
|
140
131
|
|
|
141
132
|
// void register_built_in_functions(Env* env);
|
|
142
133
|
// void register_function(Signature sig, Native_Function f, Env* env);
|
|
@@ -148,3 +139,5 @@ namespace Sass {
|
|
|
148
139
|
};
|
|
149
140
|
|
|
150
141
|
}
|
|
142
|
+
|
|
143
|
+
#endif
|