sassc 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/ext/libsass/Makefile +10 -6
  4. data/ext/libsass/Readme.md +4 -4
  5. data/ext/libsass/appveyor.yml +16 -1
  6. data/ext/libsass/docs/README.md +1 -1
  7. data/ext/libsass/docs/api-context-example.md +1 -1
  8. data/ext/libsass/docs/api-context.md +1 -1
  9. data/ext/libsass/docs/api-doc.md +1 -1
  10. data/ext/libsass/docs/api-function-example.md +12 -3
  11. data/ext/libsass/docs/api-function-internal.md +4 -4
  12. data/ext/libsass/docs/api-function.md +15 -13
  13. data/ext/libsass/docs/api-importer-internal.md +9 -4
  14. data/ext/libsass/docs/api-value.md +1 -1
  15. data/ext/libsass/docs/build-shared-library.md +3 -3
  16. data/ext/libsass/docs/custom-functions-internal.md +1 -1
  17. data/ext/libsass/docs/{plugins.go → plugins.md} +0 -0
  18. data/ext/libsass/script/ci-build-libsass +25 -36
  19. data/ext/libsass/script/ci-install-deps +3 -8
  20. data/ext/libsass/script/ci-report-coverage +17 -13
  21. data/ext/libsass/src/ast.cpp +102 -7
  22. data/ext/libsass/src/ast.hpp +53 -27
  23. data/ext/libsass/src/ast_def_macros.hpp +8 -0
  24. data/ext/libsass/src/ast_fwd_decl.hpp +3 -2
  25. data/ext/libsass/src/backtrace.hpp +1 -1
  26. data/ext/libsass/src/bind.cpp +28 -17
  27. data/ext/libsass/src/bind.hpp +1 -1
  28. data/ext/libsass/src/context.cpp +441 -184
  29. data/ext/libsass/src/context.hpp +79 -82
  30. data/ext/libsass/src/debugger.hpp +3 -1
  31. data/ext/libsass/src/emitter.cpp +18 -17
  32. data/ext/libsass/src/emitter.hpp +5 -2
  33. data/ext/libsass/src/error_handling.cpp +78 -7
  34. data/ext/libsass/src/error_handling.hpp +50 -9
  35. data/ext/libsass/src/eval.cpp +100 -36
  36. data/ext/libsass/src/eval.hpp +5 -5
  37. data/ext/libsass/src/expand.cpp +32 -3
  38. data/ext/libsass/src/extend.cpp +1 -1
  39. data/ext/libsass/src/file.cpp +39 -27
  40. data/ext/libsass/src/file.hpp +67 -13
  41. data/ext/libsass/src/functions.cpp +39 -32
  42. data/ext/libsass/src/inspect.cpp +21 -21
  43. data/ext/libsass/src/json.cpp +1 -1
  44. data/ext/libsass/src/lexer.hpp +33 -4
  45. data/ext/libsass/src/output.cpp +11 -11
  46. data/ext/libsass/src/parser.cpp +28 -130
  47. data/ext/libsass/src/parser.hpp +0 -4
  48. data/ext/libsass/src/prelexer.cpp +8 -5
  49. data/ext/libsass/src/prelexer.hpp +1 -3
  50. data/ext/libsass/src/sass_context.cpp +52 -241
  51. data/ext/libsass/src/sass_context.hpp +156 -0
  52. data/ext/libsass/src/sass_functions.cpp +1 -26
  53. data/ext/libsass/src/sass_functions.hpp +32 -0
  54. data/ext/libsass/src/sass_interface.cpp +14 -48
  55. data/ext/libsass/src/sass_values.cpp +3 -77
  56. data/ext/libsass/src/sass_values.hpp +81 -0
  57. data/ext/libsass/src/source_map.cpp +7 -7
  58. data/ext/libsass/src/source_map.hpp +1 -4
  59. data/ext/libsass/src/to_string.cpp +4 -3
  60. data/ext/libsass/src/to_string.hpp +2 -1
  61. data/ext/libsass/src/util.cpp +34 -16
  62. data/ext/libsass/src/util.hpp +10 -8
  63. data/lib/sassc/version.rb +1 -1
  64. data/lib/tasks/libsass.rb +1 -1
  65. data/test/custom_importer_test.rb +6 -4
  66. data/test/engine_test.rb +5 -3
  67. data/test/functions_test.rb +1 -0
  68. data/test/native_test.rb +1 -1
  69. metadata +6 -4
  70. data/ext/libsass/script/coveralls-debug +0 -32
