sassc 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -283,21 +283,21 @@ extern "C" {
283
283
 
284
284
  union Sass_Value* ADDCALL sass_value_stringify (const union Sass_Value* v, bool compressed, int precision)
285
285
  {
286
- Value_Obj val = sass_value_to_ast_node(v);
286
+ ValueObj val = sass_value_to_ast_node(v);
287
287
  Sass_Inspect_Options options(compressed ? COMPRESSED : NESTED, precision);
288
- std::string str(val->to_string(options));
288
+ sass::string str(val->to_string(options));
289
289
  return sass_make_qstring(str.c_str());
290
290
  }
291
291
 
292
292
  union Sass_Value* ADDCALL sass_value_op (enum Sass_OP op, const union Sass_Value* a, const union Sass_Value* b)
293
293
  {
294
294
 
295
- Sass::Value_Obj rv;
295
+ Sass::ValueObj rv;
296
296
 
297
297
  try {
298
298
 
299
- Value_Obj lhs = sass_value_to_ast_node(a);
300
- Value_Obj rhs = sass_value_to_ast_node(b);
299
+ ValueObj lhs = sass_value_to_ast_node(a);
300
+ ValueObj rhs = sass_value_to_ast_node(b);
301
301
  struct Sass_Inspect_Options options(NESTED, 5);
302
302
 
303
303
  // see if it's a relational expression
@@ -340,12 +340,10 @@ extern "C" {
340
340
  rv = Operators::op_colors(op, *l_c, *r_c, options, l_c->pstate());
341
341
  }
342
342
  else /* convert other stuff to string and apply operation */ {
343
- Value* l_v = Cast<Value>(lhs);
344
- Value* r_v = Cast<Value>(rhs);
345
- rv = Operators::op_strings(op, *l_v, *r_v, options, l_v->pstate());
343
+ rv = Operators::op_strings(op, *lhs, *rhs, options, lhs->pstate());
346
344
  }
347
345
 
348
- // ToDo: maybe we should should return null value?
346
+ // ToDo: maybe we should return null value?
349
347
  if (!rv) return sass_make_error("invalid return value");
350
348
 
351
349
  // convert result back to ast node
@@ -356,7 +354,7 @@ extern "C" {
356
354
  catch (Exception::InvalidSass& e) { return sass_make_error(e.what()); }
357
355
  catch (std::bad_alloc&) { return sass_make_error("memory exhausted"); }
358
356
  catch (std::exception& e) { return sass_make_error(e.what()); }
359
- catch (std::string& e) { return sass_make_error(e.c_str()); }
357
+ catch (sass::string& e) { return sass_make_error(e.c_str()); }
360
358
  catch (const char* e) { return sass_make_error(e); }
361
359
  catch (...) { return sass_make_error("unknown"); }
362
360
  }
@@ -0,0 +1,19 @@
1
+ #ifndef SASS_SETTINGS_H
2
+ #define SASS_SETTINGS_H
3
+
4
+ // Global compile time settings should go here
5
+
6
+ // When enabled we use our custom memory pool allocator
7
+ // With intense workloads this can double the performance
8
+ // Max memory usage mostly only grows by a slight amount
9
+ // #define SASS_CUSTOM_ALLOCATOR
10
+
11
+ // How many buckets should we have for the free-list
12
+ // Determines when allocations go directly to malloc/free
13
+ // For maximum size of managed items multiply by alignment
14
+ #define SassAllocatorBuckets 512
15
+
16
+ // The size of the memory pool arenas in bytes.
17
+ #define SassAllocatorArenaSize (1024 * 256)
18
+
19
+ #endif
@@ -0,0 +1,69 @@
1
+ #include <stdio.h>
2
+ #include <string.h>
3
+ #include "source.hpp"
4
+ #include "utf8/checked.h"
5
+ #include "position.hpp"
6
+
7
+ namespace Sass {
8
+
9
+ SourceData::SourceData()
10
+ : SharedObj()
11
+ {
12
+ }
13
+
14
+ SourceFile::SourceFile(
15
+ const char* path,
16
+ const char* data,
17
+ size_t srcid) :
18
+ SourceData(),
19
+ path(sass_copy_c_string(path)),
20
+ data(sass_copy_c_string(data)),
21
+ length(0),
22
+ srcid(srcid)
23
+ {
24
+ length = strlen(data);
25
+ }
26
+
27
+ SourceFile::~SourceFile() {
28
+ sass_free_memory(path);
29
+ sass_free_memory(data);
30
+ }
31
+
32
+ const char* SourceFile::end() const
33
+ {
34
+ return data + length;
35
+ }
36
+
37
+ const char* SourceFile::begin() const
38
+ {
39
+ return data;
40
+ }
41
+
42
+ const char* SourceFile::getRawData() const
43
+ {
44
+ return data;
45
+ }
46
+
47
+ SourceSpan SourceFile::getSourceSpan()
48
+ {
49
+ return SourceSpan(this);
50
+ }
51
+
52
+ ItplFile::ItplFile(const char* data, const SourceSpan& pstate) :
53
+ SourceFile(pstate.getPath(),
54
+ data, pstate.getSrcId()),
55
+ pstate(pstate)
56
+ {}
57
+
58
+ const char* ItplFile::getRawData() const
59
+ {
60
+ return pstate.getRawData();
61
+ }
62
+
63
+ SourceSpan ItplFile::getSourceSpan()
64
+ {
65
+ return SourceSpan(pstate);
66
+ }
67
+
68
+ }
69
+
@@ -0,0 +1,95 @@
1
+ #ifndef SASS_SOURCE_H
2
+ #define SASS_SOURCE_H
3
+
4
+ #include "sass.hpp"
5
+ #include "memory.hpp"
6
+ #include "position.hpp"
7
+ #include "source_data.hpp"
8
+
9
+ namespace Sass {
10
+
11
+ class SourceFile :
12
+ public SourceData {
13
+ protected:
14
+ char* path;
15
+ char* data;
16
+ size_t length;
17
+ size_t srcid;
18
+ public:
19
+
20
+ SourceFile(
21
+ const char* path,
22
+ const char* data,
23
+ size_t srcid);
24
+
25
+ ~SourceFile();
26
+
27
+ const char* end() const override final;
28
+ const char* begin() const override final;
29
+ virtual const char* getRawData() const override;
30
+ virtual SourceSpan getSourceSpan() override;
31
+
32
+ size_t size() const override final {
33
+ return length;
34
+ }
35
+
36
+ virtual const char* getPath() const override {
37
+ return path;
38
+ }
39
+
40
+ virtual size_t getSrcId() const override {
41
+ return srcid;
42
+ }
43
+
44
+ };
45
+
46
+ class SynthFile :
47
+ public SourceData {
48
+ protected:
49
+ const char* path;
50
+ public:
51
+
52
+ SynthFile(
53
+ const char* path) :
54
+ path(path)
55
+ {}
56
+
57
+ ~SynthFile() {}
58
+
59
+ const char* end() const override final { return nullptr; }
60
+ const char* begin() const override final { return nullptr; };
61
+ virtual const char* getRawData() const override { return nullptr; };
62
+ virtual SourceSpan getSourceSpan() override { return SourceSpan(path); };
63
+
64
+ size_t size() const override final {
65
+ return 0;
66
+ }
67
+
68
+ virtual const char* getPath() const override {
69
+ return path;
70
+ }
71
+
72
+ virtual size_t getSrcId() const override {
73
+ return std::string::npos;
74
+ }
75
+
76
+ };
77
+
78
+
79
+ class ItplFile :
80
+ public SourceFile {
81
+ private:
82
+ SourceSpan pstate;
83
+ public:
84
+
85
+ ItplFile(const char* data,
86
+ const SourceSpan& pstate);
87
+
88
+ // Offset getPosition() const override final;
89
+ const char* getRawData() const override final;
90
+ SourceSpan getSourceSpan() override final;
91
+ };
92
+
93
+ }
94
+
95
+ #endif
@@ -0,0 +1,32 @@
1
+ #ifndef SASS_SOURCE_DATA_H
2
+ #define SASS_SOURCE_DATA_H
3
+
4
+ #include "sass.hpp"
5
+ #include "memory.hpp"
6
+
7
+ namespace Sass {
8
+
9
+ class SourceSpan;
10
+
11
+ class SourceData :
12
+ public SharedObj {
13
+ public:
14
+ SourceData();
15
+ virtual size_t size() const = 0;
16
+ virtual size_t getSrcId() const = 0;
17
+ virtual const char* end() const = 0;
18
+ virtual const char* begin() const = 0;
19
+ virtual const char* getPath() const = 0;
20
+ // virtual Offset getPosition() const = 0;
21
+ virtual const char* getRawData() const = 0;
22
+ virtual SourceSpan getSourceSpan() = 0;
23
+
24
+ sass::string to_string() const override {
25
+ return sass::string{ begin(), end() };
26
+ }
27
+ ~SourceData() {}
28
+ };
29
+
30
+ }
31
+
32
+ #endif
@@ -15,13 +15,13 @@
15
15
 
16
16
  namespace Sass {
17
17
  SourceMap::SourceMap() : current_position(0, 0, 0), file("stdin") { }
18
- SourceMap::SourceMap(const std::string& file) : current_position(0, 0, 0), file(file) { }
18
+ SourceMap::SourceMap(const sass::string& file) : current_position(0, 0, 0), file(file) { }
19
19
 
20
- std::string SourceMap::render_srcmap(Context &ctx) {
20
+ sass::string SourceMap::render_srcmap(Context &ctx) {
21
21
 
22
22
  const bool include_sources = ctx.c_options.source_map_contents;
23
- const std::vector<std::string> links = ctx.srcmap_links;
24
- const std::vector<Resource>& sources(ctx.resources);
23
+ const sass::vector<sass::string> links = ctx.srcmap_links;
24
+ const sass::vector<Resource>& sources(ctx.resources);
25
25
 
26
26
  JsonNode* json_srcmap = json_mkobject();
27
27
 
@@ -39,7 +39,7 @@ namespace Sass {
39
39
 
40
40
  JsonNode *json_sources = json_mkarray();
41
41
  for (size_t i = 0; i < source_index.size(); ++i) {
42
- std::string source(links[source_index[i]]);
42
+ sass::string source(links[source_index[i]]);
43
43
  if (ctx.c_options.source_map_file_urls) {
44
44
  source = File::rel2abs(source);
45
45
  // check for windows abs path
@@ -72,19 +72,19 @@ namespace Sass {
72
72
  // no problem as we do not alter any identifiers
73
73
  json_append_member(json_srcmap, "names", json_names);
74
74
 
75
- std::string mappings = serialize_mappings();
75
+ sass::string mappings = serialize_mappings();
76
76
  JsonNode *json_mappings = json_mkstring(mappings.c_str());
77
77
  json_append_member(json_srcmap, "mappings", json_mappings);
78
78
 
79
79
  char *str = json_stringify(json_srcmap, "\t");
80
- std::string result = std::string(str);
80
+ sass::string result = sass::string(str);
81
81
  free(str);
82
82
  json_delete(json_srcmap);
83
83
  return result;
84
84
  }
85
85
 
86
- std::string SourceMap::serialize_mappings() {
87
- std::string result = "";
86
+ sass::string SourceMap::serialize_mappings() {
87
+ sass::string result = "";
88
88
 
89
89
  size_t previous_generated_line = 0;
90
90
  size_t previous_generated_column = 0;
@@ -101,7 +101,7 @@ namespace Sass {
101
101
  if (generated_line != previous_generated_line) {
102
102
  previous_generated_column = 0;
103
103
  if (generated_line > previous_generated_line) {
104
- result += std::string(generated_line - previous_generated_line, ';');
104
+ result += sass::string(generated_line - previous_generated_line, ';');
105
105
  previous_generated_line = generated_line;
106
106
  }
107
107
  }
@@ -175,23 +175,27 @@ namespace Sass {
175
175
 
176
176
  void SourceMap::add_open_mapping(const AST_Node* node)
177
177
  {
178
- mappings.push_back(Mapping(node->pstate(), current_position));
178
+ const SourceSpan& span(node->pstate());
179
+ Position from(span.getSrcId(), span.position);
180
+ mappings.push_back(Mapping(from, current_position));
179
181
  }
180
182
 
181
183
  void SourceMap::add_close_mapping(const AST_Node* node)
182
184
  {
183
- mappings.push_back(Mapping(node->pstate() + node->pstate().offset, current_position));
185
+ const SourceSpan& span(node->pstate());
186
+ Position to(span.getSrcId(), span.position + span.offset);
187
+ mappings.push_back(Mapping(to, current_position));
184
188
  }
185
189
 
186
- ParserState SourceMap::remap(const ParserState& pstate) {
190
+ SourceSpan SourceMap::remap(const SourceSpan& pstate) {
187
191
  for (size_t i = 0; i < mappings.size(); ++i) {
188
192
  if (
189
- mappings[i].generated_position.file == pstate.file &&
190
- mappings[i].generated_position.line == pstate.line &&
191
- mappings[i].generated_position.column == pstate.column
192
- ) return ParserState(pstate.path, pstate.src, mappings[i].original_position, pstate.offset);
193
+ mappings[i].generated_position.file == pstate.getSrcId() &&
194
+ mappings[i].generated_position.line == pstate.position.line &&
195
+ mappings[i].generated_position.column == pstate.position.column
196
+ ) return SourceSpan(pstate.source, mappings[i].original_position, pstate.offset);
193
197
  }
194
- return ParserState(pstate.path, pstate.src, Position(-1, -1, -1), Offset(0, 0));
198
+ return SourceSpan(pstate.source, Position(-1, -1, -1), Offset(0, 0));
195
199
 
196
200
  }
197
201
 
@@ -9,6 +9,9 @@
9
9
  #include "position.hpp"
10
10
  #include "mapping.hpp"
11
11
 
12
+ #include "backtrace.hpp"
13
+ #include "memory.hpp"
14
+
12
15
  #define VECTOR_PUSH(vec, ins) vec.insert(vec.end(), ins.begin(), ins.end())
13
16
  #define VECTOR_UNSHIFT(vec, ins) vec.insert(vec.begin(), ins.begin(), ins.end())
14
17
 
@@ -20,9 +23,9 @@ namespace Sass {
20
23
  class SourceMap {
21
24
 
22
25
  public:
23
- std::vector<size_t> source_index;
26
+ sass::vector<size_t> source_index;
24
27
  SourceMap();
25
- SourceMap(const std::string& file);
28
+ SourceMap(const sass::string& file);
26
29
 
27
30
  void append(const Offset& offset);
28
31
  void prepend(const Offset& offset);
@@ -31,17 +34,17 @@ namespace Sass {
31
34
  void add_open_mapping(const AST_Node* node);
32
35
  void add_close_mapping(const AST_Node* node);
33
36
 
34
- std::string render_srcmap(Context &ctx);
35
- ParserState remap(const ParserState& pstate);
37
+ sass::string render_srcmap(Context &ctx);
38
+ SourceSpan remap(const SourceSpan& pstate);
36
39
 
37
40
  private:
38
41
 
39
- std::string serialize_mappings();
42
+ sass::string serialize_mappings();
40
43
 
41
- std::vector<Mapping> mappings;
44
+ sass::vector<Mapping> mappings;
42
45
  Position current_position;
43
46
  public:
44
- std::string file;
47
+ sass::string file;
45
48
  private:
46
49
  Base64VLQ base64vlq;
47
50
  };
@@ -49,11 +52,11 @@ private:
49
52
  class OutputBuffer {
50
53
  public:
51
54
  OutputBuffer(void)
52
- : buffer(""),
55
+ : buffer(),
53
56
  smap()
54
57
  { }
55
58
  public:
56
- std::string buffer;
59
+ sass::string buffer;
57
60
  SourceMap smap;
58
61
  };
59
62
 
@@ -65,7 +65,7 @@ namespace Sass {
65
65
  }
66
66
  };
67
67
 
68
- std::string get_unit_class(UnitType unit)
68
+ sass::string get_unit_class(UnitType unit)
69
69
  {
70
70
  switch (unit & 0xFF00)
71
71
  {
@@ -91,7 +91,7 @@ namespace Sass {
91
91
  }
92
92
  };
93
93
 
94
- UnitType string_to_unit(const std::string& s)
94
+ UnitType string_to_unit(const sass::string& s)
95
95
  {
96
96
  // size units
97
97
  if (s == "px") return UnitType::PX;
@@ -149,7 +149,7 @@ namespace Sass {
149
149
  }
150
150
  }
151
151
 
152
- std::string unit_to_class(const std::string& s)
152
+ sass::string unit_to_class(const sass::string& s)
153
153
  {
154
154
  if (s == "px") return "LENGTH";
155
155
  else if (s == "pt") return "LENGTH";
@@ -177,7 +177,7 @@ namespace Sass {
177
177
  }
178
178
 
179
179
  // throws incompatibleUnits exceptions
180
- double conversion_factor(const std::string& s1, const std::string& s2)
180
+ double conversion_factor(const sass::string& s1, const sass::string& s2)
181
181
  {
182
182
  // assert for same units
183
183
  if (s1 == s2) return 1;
@@ -219,7 +219,7 @@ namespace Sass {
219
219
  return 0;
220
220
  }
221
221
 
222
- double convert_units(const std::string& lhs, const std::string& rhs, int& lhsexp, int& rhsexp)
222
+ double convert_units(const sass::string& lhs, const sass::string& rhs, int& lhsexp, int& rhsexp)
223
223
  {
224
224
  double f = 0;
225
225
  // do not convert same ones
@@ -283,7 +283,7 @@ namespace Sass {
283
283
  double factor = 1;
284
284
 
285
285
  for (size_t i = 0; i < iL; i++) {
286
- std::string &lhs = numerators[i];
286
+ sass::string &lhs = numerators[i];
287
287
  UnitType ulhs = string_to_unit(lhs);
288
288
  if (ulhs == UNKNOWN) continue;
289
289
  UnitClass clhs = get_unit_type(ulhs);
@@ -296,7 +296,7 @@ namespace Sass {
296
296
  }
297
297
 
298
298
  for (size_t n = 0; n < nL; n++) {
299
- std::string &rhs = denominators[n];
299
+ sass::string &rhs = denominators[n];
300
300
  UnitType urhs = string_to_unit(rhs);
301
301
  if (urhs == UNKNOWN) continue;
302
302
  UnitClass crhs = get_unit_type(urhs);
@@ -328,7 +328,7 @@ namespace Sass {
328
328
  // it seems that a map table will fit nicely to do this
329
329
  // we basically construct exponents for each unit
330
330
  // has the advantage that they will be pre-sorted
331
- std::map<std::string, int> exponents;
331
+ std::map<sass::string, int> exponents;
332
332
 
333
333
  // initialize by summing up occurrences in unit vectors
334
334
  // this will already cancel out equivalent units (e.q. px/px)
@@ -341,7 +341,7 @@ namespace Sass {
341
341
  // convert between compatible units
342
342
  for (size_t i = 0; i < iL; i++) {
343
343
  for (size_t n = 0; n < nL; n++) {
344
- std::string &lhs = numerators[i], &rhs = denominators[n];
344
+ sass::string &lhs = numerators[i], &rhs = denominators[n];
345
345
  int &lhsexp = exponents[lhs], &rhsexp = exponents[rhs];
346
346
  double f(convert_units(lhs, rhs, lhsexp, rhsexp));
347
347
  if (f == 0) continue;
@@ -367,9 +367,9 @@ namespace Sass {
367
367
 
368
368
  }
369
369
 
370
- std::string Units::unit() const
370
+ sass::string Units::unit() const
371
371
  {
372
- std::string u;
372
+ sass::string u;
373
373
  size_t iL = numerators.size();
374
374
  size_t nL = denominators.size();
375
375
  for (size_t i = 0; i < iL; i += 1) {
@@ -400,11 +400,11 @@ namespace Sass {
400
400
  double Units::convert_factor(const Units& r) const
401
401
  {
402
402
 
403
- std::vector<std::string> miss_nums(0);
404
- std::vector<std::string> miss_dens(0);
403
+ sass::vector<sass::string> miss_nums(0);
404
+ sass::vector<sass::string> miss_dens(0);
405
405
  // create copy since we need these for state keeping
406
- std::vector<std::string> r_nums(r.numerators);
407
- std::vector<std::string> r_dens(r.denominators);
406
+ sass::vector<sass::string> r_nums(r.numerators);
407
+ sass::vector<sass::string> r_dens(r.denominators);
408
408
 
409
409
  auto l_num_it = numerators.begin();
410
410
  auto l_num_end = numerators.end();
@@ -419,7 +419,7 @@ namespace Sass {
419
419
  while (l_num_it != l_num_end)
420
420
  {
421
421
  // get and increment afterwards
422
- const std::string l_num = *(l_num_it ++);
422
+ const sass::string l_num = *(l_num_it ++);
423
423
 
424
424
  auto r_num_it = r_nums.begin(), r_num_end = r_nums.end();
425
425
 
@@ -428,7 +428,7 @@ namespace Sass {
428
428
  while (r_num_it != r_num_end)
429
429
  {
430
430
  // get and increment afterwards
431
- const std::string r_num = *(r_num_it);
431
+ const sass::string r_num = *(r_num_it);
432
432
  // get possible conversion factor for units
433
433
  double conversion = conversion_factor(l_num, r_num);
434
434
  // skip incompatible numerator
@@ -456,7 +456,7 @@ namespace Sass {
456
456
  while (l_den_it != l_den_end)
457
457
  {
458
458
  // get and increment afterwards
459
- const std::string l_den = *(l_den_it ++);
459
+ const sass::string l_den = *(l_den_it ++);
460
460
 
461
461
  auto r_den_it = r_dens.begin();
462
462
  auto r_den_end = r_dens.end();
@@ -466,7 +466,7 @@ namespace Sass {
466
466
  while (r_den_it != r_den_end)
467
467
  {
468
468
  // get and increment afterwards
469
- const std::string r_den = *(r_den_it);
469
+ const sass::string r_den = *(r_den_it);
470
470
  // get possible conversion factor for units
471
471
  double conversion = conversion_factor(l_den, r_den);
472
472
  // skip incompatible denominator