sassc 2.3.0 → 2.4.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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG.md +5 -0
  4. data/ext/libsass/VERSION +1 -1
  5. data/ext/libsass/include/sass/context.h +3 -0
  6. data/ext/libsass/src/MurmurHash2.hpp +91 -0
  7. data/ext/libsass/src/ast.cpp +117 -117
  8. data/ext/libsass/src/ast.hpp +160 -162
  9. data/ext/libsass/src/ast_def_macros.hpp +10 -10
  10. data/ext/libsass/src/ast_fwd_decl.cpp +2 -2
  11. data/ext/libsass/src/ast_fwd_decl.hpp +61 -52
  12. data/ext/libsass/src/ast_helpers.hpp +5 -5
  13. data/ext/libsass/src/ast_sel_cmp.cpp +18 -18
  14. data/ext/libsass/src/ast_sel_super.cpp +52 -52
  15. data/ext/libsass/src/ast_sel_unify.cpp +16 -16
  16. data/ext/libsass/src/ast_sel_weave.cpp +62 -62
  17. data/ext/libsass/src/ast_selectors.cpp +87 -77
  18. data/ext/libsass/src/ast_selectors.hpp +72 -62
  19. data/ext/libsass/src/ast_supports.cpp +35 -35
  20. data/ext/libsass/src/ast_supports.hpp +29 -29
  21. data/ext/libsass/src/ast_values.cpp +58 -58
  22. data/ext/libsass/src/ast_values.hpp +75 -75
  23. data/ext/libsass/src/backtrace.cpp +9 -9
  24. data/ext/libsass/src/backtrace.hpp +5 -5
  25. data/ext/libsass/src/base64vlq.cpp +2 -2
  26. data/ext/libsass/src/base64vlq.hpp +1 -1
  27. data/ext/libsass/src/bind.cpp +17 -17
  28. data/ext/libsass/src/bind.hpp +1 -1
  29. data/ext/libsass/src/c2ast.cpp +3 -3
  30. data/ext/libsass/src/c2ast.hpp +1 -1
  31. data/ext/libsass/src/check_nesting.cpp +36 -36
  32. data/ext/libsass/src/check_nesting.hpp +2 -2
  33. data/ext/libsass/src/color_maps.cpp +5 -5
  34. data/ext/libsass/src/color_maps.hpp +1 -1
  35. data/ext/libsass/src/context.cpp +63 -60
  36. data/ext/libsass/src/context.hpp +33 -33
  37. data/ext/libsass/src/cssize.cpp +30 -29
  38. data/ext/libsass/src/cssize.hpp +13 -13
  39. data/ext/libsass/src/dart_helpers.hpp +5 -5
  40. data/ext/libsass/src/debugger.hpp +127 -128
  41. data/ext/libsass/src/emitter.cpp +12 -12
  42. data/ext/libsass/src/emitter.hpp +10 -10
  43. data/ext/libsass/src/environment.cpp +27 -27
  44. data/ext/libsass/src/environment.hpp +24 -24
  45. data/ext/libsass/src/error_handling.cpp +42 -42
  46. data/ext/libsass/src/error_handling.hpp +38 -50
  47. data/ext/libsass/src/eval.cpp +138 -132
  48. data/ext/libsass/src/eval.hpp +17 -17
  49. data/ext/libsass/src/eval_selectors.cpp +3 -3
  50. data/ext/libsass/src/expand.cpp +70 -64
  51. data/ext/libsass/src/expand.hpp +12 -12
  52. data/ext/libsass/src/extender.cpp +55 -53
  53. data/ext/libsass/src/extender.hpp +14 -14
  54. data/ext/libsass/src/file.cpp +66 -58
  55. data/ext/libsass/src/file.hpp +23 -25
  56. data/ext/libsass/src/fn_colors.cpp +9 -9
  57. data/ext/libsass/src/fn_lists.cpp +18 -18
  58. data/ext/libsass/src/fn_maps.cpp +3 -3
  59. data/ext/libsass/src/fn_miscs.cpp +15 -15
  60. data/ext/libsass/src/fn_numbers.cpp +7 -7
  61. data/ext/libsass/src/fn_selectors.cpp +8 -8
  62. data/ext/libsass/src/fn_strings.cpp +34 -22
  63. data/ext/libsass/src/fn_utils.cpp +29 -26
  64. data/ext/libsass/src/fn_utils.hpp +10 -10
  65. data/ext/libsass/src/inspect.cpp +35 -34
  66. data/ext/libsass/src/inspect.hpp +21 -21
  67. data/ext/libsass/src/lexer.cpp +3 -1
  68. data/ext/libsass/src/listize.cpp +2 -2
  69. data/ext/libsass/src/mapping.hpp +1 -0
  70. data/ext/libsass/src/memory.hpp +12 -0
  71. data/ext/libsass/src/memory/allocator.cpp +48 -0
  72. data/ext/libsass/src/memory/allocator.hpp +138 -0
  73. data/ext/libsass/src/memory/config.hpp +20 -0
  74. data/ext/libsass/src/memory/memory_pool.hpp +186 -0
  75. data/ext/libsass/src/memory/{SharedPtr.cpp → shared_ptr.cpp} +2 -2
  76. data/ext/libsass/src/memory/{SharedPtr.hpp → shared_ptr.hpp} +18 -6
  77. data/ext/libsass/src/operation.hpp +44 -44
  78. data/ext/libsass/src/operators.cpp +18 -18
  79. data/ext/libsass/src/operators.hpp +11 -11
  80. data/ext/libsass/src/ordered_map.hpp +18 -18
  81. data/ext/libsass/src/output.cpp +16 -16
  82. data/ext/libsass/src/output.hpp +5 -5
  83. data/ext/libsass/src/parser.cpp +327 -345
  84. data/ext/libsass/src/parser.hpp +77 -87
  85. data/ext/libsass/src/parser_selectors.cpp +6 -6
  86. data/ext/libsass/src/permutate.hpp +39 -15
  87. data/ext/libsass/src/plugins.cpp +7 -7
  88. data/ext/libsass/src/plugins.hpp +8 -8
  89. data/ext/libsass/src/position.cpp +7 -26
  90. data/ext/libsass/src/position.hpp +44 -21
  91. data/ext/libsass/src/remove_placeholders.cpp +4 -4
  92. data/ext/libsass/src/remove_placeholders.hpp +3 -3
  93. data/ext/libsass/src/sass.cpp +16 -15
  94. data/ext/libsass/src/sass.hpp +9 -5
  95. data/ext/libsass/src/sass_context.cpp +52 -34
  96. data/ext/libsass/src/sass_values.cpp +8 -10
  97. data/ext/libsass/src/settings.hpp +19 -0
  98. data/ext/libsass/src/source.cpp +69 -0
  99. data/ext/libsass/src/source.hpp +95 -0
  100. data/ext/libsass/src/source_data.hpp +32 -0
  101. data/ext/libsass/src/source_map.cpp +22 -18
  102. data/ext/libsass/src/source_map.hpp +12 -9
  103. data/ext/libsass/src/units.cpp +19 -19
  104. data/ext/libsass/src/units.hpp +8 -8
  105. data/ext/libsass/src/utf8_string.cpp +9 -10
  106. data/ext/libsass/src/utf8_string.hpp +7 -6
  107. data/ext/libsass/src/util.cpp +38 -38
  108. data/ext/libsass/src/util.hpp +18 -18
  109. data/ext/libsass/src/util_string.cpp +13 -13
  110. data/ext/libsass/src/util_string.hpp +9 -8
  111. data/ext/libsass/src/values.cpp +12 -12
  112. data/lib/sassc/native.rb +3 -5
  113. data/lib/sassc/version.rb +1 -1
  114. data/test/native_test.rb +4 -4
  115. metadata +14 -5
  116. data/lib/sassc/native/lib_c.rb +0 -21