@@ -11,13 +11,15 @@
11
11
  #include "ast_fwd_decl.hpp"
12
12
  #include "kwd_arg_macros.hpp"
13
13
  #include "memory_manager.hpp"
14
+ #include "ast_fwd_decl.hpp"
15
+ #include "sass_context.hpp"
14
16
  #include "environment.hpp"
15
17
  #include "source_map.hpp"
16
18
  #include "subset_map.hpp"
17
19
  #include "output.hpp"
18
20
  #include "plugins.hpp"
19
21
  #include "file.hpp"
20
- #include "sass.h"
22
+
21
23
 
22
24
  struct Sass_Function;
23
25
 
@@ -25,30 +27,48 @@ namespace Sass {
25
27
 
26
28
  class Context {
27
29
  public:
30
+ void import_url (Import* imp, std::string load_path, const std::string& ctx_path);
31
+ bool call_headers(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import* imp)
32
+ { return call_loader(load_path, ctx_path, pstate, imp, c_headers, false); };
33
+ bool call_importers(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import* imp)
34
+ { return call_loader(load_path, ctx_path, pstate, imp, c_importers, true); };
35
+
36
+ private:
37
+ bool call_loader(const std::string& load_path, const char* ctx_path, ParserState& pstate, Import* imp, std::vector<Sass_Importer_Entry> importers, bool only_one = true);
38
+
39
+ public:
40
+ const std::string CWD;
41
+ std::string entry_path;
28
42
  size_t head_imports;
29
43
  Memory_Manager mem;
44
+ Plugins plugins;
45
+ Output emitter;
46
+
47
+ // resources add under our control
48
+ // these are guaranteed to be freed
49
+ std::vector<char*> strings;
50
+ std::vector<Resource> resources;
51
+ std::map<const std::string, const StyleSheet> sheets;
52
+ Subset_Map<std::string, std::pair<Complex_Selector*, Compound_Selector*> > subset_map;
53
+ std::vector<Sass_Import_Entry> import_stack;
30
54
 
31
- struct Sass_Options* c_options;
32
55
  struct Sass_Compiler* c_compiler;
33
- char* source_c_str;
56
+ struct Sass_Options* c_options;
34
57
 
35
- // c-strs containing Sass file contents
36
- // we will overtake ownership of memory
37
- std::vector<char*> sources;
38
- // strings get freed with context
39
- std::vector<char*> strings;
40
58
  // absolute paths to includes
41
59
  std::vector<std::string> included_files;
42
- // relative links to includes
43
- std::vector<std::string> include_links;
60
+ // relative includes for sourcemap
61
+ std::vector<std::string> srcmap_links;
44
62
  // vectors above have same size
45
63
 
46
64
  std::vector<std::string> plugin_paths; // relative paths to load plugins
47
65
  std::vector<std::string> include_paths; // lookup paths for includes
48
- std::vector<Sass_Queued> queue; // queue of files to be parsed
49
- std::map<std::string, Block*> style_sheets; // map of paths to ASTs
50
- // SourceMap source_map;
51
- Output emitter;
66
+
67
+
68
+
69
+
70
+
71
+ void apply_custom_headers(Block* root, const char* path, ParserState pstate);
52
72
 
53
73
  std::vector<Sass_Importer_Entry> c_headers;
54
74
  std::vector<Sass_Importer_Entry> c_importers;
@@ -58,71 +78,25 @@ namespace Sass {
58
78
  void add_c_importer(Sass_Importer_Entry importer);
59
79
  void add_c_function(Sass_Function_Entry function);
60
80
 
61
- std::string indent; // String to be used for indentation
62
- std::string linefeed; // String to be used for line feeds
63
- std::string input_path; // for relative paths in src-map
64
- std::string output_path; // for relative paths to the output
65
- bool source_comments; // for inline debug comments in css output
66
- Output_Style output_style; // output style for the generated css code
67
- std::string source_map_file; // path to source map file (enables feature)
68
- std::string source_map_root; // path for sourceRoot property (pass-through)
69
- bool source_map_embed; // embed in sourceMappingUrl (as data-url)
70
- bool source_map_contents; // insert included contents into source map
71
- bool omit_source_map_url; // disable source map comment in css output
72
- bool is_indented_syntax_src; // treat source string as sass
73
-
74
- // overload import calls
75
- std::vector<Sass_Import_Entry> import_stack;
76
-
77
- size_t precision; // precision for outputting fractional numbers
78
-
79
- KWD_ARG_SET(Data) {
80
- KWD_ARG(Data, struct Sass_Options*, c_options)
81
- KWD_ARG(Data, struct Sass_Compiler*, c_compiler)
82
- KWD_ARG(Data, char*, source_c_str)
83
- KWD_ARG(Data, std::string, entry_point)
84
- KWD_ARG(Data, std::string, input_path)
85
- KWD_ARG(Data, std::string, output_path)
86
- KWD_ARG(Data, std::string, indent)
87
- KWD_ARG(Data, std::string, linefeed)
88
- KWD_ARG(Data, const char*, include_paths_c_str)
89
- KWD_ARG(Data, const char*, plugin_paths_c_str)
90
- // KWD_ARG(Data, const char**, include_paths_array)
91
- // KWD_ARG(Data, const char**, plugin_paths_array)
92
- KWD_ARG(Data, std::vector<std::string>, include_paths)
93
- KWD_ARG(Data, std::vector<std::string>, plugin_paths)
94
- KWD_ARG(Data, bool, source_comments)
95
- KWD_ARG(Data, Output_Style, output_style)
96
- KWD_ARG(Data, std::string, source_map_file)
97
- KWD_ARG(Data, std::string, source_map_root)
98
- KWD_ARG(Data, bool, omit_source_map_url)
99
- KWD_ARG(Data, bool, is_indented_syntax_src)
100
- KWD_ARG(Data, size_t, precision)
101
- KWD_ARG(Data, bool, source_map_embed)
102
- KWD_ARG(Data, bool, source_map_contents)
103
- };
104
-
105
- Context(Data);
106
- ~Context();
107
- static std::string get_cwd();
108
-
109
- Block* parse_file();
110
- Block* parse_string();
111
- void add_source(std::string, std::string, char*);
112
-
113
- std::string add_file(const std::string& imp_path, bool delay = false);
114
- std::string add_file(const std::string& imp_path, const std::string& abs_path, ParserState pstate);
115
-
116
- void process_queue_entry(Sass_Queued& entry, size_t idx);
117
-
118
- // allow to optionally overwrite the input path
119
- // default argument for input_path is std::string("stdin")
120
- // usefull to influence the source-map generating etc.
121
- char* compile_file();
122
- char* compile_string();
123
- char* compile_block(Block* root);
124
- char* generate_source_map();
125
-
81
+ const std::string indent; // String to be used for indentation
82
+ const std::string linefeed; // String to be used for line feeds
83
+ const std::string input_path; // for relative paths in src-map
84
+ const std::string output_path; // for relative paths to the output
85
+ const std::string source_map_file; // path to source map file (enables feature)
86
+ const std::string source_map_root; // path for sourceRoot property (pass-through)
87
+
88
+ virtual ~Context();
89
+ Context(struct Sass_Context*);
90
+ virtual Block* parse() = 0;
91
+ virtual Block* compile();
92
+ virtual char* render(Block* root);
93
+ virtual char* render_srcmap();
94
+
95
+ void register_resource(const Include&, const Resource&);
96
+ std::vector<Include> find_includes(const Importer& import);
97
+ Include load_import(const Importer&, ParserState pstate);
98
+
99
+ Sass_Output_Style output_style() { return c_options->output_style; };
126
100
  std::vector<std::string> get_included_files(bool skip = false, size_t headers = 0);
127
101
 
128
102
  private:
@@ -133,8 +107,6 @@ namespace Sass {
133
107
  std::string format_embedded_source_map();
134
108
  std::string format_source_mapping_url(const std::string& out_path);
135
109
 
136
- std::string cwd;
137
- Plugins plugins;
138
110
 
139
111
  // void register_built_in_functions(Env* env);
140
112
  // void register_function(Signature sig, Native_Function f, Env* env);
@@ -142,7 +114,32 @@ namespace Sass {
142
114
  // void register_overload_stub(std::string name, Env* env);
143
115
 
144
116
  public:
145
- Subset_Map<std::string, std::pair<Complex_Selector*, Compound_Selector*> > subset_map;
117
+ const std::string& cwd() { return CWD; };
118
+ };
119
+
120
+ class File_Context : public Context {
121
+ public:
122
+ File_Context(struct Sass_File_Context* ctx)
123
+ : Context(ctx)
124
+ { }
125
+ virtual ~File_Context();
126
+ virtual Block* parse();
127
+ };
128
+
129
+ class Data_Context : public Context {
130
+ public:
131
+ char* source_c_str;
132
+ char* srcmap_c_str;
133
+ Data_Context(struct Sass_Data_Context* ctx)
134
+ : Context(ctx)
135
+ {
136
+ source_c_str = ctx->source_string;
137
+ srcmap_c_str = ctx->srcmap_string;
138
+ ctx->source_string = 0; // passed away
139
+ ctx->srcmap_string = 0; // passed away
140
+ }
141
+ virtual ~Data_Context();
142
+ virtual Block* parse();
146
143
  };
147
144
 
148
145
  }
@@ -524,7 +524,9 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
524
524
  Number* expression = dynamic_cast<Number*>(node);
525
525
  std::cerr << ind << "Number " << expression;
526
526
  std::cerr << " (" << pstate_source_position(node) << ")";
527
- std::cerr << " [" << expression->value() << expression->unit() << "]" << std::endl;
527
+ std::cerr << " [" << expression->value() << expression->unit() << "]" <<
528
+ " [hash: " << expression->hash() << "] " <<
529
+ std::endl;
528
530
  } else if (dynamic_cast<String_Quoted*>(node)) {
529
531
  String_Quoted* expression = dynamic_cast<String_Quoted*>(node);
530
532
  std::cerr << ind << "String_Quoted " << expression;
@@ -18,7 +18,8 @@ namespace Sass {
18
18
  in_media_block(false),
19
19
  in_declaration(false),
20
20
  in_space_array(false),
21
- in_comma_array(false)
21
+ in_comma_array(false),
22
+ in_debug(false)
22
23
  { }
23
24
 
24
25
  // return buffer as string
@@ -27,9 +28,9 @@ namespace Sass {
27
28
  return wbuf.buffer;
28
29
  }
29
30
 
30
- Output_Style Emitter::output_style(void)
31
+ Sass_Output_Style Emitter::output_style(void)
31
32
  {
32
- return ctx ? ctx->output_style : COMPRESSED;
33
+ return ctx ? ctx->output_style() : SASS_STYLE_COMPRESSED;
33
34
  }
34
35
 
35
36
  // PROXY METHODS FOR SOURCE MAPS
@@ -37,8 +38,8 @@ namespace Sass {
37
38
  void Emitter::add_source_index(size_t idx)
38
39
  { wbuf.smap.source_index.push_back(idx); }
39
40
 
40
- std::string Emitter::generate_source_map(Context &ctx)
41
- { return wbuf.smap.generate_source_map(ctx); }
41
+ std::string Emitter::render_srcmap(Context &ctx)
42
+ { return wbuf.smap.render_srcmap(ctx); }
42
43
 
43
44
  void Emitter::set_filename(const std::string& str)
44
45
  { wbuf.smap.file = str; }
@@ -105,7 +106,7 @@ namespace Sass {
105
106
  // write space/lf
106
107
  flush_schedules();
107
108
 
108
- if (in_comment && output_style() == COMPACT) {
109
+ if (in_comment && output_style() == SASS_STYLE_COMPACT) {
109
110
  // unescape comment nodes
110
111
  std::string out = comment_to_string(text);
111
112
  // add to buffer
@@ -144,8 +145,8 @@ namespace Sass {
144
145
 
145
146
  void Emitter::append_indentation()
146
147
  {
147
- if (output_style() == COMPRESSED) return;
148
- if (output_style() == COMPACT) return;
148
+ if (output_style() == SASS_STYLE_COMPRESSED) return;
149
+ if (output_style() == SASS_STYLE_COMPACT) return;
149
150
  if (in_declaration && in_comma_array) return;
150
151
  if (scheduled_linefeed && indentation)
151
152
  scheduled_linefeed = 1;
@@ -158,13 +159,13 @@ namespace Sass {
158
159
  void Emitter::append_delimiter()
159
160
  {
160
161
  scheduled_delimiter = true;
161
- if (output_style() == COMPACT) {
162
+ if (output_style() == SASS_STYLE_COMPACT) {
162
163
  if (indentation == 0) {
163
164
  append_mandatory_linefeed();
164
165
  } else {
165
166
  append_mandatory_space();
166
167
  }
167
- } else if (output_style() != COMPRESSED) {
168
+ } else if (output_style() != SASS_STYLE_COMPRESSED) {
168
169
  append_optional_linefeed();
169
170
  }
170
171
  }
@@ -190,7 +191,7 @@ namespace Sass {
190
191
 
191
192
  void Emitter::append_optional_space()
192
193
  {
193
- if (output_style() != COMPRESSED && buffer().size()) {
194
+ if ((output_style() != SASS_STYLE_COMPRESSED || in_debug) && buffer().size()) {
194
195
  char lst = buffer().at(buffer().length() - 1);
195
196
  if (!isspace(lst) || scheduled_delimiter) {
196
197
  append_mandatory_space();
@@ -200,7 +201,7 @@ namespace Sass {
200
201
 
201
202
  void Emitter::append_special_linefeed()
202
203
  {
203
- if (output_style() == COMPACT) {
204
+ if (output_style() == SASS_STYLE_COMPACT) {
204
205
  append_mandatory_linefeed();
205
206
  for (size_t p = 0; p < indentation; p++)
206
207
  append_string(ctx ? ctx->indent : " ");
@@ -210,7 +211,7 @@ namespace Sass {
210
211
  void Emitter::append_optional_linefeed()
211
212
  {
212
213
  if (in_declaration && in_comma_array) return;
213
- if (output_style() == COMPACT) {
214
+ if (output_style() == SASS_STYLE_COMPACT) {
214
215
  append_mandatory_space();
215
216
  } else {
216
217
  append_mandatory_linefeed();
@@ -219,7 +220,7 @@ namespace Sass {
219
220
 
220
221
  void Emitter::append_mandatory_linefeed()
221
222
  {
222
- if (output_style() != COMPRESSED) {
223
+ if (output_style() != SASS_STYLE_COMPRESSED) {
223
224
  scheduled_linefeed = 1;
224
225
  scheduled_space = 0;
225
226
  // flush_schedules();
@@ -241,9 +242,9 @@ namespace Sass {
241
242
  {
242
243
  -- indentation;
243
244
  scheduled_linefeed = 0;
244
- if (output_style() == COMPRESSED)
245
+ if (output_style() == SASS_STYLE_COMPRESSED)
245
246
  scheduled_delimiter = false;
246
- if (output_style() == EXPANDED) {
247
+ if (output_style() == SASS_STYLE_EXPANDED) {
247
248
  append_optional_linefeed();
248
249
  append_indentation();
249
250
  } else {
@@ -253,7 +254,7 @@ namespace Sass {
253
254
  if (node) add_close_mapping(node);
254
255
  append_optional_linefeed();
255
256
  if (indentation != 0) return;
256
- if (output_style() != COMPRESSED)
257
+ if (output_style() != SASS_STYLE_COMPRESSED)
257
258
  scheduled_linefeed = 2;
258
259
  }
259
260
 
@@ -2,6 +2,7 @@
2
2
  #define SASS_EMITTER_H
3
3
 
4
4
  #include <string>
5
+ #include "sass/base.h"
5
6
  #include "source_map.hpp"
6
7
  #include "ast_fwd_decl.hpp"
7
8
 
@@ -25,7 +26,7 @@ namespace Sass {
25
26
  void set_filename(const std::string& str);
26
27
  void add_open_mapping(AST_Node* node);
27
28
  void add_close_mapping(AST_Node* node);
28
- std::string generate_source_map(Context &ctx);
29
+ std::string render_srcmap(Context &ctx);
29
30
  ParserState remap(const ParserState& pstate);
30
31
 
31
32
  public:
@@ -47,12 +48,14 @@ namespace Sass {
47
48
  // nested lists need parentheses
48
49
  bool in_space_array;
49
50
  bool in_comma_array;
51
+ // list separators don't get compressed in @debug
52
+ bool in_debug;
50
53
 
51
54
  public:
52
55
  // return buffer as std::string
53
56
  std::string get_buffer(void);
54
57
  // flush scheduled space/linefeed
55
- Output_Style output_style(void);
58
+ Sass_Output_Style output_style(void);
56
59
  // add outstanding linefeed
57
60
  void finalize(void);
58
61
  // flush scheduled space/linefeed
@@ -1,14 +1,55 @@
1
+ #include "ast.hpp"
1
2
  #include "prelexer.hpp"
2
3
  #include "backtrace.hpp"
4
+ #include "to_string.hpp"
3
5
  #include "error_handling.hpp"
4
6
 
5
7
  #include <iostream>
6
8
 
7
9
  namespace Sass {
8
10
 
9
- Error_Invalid::Error_Invalid(Type type, ParserState pstate, std::string message)
10
- : type(type), pstate(pstate), message(message)
11
- { }
11
+ namespace Exception {
12
+
13
+ Base::Base(ParserState pstate, std::string msg)
14
+ : std::runtime_error(msg),
15
+ msg(msg), pstate(pstate)
16
+ { }
17
+
18
+ const char* Base::what() const throw()
19
+ {
20
+ return msg.c_str();
21
+ }
22
+
23
+ InvalidSass::InvalidSass(ParserState pstate, std::string msg)
24
+ : Base(pstate, msg)
25
+ { }
26
+
27
+
28
+ InvalidParent::InvalidParent(Selector* parent, Selector* selector)
29
+ : Base(selector->pstate()), parent(parent), selector(selector)
30
+ {
31
+ msg = "Invalid parent selector for \"";
32
+ msg += selector->to_string(false);
33
+ msg += "\": \"";
34
+ msg += parent->to_string(false);;
35
+ msg += "\"";
36
+ }
37
+
38
+ InvalidArgumentType::InvalidArgumentType(ParserState pstate, std::string fn, std::string arg, std::string type, const Value* value)
39
+ : Base(pstate), fn(fn), arg(arg), type(type), value(value)
40
+ {
41
+ msg = arg + ": \"";
42
+ msg += value->to_string(true, 5);
43
+ msg += "\" is not a " + type;
44
+ msg += " for `" + fn + "'";
45
+ }
46
+
47
+ InvalidSyntax::InvalidSyntax(ParserState pstate, std::string msg)
48
+ : Base(pstate, msg)
49
+ { }
50
+
51
+ }
52
+
12
53
 
13
54
  void warn(std::string msg, ParserState pstate)
14
55
  {
@@ -22,18 +63,48 @@ namespace Sass {
22
63
  warn(msg, pstate);
23
64
  }
24
65
 
25
- void deprecated(std::string msg, ParserState pstate)
66
+ void deprecated_function(std::string msg, ParserState pstate)
26
67
  {
27
68
  std::string cwd(Sass::File::get_cwd());
69
+ std::string abs_path(Sass::File::rel2abs(pstate.path, cwd, cwd));
70
+ std::string rel_path(Sass::File::abs2rel(pstate.path, cwd, cwd));
71
+ std::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.path));
72
+
28
73
  std::cerr << "DEPRECATION WARNING: " << msg << std::endl;
29
74
  std::cerr << "will be an error in future versions of Sass." << std::endl;
30
- std::string rel_path(Sass::File::resolve_relative_path(pstate.path, cwd, cwd));
31
- std::cerr << " on line " << pstate.line+1 << " of " << rel_path << std::endl;
75
+ std::cerr << " on line " << pstate.line+1 << " of " << output_path << std::endl;
76
+ }
77
+
78
+ void deprecated(std::string msg, std::string msg2, ParserState pstate)
79
+ {
80
+ std::string cwd(Sass::File::get_cwd());
81
+ std::string abs_path(Sass::File::rel2abs(pstate.path, cwd, cwd));
82
+ std::string rel_path(Sass::File::abs2rel(pstate.path, cwd, cwd));
83
+ std::string output_path(Sass::File::path_for_console(rel_path, pstate.path, pstate.path));
84
+
85
+ std::cerr << "DEPRECATION WARNING on line " << pstate.line + 1;
86
+ if (output_path.length()) std::cerr << " of " << output_path;
87
+ std::cerr << ":" << std::endl;
88
+ std::cerr << msg << " and will be an error in future versions of Sass." << std::endl;
89
+ if (msg2.length()) std::cerr << msg2 << std::endl;
90
+ std::cerr << std::endl;
91
+ }
92
+
93
+ void deprecated_bind(std::string msg, ParserState pstate)
94
+ {
95
+ std::string cwd(Sass::File::get_cwd());
96
+ std::string abs_path(Sass::File::rel2abs(pstate.path, cwd, cwd));
97
+ std::string rel_path(Sass::File::abs2rel(pstate.path, cwd, cwd));
98
+ std::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.path));
99
+
100
+ std::cerr << "WARNING: " << msg << std::endl;
101
+ std::cerr << " on line " << pstate.line+1 << " of " << output_path << std::endl;
102
+ std::cerr << "This will be an error in future versions of Sass." << std::endl;
32
103
  }
33
104
 
34
105
  void error(std::string msg, ParserState pstate)
35
106
  {
36
- throw Error_Invalid(Error_Invalid::syntax, pstate, msg);
107
+ throw Exception::InvalidSyntax(pstate, msg);
37
108
  }
38
109
 
39
110
  void error(std::string msg, ParserState pstate, Backtrace* bt)