sassc 1.9.0 → 1.10.0
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/README.md +30 -3
- data/ext/libsass/.gitignore +3 -0
- data/ext/libsass/.travis.yml +1 -1
- data/ext/libsass/GNUmakefile.am +7 -7
- data/ext/libsass/Makefile +7 -4
- data/ext/libsass/Makefile.conf +0 -1
- data/ext/libsass/appveyor.yml +6 -2
- data/ext/libsass/docs/api-context.md +4 -4
- data/ext/libsass/docs/api-doc.md +29 -11
- data/ext/libsass/docs/api-importer-example.md +5 -5
- data/ext/libsass/docs/build-on-windows.md +1 -1
- data/ext/libsass/include/sass/base.h +10 -0
- data/ext/libsass/include/sass/version.h +4 -0
- data/ext/libsass/include/sass/version.h.in +4 -0
- data/ext/libsass/include/sass2scss.h +1 -1
- data/ext/libsass/script/ci-build-libsass +15 -3
- data/ext/libsass/src/ast.cpp +161 -6
- data/ext/libsass/src/ast.hpp +71 -44
- data/ext/libsass/src/ast_factory.hpp +1 -1
- data/ext/libsass/src/ast_fwd_decl.hpp +2 -2
- data/ext/libsass/src/constants.cpp +2 -4
- data/ext/libsass/src/constants.hpp +3 -4
- data/ext/libsass/src/context.cpp +16 -17
- data/ext/libsass/src/context.hpp +2 -2
- data/ext/libsass/src/cssize.cpp +19 -8
- data/ext/libsass/src/cssize.hpp +5 -2
- data/ext/libsass/src/debugger.hpp +6 -3
- data/ext/libsass/src/emitter.cpp +1 -1
- data/ext/libsass/src/environment.cpp +1 -1
- data/ext/libsass/src/eval.cpp +42 -14
- data/ext/libsass/src/eval.hpp +1 -1
- data/ext/libsass/src/expand.cpp +24 -8
- data/ext/libsass/src/expand.hpp +2 -1
- data/ext/libsass/src/extend.cpp +55 -15
- data/ext/libsass/src/extend.hpp +5 -1
- data/ext/libsass/src/functions.cpp +10 -5
- data/ext/libsass/src/inspect.cpp +25 -19
- data/ext/libsass/src/inspect.hpp +2 -2
- data/ext/libsass/src/json.cpp +20 -9
- data/ext/libsass/src/json.hpp +5 -5
- data/ext/libsass/src/lexer.cpp +4 -1
- data/ext/libsass/src/lexer.hpp +21 -0
- data/ext/libsass/src/listize.cpp +2 -1
- data/ext/libsass/src/operation.hpp +4 -4
- data/ext/libsass/src/output.cpp +1 -1
- data/ext/libsass/src/output.hpp +1 -1
- data/ext/libsass/src/parser.cpp +189 -90
- data/ext/libsass/src/parser.hpp +42 -2
- data/ext/libsass/src/prelexer.cpp +474 -7
- data/ext/libsass/src/prelexer.hpp +15 -2
- data/ext/libsass/src/remove_placeholders.cpp +5 -5
- data/ext/libsass/src/remove_placeholders.hpp +3 -2
- data/ext/libsass/src/sass.cpp +33 -3
- data/ext/libsass/src/sass2scss.cpp +7 -0
- data/ext/libsass/src/sass_context.cpp +32 -62
- data/ext/libsass/src/sass_functions.cpp +3 -3
- data/ext/libsass/src/sass_values.cpp +5 -5
- data/ext/libsass/src/utf8/unchecked.h +16 -16
- data/ext/libsass/src/util.cpp +51 -30
- data/ext/libsass/src/util.hpp +6 -1
- data/ext/libsass/win/libsass.targets +0 -2
- data/ext/libsass/win/libsass.vcxproj.filters +0 -6
- data/lib/sassc/engine.rb +4 -1
- data/lib/sassc/error.rb +23 -1
- data/lib/sassc/version.rb +1 -1
- data/test/error_test.rb +27 -0
- data/test/native_test.rb +1 -1
- metadata +5 -5
- data/ext/libsass/include/sass/interface.h +0 -105
- data/ext/libsass/src/sass_interface.cpp +0 -215
@@ -1,215 +0,0 @@
|
|
1
|
-
#include "sass.hpp"
|
2
|
-
#include <string>
|
3
|
-
#include <cstdlib>
|
4
|
-
#include <cstring>
|
5
|
-
#include <sstream>
|
6
|
-
#include <iostream>
|
7
|
-
|
8
|
-
#include "util.hpp"
|
9
|
-
#include "context.hpp"
|
10
|
-
#include "inspect.hpp"
|
11
|
-
#include "error_handling.hpp"
|
12
|
-
#include "sass/base.h"
|
13
|
-
#include "sass/interface.h"
|
14
|
-
|
15
|
-
#define LFEED "\n"
|
16
|
-
|
17
|
-
extern "C" {
|
18
|
-
|
19
|
-
sass_context* sass_new_context()
|
20
|
-
{ return (sass_context*) calloc(1, sizeof(sass_context)); }
|
21
|
-
|
22
|
-
void sass_free_context(sass_context* ctx)
|
23
|
-
{
|
24
|
-
if (ctx->output_string) free(ctx->output_string);
|
25
|
-
if (ctx->source_map_string) free(ctx->source_map_string);
|
26
|
-
if (ctx->error_message) free(ctx->error_message);
|
27
|
-
if (ctx->c_functions) free(ctx->c_functions);
|
28
|
-
|
29
|
-
Sass::free_string_array(ctx->included_files);
|
30
|
-
|
31
|
-
free(ctx);
|
32
|
-
}
|
33
|
-
|
34
|
-
sass_file_context* sass_new_file_context()
|
35
|
-
{ return (sass_file_context*) calloc(1, sizeof(sass_file_context)); }
|
36
|
-
|
37
|
-
void sass_free_file_context(sass_file_context* ctx)
|
38
|
-
{
|
39
|
-
if (ctx->output_string) free(ctx->output_string);
|
40
|
-
if (ctx->source_map_string) free(ctx->source_map_string);
|
41
|
-
if (ctx->error_message) free(ctx->error_message);
|
42
|
-
if (ctx->c_functions) free(ctx->c_functions);
|
43
|
-
|
44
|
-
Sass::free_string_array(ctx->included_files);
|
45
|
-
|
46
|
-
free(ctx);
|
47
|
-
}
|
48
|
-
|
49
|
-
sass_folder_context* sass_new_folder_context()
|
50
|
-
{ return (sass_folder_context*) calloc(1, sizeof(sass_folder_context)); }
|
51
|
-
|
52
|
-
void sass_free_folder_context(sass_folder_context* ctx)
|
53
|
-
{
|
54
|
-
Sass::free_string_array(ctx->included_files);
|
55
|
-
free(ctx);
|
56
|
-
}
|
57
|
-
|
58
|
-
int sass_compile(sass_context* c_ctx)
|
59
|
-
{
|
60
|
-
using namespace Sass;
|
61
|
-
try {
|
62
|
-
std::string input_path = safe_str(c_ctx->input_path);
|
63
|
-
int lastindex = static_cast<int>(input_path.find_last_of("."));
|
64
|
-
std::string output_path;
|
65
|
-
if (!c_ctx->output_path) {
|
66
|
-
if (input_path != "") {
|
67
|
-
output_path = (lastindex > -1 ? input_path.substr(0, lastindex) : input_path) + ".css";
|
68
|
-
}
|
69
|
-
}
|
70
|
-
else {
|
71
|
-
output_path = c_ctx->output_path;
|
72
|
-
}
|
73
|
-
struct Sass_Data_Context opt;
|
74
|
-
Data_Context cpp_ctx(opt);
|
75
|
-
if (c_ctx->c_functions) {
|
76
|
-
Sass_Function_List this_func_data = c_ctx->c_functions;
|
77
|
-
while ((this_func_data) && (*this_func_data)) {
|
78
|
-
cpp_ctx.c_functions.push_back(*this_func_data);
|
79
|
-
++this_func_data;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
Block* root = cpp_ctx.parse();
|
83
|
-
c_ctx->output_string = cpp_ctx.render(root);
|
84
|
-
c_ctx->source_map_string = cpp_ctx.render_srcmap();
|
85
|
-
c_ctx->error_message = 0;
|
86
|
-
c_ctx->error_status = 0;
|
87
|
-
|
88
|
-
if (copy_strings(cpp_ctx.get_included_files(true), &c_ctx->included_files, 1) == NULL)
|
89
|
-
throw(std::bad_alloc());
|
90
|
-
}
|
91
|
-
catch (Exception::InvalidSass& e) {
|
92
|
-
std::stringstream msg_stream;
|
93
|
-
msg_stream << e.pstate.path << ":" << e.pstate.line << ": " << e.what() << std::endl;
|
94
|
-
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
95
|
-
c_ctx->error_status = 1;
|
96
|
-
c_ctx->output_string = 0;
|
97
|
-
c_ctx->source_map_string = 0;
|
98
|
-
}
|
99
|
-
catch(std::bad_alloc& ba) {
|
100
|
-
std::stringstream msg_stream;
|
101
|
-
msg_stream << "Unable to allocate memory: " << ba.what() << std::endl;
|
102
|
-
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
103
|
-
c_ctx->error_status = 1;
|
104
|
-
c_ctx->output_string = 0;
|
105
|
-
c_ctx->source_map_string = 0;
|
106
|
-
}
|
107
|
-
catch (std::exception& e) {
|
108
|
-
std::stringstream msg_stream;
|
109
|
-
msg_stream << "Error: " << e.what() << std::endl;
|
110
|
-
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
111
|
-
c_ctx->error_status = 1;
|
112
|
-
c_ctx->output_string = 0;
|
113
|
-
c_ctx->source_map_string = 0;
|
114
|
-
}
|
115
|
-
catch (std::string& e) {
|
116
|
-
std::stringstream msg_stream;
|
117
|
-
msg_stream << "Error: " << e << std::endl;
|
118
|
-
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
119
|
-
c_ctx->error_status = 1;
|
120
|
-
c_ctx->output_string = 0;
|
121
|
-
c_ctx->source_map_string = 0;
|
122
|
-
}
|
123
|
-
catch (...) {
|
124
|
-
// couldn't find the specified file in the include paths; report an error
|
125
|
-
std::stringstream msg_stream;
|
126
|
-
msg_stream << "Unknown error occurred" << std::endl;
|
127
|
-
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
128
|
-
c_ctx->error_status = 1;
|
129
|
-
c_ctx->output_string = 0;
|
130
|
-
c_ctx->source_map_string = 0;
|
131
|
-
}
|
132
|
-
return 0;
|
133
|
-
}
|
134
|
-
|
135
|
-
int sass_compile_file(sass_file_context* c_ctx)
|
136
|
-
{
|
137
|
-
using namespace Sass;
|
138
|
-
try {
|
139
|
-
std::string input_path = safe_str(c_ctx->input_path);
|
140
|
-
int lastindex = static_cast<int>(input_path.find_last_of("."));
|
141
|
-
std::string output_path;
|
142
|
-
if (!c_ctx->output_path) {
|
143
|
-
output_path = (lastindex > -1 ? input_path.substr(0, lastindex) : input_path) + ".css";
|
144
|
-
}
|
145
|
-
else {
|
146
|
-
output_path = c_ctx->output_path;
|
147
|
-
}
|
148
|
-
struct Sass_File_Context opt;
|
149
|
-
File_Context cpp_ctx(opt);
|
150
|
-
if (c_ctx->c_functions) {
|
151
|
-
Sass_Function_List this_func_data = c_ctx->c_functions;
|
152
|
-
while ((this_func_data) && (*this_func_data)) {
|
153
|
-
cpp_ctx.c_functions.push_back(*this_func_data);
|
154
|
-
++this_func_data;
|
155
|
-
}
|
156
|
-
}
|
157
|
-
Block* root = cpp_ctx.parse();
|
158
|
-
c_ctx->output_string = cpp_ctx.render(root);
|
159
|
-
c_ctx->source_map_string = cpp_ctx.render_srcmap();
|
160
|
-
c_ctx->error_message = 0;
|
161
|
-
c_ctx->error_status = 0;
|
162
|
-
|
163
|
-
if (copy_strings(cpp_ctx.get_included_files(false), &c_ctx->included_files) == NULL)
|
164
|
-
throw(std::bad_alloc());
|
165
|
-
}
|
166
|
-
catch (Exception::InvalidSass& e) {
|
167
|
-
std::stringstream msg_stream;
|
168
|
-
msg_stream << e.pstate.path << ":" << e.pstate.line << ": " << e.what() << std::endl;
|
169
|
-
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
170
|
-
c_ctx->error_status = 1;
|
171
|
-
c_ctx->output_string = 0;
|
172
|
-
c_ctx->source_map_string = 0;
|
173
|
-
}
|
174
|
-
catch(std::bad_alloc& ba) {
|
175
|
-
std::stringstream msg_stream;
|
176
|
-
msg_stream << "Unable to allocate memory: " << ba.what() << std::endl;
|
177
|
-
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
178
|
-
c_ctx->error_status = 1;
|
179
|
-
c_ctx->output_string = 0;
|
180
|
-
c_ctx->source_map_string = 0;
|
181
|
-
}
|
182
|
-
catch (std::exception& e) {
|
183
|
-
std::stringstream msg_stream;
|
184
|
-
msg_stream << "Error: " << e.what() << std::endl;
|
185
|
-
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
186
|
-
c_ctx->error_status = 1;
|
187
|
-
c_ctx->output_string = 0;
|
188
|
-
c_ctx->source_map_string = 0;
|
189
|
-
}
|
190
|
-
catch (std::string& e) {
|
191
|
-
std::stringstream msg_stream;
|
192
|
-
msg_stream << "Error: " << e << std::endl;
|
193
|
-
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
194
|
-
c_ctx->error_status = 1;
|
195
|
-
c_ctx->output_string = 0;
|
196
|
-
c_ctx->source_map_string = 0;
|
197
|
-
}
|
198
|
-
catch (...) {
|
199
|
-
// couldn't find the specified file in the include paths; report an error
|
200
|
-
std::stringstream msg_stream;
|
201
|
-
msg_stream << "Unknown error occurred" << std::endl;
|
202
|
-
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
203
|
-
c_ctx->error_status = 1;
|
204
|
-
c_ctx->output_string = 0;
|
205
|
-
c_ctx->source_map_string = 0;
|
206
|
-
}
|
207
|
-
return 0;
|
208
|
-
}
|
209
|
-
|
210
|
-
int sass_compile_folder(sass_folder_context* c_ctx)
|
211
|
-
{
|
212
|
-
return 1;
|
213
|
-
}
|
214
|
-
|
215
|
-
}
|