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
@@ -1,9 +1,8 @@
|
|
1
1
|
#ifndef SASS_PARSER_H
|
2
2
|
#define SASS_PARSER_H
|
3
3
|
|
4
|
-
#include <
|
4
|
+
#include <string>
|
5
5
|
#include <vector>
|
6
|
-
#include <iostream>
|
7
6
|
|
8
7
|
#include "ast.hpp"
|
9
8
|
#include "position.hpp"
|
@@ -11,30 +10,28 @@
|
|
11
10
|
#include "position.hpp"
|
12
11
|
#include "prelexer.hpp"
|
13
12
|
|
14
|
-
struct
|
13
|
+
struct Lookahead {
|
15
14
|
const char* found;
|
15
|
+
const char* error;
|
16
|
+
const char* position;
|
17
|
+
bool parsable;
|
16
18
|
bool has_interpolants;
|
17
19
|
};
|
18
20
|
|
19
21
|
namespace Sass {
|
20
|
-
using std::string;
|
21
|
-
using std::vector;
|
22
|
-
using std::map;
|
23
|
-
using namespace Prelexer;
|
24
22
|
|
25
23
|
class Parser : public ParserState {
|
26
24
|
private:
|
27
|
-
void add_single_file (Import* imp, string import_path);
|
28
|
-
void import_single_file (Import* imp, string import_path);
|
25
|
+
void add_single_file (Import* imp, std::string import_path);
|
26
|
+
void import_single_file (Import* imp, std::string import_path);
|
29
27
|
public:
|
30
|
-
class AST_Node;
|
31
28
|
|
32
29
|
enum Syntactic_Context { nothing, mixin_def, function_def };
|
33
|
-
bool do_import(const string& import_path, Import* imp, vector<Sass_Importer_Entry> importers, bool only_one = true);
|
30
|
+
bool do_import(const std::string& import_path, Import* imp, std::vector<Sass_Importer_Entry> importers, bool only_one = true);
|
34
31
|
|
35
32
|
Context& ctx;
|
36
|
-
vector<Block*> block_stack;
|
37
|
-
vector<Syntactic_Context> stack;
|
33
|
+
std::vector<Block*> block_stack;
|
34
|
+
std::vector<Syntactic_Context> stack;
|
38
35
|
Media_Block* last_media_block;
|
39
36
|
const char* source;
|
40
37
|
const char* position;
|
@@ -53,7 +50,7 @@ namespace Sass {
|
|
53
50
|
source(0), position(0), end(0), before_token(pstate), after_token(pstate), pstate(pstate), indentation(0)
|
54
51
|
{ in_at_root = false; stack.push_back(nothing); }
|
55
52
|
|
56
|
-
// static Parser from_string(const string& src, Context& ctx, ParserState pstate = ParserState("[STRING]"));
|
53
|
+
// static Parser from_string(const std::string& src, Context& ctx, ParserState pstate = ParserState("[STRING]"));
|
57
54
|
static Parser from_c_str(const char* src, Context& ctx, ParserState pstate = ParserState("[CSTRING]"));
|
58
55
|
static Parser from_c_str(const char* beg, const char* end, Context& ctx, ParserState pstate = ParserState("[CSTRING]"));
|
59
56
|
static Parser from_token(Token t, Context& ctx, ParserState pstate = ParserState("[TOKEN]"));
|
@@ -76,9 +73,10 @@ namespace Sass {
|
|
76
73
|
bool peek_newline(const char* start = 0);
|
77
74
|
|
78
75
|
// skip over spaces, tabs and line comments
|
79
|
-
template <prelexer mx>
|
76
|
+
template <Prelexer::prelexer mx>
|
80
77
|
const char* sneak(const char* start = 0)
|
81
78
|
{
|
79
|
+
using namespace Prelexer;
|
82
80
|
|
83
81
|
// maybe use optional start position from arguments?
|
84
82
|
const char* it_position = start ? start : position;
|
@@ -104,7 +102,7 @@ namespace Sass {
|
|
104
102
|
|
105
103
|
// peek will only skip over space, tabs and line comment
|
106
104
|
// return the position where the lexer match will occur
|
107
|
-
template <prelexer mx>
|
105
|
+
template <Prelexer::prelexer mx>
|
108
106
|
const char* peek(const char* start = 0)
|
109
107
|
{
|
110
108
|
|
@@ -123,8 +121,8 @@ namespace Sass {
|
|
123
121
|
// we do not support start arg, since we manipulate
|
124
122
|
// sourcemap offset and we modify the position pointer!
|
125
123
|
// lex will only skip over space, tabs and line comment
|
126
|
-
template <prelexer mx>
|
127
|
-
const char* lex(bool lazy = true)
|
124
|
+
template <Prelexer::prelexer mx>
|
125
|
+
const char* lex(bool lazy = true, bool force = false)
|
128
126
|
{
|
129
127
|
|
130
128
|
// position considered before lexed token
|
@@ -139,12 +137,15 @@ namespace Sass {
|
|
139
137
|
// now call matcher to get position after token
|
140
138
|
const char* it_after_token = mx(it_before_token);
|
141
139
|
|
142
|
-
//
|
143
|
-
if (
|
144
|
-
|
145
|
-
|
140
|
+
// maybe we want to update the parser state anyway?
|
141
|
+
if (force == false) {
|
142
|
+
// assertion that we got a valid match
|
143
|
+
if (it_after_token == 0) return 0;
|
144
|
+
// assertion that we actually lexed something
|
145
|
+
if (it_after_token == it_before_token) return 0;
|
146
|
+
}
|
146
147
|
|
147
|
-
// create new lexed token object (holds
|
148
|
+
// create new lexed token object (holds the parse results)
|
148
149
|
lexed = Token(position, it_before_token, it_after_token);
|
149
150
|
|
150
151
|
// advance position (add whitespace before current token)
|
@@ -164,28 +165,39 @@ namespace Sass {
|
|
164
165
|
// lex_css skips over space, tabs, line and block comment
|
165
166
|
// all block comments will be consumed and thrown away
|
166
167
|
// source-map position will point to token after the comment
|
167
|
-
template <prelexer mx>
|
168
|
+
template <Prelexer::prelexer mx>
|
168
169
|
const char* lex_css()
|
169
170
|
{
|
170
171
|
// copy old token
|
171
172
|
Token prev = lexed;
|
173
|
+
// store previous pointer
|
174
|
+
const char* oldpos = position;
|
175
|
+
Position bt = before_token;
|
176
|
+
Position at = after_token;
|
177
|
+
ParserState op = pstate;
|
172
178
|
// throw away comments
|
173
179
|
// update srcmap position
|
174
|
-
lex < css_comments >();
|
180
|
+
lex < Prelexer::css_comments >();
|
175
181
|
// now lex a new token
|
176
182
|
const char* pos = lex< mx >();
|
177
|
-
// maybe restore prev
|
178
|
-
if (pos == 0)
|
183
|
+
// maybe restore prev state
|
184
|
+
if (pos == 0) {
|
185
|
+
pstate = op;
|
186
|
+
lexed = prev;
|
187
|
+
position = oldpos;
|
188
|
+
after_token = at;
|
189
|
+
before_token = bt;
|
190
|
+
}
|
179
191
|
// return match
|
180
192
|
return pos;
|
181
193
|
}
|
182
194
|
|
183
195
|
// all block comments will be skipped and thrown away
|
184
|
-
template <prelexer mx>
|
196
|
+
template <Prelexer::prelexer mx>
|
185
197
|
const char* peek_css(const char* start = 0)
|
186
198
|
{
|
187
199
|
// now peek a token (skip comments first)
|
188
|
-
return peek< mx >(peek < css_comments >(start));
|
200
|
+
return peek< mx >(peek < Prelexer::css_comments >(start));
|
189
201
|
}
|
190
202
|
|
191
203
|
#ifdef __clang__
|
@@ -194,34 +206,38 @@ namespace Sass {
|
|
194
206
|
|
195
207
|
#endif
|
196
208
|
|
197
|
-
void error(string msg, Position pos);
|
209
|
+
void error(std::string msg, Position pos);
|
198
210
|
// generate message with given and expected sample
|
199
211
|
// text before and in the middle are configurable
|
200
|
-
void css_error(const string& msg,
|
201
|
-
const string& prefix = " after ",
|
202
|
-
const string& middle = ", was: ");
|
212
|
+
void css_error(const std::string& msg,
|
213
|
+
const std::string& prefix = " after ",
|
214
|
+
const std::string& middle = ", was: ");
|
203
215
|
void read_bom();
|
204
216
|
|
205
217
|
Block* parse();
|
206
218
|
Import* parse_import();
|
207
|
-
Definition* parse_definition();
|
219
|
+
Definition* parse_definition(Definition::Type which_type);
|
208
220
|
Parameters* parse_parameters();
|
209
221
|
Parameter* parse_parameter();
|
210
|
-
Mixin_Call*
|
211
|
-
Arguments* parse_arguments(
|
212
|
-
Argument* parse_argument(
|
222
|
+
Mixin_Call* parse_include_directive();
|
223
|
+
Arguments* parse_arguments();
|
224
|
+
Argument* parse_argument();
|
213
225
|
Assignment* parse_assignment();
|
214
226
|
// Propset* parse_propset();
|
215
|
-
Ruleset* parse_ruleset(
|
227
|
+
Ruleset* parse_ruleset(Lookahead lookahead, bool is_root = false);
|
216
228
|
Selector_Schema* parse_selector_schema(const char* end_of_selector);
|
217
|
-
Selector_List*
|
218
|
-
Complex_Selector*
|
219
|
-
Compound_Selector*
|
229
|
+
Selector_List* parse_selector_list(bool at_root = false);
|
230
|
+
Complex_Selector* parse_complex_selector(bool in_root = true);
|
231
|
+
Compound_Selector* parse_compound_selector();
|
220
232
|
Simple_Selector* parse_simple_selector();
|
221
233
|
Wrapped_Selector* parse_negated_selector();
|
222
234
|
Simple_Selector* parse_pseudo_selector();
|
223
235
|
Attribute_Selector* parse_attribute_selector();
|
224
|
-
Block* parse_block();
|
236
|
+
Block* parse_block(bool is_root = false);
|
237
|
+
Block* parse_css_block(bool is_root = false);
|
238
|
+
bool parse_block_nodes(bool is_root = false);
|
239
|
+
bool parse_block_node(bool is_root = false);
|
240
|
+
|
225
241
|
bool parse_number_prefix();
|
226
242
|
Declaration* parse_declaration();
|
227
243
|
Expression* parse_map_value();
|
@@ -233,38 +249,42 @@ namespace Sass {
|
|
233
249
|
Expression* parse_conjunction();
|
234
250
|
Expression* parse_relation();
|
235
251
|
Expression* parse_expression();
|
236
|
-
Expression*
|
252
|
+
Expression* parse_operators();
|
237
253
|
Expression* parse_factor();
|
254
|
+
Expression* parse_value2();
|
238
255
|
Expression* parse_value();
|
239
256
|
Function_Call* parse_calc_function();
|
240
257
|
Function_Call* parse_function_call();
|
241
258
|
Function_Call_Schema* parse_function_call_schema();
|
259
|
+
String* parse_url_function_string();
|
242
260
|
String* parse_interpolated_chunk(Token, bool constant = false);
|
243
261
|
String* parse_string();
|
244
262
|
String_Constant* parse_static_expression();
|
263
|
+
// String_Constant* parse_static_property();
|
245
264
|
String_Constant* parse_static_value();
|
246
265
|
String* parse_ie_property();
|
247
266
|
String* parse_ie_keyword_arg();
|
248
267
|
String_Schema* parse_value_schema(const char* stop);
|
249
|
-
Expression* parse_operators(Expression* factor);
|
250
268
|
String* parse_identifier_schema();
|
251
269
|
// String_Schema* parse_url_schema();
|
252
270
|
If* parse_if_directive(bool else_if = false);
|
253
271
|
For* parse_for_directive();
|
254
272
|
Each* parse_each_directive();
|
255
273
|
While* parse_while_directive();
|
274
|
+
Return* parse_return_directive();
|
275
|
+
Content* parse_content_directive();
|
276
|
+
void parse_charset_directive();
|
256
277
|
Media_Block* parse_media_block();
|
257
278
|
List* parse_media_queries();
|
258
279
|
Media_Query* parse_media_query();
|
259
280
|
Media_Query_Expression* parse_media_expression();
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
Feature_Query_Condition* parse_supports_declaration();
|
281
|
+
Supports_Block* parse_supports_directive();
|
282
|
+
Supports_Condition* parse_supports_condition();
|
283
|
+
Supports_Condition* parse_supports_negation();
|
284
|
+
Supports_Condition* parse_supports_operator();
|
285
|
+
Supports_Condition* parse_supports_interpolation();
|
286
|
+
Supports_Condition* parse_supports_declaration();
|
287
|
+
Supports_Condition* parse_supports_condition_in_parens();
|
268
288
|
At_Root_Block* parse_at_root_block();
|
269
289
|
At_Root_Expression* parse_at_root_expression();
|
270
290
|
At_Rule* parse_at_rule();
|
@@ -272,17 +292,21 @@ namespace Sass {
|
|
272
292
|
Error* parse_error();
|
273
293
|
Debug* parse_debug();
|
274
294
|
|
275
|
-
|
295
|
+
// these will throw errors
|
296
|
+
Token lex_variable();
|
297
|
+
Token lex_identifier();
|
298
|
+
|
299
|
+
void parse_block_comments();
|
276
300
|
|
277
|
-
|
278
|
-
|
279
|
-
|
301
|
+
Lookahead lookahead_for_value(const char* start = 0);
|
302
|
+
Lookahead lookahead_for_selector(const char* start = 0);
|
303
|
+
Lookahead lookahead_for_include(const char* start = 0);
|
280
304
|
|
281
|
-
Expression* fold_operands(Expression* base, vector<Expression*>& operands,
|
282
|
-
Expression* fold_operands(Expression* base, vector<Expression*>& operands, vector<
|
305
|
+
Expression* fold_operands(Expression* base, std::vector<Expression*>& operands, Sass_OP op);
|
306
|
+
Expression* fold_operands(Expression* base, std::vector<Expression*>& operands, std::vector<Sass_OP>& ops);
|
283
307
|
|
284
|
-
void throw_syntax_error(string message, size_t ln = 0);
|
285
|
-
void throw_read_error(string message, size_t ln = 0);
|
308
|
+
void throw_syntax_error(std::string message, size_t ln = 0);
|
309
|
+
void throw_read_error(std::string message, size_t ln = 0);
|
286
310
|
};
|
287
311
|
|
288
312
|
size_t check_bom_chars(const char* src, const char *end, const unsigned char* bom, size_t len);
|
@@ -4,14 +4,12 @@
|
|
4
4
|
#include <string>
|
5
5
|
#include <vector>
|
6
6
|
#include <sstream>
|
7
|
-
#include <iostream>
|
8
7
|
|
9
|
-
using namespace std;
|
10
8
|
|
11
9
|
template<typename T>
|
12
|
-
string vector_to_string(vector<T> v)
|
10
|
+
std::string vector_to_string(std::vector<T> v)
|
13
11
|
{
|
14
|
-
stringstream buffer;
|
12
|
+
std::stringstream buffer;
|
15
13
|
buffer << "[";
|
16
14
|
|
17
15
|
if (!v.empty())
|
@@ -32,35 +30,34 @@ string vector_to_string(vector<T> v)
|
|
32
30
|
|
33
31
|
namespace Sass {
|
34
32
|
|
35
|
-
using namespace std;
|
36
33
|
|
37
34
|
template<typename T>
|
38
|
-
vector<vector<T> > paths(vector<vector<T> > strata, size_t from_end = 0)
|
35
|
+
std::vector<std::vector<T> > paths(std::vector<std::vector<T> > strata, size_t from_end = 0)
|
39
36
|
{
|
40
37
|
if (strata.empty()) {
|
41
|
-
return vector<vector<T> >();
|
38
|
+
return std::vector<std::vector<T> >();
|
42
39
|
}
|
43
40
|
|
44
41
|
size_t end = strata.size() - from_end;
|
45
42
|
if (end <= 1) {
|
46
|
-
vector<vector<T> > starting_points;
|
43
|
+
std::vector<std::vector<T> > starting_points;
|
47
44
|
starting_points.reserve(strata[0].size());
|
48
45
|
for (size_t i = 0, S = strata[0].size(); i < S; ++i) {
|
49
|
-
vector<T> starting_point;
|
46
|
+
std::vector<T> starting_point;
|
50
47
|
starting_point.push_back(strata[0][i]);
|
51
48
|
starting_points.push_back(starting_point);
|
52
49
|
}
|
53
50
|
return starting_points;
|
54
51
|
}
|
55
52
|
|
56
|
-
vector<vector<T> > up_to_here = paths(strata, from_end + 1);
|
57
|
-
vector<T> here = strata[end-1];
|
53
|
+
std::vector<std::vector<T> > up_to_here = paths(strata, from_end + 1);
|
54
|
+
std::vector<T> here = strata[end-1];
|
58
55
|
|
59
|
-
vector<vector<T> > branches;
|
56
|
+
std::vector<std::vector<T> > branches;
|
60
57
|
branches.reserve(up_to_here.size() * here.size());
|
61
58
|
for (size_t i = 0, S1 = up_to_here.size(); i < S1; ++i) {
|
62
59
|
for (size_t j = 0, S2 = here.size(); j < S2; ++j) {
|
63
|
-
vector<T> branch = up_to_here[i];
|
60
|
+
std::vector<T> branch = up_to_here[i];
|
64
61
|
branch.push_back(here[j]);
|
65
62
|
branches.push_back(branch);
|
66
63
|
}
|
@@ -11,8 +11,6 @@
|
|
11
11
|
#include "output.hpp"
|
12
12
|
#include "plugins.hpp"
|
13
13
|
|
14
|
-
#define npos string::npos
|
15
|
-
|
16
14
|
namespace Sass {
|
17
15
|
|
18
16
|
Plugins::Plugins(void) { }
|
@@ -30,18 +28,18 @@ namespace Sass {
|
|
30
28
|
if (!strcmp(our_version, "[na]")) return false;
|
31
29
|
|
32
30
|
// find the position of the second dot
|
33
|
-
size_t pos = string(our_version).find('.', 0);
|
34
|
-
if (pos != npos) pos = string(our_version).find('.', pos + 1);
|
31
|
+
size_t pos = std::string(our_version).find('.', 0);
|
32
|
+
if (pos != std::string::npos) pos = std::string(our_version).find('.', pos + 1);
|
35
33
|
|
36
34
|
// if we do not have two dots we fallback to compare complete string
|
37
|
-
if (pos == npos) { return strcmp(their_version, our_version) ? 0 : 1; }
|
35
|
+
if (pos == std::string::npos) { return strcmp(their_version, our_version) ? 0 : 1; }
|
38
36
|
// otherwise only compare up to the second dot (major versions)
|
39
37
|
else { return strncmp(their_version, our_version, pos) ? 0 : 1; }
|
40
38
|
|
41
39
|
}
|
42
40
|
|
43
41
|
// load one specific plugin
|
44
|
-
bool Plugins::load_plugin (const string& path)
|
42
|
+
bool Plugins::load_plugin (const std::string& path)
|
45
43
|
{
|
46
44
|
|
47
45
|
typedef const char* (*__plugin_version__)(void);
|
@@ -79,23 +77,23 @@ namespace Sass {
|
|
79
77
|
else
|
80
78
|
{
|
81
79
|
// print debug message to stderr (should not happen)
|
82
|
-
cerr << "failed loading 'libsass_support' in <" << path << ">" << endl;
|
83
|
-
if (const char* dlsym_error = dlerror()) cerr << dlsym_error << endl;
|
80
|
+
std::cerr << "failed loading 'libsass_support' in <" << path << ">" << std::endl;
|
81
|
+
if (const char* dlsym_error = dlerror()) std::cerr << dlsym_error << std::endl;
|
84
82
|
CLOSE_LIB(plugin);
|
85
83
|
}
|
86
84
|
}
|
87
85
|
else
|
88
86
|
{
|
89
87
|
// print debug message to stderr (should not happen)
|
90
|
-
cerr << "failed loading plugin <" << path << ">" << endl;
|
91
|
-
if (const char* dlopen_error = dlerror()) cerr << dlopen_error << endl;
|
88
|
+
std::cerr << "failed loading plugin <" << path << ">" << std::endl;
|
89
|
+
if (const char* dlopen_error = dlerror()) std::cerr << dlopen_error << std::endl;
|
92
90
|
}
|
93
91
|
|
94
92
|
return false;
|
95
93
|
|
96
94
|
}
|
97
95
|
|
98
|
-
size_t Plugins::load_plugins(const string& path)
|
96
|
+
size_t Plugins::load_plugins(const std::string& path)
|
99
97
|
{
|
100
98
|
|
101
99
|
// count plugins
|
@@ -109,9 +107,9 @@ namespace Sass {
|
|
109
107
|
// use wchar (utf16)
|
110
108
|
WIN32_FIND_DATAW data;
|
111
109
|
// trailing slash is guaranteed
|
112
|
-
string globsrch(path + "*.dll");
|
110
|
+
std::string globsrch(path + "*.dll");
|
113
111
|
// convert to wide chars (utf16) for system call
|
114
|
-
wstring wglobsrch(UTF_8::convert_to_utf16(globsrch));
|
112
|
+
std::wstring wglobsrch(UTF_8::convert_to_utf16(globsrch));
|
115
113
|
HANDLE hFile = FindFirstFileW(wglobsrch.c_str(), &data);
|
116
114
|
// check if system called returned a result
|
117
115
|
// ToDo: maybe we should print a debug message
|
@@ -123,7 +121,7 @@ namespace Sass {
|
|
123
121
|
try
|
124
122
|
{
|
125
123
|
// the system will report the filenames with wide chars (utf16)
|
126
|
-
string entry = UTF_8::convert_from_utf16(data.cFileName);
|
124
|
+
std::string entry = UTF_8::convert_from_utf16(data.cFileName);
|
127
125
|
// check if file ending matches exactly
|
128
126
|
if (!ends_with(entry, ".dll")) continue;
|
129
127
|
// load the plugin and increase counter
|
@@ -137,7 +135,7 @@ namespace Sass {
|
|
137
135
|
{
|
138
136
|
// report the error to the console (should not happen)
|
139
137
|
// seems like we got strange data from the system call?
|
140
|
-
cerr << "filename in plugin path has invalid utf8?" << endl;
|
138
|
+
std::cerr << "filename in plugin path has invalid utf8?" << std::endl;
|
141
139
|
}
|
142
140
|
}
|
143
141
|
}
|
@@ -145,7 +143,7 @@ namespace Sass {
|
|
145
143
|
{
|
146
144
|
// report the error to the console (should not happen)
|
147
145
|
// implementors should make sure to provide valid utf8
|
148
|
-
cerr << "plugin path contains invalid utf8" << endl;
|
146
|
+
std::cerr << "plugin path contains invalid utf8" << std::endl;
|
149
147
|
}
|
150
148
|
|
151
149
|
#else
|
@@ -165,4 +163,3 @@ namespace Sass {
|
|
165
163
|
}
|
166
164
|
|
167
165
|
}
|
168
|
-
|