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
@@ -26,7 +26,7 @@ namespace Sass {
26
26
  { }
27
27
 
28
28
  // return buffer as string
29
- std::string Emitter::get_buffer(void)
29
+ sass::string Emitter::get_buffer(void)
30
30
  {
31
31
  return wbuf.buffer;
32
32
  }
@@ -41,10 +41,10 @@ namespace Sass {
41
41
  void Emitter::add_source_index(size_t idx)
42
42
  { wbuf.smap.source_index.push_back(idx); }
43
43
 
44
- std::string Emitter::render_srcmap(Context &ctx)
44
+ sass::string Emitter::render_srcmap(Context &ctx)
45
45
  { return wbuf.smap.render_srcmap(ctx); }
46
46
 
47
- void Emitter::set_filename(const std::string& str)
47
+ void Emitter::set_filename(const sass::string& str)
48
48
  { wbuf.smap.file = str; }
49
49
 
50
50
  void Emitter::schedule_mapping(const AST_Node* node)
@@ -53,7 +53,7 @@ namespace Sass {
53
53
  { wbuf.smap.add_open_mapping(node); }
54
54
  void Emitter::add_close_mapping(const AST_Node* node)
55
55
  { wbuf.smap.add_close_mapping(node); }
56
- ParserState Emitter::remap(const ParserState& pstate)
56
+ SourceSpan Emitter::remap(const SourceSpan& pstate)
57
57
  { return wbuf.smap.remap(pstate); }
58
58
 
59
59
  // MAIN BUFFER MANIPULATION
@@ -74,7 +74,7 @@ namespace Sass {
74
74
  {
75
75
  // check the schedule
76
76
  if (scheduled_linefeed) {
77
- std::string linefeeds = "";
77
+ sass::string linefeeds = "";
78
78
 
79
79
  for (size_t i = 0; i < scheduled_linefeed; i++)
80
80
  linefeeds += opt.linefeed;
@@ -83,7 +83,7 @@ namespace Sass {
83
83
  append_string(linefeeds);
84
84
 
85
85
  } else if (scheduled_space) {
86
- std::string spaces(scheduled_space, ' ');
86
+ sass::string spaces(scheduled_space, ' ');
87
87
  scheduled_space = 0;
88
88
  append_string(spaces);
89
89
  }
@@ -101,7 +101,7 @@ namespace Sass {
101
101
  }
102
102
 
103
103
  // prepend some text or token to the buffer
104
- void Emitter::prepend_string(const std::string& text)
104
+ void Emitter::prepend_string(const sass::string& text)
105
105
  {
106
106
  // do not adjust mappings for utf8 bom
107
107
  // seems they are not counted in any UA
@@ -128,14 +128,14 @@ namespace Sass {
128
128
  }
129
129
 
130
130
  // append some text or token to the buffer
131
- void Emitter::append_string(const std::string& text)
131
+ void Emitter::append_string(const sass::string& text)
132
132
  {
133
133
 
134
134
  // write space/lf
135
135
  flush_schedules();
136
136
 
137
137
  if (in_comment) {
138
- std::string out = Util::normalize_newlines(text);
138
+ sass::string out = Util::normalize_newlines(text);
139
139
  if (output_style() == COMPACT) {
140
140
  out = comment_to_compact_string(out);
141
141
  }
@@ -150,7 +150,7 @@ namespace Sass {
150
150
  }
151
151
 
152
152
  // append some white-space only text
153
- void Emitter::append_wspace(const std::string& text)
153
+ void Emitter::append_wspace(const sass::string& text)
154
154
  {
155
155
  if (text.empty()) return;
156
156
  if (peek_linefeed(text.c_str())) {
@@ -161,7 +161,7 @@ namespace Sass {
161
161
 
162
162
  // append some text or token to the buffer
163
163
  // this adds source-mappings for node start and end
164
- void Emitter::append_token(const std::string& text, const AST_Node* node)
164
+ void Emitter::append_token(const sass::string& text, const AST_Node* node)
165
165
  {
166
166
  flush_schedules();
167
167
  add_open_mapping(node);
@@ -184,7 +184,7 @@ namespace Sass {
184
184
  if (in_declaration && in_comma_array) return;
185
185
  if (scheduled_linefeed && indentation)
186
186
  scheduled_linefeed = 1;
187
- std::string indent = "";
187
+ sass::string indent = "";
188
188
  for (size_t i = 0; i < indentation; i++)
189
189
  indent += opt.indent;
190
190
  append_string(indent);
@@ -21,17 +21,17 @@ namespace Sass {
21
21
  protected:
22
22
  OutputBuffer wbuf;
23
23
  public:
24
- const std::string& buffer(void) { return wbuf.buffer; }
24
+ const sass::string& buffer(void) { return wbuf.buffer; }
25
25
  const SourceMap smap(void) { return wbuf.smap; }
26
26
  const OutputBuffer output(void) { return wbuf; }
27
27
  // proxy methods for source maps
28
28
  void add_source_index(size_t idx);
29
- void set_filename(const std::string& str);
29
+ void set_filename(const sass::string& str);
30
30
  void add_open_mapping(const AST_Node* node);
31
31
  void add_close_mapping(const AST_Node* node);
32
32
  void schedule_mapping(const AST_Node* node);
33
- std::string render_srcmap(Context &ctx);
34
- ParserState remap(const ParserState& pstate);
33
+ sass::string render_srcmap(Context &ctx);
34
+ SourceSpan remap(const SourceSpan& pstate);
35
35
 
36
36
  public:
37
37
  struct Sass_Output_Options& opt;
@@ -58,8 +58,8 @@ namespace Sass {
58
58
  bool in_comma_array;
59
59
 
60
60
  public:
61
- // return buffer as std::string
62
- std::string get_buffer(void);
61
+ // return buffer as sass::string
62
+ sass::string get_buffer(void);
63
63
  // flush scheduled space/linefeed
64
64
  Sass_Output_Style output_style(void) const;
65
65
  // add outstanding linefeed
@@ -67,17 +67,17 @@ namespace Sass {
67
67
  // flush scheduled space/linefeed
68
68
  void flush_schedules(void);
69
69
  // prepend some text or token to the buffer
70
- void prepend_string(const std::string& text);
70
+ void prepend_string(const sass::string& text);
71
71
  void prepend_output(const OutputBuffer& out);
72
72
  // append some text or token to the buffer
73
- void append_string(const std::string& text);
73
+ void append_string(const sass::string& text);
74
74
  // append a single character to buffer
75
75
  void append_char(const char chr);
76
76
  // append some white-space only text
77
- void append_wspace(const std::string& text);
77
+ void append_wspace(const sass::string& text);
78
78
  // append some text or token to the buffer
79
79
  // this adds source-mappings for node start and end
80
- void append_token(const std::string& text, const AST_Node* node);
80
+ void append_token(const sass::string& text, const AST_Node* node);
81
81
  // query last appended character
82
82
  char last_char();
83
83
 
@@ -6,17 +6,17 @@ namespace Sass {
6
6
 
7
7
  template <typename T>
8
8
  Environment<T>::Environment(bool is_shadow)
9
- : local_frame_(environment_map<std::string, T>()),
9
+ : local_frame_(environment_map<sass::string, T>()),
10
10
  parent_(0), is_shadow_(false)
11
11
  { }
12
12
  template <typename T>
13
13
  Environment<T>::Environment(Environment<T>* env, bool is_shadow)
14
- : local_frame_(environment_map<std::string, T>()),
14
+ : local_frame_(environment_map<sass::string, T>()),
15
15
  parent_(env), is_shadow_(is_shadow)
16
16
  { }
17
17
  template <typename T>
18
18
  Environment<T>::Environment(Environment<T>& env, bool is_shadow)
19
- : local_frame_(environment_map<std::string, T>()),
19
+ : local_frame_(environment_map<sass::string, T>()),
20
20
  parent_(&env), is_shadow_(is_shadow)
21
21
  { }
22
22
 
@@ -45,16 +45,16 @@ namespace Sass {
45
45
  }
46
46
 
47
47
  template <typename T>
48
- environment_map<std::string, T>& Environment<T>::local_frame() {
48
+ environment_map<sass::string, T>& Environment<T>::local_frame() {
49
49
  return local_frame_;
50
50
  }
51
51
 
52
52
  template <typename T>
53
- bool Environment<T>::has_local(const std::string& key) const
53
+ bool Environment<T>::has_local(const sass::string& key) const
54
54
  { return local_frame_.find(key) != local_frame_.end(); }
55
55
 
56
56
  template <typename T> EnvResult
57
- Environment<T>::find_local(const std::string& key)
57
+ Environment<T>::find_local(const sass::string& key)
58
58
  {
59
59
  auto end = local_frame_.end();
60
60
  auto it = local_frame_.find(key);
@@ -62,22 +62,22 @@ namespace Sass {
62
62
  }
63
63
 
64
64
  template <typename T>
65
- T& Environment<T>::get_local(const std::string& key)
65
+ T& Environment<T>::get_local(const sass::string& key)
66
66
  { return local_frame_[key]; }
67
67
 
68
68
  template <typename T>
69
- void Environment<T>::set_local(const std::string& key, const T& val)
69
+ void Environment<T>::set_local(const sass::string& key, const T& val)
70
70
  {
71
71
  local_frame_[key] = val;
72
72
  }
73
73
  template <typename T>
74
- void Environment<T>::set_local(const std::string& key, T&& val)
74
+ void Environment<T>::set_local(const sass::string& key, T&& val)
75
75
  {
76
76
  local_frame_[key] = val;
77
77
  }
78
78
 
79
79
  template <typename T>
80
- void Environment<T>::del_local(const std::string& key)
80
+ void Environment<T>::del_local(const sass::string& key)
81
81
  { local_frame_.erase(key); }
82
82
 
83
83
  template <typename T>
@@ -91,30 +91,30 @@ namespace Sass {
91
91
  }
92
92
 
93
93
  template <typename T>
94
- bool Environment<T>::has_global(const std::string& key)
94
+ bool Environment<T>::has_global(const sass::string& key)
95
95
  { return global_env()->has(key); }
96
96
 
97
97
  template <typename T>
98
- T& Environment<T>::get_global(const std::string& key)
98
+ T& Environment<T>::get_global(const sass::string& key)
99
99
  { return (*global_env())[key]; }
100
100
 
101
101
  template <typename T>
102
- void Environment<T>::set_global(const std::string& key, const T& val)
102
+ void Environment<T>::set_global(const sass::string& key, const T& val)
103
103
  {
104
104
  global_env()->local_frame_[key] = val;
105
105
  }
106
106
  template <typename T>
107
- void Environment<T>::set_global(const std::string& key, T&& val)
107
+ void Environment<T>::set_global(const sass::string& key, T&& val)
108
108
  {
109
109
  global_env()->local_frame_[key] = val;
110
110
  }
111
111
 
112
112
  template <typename T>
113
- void Environment<T>::del_global(const std::string& key)
113
+ void Environment<T>::del_global(const sass::string& key)
114
114
  { global_env()->local_frame_.erase(key); }
115
115
 
116
116
  template <typename T>
117
- Environment<T>* Environment<T>::lexical_env(const std::string& key)
117
+ Environment<T>* Environment<T>::lexical_env(const sass::string& key)
118
118
  {
119
119
  Environment* cur = this;
120
120
  while (cur) {
@@ -130,7 +130,7 @@ namespace Sass {
130
130
  // move down the stack but stop before we
131
131
  // reach the global frame (is not included)
132
132
  template <typename T>
133
- bool Environment<T>::has_lexical(const std::string& key) const
133
+ bool Environment<T>::has_lexical(const sass::string& key) const
134
134
  {
135
135
  auto cur = this;
136
136
  while (cur->is_lexical()) {
@@ -144,7 +144,7 @@ namespace Sass {
144
144
  // either update already existing lexical value
145
145
  // or if flag is set, we create one if no lexical found
146
146
  template <typename T>
147
- void Environment<T>::set_lexical(const std::string& key, const T& val)
147
+ void Environment<T>::set_lexical(const sass::string& key, const T& val)
148
148
  {
149
149
  Environment<T>* cur = this;
150
150
  bool shadow = false;
@@ -161,7 +161,7 @@ namespace Sass {
161
161
  }
162
162
  // this one moves the value
163
163
  template <typename T>
164
- void Environment<T>::set_lexical(const std::string& key, T&& val)
164
+ void Environment<T>::set_lexical(const sass::string& key, T&& val)
165
165
  {
166
166
  Environment<T>* cur = this;
167
167
  bool shadow = false;
@@ -180,7 +180,7 @@ namespace Sass {
180
180
  // look on the full stack for key
181
181
  // include all scopes available
182
182
  template <typename T>
183
- bool Environment<T>::has(const std::string& key) const
183
+ bool Environment<T>::has(const sass::string& key) const
184
184
  {
185
185
  auto cur = this;
186
186
  while (cur) {
@@ -195,7 +195,7 @@ namespace Sass {
195
195
  // look on the full stack for key
196
196
  // include all scopes available
197
197
  template <typename T> EnvResult
198
- Environment<T>::find(const std::string& key)
198
+ Environment<T>::find(const sass::string& key)
199
199
  {
200
200
  auto cur = this;
201
201
  while (true) {
@@ -208,7 +208,7 @@ namespace Sass {
208
208
 
209
209
  // use array access for getter and setter functions
210
210
  template <typename T>
211
- T& Environment<T>::get(const std::string& key)
211
+ T& Environment<T>::get(const sass::string& key)
212
212
  {
213
213
  auto cur = this;
214
214
  while (cur) {
@@ -222,7 +222,7 @@ namespace Sass {
222
222
 
223
223
  // use array access for getter and setter functions
224
224
  template <typename T>
225
- T& Environment<T>::operator[](const std::string& key)
225
+ T& Environment<T>::operator[](const sass::string& key)
226
226
  {
227
227
  auto cur = this;
228
228
  while (cur) {
@@ -236,14 +236,14 @@ namespace Sass {
236
236
  /*
237
237
  #ifdef DEBUG
238
238
  template <typename T>
239
- size_t Environment<T>::print(std::string prefix)
239
+ size_t Environment<T>::print(sass::string prefix)
240
240
  {
241
241
  size_t indent = 0;
242
242
  if (parent_) indent = parent_->print(prefix) + 1;
243
- std::cerr << prefix << std::string(indent, ' ') << "== " << this << std::endl;
244
- for (typename environment_map<std::string, T>::iterator i = local_frame_.begin(); i != local_frame_.end(); ++i) {
243
+ std::cerr << prefix << sass::string(indent, ' ') << "== " << this << std::endl;
244
+ for (typename environment_map<sass::string, T>::iterator i = local_frame_.begin(); i != local_frame_.end(); ++i) {
245
245
  if (!ends_with(i->first, "[f]") && !ends_with(i->first, "[f]4") && !ends_with(i->first, "[f]2")) {
246
- std::cerr << prefix << std::string(indent, ' ') << i->first << " " << i->second;
246
+ std::cerr << prefix << sass::string(indent, ' ') << i->first << " " << i->second;
247
247
  if (Value* val = Cast<Value>(i->second))
248
248
  { std::cerr << " : " << val->to_string(); }
249
249
  std::cerr << std::endl;
@@ -13,7 +13,7 @@
13
13
  namespace Sass {
14
14
 
15
15
  // this defeats the whole purpose of environment being templatable!!
16
- typedef environment_map<std::string, AST_Node_Obj>::iterator EnvIter;
16
+ typedef environment_map<sass::string, AST_Node_Obj>::iterator EnvIter;
17
17
 
18
18
  class EnvResult {
19
19
  public:
@@ -27,7 +27,7 @@ namespace Sass {
27
27
  template <typename T>
28
28
  class Environment {
29
29
  // TODO: test with map
30
- environment_map<std::string, T> local_frame_;
30
+ environment_map<sass::string, T> local_frame_;
31
31
  ADD_PROPERTY(Environment*, parent)
32
32
  ADD_PROPERTY(bool, is_shadow)
33
33
 
@@ -52,72 +52,72 @@ namespace Sass {
52
52
 
53
53
  // scope operates on the current frame
54
54
 
55
- environment_map<std::string, T>& local_frame();
55
+ environment_map<sass::string, T>& local_frame();
56
56
 
57
- bool has_local(const std::string& key) const;
57
+ bool has_local(const sass::string& key) const;
58
58
 
59
- EnvResult find_local(const std::string& key);
59
+ EnvResult find_local(const sass::string& key);
60
60
 
61
- T& get_local(const std::string& key);
61
+ T& get_local(const sass::string& key);
62
62
 
63
63
  // set variable on the current frame
64
- void set_local(const std::string& key, const T& val);
65
- void set_local(const std::string& key, T&& val);
64
+ void set_local(const sass::string& key, const T& val);
65
+ void set_local(const sass::string& key, T&& val);
66
66
 
67
- void del_local(const std::string& key);
67
+ void del_local(const sass::string& key);
68
68
 
69
69
  // global operates on the global frame
70
70
  // which is the second last on the stack
71
71
  Environment* global_env();
72
72
  // get the env where the variable already exists
73
73
  // if it does not yet exist, we return current env
74
- Environment* lexical_env(const std::string& key);
74
+ Environment* lexical_env(const sass::string& key);
75
75
 
76
- bool has_global(const std::string& key);
76
+ bool has_global(const sass::string& key);
77
77
 
78
- T& get_global(const std::string& key);
78
+ T& get_global(const sass::string& key);
79
79
 
80
80
  // set a variable on the global frame
81
- void set_global(const std::string& key, const T& val);
82
- void set_global(const std::string& key, T&& val);
81
+ void set_global(const sass::string& key, const T& val);
82
+ void set_global(const sass::string& key, T&& val);
83
83
 
84
- void del_global(const std::string& key);
84
+ void del_global(const sass::string& key);
85
85
 
86
86
  // see if we have a lexical variable
87
87
  // move down the stack but stop before we
88
88
  // reach the global frame (is not included)
89
- bool has_lexical(const std::string& key) const;
89
+ bool has_lexical(const sass::string& key) const;
90
90
 
91
91
  // see if we have a lexical we could update
92
92
  // either update already existing lexical value
93
93
  // or we create a new one on the current frame
94
- void set_lexical(const std::string& key, T&& val);
95
- void set_lexical(const std::string& key, const T& val);
94
+ void set_lexical(const sass::string& key, T&& val);
95
+ void set_lexical(const sass::string& key, const T& val);
96
96
 
97
97
  // look on the full stack for key
98
98
  // include all scopes available
99
- bool has(const std::string& key) const;
99
+ bool has(const sass::string& key) const;
100
100
 
101
101
  // look on the full stack for key
102
102
  // include all scopes available
103
- T& get(const std::string& key);
103
+ T& get(const sass::string& key);
104
104
 
105
105
  // look on the full stack for key
106
106
  // include all scopes available
107
- EnvResult find(const std::string& key);
107
+ EnvResult find(const sass::string& key);
108
108
 
109
109
  // use array access for getter and setter functions
110
- T& operator[](const std::string& key);
110
+ T& operator[](const sass::string& key);
111
111
 
112
112
  #ifdef DEBUG
113
- size_t print(std::string prefix = "");
113
+ size_t print(sass::string prefix = "");
114
114
  #endif
115
115
 
116
116
  };
117
117
 
118
118
  // define typedef for our use case
119
119
  typedef Environment<AST_Node_Obj> Env;
120
- typedef std::vector<Env*> EnvStack;
120
+ typedef sass::vector<Env*> EnvStack;
121
121
 
122
122
  }
123
123
 
@@ -13,13 +13,13 @@ namespace Sass {
13
13
 
14
14
  namespace Exception {
15
15
 
16
- Base::Base(ParserState pstate, std::string msg, Backtraces traces)
17
- : std::runtime_error(msg), msg(msg),
16
+ Base::Base(SourceSpan pstate, sass::string msg, Backtraces traces)
17
+ : std::runtime_error(msg.c_str()), msg(msg),
18
18
  prefix("Error"), pstate(pstate), traces(traces)
19
19
  { }
20
20
 
21
- InvalidSass::InvalidSass(ParserState pstate, Backtraces traces, std::string msg, char* owned_src)
22
- : Base(pstate, msg, traces), owned_src(owned_src)
21
+ InvalidSass::InvalidSass(SourceSpan pstate, Backtraces traces, sass::string msg)
22
+ : Base(pstate, msg, traces)
23
23
  { }
24
24
 
25
25
 
@@ -31,14 +31,14 @@ namespace Sass {
31
31
  "\"" + parent->to_string(Sass_Inspect_Options()) + "\"";
32
32
  }
33
33
 
34
- InvalidVarKwdType::InvalidVarKwdType(ParserState pstate, Backtraces traces, std::string name, const Argument* arg)
34
+ InvalidVarKwdType::InvalidVarKwdType(SourceSpan pstate, Backtraces traces, sass::string name, const Argument* arg)
35
35
  : Base(pstate, def_msg, traces), name(name), arg(arg)
36
36
  {
37
37
  msg = "Variable keyword argument map must have string keys.\n" +
38
38
  name + " is not a string in " + arg->to_string() + ".";
39
39
  }
40
40
 
41
- InvalidArgumentType::InvalidArgumentType(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string type, const Value* value)
41
+ InvalidArgumentType::InvalidArgumentType(SourceSpan pstate, Backtraces traces, sass::string fn, sass::string arg, sass::string type, const Value* value)
42
42
  : Base(pstate, def_msg, traces), fn(fn), arg(arg), type(type), value(value)
43
43
  {
44
44
  msg = arg + ": \"";
@@ -46,17 +46,17 @@ namespace Sass {
46
46
  msg += "\" is not a " + type + " for `" + fn + "'";
47
47
  }
48
48
 
49
- MissingArgument::MissingArgument(ParserState pstate, Backtraces traces, std::string fn, std::string arg, std::string fntype)
49
+ MissingArgument::MissingArgument(SourceSpan pstate, Backtraces traces, sass::string fn, sass::string arg, sass::string fntype)
50
50
  : Base(pstate, def_msg, traces), fn(fn), arg(arg), fntype(fntype)
51
51
  {
52
52
  msg = fntype + " " + fn + " is missing argument " + arg + ".";
53
53
  }
54
54
 
55
- InvalidSyntax::InvalidSyntax(ParserState pstate, Backtraces traces, std::string msg)
55
+ InvalidSyntax::InvalidSyntax(SourceSpan pstate, Backtraces traces, sass::string msg)
56
56
  : Base(pstate, msg, traces)
57
57
  { }
58
58
 
59
- NestingLimitError::NestingLimitError(ParserState pstate, Backtraces traces, std::string msg)
59
+ NestingLimitError::NestingLimitError(SourceSpan pstate, Backtraces traces, sass::string msg)
60
60
  : Base(pstate, msg, traces)
61
61
  { }
62
62
 
@@ -66,7 +66,7 @@ namespace Sass {
66
66
  msg = "Duplicate key " + dup.get_duplicate_key()->inspect() + " in map (" + org.inspect() + ").";
67
67
  }
68
68
 
69
- TypeMismatch::TypeMismatch(Backtraces traces, const Expression& var, const std::string type)
69
+ TypeMismatch::TypeMismatch(Backtraces traces, const Expression& var, const sass::string type)
70
70
  : Base(var.pstate(), def_msg, traces), var(var), type(type)
71
71
  {
72
72
  msg = var.to_string() + " is not an " + type + ".";
@@ -91,7 +91,7 @@ namespace Sass {
91
91
 
92
92
  IncompatibleUnits::IncompatibleUnits(const UnitType lhs, const UnitType rhs)
93
93
  {
94
- msg = std::string("Incompatible units: '") + unit_to_string(rhs) + "' and '" + unit_to_string(lhs) + "'.";
94
+ msg = sass::string("Incompatible units: '") + unit_to_string(rhs) + "' and '" + unit_to_string(lhs) + "'.";
95
95
  }
96
96
 
97
97
  AlphaChannelsNotEqual::AlphaChannelsNotEqual(const Expression* lhs, const Expression* rhs, enum Sass_OP op)
@@ -125,14 +125,14 @@ namespace Sass {
125
125
  msg = def_op_null_msg + ": \"" + lhs->inspect() + " " + sass_op_to_name(op) + " " + rhs->inspect() + "\".";
126
126
  }
127
127
 
128
- SassValueError::SassValueError(Backtraces traces, ParserState pstate, OperationError& err)
128
+ SassValueError::SassValueError(Backtraces traces, SourceSpan pstate, OperationError& err)
129
129
  : Base(pstate, err.what(), traces)
130
130
  {
131
131
  msg = err.what();
132
132
  prefix = err.errtype();
133
133
  }
134
134
 
135
- TopLevelParent::TopLevelParent(Backtraces traces, ParserState pstate)
135
+ TopLevelParent::TopLevelParent(Backtraces traces, SourceSpan pstate)
136
136
  : Base(pstate, "Top-level selectors may not contain the parent selector \"&\".", traces)
137
137
  {
138
138
 
@@ -156,48 +156,48 @@ namespace Sass {
156
156
  }
157
157
 
158
158
 
159
- void warn(std::string msg, ParserState pstate)
159
+ void warn(sass::string msg, SourceSpan pstate)
160
160
  {
161
161
  std::cerr << "Warning: " << msg << std::endl;
162
162
  }
163
163
 
164
- void warning(std::string msg, ParserState pstate)
164
+ void warning(sass::string msg, SourceSpan pstate)
165
165
  {
166
- std::string cwd(Sass::File::get_cwd());
167
- std::string abs_path(Sass::File::rel2abs(pstate.path, cwd, cwd));
168
- std::string rel_path(Sass::File::abs2rel(pstate.path, cwd, cwd));
169
- std::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.path));
166
+ sass::string cwd(Sass::File::get_cwd());
167
+ sass::string abs_path(Sass::File::rel2abs(pstate.getPath(), cwd, cwd));
168
+ sass::string rel_path(Sass::File::abs2rel(pstate.getPath(), cwd, cwd));
169
+ sass::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.getPath()));
170
170
 
171
- std::cerr << "WARNING on line " << pstate.line+1 << ", column " << pstate.column+1 << " of " << output_path << ":" << std::endl;
171
+ std::cerr << "WARNING on line " << pstate.getLine() << ", column " << pstate.getColumn() << " of " << output_path << ":" << std::endl;
172
172
  std::cerr << msg << std::endl << std::endl;
173
173
  }
174
174
 
175
- void warn(std::string msg, ParserState pstate, Backtrace* bt)
175
+ void warn(sass::string msg, SourceSpan pstate, Backtrace* bt)
176
176
  {
177
177
  warn(msg, pstate);
178
178
  }
179
179
 
180
- void deprecated_function(std::string msg, ParserState pstate)
180
+ void deprecated_function(sass::string msg, SourceSpan pstate)
181
181
  {
182
- std::string cwd(Sass::File::get_cwd());
183
- std::string abs_path(Sass::File::rel2abs(pstate.path, cwd, cwd));
184
- std::string rel_path(Sass::File::abs2rel(pstate.path, cwd, cwd));
185
- std::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.path));
182
+ sass::string cwd(Sass::File::get_cwd());
183
+ sass::string abs_path(Sass::File::rel2abs(pstate.getPath(), cwd, cwd));
184
+ sass::string rel_path(Sass::File::abs2rel(pstate.getPath(), cwd, cwd));
185
+ sass::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.getPath()));
186
186
 
187
187
  std::cerr << "DEPRECATION WARNING: " << msg << std::endl;
188
188
  std::cerr << "will be an error in future versions of Sass." << std::endl;
189
- std::cerr << " on line " << pstate.line+1 << " of " << output_path << std::endl;
189
+ std::cerr << " on line " << pstate.getLine() << " of " << output_path << std::endl;
190
190
  }
191
191
 
192
- void deprecated(std::string msg, std::string msg2, bool with_column, ParserState pstate)
192
+ void deprecated(sass::string msg, sass::string msg2, bool with_column, SourceSpan pstate)
193
193
  {
194
- std::string cwd(Sass::File::get_cwd());
195
- std::string abs_path(Sass::File::rel2abs(pstate.path, cwd, cwd));
196
- std::string rel_path(Sass::File::abs2rel(pstate.path, cwd, cwd));
197
- std::string output_path(Sass::File::path_for_console(rel_path, pstate.path, pstate.path));
194
+ sass::string cwd(Sass::File::get_cwd());
195
+ sass::string abs_path(Sass::File::rel2abs(pstate.getPath(), cwd, cwd));
196
+ sass::string rel_path(Sass::File::abs2rel(pstate.getPath(), cwd, cwd));
197
+ sass::string output_path(Sass::File::path_for_console(rel_path, pstate.getPath(), pstate.getPath()));
198
198
 
199
- std::cerr << "DEPRECATION WARNING on line " << pstate.line + 1;
200
- if (with_column) std::cerr << ", column " << pstate.column + pstate.offset.column + 1;
199
+ std::cerr << "DEPRECATION WARNING on line " << pstate.getLine();
200
+ // if (with_column) std::cerr << ", column " << pstate.column + pstate.offset.column + 1;
201
201
  if (output_path.length()) std::cerr << " of " << output_path;
202
202
  std::cerr << ":" << std::endl;
203
203
  std::cerr << msg << std::endl;
@@ -205,26 +205,26 @@ namespace Sass {
205
205
  std::cerr << std::endl;
206
206
  }
207
207
 
208
- void deprecated_bind(std::string msg, ParserState pstate)
208
+ void deprecated_bind(sass::string msg, SourceSpan pstate)
209
209
  {
210
- std::string cwd(Sass::File::get_cwd());
211
- std::string abs_path(Sass::File::rel2abs(pstate.path, cwd, cwd));
212
- std::string rel_path(Sass::File::abs2rel(pstate.path, cwd, cwd));
213
- std::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.path));
210
+ sass::string cwd(Sass::File::get_cwd());
211
+ sass::string abs_path(Sass::File::rel2abs(pstate.getPath(), cwd, cwd));
212
+ sass::string rel_path(Sass::File::abs2rel(pstate.getPath(), cwd, cwd));
213
+ sass::string output_path(Sass::File::path_for_console(rel_path, abs_path, pstate.getPath()));
214
214
 
215
215
  std::cerr << "WARNING: " << msg << std::endl;
216
- std::cerr << " on line " << pstate.line+1 << " of " << output_path << std::endl;
216
+ std::cerr << " on line " << pstate.getLine() << " of " << output_path << std::endl;
217
217
  std::cerr << "This will be an error in future versions of Sass." << std::endl;
218
218
  }
219
219
 
220
220
  // should be replaced with error with backtraces
221
- void coreError(std::string msg, ParserState pstate)
221
+ void coreError(sass::string msg, SourceSpan pstate)
222
222
  {
223
223
  Backtraces traces;
224
224
  throw Exception::InvalidSyntax(pstate, traces, msg);
225
225
  }
226
226
 
227
- void error(std::string msg, ParserState pstate, Backtraces& traces)
227
+ void error(sass::string msg, SourceSpan pstate, Backtraces& traces)
228
228
  {
229
229
  traces.push_back(Backtrace(pstate));
230
230
  throw Exception::InvalidSyntax(pstate, traces, msg);