@@ -32,16 +32,16 @@
32
32
 
33
33
  # ifdef _MSC_VER
34
34
  # include <codecvt>
35
- inline static std::string wstring_to_string(const std::wstring& wstr)
35
+ inline static Sass::sass::string wstring_to_string(const std::wstring& wstr)
36
36
  {
37
37
  std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> wchar_converter;
38
38
  return wchar_converter.to_bytes(wstr);
39
39
  }
40
40
  # else // mingw(/gcc) does not support C++11's codecvt yet.
41
- inline static std::string wstring_to_string(const std::wstring &wstr)
41
+ inline static Sass::sass::string wstring_to_string(const std::wstring &wstr)
42
42
  {
43
43
  int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
44
- std::string strTo(size_needed, 0);
44
+ Sass::sass::string strTo(size_needed, 0);
45
45
  WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
46
46
  return strTo;
47
47
  }
@@ -54,7 +54,7 @@ namespace Sass {
54
54
  // return the current directory
55
55
  // always with forward slashes
56
56
  // always with trailing slash
57
- std::string get_cwd()
57
+ sass::string get_cwd()
58
58
  {
59
59
  const size_t wd_len = 4096;
60
60
  #ifndef _WIN32
@@ -63,12 +63,12 @@ namespace Sass {
63
63
  // we should check error for more detailed info (e.g. ENOENT)
64
64
  // http://man7.org/linux/man-pages/man2/getcwd.2.html#ERRORS
65
65
  if (pwd == NULL) throw Exception::OperationError("cwd gone missing");
66
- std::string cwd = pwd;
66
+ sass::string cwd = pwd;
67
67
  #else
68
68
  wchar_t wd[wd_len];
69
69
  wchar_t* pwd = _wgetcwd(wd, wd_len);
70
70
  if (pwd == NULL) throw Exception::OperationError("cwd gone missing");
71
- std::string cwd = wstring_to_string(pwd);
71
+ sass::string cwd = wstring_to_string(pwd);
72
72
  //convert backslashes to forward slashes
73
73
  replace(cwd.begin(), cwd.end(), '\\', '/');
74
74
  #endif
@@ -77,12 +77,12 @@ namespace Sass {
77
77
  }
78
78
 
79
79
  // test if path exists and is a file
80
- bool file_exists(const std::string& path)
80
+ bool file_exists(const sass::string& path)
81
81
  {
82
82
  #ifdef _WIN32
83
83
  wchar_t resolved[32768];
84
84
  // windows unicode filepaths are encoded in utf16
85
- std::string abspath(join_paths(get_cwd(), path));
85
+ sass::string abspath(join_paths(get_cwd(), path));
86
86
  if (!(abspath[0] == '/' && abspath[1] == '/')) {
87
87
  abspath = "//?/" + abspath;
88
88
  }
@@ -103,7 +103,7 @@ namespace Sass {
103
103
 
104
104
  // return if given path is absolute
105
105
  // works with *nix and windows paths
106
- bool is_absolute_path(const std::string& path)
106
+ bool is_absolute_path(const sass::string& path)
107
107
  {
108
108
  #ifdef _WIN32
109
109
  if (path.length() >= 2 && Util::ascii_isalpha(path[0]) && path[1] == ':') return true;
@@ -119,19 +119,19 @@ namespace Sass {
119
119
  }
120
120
 
121
121
  // helper function to find the last directory separator
122
- inline size_t find_last_folder_separator(const std::string& path, size_t limit = std::string::npos)
122
+ inline size_t find_last_folder_separator(const sass::string& path, size_t limit = sass::string::npos)
123
123
  {
124
124
  size_t pos;
125
125
  size_t pos_p = path.find_last_of('/', limit);
126
126
  #ifdef _WIN32
127
127
  size_t pos_w = path.find_last_of('\\', limit);
128
128
  #else
129
- size_t pos_w = std::string::npos;
129
+ size_t pos_w = sass::string::npos;
130
130
  #endif
131
- if (pos_p != std::string::npos && pos_w != std::string::npos) {
131
+ if (pos_p != sass::string::npos && pos_w != sass::string::npos) {
132
132
  pos = std::max(pos_p, pos_w);
133
133
  }
134
- else if (pos_p != std::string::npos) {
134
+ else if (pos_p != sass::string::npos) {
135
135
  pos = pos_p;
136
136
  }
137
137
  else {
@@ -141,24 +141,24 @@ namespace Sass {
141
141
  }
142
142
 
143
143
  // return only the directory part of path
144
- std::string dir_name(const std::string& path)
144
+ sass::string dir_name(const sass::string& path)
145
145
  {
146
146
  size_t pos = find_last_folder_separator(path);
147
- if (pos == std::string::npos) return "";
147
+ if (pos == sass::string::npos) return "";
148
148
  else return path.substr(0, pos+1);
149
149
  }
150
150
 
151
151
  // return only the filename part of path
152
- std::string base_name(const std::string& path)
152
+ sass::string base_name(const sass::string& path)
153
153
  {
154
154
  size_t pos = find_last_folder_separator(path);
155
- if (pos == std::string::npos) return path;
155
+ if (pos == sass::string::npos) return path;
156
156
  else return path.substr(pos+1);
157
157
  }
158
158
 
159
159
  // do a logical clean up of the path
160
160
  // no physical check on the filesystem
161
- std::string make_canonical_path (std::string path)
161
+ sass::string make_canonical_path (sass::string path)
162
162
  {
163
163
 
164
164
  // declarations
@@ -170,7 +170,7 @@ namespace Sass {
170
170
  #endif
171
171
 
172
172
  pos = 0; // remove all self references inside the path string
173
- while((pos = path.find("/./", pos)) != std::string::npos) path.erase(pos, 2);
173
+ while((pos = path.find("/./", pos)) != sass::string::npos) path.erase(pos, 2);
174
174
 
175
175
  // remove all leading and trailing self references
176
176
  while(path.size() >= 2 && path[0] == '.' && path[1] == '/') path.erase(0, 2);
@@ -190,7 +190,7 @@ namespace Sass {
190
190
  while (path[proto++] == '/') {}
191
191
 
192
192
  pos = proto; // collapse multiple delimiters into a single one
193
- while((pos = path.find("//", pos)) != std::string::npos) path.erase(pos, 1);
193
+ while((pos = path.find("//", pos)) != sass::string::npos) path.erase(pos, 1);
194
194
 
195
195
  return path;
196
196
 
@@ -198,7 +198,7 @@ namespace Sass {
198
198
 
199
199
  // join two path segments cleanly together
200
200
  // but only if right side is not absolute yet
201
- std::string join_paths(std::string l, std::string r)
201
+ sass::string join_paths(sass::string l, sass::string r)
202
202
  {
203
203
 
204
204
  #ifdef _WIN32
@@ -225,16 +225,16 @@ namespace Sass {
225
225
  bool is_slash = pos + 2 == L && (l[pos+1] == '/' || l[pos+1] == '\\');
226
226
  bool is_self = pos + 3 == L && (l[pos+1] == '.');
227
227
  if (!is_self && !is_slash) r = r.substr(3);
228
- else if (pos == std::string::npos) break;
229
- l = l.substr(0, pos == std::string::npos ? pos : pos + 1);
228
+ else if (pos == sass::string::npos) break;
229
+ l = l.substr(0, pos == sass::string::npos ? pos : pos + 1);
230
230
  }
231
231
 
232
232
  return l + r;
233
233
  }
234
234
 
235
- std::string path_for_console(const std::string& rel_path, const std::string& abs_path, const std::string& orig_path)
235
+ sass::string path_for_console(const sass::string& rel_path, const sass::string& abs_path, const sass::string& orig_path)
236
236
  {
237
- // magic algorith goes here!!
237
+ // magic algorithm goes here!!
238
238
 
239
239
  // if the file is outside this directory show the absolute path
240
240
  if (rel_path.substr(0, 3) == "../") {
@@ -245,18 +245,26 @@ namespace Sass {
245
245
  }
246
246
 
247
247
  // create an absolute path by resolving relative paths with cwd
248
- std::string rel2abs(const std::string& path, const std::string& base, const std::string& cwd)
248
+ sass::string rel2abs(const sass::string& path, const sass::string& base, const sass::string& cwd)
249
249
  {
250
- return make_canonical_path(join_paths(join_paths(cwd + "/", base + "/"), path));
250
+ sass::string rv = make_canonical_path(join_paths(join_paths(cwd + "/", base + "/"), path));
251
+ #ifdef _WIN32
252
+ // On windows we may get an absolute path without directory
253
+ // In that case we should prepend the directory from the root
254
+ if (rv[0] == '/' && rv[1] != '/') {
255
+ rv.insert(0, cwd, 0, 2);
256
+ }
257
+ #endif
258
+ return rv;
251
259
  }
252
260
 
253
261
  // create a path that is relative to the given base directory
254
262
  // path and base will first be resolved against cwd to make them absolute
255
- std::string abs2rel(const std::string& path, const std::string& base, const std::string& cwd)
263
+ sass::string abs2rel(const sass::string& path, const sass::string& base, const sass::string& cwd)
256
264
  {
257
265
 
258
- std::string abs_path = rel2abs(path, cwd);
259
- std::string abs_base = rel2abs(base, cwd);
266
+ sass::string abs_path = rel2abs(path, cwd);
267
+ sass::string abs_base = rel2abs(base, cwd);
260
268
 
261
269
  size_t proto = 0;
262
270
  // check if we have a protocol
@@ -277,8 +285,8 @@ namespace Sass {
277
285
  if (abs_base[0] != abs_path[0]) return abs_path;
278
286
  #endif
279
287
 
280
- std::string stripped_uri = "";
281
- std::string stripped_base = "";
288
+ sass::string stripped_uri = "";
289
+ sass::string stripped_base = "";
282
290
 
283
291
  size_t index = 0;
284
292
  size_t minSize = std::min(abs_path.size(), abs_base.size());
@@ -317,7 +325,7 @@ namespace Sass {
317
325
  }
318
326
  }
319
327
 
320
- std::string result = "";
328
+ sass::string result = "";
321
329
  for (size_t i = 0; i < directories; ++i) {
322
330
  result += "../";
323
331
  }
@@ -333,16 +341,16 @@ namespace Sass {
333
341
  // (4) given + extension
334
342
  // (5) given + _index.scss
335
343
  // (6) given + _index.sass
336
- std::vector<Include> resolve_includes(const std::string& root, const std::string& file, const std::vector<std::string>& exts)
344
+ sass::vector<Include> resolve_includes(const sass::string& root, const sass::string& file, const sass::vector<sass::string>& exts)
337
345
  {
338
- std::string filename = join_paths(root, file);
346
+ sass::string filename = join_paths(root, file);
339
347
  // split the filename
340
- std::string base(dir_name(file));
341
- std::string name(base_name(file));
342
- std::vector<Include> includes;
348
+ sass::string base(dir_name(file));
349
+ sass::string name(base_name(file));
350
+ sass::vector<Include> includes;
343
351
  // create full path (maybe relative)
344
- std::string rel_path(join_paths(base, name));
345
- std::string abs_path(join_paths(root, rel_path));
352
+ sass::string rel_path(join_paths(base, name));
353
+ sass::string abs_path(join_paths(root, rel_path));
346
354
  if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path });
347
355
  // next test variation with underscore
348
356
  rel_path = join_paths(base, "_" + name);
@@ -383,24 +391,24 @@ namespace Sass {
383
391
  return includes;
384
392
  }
385
393
 
386
- std::vector<std::string> find_files(const std::string& file, const std::vector<std::string> paths)
394
+ sass::vector<sass::string> find_files(const sass::string& file, const sass::vector<sass::string> paths)
387
395
  {
388
- std::vector<std::string> includes;
389
- for (std::string path : paths) {
390
- std::string abs_path(join_paths(path, file));
396
+ sass::vector<sass::string> includes;
397
+ for (sass::string path : paths) {
398
+ sass::string abs_path(join_paths(path, file));
391
399
  if (file_exists(abs_path)) includes.push_back(abs_path);
392
400
  }
393
401
  return includes;
394
402
  }
395
403
 
396
- std::vector<std::string> find_files(const std::string& file, struct Sass_Compiler* compiler)
404
+ sass::vector<sass::string> find_files(const sass::string& file, struct Sass_Compiler* compiler)
397
405
  {
398
406
  // get the last import entry to get current base directory
399
407
  // struct Sass_Options* options = sass_compiler_get_options(compiler);
400
408
  Sass_Import_Entry import = sass_compiler_get_last_import(compiler);
401
- const std::vector<std::string>& incs = compiler->cpp_ctx->include_paths;
409
+ const sass::vector<sass::string>& incs = compiler->cpp_ctx->include_paths;
402
410
  // create the vector with paths to lookup
403
- std::vector<std::string> paths(1 + incs.size());
411
+ sass::vector<sass::string> paths(1 + incs.size());
404
412
  paths.push_back(dir_name(import->abs_path));
405
413
  paths.insert(paths.end(), incs.begin(), incs.end());
406
414
  // dispatch to find files in paths
@@ -409,7 +417,7 @@ namespace Sass {
409
417
 
410
418
  // helper function to search one file in all include paths
411
419
  // this is normally not used internally by libsass (C-API sugar)
412
- std::string find_file(const std::string& file, const std::vector<std::string> paths)
420
+ sass::string find_file(const sass::string& file, const sass::vector<sass::string> paths)
413
421
  {
414
422
  if (file.empty()) return file;
415
423
  auto res = find_files(file, paths);
@@ -417,29 +425,29 @@ namespace Sass {
417
425
  }
418
426
 
419
427
  // helper function to resolve a filename
420
- std::string find_include(const std::string& file, const std::vector<std::string> paths)
428
+ sass::string find_include(const sass::string& file, const sass::vector<sass::string> paths)
421
429
  {
422
430
  // search in every include path for a match
423
431
  for (size_t i = 0, S = paths.size(); i < S; ++i)
424
432
  {
425
- std::vector<Include> resolved(resolve_includes(paths[i], file));
433
+ sass::vector<Include> resolved(resolve_includes(paths[i], file));
426
434
  if (resolved.size()) return resolved[0].abs_path;
427
435
  }
428
436
  // nothing found
429
- return std::string("");
437
+ return sass::string("");
430
438
  }
431
439
 
432
440
  // try to load the given filename
433
441
  // returned memory must be freed
434
442
  // will auto convert .sass files
435
- char* read_file(const std::string& path)
443
+ char* read_file(const sass::string& path)
436
444
  {
437
445
  #ifdef _WIN32
438
446
  BYTE* pBuffer;
439
447
  DWORD dwBytes;
440
448
  wchar_t resolved[32768];
441
449
  // windows unicode filepaths are encoded in utf16
442
- std::string abspath(join_paths(get_cwd(), path));
450
+ sass::string abspath(join_paths(get_cwd(), path));
443
451
  if (!(abspath[0] == '/' && abspath[1] == '/')) {
444
452
  abspath = "//?/" + abspath;
445
453
  }
@@ -485,7 +493,7 @@ namespace Sass {
485
493
  contents[size] = '\0';
486
494
  contents[size + 1] = '\0';
487
495
  #endif
488
- std::string extension;
496
+ sass::string extension;
489
497
  if (path.length() > 5) {
490
498
  extension = path.substr(path.length() - 5, 5);
491
499
  }
@@ -500,21 +508,21 @@ namespace Sass {
500
508
  }
501
509
 
502
510
  // split a path string delimited by semicolons or colons (OS dependent)
503
- std::vector<std::string> split_path_list(const char* str)
511
+ sass::vector<sass::string> split_path_list(const char* str)
504
512
  {
505
- std::vector<std::string> paths;
513
+ sass::vector<sass::string> paths;
506
514
  if (str == NULL) return paths;
507
515
  // find delimiter via prelexer (return zero at end)
508
516
  const char* end = Prelexer::find_first<PATH_SEP>(str);
509
517
  // search until null delimiter
510
518
  while (end) {
511
519
  // add path from current position to delimiter
512
- paths.push_back(std::string(str, end - str));
520
+ paths.push_back(sass::string(str, end - str));
513
521
  str = end + 1; // skip delimiter
514
522
  end = Prelexer::find_first<PATH_SEP>(str);
515
523
  }
516
524
  // add path from current position to end
517
- paths.push_back(std::string(str));
525
+ paths.push_back(sass::string(str));
518
526
  // return back
519
527
  return paths;
520
528
  }
@@ -17,56 +17,56 @@ namespace Sass {
17
17
 
18
18
  // return the current directory
19
19
  // always with forward slashes
20
- std::string get_cwd();
20
+ sass::string get_cwd();
21
21
 
22
22
  // test if path exists and is a file
23
- bool file_exists(const std::string& file);
23
+ bool file_exists(const sass::string& file);
24
24
 
25
25
  // return if given path is absolute
26
26
  // works with *nix and windows paths
27
- bool is_absolute_path(const std::string& path);
27
+ bool is_absolute_path(const sass::string& path);
28
28
 
29
29
  // return only the directory part of path
30
- std::string dir_name(const std::string& path);
30
+ sass::string dir_name(const sass::string& path);
31
31
 
32
32
  // return only the filename part of path
33
- std::string base_name(const std::string&);
33
+ sass::string base_name(const sass::string&);
34
34
 
35
35
  // do a locigal clean up of the path
36
36
  // no physical check on the filesystem
37
- std::string make_canonical_path (std::string path);
37
+ sass::string make_canonical_path (sass::string path);
38
38
 
39
39
  // join two path segments cleanly together
40
40
  // but only if right side is not absolute yet
41
- std::string join_paths(std::string root, std::string name);
41
+ sass::string join_paths(sass::string root, sass::string name);
42
42
 
43
43
  // if the relative path is outside of the cwd we want want to
44
44
  // show the absolute path in console messages
45
- std::string path_for_console(const std::string& rel_path, const std::string& abs_path, const std::string& orig_path);
45
+ sass::string path_for_console(const sass::string& rel_path, const sass::string& abs_path, const sass::string& orig_path);
46
46
 
47
47
  // create an absolute path by resolving relative paths with cwd
48
- std::string rel2abs(const std::string& path, const std::string& base = ".", const std::string& cwd = get_cwd());
48
+ sass::string rel2abs(const sass::string& path, const sass::string& base = ".", const sass::string& cwd = get_cwd());
49
49
 
50
50
  // create a path that is relative to the given base directory
51
51
  // path and base will first be resolved against cwd to make them absolute
52
- std::string abs2rel(const std::string& path, const std::string& base = ".", const std::string& cwd = get_cwd());
52
+ sass::string abs2rel(const sass::string& path, const sass::string& base = ".", const sass::string& cwd = get_cwd());
53
53
 
54
54
  // helper function to resolve a filename
55
55
  // searching without variations in all paths
56
- std::string find_file(const std::string& file, struct Sass_Compiler* options);
57
- std::string find_file(const std::string& file, const std::vector<std::string> paths);
56
+ sass::string find_file(const sass::string& file, struct Sass_Compiler* options);
57
+ sass::string find_file(const sass::string& file, const sass::vector<sass::string> paths);
58
58
 
59
59
  // helper function to resolve a include filename
60
60
  // this has the original resolve logic for sass include
61
- std::string find_include(const std::string& file, const std::vector<std::string> paths);
61
+ sass::string find_include(const sass::string& file, const sass::vector<sass::string> paths);
62
62
 
63
63
  // split a path string delimited by semicolons or colons (OS dependent)
64
- std::vector<std::string> split_path_list(const char* paths);
64
+ sass::vector<sass::string> split_path_list(const char* paths);
65
65
 
66
66
  // try to load the given filename
67
67
  // returned memory must be freed
68
68
  // will auto convert .sass files
69
- char* read_file(const std::string& file);
69
+ char* read_file(const sass::string& file);
70
70
 
71
71
  }
72
72
 
@@ -74,14 +74,14 @@ namespace Sass {
74
74
  class Importer {
75
75
  public:
76
76
  // requested import path
77
- std::string imp_path;
77
+ sass::string imp_path;
78
78
  // parent context path
79
- std::string ctx_path;
79
+ sass::string ctx_path;
80
80
  // base derived from context path
81
81
  // this really just acts as a cache
82
- std::string base_path;
82
+ sass::string base_path;
83
83
  public:
84
- Importer(std::string imp_path, std::string ctx_path)
84
+ Importer(sass::string imp_path, sass::string ctx_path)
85
85
  : imp_path(File::make_canonical_path(imp_path)),
86
86
  ctx_path(File::make_canonical_path(ctx_path)),
87
87
  base_path(File::dir_name(ctx_path))
@@ -92,9 +92,9 @@ namespace Sass {
92
92
  class Include : public Importer {
93
93
  public:
94
94
  // resolved absolute path
95
- std::string abs_path;
95
+ sass::string abs_path;
96
96
  public:
97
- Include(const Importer& imp, std::string abs_path)
97
+ Include(const Importer& imp, sass::string abs_path)
98
98
  : Importer(imp), abs_path(abs_path)
99
99
  { }
100
100
  };
@@ -114,10 +114,8 @@ namespace Sass {
114
114
 
115
115
  namespace File {
116
116
 
117
- static std::vector<std::string> defaultExtensions = { ".scss", ".sass", ".css" };
118
-
119
- std::vector<Include> resolve_includes(const std::string& root, const std::string& file,
120
- const std::vector<std::string>& exts = defaultExtensions);
117
+ sass::vector<Include> resolve_includes(const sass::string& root, const sass::string& file,
118
+ const sass::vector<sass::string>& exts = { ".scss", ".sass", ".css" });
121
119
 
122
120
  }
123
121