sassc 1.11.1 → 1.11.2

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 (85) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/README.md +3 -2
  4. data/ext/libsass/Makefile.conf +2 -1
  5. data/ext/libsass/appveyor.yml +10 -5
  6. data/ext/libsass/docs/dev-ast-memory.md +223 -0
  7. data/ext/libsass/include/sass/base.h +2 -0
  8. data/ext/libsass/script/bootstrap +7 -4
  9. data/ext/libsass/script/ci-build-libsass +3 -3
  10. data/ext/libsass/script/ci-install-compiler +2 -0
  11. data/ext/libsass/script/ci-report-coverage +2 -1
  12. data/ext/libsass/script/test-leaks.pl +103 -0
  13. data/ext/libsass/src/ast.cpp +621 -495
  14. data/ext/libsass/src/ast.hpp +801 -367
  15. data/ext/libsass/src/ast_def_macros.hpp +5 -5
  16. data/ext/libsass/src/ast_fwd_decl.hpp +312 -14
  17. data/ext/libsass/src/bind.cpp +54 -51
  18. data/ext/libsass/src/bind.hpp +3 -7
  19. data/ext/libsass/src/check_nesting.cpp +117 -120
  20. data/ext/libsass/src/check_nesting.hpp +38 -34
  21. data/ext/libsass/src/color_maps.cpp +3 -3
  22. data/ext/libsass/src/color_maps.hpp +3 -3
  23. data/ext/libsass/src/context.cpp +33 -34
  24. data/ext/libsass/src/context.hpp +12 -14
  25. data/ext/libsass/src/cssize.cpp +200 -228
  26. data/ext/libsass/src/cssize.hpp +49 -49
  27. data/ext/libsass/src/debugger.hpp +260 -241
  28. data/ext/libsass/src/emitter.cpp +6 -6
  29. data/ext/libsass/src/emitter.hpp +7 -7
  30. data/ext/libsass/src/environment.cpp +2 -2
  31. data/ext/libsass/src/environment.hpp +0 -2
  32. data/ext/libsass/src/error_handling.cpp +5 -5
  33. data/ext/libsass/src/error_handling.hpp +12 -12
  34. data/ext/libsass/src/eval.cpp +412 -401
  35. data/ext/libsass/src/eval.hpp +61 -62
  36. data/ext/libsass/src/expand.cpp +223 -204
  37. data/ext/libsass/src/expand.hpp +42 -42
  38. data/ext/libsass/src/extend.cpp +198 -201
  39. data/ext/libsass/src/extend.hpp +12 -14
  40. data/ext/libsass/src/file.hpp +4 -5
  41. data/ext/libsass/src/functions.cpp +413 -418
  42. data/ext/libsass/src/functions.hpp +7 -10
  43. data/ext/libsass/src/inspect.cpp +115 -109
  44. data/ext/libsass/src/inspect.hpp +69 -69
  45. data/ext/libsass/src/listize.cpp +31 -33
  46. data/ext/libsass/src/listize.hpp +8 -10
  47. data/ext/libsass/src/memory/SharedPtr.cpp +116 -0
  48. data/ext/libsass/src/memory/SharedPtr.hpp +202 -0
  49. data/ext/libsass/src/node.cpp +45 -43
  50. data/ext/libsass/src/node.hpp +15 -15
  51. data/ext/libsass/src/operation.hpp +136 -136
  52. data/ext/libsass/src/output.cpp +48 -49
  53. data/ext/libsass/src/output.hpp +14 -14
  54. data/ext/libsass/src/parser.cpp +530 -554
  55. data/ext/libsass/src/parser.hpp +91 -96
  56. data/ext/libsass/src/prelexer.cpp +13 -10
  57. data/ext/libsass/src/remove_placeholders.cpp +25 -21
  58. data/ext/libsass/src/remove_placeholders.hpp +7 -7
  59. data/ext/libsass/src/sass2scss.cpp +2 -1
  60. data/ext/libsass/src/sass_context.cpp +125 -107
  61. data/ext/libsass/src/sass_context.hpp +1 -1
  62. data/ext/libsass/src/sass_util.hpp +5 -5
  63. data/ext/libsass/src/sass_values.cpp +27 -27
  64. data/ext/libsass/src/source_map.cpp +2 -2
  65. data/ext/libsass/src/source_map.hpp +2 -2
  66. data/ext/libsass/src/subset_map.cpp +57 -0
  67. data/ext/libsass/src/subset_map.hpp +8 -76
  68. data/ext/libsass/src/to_c.cpp +13 -13
  69. data/ext/libsass/src/to_c.hpp +14 -14
  70. data/ext/libsass/src/to_value.cpp +20 -20
  71. data/ext/libsass/src/to_value.hpp +20 -21
  72. data/ext/libsass/src/util.cpp +55 -88
  73. data/ext/libsass/src/util.hpp +9 -13
  74. data/ext/libsass/src/values.cpp +27 -26
  75. data/ext/libsass/src/values.hpp +2 -2
  76. data/ext/libsass/test/test_subset_map.cpp +69 -69
  77. data/ext/libsass/win/libsass.targets +3 -2
  78. data/ext/libsass/win/libsass.vcxproj.filters +9 -6
  79. data/lib/sassc/version.rb +1 -1
  80. data/sassc.gemspec +0 -1
  81. data/test/native_test.rb +1 -1
  82. metadata +7 -5
  83. data/ext/libsass/src/ast_factory.hpp +0 -92
  84. data/ext/libsass/src/memory_manager.cpp +0 -77
  85. data/ext/libsass/src/memory_manager.hpp +0 -48
@@ -8,20 +8,20 @@
8
8
  namespace Sass {
9
9
 
10
10
 
11
- Node Node::createCombinator(const Sequence_Selector::Combinator& combinator) {
11
+ Node Node::createCombinator(const Complex_Selector::Combinator& combinator) {
12
12
  NodeDequePtr null;
13
13
  return Node(COMBINATOR, combinator, NULL /*pSelector*/, null /*pCollection*/);
14
14
  }
15
15
 
16
16
 
17
- Node Node::createSelector(Sequence_Selector* pSelector, Context& ctx) {
17
+ Node Node::createSelector(Complex_Selector_Ptr pSelector, Context& ctx) {
18
18
  NodeDequePtr null;
19
19
 
20
- Sequence_Selector* pStripped = pSelector->clone(ctx);
20
+ Complex_Selector_Ptr pStripped = SASS_MEMORY_COPY(pSelector);
21
21
  pStripped->tail(NULL);
22
- pStripped->combinator(Sequence_Selector::ANCESTOR_OF);
22
+ pStripped->combinator(Complex_Selector::ANCESTOR_OF);
23
23
 
24
- Node n(SELECTOR, Sequence_Selector::ANCESTOR_OF, pStripped, null /*pCollection*/);
24
+ Node n(SELECTOR, Complex_Selector::ANCESTOR_OF, pStripped, null /*pCollection*/);
25
25
  if (pSelector) n.got_line_feed = pSelector->has_line_feed();
26
26
  return n;
27
27
  }
@@ -29,37 +29,37 @@ namespace Sass {
29
29
 
30
30
  Node Node::createCollection() {
31
31
  NodeDequePtr pEmptyCollection = std::make_shared<NodeDeque>();
32
- return Node(COLLECTION, Sequence_Selector::ANCESTOR_OF, NULL /*pSelector*/, pEmptyCollection);
32
+ return Node(COLLECTION, Complex_Selector::ANCESTOR_OF, NULL /*pSelector*/, pEmptyCollection);
33
33
  }
34
34
 
35
35
 
36
36
  Node Node::createCollection(const NodeDeque& values) {
37
37
  NodeDequePtr pShallowCopiedCollection = std::make_shared<NodeDeque>(values);
38
- return Node(COLLECTION, Sequence_Selector::ANCESTOR_OF, NULL /*pSelector*/, pShallowCopiedCollection);
38
+ return Node(COLLECTION, Complex_Selector::ANCESTOR_OF, NULL /*pSelector*/, pShallowCopiedCollection);
39
39
  }
40
40
 
41
41
 
42
42
  Node Node::createNil() {
43
43
  NodeDequePtr null;
44
- return Node(NIL, Sequence_Selector::ANCESTOR_OF, NULL /*pSelector*/, null /*pCollection*/);
44
+ return Node(NIL, Complex_Selector::ANCESTOR_OF, NULL /*pSelector*/, null /*pCollection*/);
45
45
  }
46
46
 
47
47
 
48
- Node::Node(const TYPE& type, Sequence_Selector::Combinator combinator, Sequence_Selector* pSelector, NodeDequePtr& pCollection)
48
+ Node::Node(const TYPE& type, Complex_Selector::Combinator combinator, Complex_Selector_Ptr pSelector, NodeDequePtr& pCollection)
49
49
  : got_line_feed(false), mType(type), mCombinator(combinator), mpSelector(pSelector), mpCollection(pCollection)
50
50
  { if (pSelector) got_line_feed = pSelector->has_line_feed(); }
51
51
 
52
52
 
53
- Node Node::clone(Context& ctx) const {
53
+ Node Node::klone(Context& ctx) const {
54
54
  NodeDequePtr pNewCollection = std::make_shared<NodeDeque>();
55
55
  if (mpCollection) {
56
56
  for (NodeDeque::iterator iter = mpCollection->begin(), iterEnd = mpCollection->end(); iter != iterEnd; iter++) {
57
57
  Node& toClone = *iter;
58
- pNewCollection->push_back(toClone.clone(ctx));
58
+ pNewCollection->push_back(toClone.klone(ctx));
59
59
  }
60
60
  }
61
61
 
62
- Node n(mType, mCombinator, mpSelector ? mpSelector->clone(ctx) : NULL, pNewCollection);
62
+ Node n(mType, mCombinator, mpSelector ? SASS_MEMORY_COPY(mpSelector) : NULL, pNewCollection);
63
63
  n.got_line_feed = got_line_feed;
64
64
  return n;
65
65
  }
@@ -101,7 +101,7 @@ namespace Sass {
101
101
 
102
102
  } else if (lhs.isSelector()){
103
103
 
104
- return selectors_equal(*lhs.selector(), *rhs.selector(), simpleSelectorOrderDependent);
104
+ return selectors_equal(*&lhs.selector(), *&rhs.selector(), simpleSelectorOrderDependent);
105
105
 
106
106
  } else if (lhs.isCollection()) {
107
107
 
@@ -140,11 +140,11 @@ namespace Sass {
140
140
  if (node.isCombinator()) {
141
141
 
142
142
  switch (node.combinator()) {
143
- case Sequence_Selector::ANCESTOR_OF: os << "\" \""; break;
144
- case Sequence_Selector::PARENT_OF: os << "\">\""; break;
145
- case Sequence_Selector::PRECEDES: os << "\"~\""; break;
146
- case Sequence_Selector::ADJACENT_TO: os << "\"+\""; break;
147
- case Sequence_Selector::REFERENCE: os << "\"/\""; break;
143
+ case Complex_Selector::ANCESTOR_OF: os << "\" \""; break;
144
+ case Complex_Selector::PARENT_OF: os << "\">\""; break;
145
+ case Complex_Selector::PRECEDES: os << "\"~\""; break;
146
+ case Complex_Selector::ADJACENT_TO: os << "\"+\""; break;
147
+ case Complex_Selector::REFERENCE: os << "\"/\""; break;
148
148
  }
149
149
 
150
150
  } else if (node.isNil()) {
@@ -177,7 +177,7 @@ namespace Sass {
177
177
  #endif
178
178
 
179
179
 
180
- Node complexSelectorToNode(Sequence_Selector* pToConvert, Context& ctx) {
180
+ Node complexSelectorToNode(Complex_Selector_Ptr pToConvert, Context& ctx) {
181
181
  if (pToConvert == NULL) {
182
182
  return Node::createNil();
183
183
  }
@@ -187,26 +187,26 @@ namespace Sass {
187
187
 
188
188
  // unwrap the selector from parent ref
189
189
  if (pToConvert->head() && pToConvert->head()->has_parent_ref()) {
190
- Sequence_Selector* tail = pToConvert->tail();
190
+ Complex_Selector_Obj tail = pToConvert->tail();
191
191
  if (tail) tail->has_line_feed(pToConvert->has_line_feed());
192
- pToConvert = tail;
192
+ pToConvert = &tail;
193
193
  }
194
194
 
195
195
  while (pToConvert) {
196
196
 
197
197
  bool empty_parent_ref = pToConvert->head() && pToConvert->head()->is_empty_reference();
198
198
 
199
- if (pToConvert->head() == NULL || empty_parent_ref) {
199
+ if (pToConvert->head() || empty_parent_ref) {
200
200
  }
201
201
 
202
- // the first Sequence_Selector may contain a dummy head pointer, skip it.
203
- if (pToConvert->head() != NULL && !empty_parent_ref) {
202
+ // the first Complex_Selector may contain a dummy head pointer, skip it.
203
+ if (pToConvert->head() && !empty_parent_ref) {
204
204
  node.collection()->push_back(Node::createSelector(pToConvert, ctx));
205
205
  if (has_lf) node.collection()->back().got_line_feed = has_lf;
206
206
  has_lf = false;
207
207
  }
208
208
 
209
- if (pToConvert->combinator() != Sequence_Selector::ANCESTOR_OF) {
209
+ if (pToConvert->combinator() != Complex_Selector::ANCESTOR_OF) {
210
210
  node.collection()->push_back(Node::createCombinator(pToConvert->combinator()));
211
211
  if (has_lf) node.collection()->back().got_line_feed = has_lf;
212
212
  has_lf = false;
@@ -216,21 +216,21 @@ namespace Sass {
216
216
  // pToConvert->tail()->has_line_feed(pToConvert->has_line_feed());
217
217
  }
218
218
 
219
- pToConvert = pToConvert->tail();
219
+ pToConvert = &pToConvert->tail();
220
220
  }
221
221
 
222
222
  return node;
223
223
  }
224
224
 
225
225
 
226
- Sequence_Selector* nodeToComplexSelector(const Node& toConvert, Context& ctx) {
226
+ Complex_Selector_Ptr nodeToComplexSelector(const Node& toConvert, Context& ctx) {
227
227
  if (toConvert.isNil()) {
228
228
  return NULL;
229
229
  }
230
230
 
231
231
 
232
232
  if (!toConvert.isCollection()) {
233
- throw "The node to convert to a Sequence_Selector* must be a collection type or nil.";
233
+ throw "The node to convert to a Complex_Selector_Ptr must be a collection type or nil.";
234
234
  }
235
235
 
236
236
 
@@ -238,9 +238,9 @@ namespace Sass {
238
238
 
239
239
  std::string noPath("");
240
240
  Position noPosition(-1, -1, -1);
241
- Sequence_Selector* pFirst = SASS_MEMORY_NEW(ctx.mem, Sequence_Selector, ParserState("[NODE]"), Sequence_Selector::ANCESTOR_OF, NULL, NULL);
241
+ Complex_Selector_Obj pFirst = SASS_MEMORY_NEW(Complex_Selector, ParserState("[NODE]"), Complex_Selector::ANCESTOR_OF, NULL, NULL);
242
242
 
243
- Sequence_Selector* pCurrent = pFirst;
243
+ Complex_Selector_Obj pCurrent = pFirst;
244
244
 
245
245
  if (toConvert.isSelector()) pFirst->has_line_feed(toConvert.got_line_feed);
246
246
  if (toConvert.isCombinator()) pFirst->has_line_feed(toConvert.got_line_feed);
@@ -250,20 +250,22 @@ namespace Sass {
250
250
  Node& child = *childIter;
251
251
 
252
252
  if (child.isSelector()) {
253
- pCurrent->tail(child.selector()->clone(ctx)); // JMA - need to clone the selector, because they can end up getting shared across Node collections, and can result in an infinite loop during the call to parentSuperselector()
253
+ // JMA - need to clone the selector, because they can end up getting shared across Node
254
+ // collections, and can result in an infinite loop during the call to parentSuperselector()
255
+ pCurrent->tail(SASS_MEMORY_COPY(child.selector()));
254
256
  // if (child.got_line_feed) pCurrent->has_line_feed(child.got_line_feed);
255
- pCurrent = pCurrent->tail();
257
+ pCurrent = &pCurrent->tail();
256
258
  } else if (child.isCombinator()) {
257
259
  pCurrent->combinator(child.combinator());
258
260
  if (child.got_line_feed) pCurrent->has_line_feed(child.got_line_feed);
259
261
 
260
- // if the next node is also a combinator, create another Sequence_Selector to hold it so it doesn't replace the current combinator
262
+ // if the next node is also a combinator, create another Complex_Selector to hold it so it doesn't replace the current combinator
261
263
  if (childIter+1 != childIterEnd) {
262
264
  Node& nextNode = *(childIter+1);
263
265
  if (nextNode.isCombinator()) {
264
- pCurrent->tail(SASS_MEMORY_NEW(ctx.mem, Sequence_Selector, ParserState("[NODE]"), Sequence_Selector::ANCESTOR_OF, NULL, NULL));
266
+ pCurrent->tail(SASS_MEMORY_NEW(Complex_Selector, ParserState("[NODE]"), Complex_Selector::ANCESTOR_OF, NULL, NULL));
265
267
  if (nextNode.got_line_feed) pCurrent->tail()->has_line_feed(nextNode.got_line_feed);
266
- pCurrent = pCurrent->tail();
268
+ pCurrent = &pCurrent->tail();
267
269
  }
268
270
  }
269
271
  } else {
@@ -271,22 +273,22 @@ namespace Sass {
271
273
  }
272
274
  }
273
275
 
274
- // Put the dummy SimpleSequence_Selector in the first position, for consistency with the rest of libsass
275
- SimpleSequence_Selector* fakeHead = SASS_MEMORY_NEW(ctx.mem, SimpleSequence_Selector, ParserState("[NODE]"), 1);
276
- Parent_Selector* selectorRef = SASS_MEMORY_NEW(ctx.mem, Parent_Selector, ParserState("[NODE]"));
276
+ // Put the dummy Compound_Selector in the first position, for consistency with the rest of libsass
277
+ Compound_Selector_Ptr fakeHead = SASS_MEMORY_NEW(Compound_Selector, ParserState("[NODE]"), 1);
278
+ Parent_Selector_Ptr selectorRef = SASS_MEMORY_NEW(Parent_Selector, ParserState("[NODE]"));
277
279
  fakeHead->elements().push_back(selectorRef);
278
280
  if (toConvert.got_line_feed) pFirst->has_line_feed(toConvert.got_line_feed);
279
281
  // pFirst->has_line_feed(pFirst->has_line_feed() || pFirst->tail()->has_line_feed() || toConvert.got_line_feed);
280
282
  pFirst->head(fakeHead);
281
- return pFirst;
283
+ return SASS_MEMORY_COPY(pFirst);
282
284
  }
283
285
 
284
286
  // A very naive trim function, which removes duplicates in a node
285
- // This is only used in Sequence_Selector::unify_with for now, may need modifications to fit other needs
287
+ // This is only used in Complex_Selector::unify_with for now, may need modifications to fit other needs
286
288
  Node Node::naiveTrim(Node& seqses, Context& ctx) {
287
289
 
288
290
  std::vector<Node*> res;
289
- std::vector<Sequence_Selector*> known;
291
+ std::vector<Complex_Selector_Obj> known;
290
292
 
291
293
  NodeDeque::reverse_iterator seqsesIter = seqses.collection()->rbegin(),
292
294
  seqsesIterEnd = seqses.collection()->rend();
@@ -295,8 +297,8 @@ namespace Sass {
295
297
  {
296
298
  Node& seqs1 = *seqsesIter;
297
299
  if( seqs1.isSelector() ) {
298
- Sequence_Selector* sel = seqs1.selector();
299
- std::vector<Sequence_Selector*>::iterator it;
300
+ Complex_Selector_Obj sel = seqs1.selector();
301
+ std::vector<Complex_Selector_Obj>::iterator it;
300
302
  bool found = false;
301
303
  for (it = known.begin(); it != known.end(); ++it) {
302
304
  if (**it == *sel) { found = true; break; }
@@ -17,7 +17,7 @@ namespace Sass {
17
17
  /*
18
18
  There are a lot of stumbling blocks when trying to port the ruby extend code to C++. The biggest is the choice of
19
19
  data type. The ruby code will pretty seamlessly switch types between an Array<SimpleSequence or Op> (libsass'
20
- equivalent is the Sequence_Selector) to a Sequence, which contains more metadata about the sequence than just the
20
+ equivalent is the Complex_Selector) to a Sequence, which contains more metadata about the sequence than just the
21
21
  selector info. They also have the ability to have arbitrary nestings of arrays like [1, [2]], which is hard to
22
22
  implement using Array equivalents in C++ (like the deque or vector). They also have the ability to include nil
23
23
  in the arrays, like [1, nil, 3], which has potential semantic differences than an empty array [1, [], 3]. To be
@@ -26,7 +26,7 @@ namespace Sass {
26
26
  more closely match the ruby code, which is a huge benefit when attempting to implement an complex algorithm like
27
27
  the Extend operator.
28
28
 
29
- Note that the current libsass data model also pairs the combinator with the Sequence_Selector that follows it, but
29
+ Note that the current libsass data model also pairs the combinator with the Complex_Selector that follows it, but
30
30
  ruby sass has no such restriction, so we attempt to create a data structure that can handle them split apart.
31
31
  */
32
32
 
@@ -50,18 +50,18 @@ namespace Sass {
50
50
  bool isNil() const { return mType == NIL; }
51
51
  bool got_line_feed;
52
52
 
53
- Sequence_Selector::Combinator combinator() const { return mCombinator; }
53
+ Complex_Selector::Combinator combinator() const { return mCombinator; }
54
54
 
55
- Sequence_Selector* selector() { return mpSelector; }
56
- const Sequence_Selector* selector() const { return mpSelector; }
55
+ Complex_Selector_Obj selector() { return mpSelector; }
56
+ Complex_Selector_Obj selector() const { return mpSelector; }
57
57
 
58
58
  NodeDequePtr collection() { return mpCollection; }
59
59
  const NodeDequePtr collection() const { return mpCollection; }
60
60
 
61
- static Node createCombinator(const Sequence_Selector::Combinator& combinator);
61
+ static Node createCombinator(const Complex_Selector::Combinator& combinator);
62
62
 
63
- // This method will clone the selector, stripping off the tail and combinator
64
- static Node createSelector(Sequence_Selector* pSelector, Context& ctx);
63
+ // This method will klone the selector, stripping off the tail and combinator
64
+ static Node createSelector(Complex_Selector_Ptr pSelector, Context& ctx);
65
65
 
66
66
  static Node createCollection();
67
67
  static Node createCollection(const NodeDeque& values);
@@ -69,7 +69,7 @@ namespace Sass {
69
69
  static Node createNil();
70
70
  static Node naiveTrim(Node& seqses, Context& ctx);
71
71
 
72
- Node clone(Context& ctx) const;
72
+ Node klone(Context& ctx) const;
73
73
 
74
74
  bool operator==(const Node& rhs) const;
75
75
  inline bool operator!=(const Node& rhs) const { return !(*this == rhs); }
@@ -79,7 +79,7 @@ namespace Sass {
79
79
  COLLECTION FUNCTIONS
80
80
 
81
81
  Most types don't need any helper methods (nil and combinator due to their simplicity and
82
- selector due to the fact that we leverage the non-node selector code on the Sequence_Selector
82
+ selector due to the fact that we leverage the non-node selector code on the Complex_Selector
83
83
  whereever possible). The following methods are intended to be called on Node objects whose
84
84
  type is COLLECTION only.
85
85
  */
@@ -97,21 +97,21 @@ namespace Sass {
97
97
  // Private constructor; Use the static methods (like createCombinator and createSelector)
98
98
  // to instantiate this object. This is more expressive, and it allows us to break apart each
99
99
  // case into separate functions.
100
- Node(const TYPE& type, Sequence_Selector::Combinator combinator, Sequence_Selector* pSelector, NodeDequePtr& pCollection);
100
+ Node(const TYPE& type, Complex_Selector::Combinator combinator, Complex_Selector_Ptr pSelector, NodeDequePtr& pCollection);
101
101
 
102
102
  TYPE mType;
103
103
 
104
104
  // TODO: can we union these to save on memory?
105
- Sequence_Selector::Combinator mCombinator;
106
- Sequence_Selector* mpSelector; // this is an AST_Node, so it will be handled by the Memory_Manager
105
+ Complex_Selector::Combinator mCombinator;
106
+ Complex_Selector_Obj mpSelector;
107
107
  NodeDequePtr mpCollection;
108
108
  };
109
109
 
110
110
  #ifdef DEBUG
111
111
  std::ostream& operator<<(std::ostream& os, const Node& node);
112
112
  #endif
113
- Node complexSelectorToNode(Sequence_Selector* pToConvert, Context& ctx);
114
- Sequence_Selector* nodeToComplexSelector(const Node& toConvert, Context& ctx);
113
+ Node complexSelectorToNode(Complex_Selector_Ptr pToConvert, Context& ctx);
114
+ Complex_Selector_Ptr nodeToComplexSelector(const Node& toConvert, Context& ctx);
115
115
 
116
116
  bool nodesEqual(const Node& one, const Node& two, bool simpleSelectorOrderDependent);
117
117
 
@@ -8,79 +8,79 @@ namespace Sass {
8
8
  template<typename T>
9
9
  class Operation {
10
10
  public:
11
- virtual T operator()(AST_Node* x) = 0;
11
+ virtual T operator()(AST_Node_Ptr x) = 0;
12
12
  virtual ~Operation() { }
13
13
  // statements
14
- virtual T operator()(Block* x) = 0;
15
- virtual T operator()(Ruleset* x) = 0;
16
- virtual T operator()(Bubble* x) = 0;
17
- virtual T operator()(Trace* x) = 0;
18
- virtual T operator()(Supports_Block* x) = 0;
19
- virtual T operator()(Media_Block* x) = 0;
20
- virtual T operator()(At_Root_Block* x) = 0;
21
- virtual T operator()(Directive* x) = 0;
22
- virtual T operator()(Keyframe_Rule* x) = 0;
23
- virtual T operator()(Declaration* x) = 0;
24
- virtual T operator()(Assignment* x) = 0;
25
- virtual T operator()(Import* x) = 0;
26
- virtual T operator()(Import_Stub* x) = 0;
27
- virtual T operator()(Warning* x) = 0;
28
- virtual T operator()(Error* x) = 0;
29
- virtual T operator()(Debug* x) = 0;
30
- virtual T operator()(Comment* x) = 0;
31
- virtual T operator()(If* x) = 0;
32
- virtual T operator()(For* x) = 0;
33
- virtual T operator()(Each* x) = 0;
34
- virtual T operator()(While* x) = 0;
35
- virtual T operator()(Return* x) = 0;
36
- virtual T operator()(Content* x) = 0;
37
- virtual T operator()(Extension* x) = 0;
38
- virtual T operator()(Definition* x) = 0;
39
- virtual T operator()(Mixin_Call* x) = 0;
14
+ virtual T operator()(Block_Ptr x) = 0;
15
+ virtual T operator()(Ruleset_Ptr x) = 0;
16
+ virtual T operator()(Bubble_Ptr x) = 0;
17
+ virtual T operator()(Trace_Ptr x) = 0;
18
+ virtual T operator()(Supports_Block_Ptr x) = 0;
19
+ virtual T operator()(Media_Block_Ptr x) = 0;
20
+ virtual T operator()(At_Root_Block_Ptr x) = 0;
21
+ virtual T operator()(Directive_Ptr x) = 0;
22
+ virtual T operator()(Keyframe_Rule_Ptr x) = 0;
23
+ virtual T operator()(Declaration_Ptr x) = 0;
24
+ virtual T operator()(Assignment_Ptr x) = 0;
25
+ virtual T operator()(Import_Ptr x) = 0;
26
+ virtual T operator()(Import_Stub_Ptr x) = 0;
27
+ virtual T operator()(Warning_Ptr x) = 0;
28
+ virtual T operator()(Error_Ptr x) = 0;
29
+ virtual T operator()(Debug_Ptr x) = 0;
30
+ virtual T operator()(Comment_Ptr x) = 0;
31
+ virtual T operator()(If_Ptr x) = 0;
32
+ virtual T operator()(For_Ptr x) = 0;
33
+ virtual T operator()(Each_Ptr x) = 0;
34
+ virtual T operator()(While_Ptr x) = 0;
35
+ virtual T operator()(Return_Ptr x) = 0;
36
+ virtual T operator()(Content_Ptr x) = 0;
37
+ virtual T operator()(Extension_Ptr x) = 0;
38
+ virtual T operator()(Definition_Ptr x) = 0;
39
+ virtual T operator()(Mixin_Call_Ptr x) = 0;
40
40
  // expressions
41
- virtual T operator()(List* x) = 0;
42
- virtual T operator()(Map* x) = 0;
43
- virtual T operator()(Binary_Expression* x) = 0;
44
- virtual T operator()(Unary_Expression* x) = 0;
45
- virtual T operator()(Function_Call* x) = 0;
46
- virtual T operator()(Function_Call_Schema* x) = 0;
47
- virtual T operator()(Custom_Warning* x) = 0;
48
- virtual T operator()(Custom_Error* x) = 0;
49
- virtual T operator()(Variable* x) = 0;
50
- virtual T operator()(Textual* x) = 0;
51
- virtual T operator()(Number* x) = 0;
52
- virtual T operator()(Color* x) = 0;
53
- virtual T operator()(Boolean* x) = 0;
54
- virtual T operator()(String_Schema* x) = 0;
55
- virtual T operator()(String_Quoted* x) = 0;
56
- virtual T operator()(String_Constant* x) = 0;
57
- virtual T operator()(Supports_Condition* x) = 0;
58
- virtual T operator()(Supports_Operator* x) = 0;
59
- virtual T operator()(Supports_Negation* x) = 0;
60
- virtual T operator()(Supports_Declaration* x) = 0;
61
- virtual T operator()(Supports_Interpolation* x) = 0;
62
- virtual T operator()(Media_Query* x) = 0;
63
- virtual T operator()(Media_Query_Expression* x) = 0;
64
- virtual T operator()(At_Root_Query* x) = 0;
65
- virtual T operator()(Null* x) = 0;
66
- virtual T operator()(Parent_Selector* x) = 0;
41
+ virtual T operator()(List_Ptr x) = 0;
42
+ virtual T operator()(Map_Ptr x) = 0;
43
+ virtual T operator()(Binary_Expression_Ptr x) = 0;
44
+ virtual T operator()(Unary_Expression_Ptr x) = 0;
45
+ virtual T operator()(Function_Call_Ptr x) = 0;
46
+ virtual T operator()(Function_Call_Schema_Ptr x) = 0;
47
+ virtual T operator()(Custom_Warning_Ptr x) = 0;
48
+ virtual T operator()(Custom_Error_Ptr x) = 0;
49
+ virtual T operator()(Variable_Ptr x) = 0;
50
+ virtual T operator()(Textual_Ptr x) = 0;
51
+ virtual T operator()(Number_Ptr x) = 0;
52
+ virtual T operator()(Color_Ptr x) = 0;
53
+ virtual T operator()(Boolean_Ptr x) = 0;
54
+ virtual T operator()(String_Schema_Ptr x) = 0;
55
+ virtual T operator()(String_Quoted_Ptr x) = 0;
56
+ virtual T operator()(String_Constant_Ptr x) = 0;
57
+ virtual T operator()(Supports_Condition_Ptr x) = 0;
58
+ virtual T operator()(Supports_Operator_Ptr x) = 0;
59
+ virtual T operator()(Supports_Negation_Ptr x) = 0;
60
+ virtual T operator()(Supports_Declaration_Ptr x) = 0;
61
+ virtual T operator()(Supports_Interpolation_Ptr x) = 0;
62
+ virtual T operator()(Media_Query_Ptr x) = 0;
63
+ virtual T operator()(Media_Query_Expression_Ptr x) = 0;
64
+ virtual T operator()(At_Root_Query_Ptr x) = 0;
65
+ virtual T operator()(Null_Ptr x) = 0;
66
+ virtual T operator()(Parent_Selector_Ptr x) = 0;
67
67
  // parameters and arguments
68
- virtual T operator()(Parameter* x) = 0;
69
- virtual T operator()(Parameters* x) = 0;
70
- virtual T operator()(Argument* x) = 0;
71
- virtual T operator()(Arguments* x) = 0;
68
+ virtual T operator()(Parameter_Ptr x) = 0;
69
+ virtual T operator()(Parameters_Ptr x) = 0;
70
+ virtual T operator()(Argument_Ptr x) = 0;
71
+ virtual T operator()(Arguments_Ptr x) = 0;
72
72
  // selectors
73
- virtual T operator()(Selector_Schema* x) = 0;
74
- virtual T operator()(Placeholder_Selector* x) = 0;
75
- virtual T operator()(Element_Selector* x) = 0;
76
- virtual T operator()(Class_Selector* x) = 0;
77
- virtual T operator()(Id_Selector* x) = 0;
78
- virtual T operator()(Attribute_Selector* x) = 0;
79
- virtual T operator()(Pseudo_Selector* x) = 0;
80
- virtual T operator()(Wrapped_Selector* x) = 0;
81
- virtual T operator()(SimpleSequence_Selector* x)= 0;
82
- virtual T operator()(Sequence_Selector* x) = 0;
83
- virtual T operator()(CommaSequence_Selector* x) = 0;
73
+ virtual T operator()(Selector_Schema_Ptr x) = 0;
74
+ virtual T operator()(Placeholder_Selector_Ptr x) = 0;
75
+ virtual T operator()(Element_Selector_Ptr x) = 0;
76
+ virtual T operator()(Class_Selector_Ptr x) = 0;
77
+ virtual T operator()(Id_Selector_Ptr x) = 0;
78
+ virtual T operator()(Attribute_Selector_Ptr x) = 0;
79
+ virtual T operator()(Pseudo_Selector_Ptr x) = 0;
80
+ virtual T operator()(Wrapped_Selector_Ptr x) = 0;
81
+ virtual T operator()(Compound_Selector_Ptr x)= 0;
82
+ virtual T operator()(Complex_Selector_Ptr x) = 0;
83
+ virtual T operator()(Selector_List_Ptr x) = 0;
84
84
 
85
85
  template <typename U>
86
86
  T fallback(U x) { return T(); }
@@ -91,78 +91,78 @@ namespace Sass {
91
91
  public:
92
92
  D& impl() { return static_cast<D&>(*this); }
93
93
  public:
94
- T operator()(AST_Node* x) { return static_cast<D*>(this)->fallback(x); }
94
+ T operator()(AST_Node_Ptr x) { return static_cast<D*>(this)->fallback(x); }
95
95
  // statements
96
- T operator()(Block* x) { return static_cast<D*>(this)->fallback(x); }
97
- T operator()(Ruleset* x) { return static_cast<D*>(this)->fallback(x); }
98
- T operator()(Bubble* x) { return static_cast<D*>(this)->fallback(x); }
99
- T operator()(Trace* x) { return static_cast<D*>(this)->fallback(x); }
100
- T operator()(Supports_Block* x) { return static_cast<D*>(this)->fallback(x); }
101
- T operator()(Media_Block* x) { return static_cast<D*>(this)->fallback(x); }
102
- T operator()(At_Root_Block* x) { return static_cast<D*>(this)->fallback(x); }
103
- T operator()(Directive* x) { return static_cast<D*>(this)->fallback(x); }
104
- T operator()(Keyframe_Rule* x) { return static_cast<D*>(this)->fallback(x); }
105
- T operator()(Declaration* x) { return static_cast<D*>(this)->fallback(x); }
106
- T operator()(Assignment* x) { return static_cast<D*>(this)->fallback(x); }
107
- T operator()(Import* x) { return static_cast<D*>(this)->fallback(x); }
108
- T operator()(Import_Stub* x) { return static_cast<D*>(this)->fallback(x); }
109
- T operator()(Warning* x) { return static_cast<D*>(this)->fallback(x); }
110
- T operator()(Error* x) { return static_cast<D*>(this)->fallback(x); }
111
- T operator()(Debug* x) { return static_cast<D*>(this)->fallback(x); }
112
- T operator()(Comment* x) { return static_cast<D*>(this)->fallback(x); }
113
- T operator()(If* x) { return static_cast<D*>(this)->fallback(x); }
114
- T operator()(For* x) { return static_cast<D*>(this)->fallback(x); }
115
- T operator()(Each* x) { return static_cast<D*>(this)->fallback(x); }
116
- T operator()(While* x) { return static_cast<D*>(this)->fallback(x); }
117
- T operator()(Return* x) { return static_cast<D*>(this)->fallback(x); }
118
- T operator()(Content* x) { return static_cast<D*>(this)->fallback(x); }
119
- T operator()(Extension* x) { return static_cast<D*>(this)->fallback(x); }
120
- T operator()(Definition* x) { return static_cast<D*>(this)->fallback(x); }
121
- T operator()(Mixin_Call* x) { return static_cast<D*>(this)->fallback(x); }
96
+ T operator()(Block_Ptr x) { return static_cast<D*>(this)->fallback(x); }
97
+ T operator()(Ruleset_Ptr x) { return static_cast<D*>(this)->fallback(x); }
98
+ T operator()(Bubble_Ptr x) { return static_cast<D*>(this)->fallback(x); }
99
+ T operator()(Trace_Ptr x) { return static_cast<D*>(this)->fallback(x); }
100
+ T operator()(Supports_Block_Ptr x) { return static_cast<D*>(this)->fallback(x); }
101
+ T operator()(Media_Block_Ptr x) { return static_cast<D*>(this)->fallback(x); }
102
+ T operator()(At_Root_Block_Ptr x) { return static_cast<D*>(this)->fallback(x); }
103
+ T operator()(Directive_Ptr x) { return static_cast<D*>(this)->fallback(x); }
104
+ T operator()(Keyframe_Rule_Ptr x) { return static_cast<D*>(this)->fallback(x); }
105
+ T operator()(Declaration_Ptr x) { return static_cast<D*>(this)->fallback(x); }
106
+ T operator()(Assignment_Ptr x) { return static_cast<D*>(this)->fallback(x); }
107
+ T operator()(Import_Ptr x) { return static_cast<D*>(this)->fallback(x); }
108
+ T operator()(Import_Stub_Ptr x) { return static_cast<D*>(this)->fallback(x); }
109
+ T operator()(Warning_Ptr x) { return static_cast<D*>(this)->fallback(x); }
110
+ T operator()(Error_Ptr x) { return static_cast<D*>(this)->fallback(x); }
111
+ T operator()(Debug_Ptr x) { return static_cast<D*>(this)->fallback(x); }
112
+ T operator()(Comment_Ptr x) { return static_cast<D*>(this)->fallback(x); }
113
+ T operator()(If_Ptr x) { return static_cast<D*>(this)->fallback(x); }
114
+ T operator()(For_Ptr x) { return static_cast<D*>(this)->fallback(x); }
115
+ T operator()(Each_Ptr x) { return static_cast<D*>(this)->fallback(x); }
116
+ T operator()(While_Ptr x) { return static_cast<D*>(this)->fallback(x); }
117
+ T operator()(Return_Ptr x) { return static_cast<D*>(this)->fallback(x); }
118
+ T operator()(Content_Ptr x) { return static_cast<D*>(this)->fallback(x); }
119
+ T operator()(Extension_Ptr x) { return static_cast<D*>(this)->fallback(x); }
120
+ T operator()(Definition_Ptr x) { return static_cast<D*>(this)->fallback(x); }
121
+ T operator()(Mixin_Call_Ptr x) { return static_cast<D*>(this)->fallback(x); }
122
122
  // expressions
123
- T operator()(List* x) { return static_cast<D*>(this)->fallback(x); }
124
- T operator()(Map* x) { return static_cast<D*>(this)->fallback(x); }
125
- T operator()(Binary_Expression* x) { return static_cast<D*>(this)->fallback(x); }
126
- T operator()(Unary_Expression* x) { return static_cast<D*>(this)->fallback(x); }
127
- T operator()(Function_Call* x) { return static_cast<D*>(this)->fallback(x); }
128
- T operator()(Function_Call_Schema* x) { return static_cast<D*>(this)->fallback(x); }
129
- T operator()(Custom_Warning* x) { return static_cast<D*>(this)->fallback(x); }
130
- T operator()(Custom_Error* x) { return static_cast<D*>(this)->fallback(x); }
131
- T operator()(Variable* x) { return static_cast<D*>(this)->fallback(x); }
132
- T operator()(Textual* x) { return static_cast<D*>(this)->fallback(x); }
133
- T operator()(Number* x) { return static_cast<D*>(this)->fallback(x); }
134
- T operator()(Color* x) { return static_cast<D*>(this)->fallback(x); }
135
- T operator()(Boolean* x) { return static_cast<D*>(this)->fallback(x); }
136
- T operator()(String_Schema* x) { return static_cast<D*>(this)->fallback(x); }
137
- T operator()(String_Constant* x) { return static_cast<D*>(this)->fallback(x); }
138
- T operator()(String_Quoted* x) { return static_cast<D*>(this)->fallback(x); }
139
- T operator()(Supports_Condition* x) { return static_cast<D*>(this)->fallback(x); }
140
- T operator()(Supports_Operator* x) { return static_cast<D*>(this)->fallback(x); }
141
- T operator()(Supports_Negation* x) { return static_cast<D*>(this)->fallback(x); }
142
- T operator()(Supports_Declaration* x) { return static_cast<D*>(this)->fallback(x); }
143
- T operator()(Supports_Interpolation* x) { return static_cast<D*>(this)->fallback(x); }
144
- T operator()(Media_Query* x) { return static_cast<D*>(this)->fallback(x); }
145
- T operator()(Media_Query_Expression* x) { return static_cast<D*>(this)->fallback(x); }
146
- T operator()(At_Root_Query* x) { return static_cast<D*>(this)->fallback(x); }
147
- T operator()(Null* x) { return static_cast<D*>(this)->fallback(x); }
148
- T operator()(Parent_Selector* x) { return static_cast<D*>(this)->fallback(x); }
123
+ T operator()(List_Ptr x) { return static_cast<D*>(this)->fallback(x); }
124
+ T operator()(Map_Ptr x) { return static_cast<D*>(this)->fallback(x); }
125
+ T operator()(Binary_Expression_Ptr x) { return static_cast<D*>(this)->fallback(x); }
126
+ T operator()(Unary_Expression_Ptr x) { return static_cast<D*>(this)->fallback(x); }
127
+ T operator()(Function_Call_Ptr x) { return static_cast<D*>(this)->fallback(x); }
128
+ T operator()(Function_Call_Schema_Ptr x) { return static_cast<D*>(this)->fallback(x); }
129
+ T operator()(Custom_Warning_Ptr x) { return static_cast<D*>(this)->fallback(x); }
130
+ T operator()(Custom_Error_Ptr x) { return static_cast<D*>(this)->fallback(x); }
131
+ T operator()(Variable_Ptr x) { return static_cast<D*>(this)->fallback(x); }
132
+ T operator()(Textual_Ptr x) { return static_cast<D*>(this)->fallback(x); }
133
+ T operator()(Number_Ptr x) { return static_cast<D*>(this)->fallback(x); }
134
+ T operator()(Color_Ptr x) { return static_cast<D*>(this)->fallback(x); }
135
+ T operator()(Boolean_Ptr x) { return static_cast<D*>(this)->fallback(x); }
136
+ T operator()(String_Schema_Ptr x) { return static_cast<D*>(this)->fallback(x); }
137
+ T operator()(String_Constant_Ptr x) { return static_cast<D*>(this)->fallback(x); }
138
+ T operator()(String_Quoted_Ptr x) { return static_cast<D*>(this)->fallback(x); }
139
+ T operator()(Supports_Condition_Ptr x) { return static_cast<D*>(this)->fallback(x); }
140
+ T operator()(Supports_Operator_Ptr x) { return static_cast<D*>(this)->fallback(x); }
141
+ T operator()(Supports_Negation_Ptr x) { return static_cast<D*>(this)->fallback(x); }
142
+ T operator()(Supports_Declaration_Ptr x) { return static_cast<D*>(this)->fallback(x); }
143
+ T operator()(Supports_Interpolation_Ptr x) { return static_cast<D*>(this)->fallback(x); }
144
+ T operator()(Media_Query_Ptr x) { return static_cast<D*>(this)->fallback(x); }
145
+ T operator()(Media_Query_Expression_Ptr x) { return static_cast<D*>(this)->fallback(x); }
146
+ T operator()(At_Root_Query_Ptr x) { return static_cast<D*>(this)->fallback(x); }
147
+ T operator()(Null_Ptr x) { return static_cast<D*>(this)->fallback(x); }
148
+ T operator()(Parent_Selector_Ptr x) { return static_cast<D*>(this)->fallback(x); }
149
149
  // parameters and arguments
150
- T operator()(Parameter* x) { return static_cast<D*>(this)->fallback(x); }
151
- T operator()(Parameters* x) { return static_cast<D*>(this)->fallback(x); }
152
- T operator()(Argument* x) { return static_cast<D*>(this)->fallback(x); }
153
- T operator()(Arguments* x) { return static_cast<D*>(this)->fallback(x); }
150
+ T operator()(Parameter_Ptr x) { return static_cast<D*>(this)->fallback(x); }
151
+ T operator()(Parameters_Ptr x) { return static_cast<D*>(this)->fallback(x); }
152
+ T operator()(Argument_Ptr x) { return static_cast<D*>(this)->fallback(x); }
153
+ T operator()(Arguments_Ptr x) { return static_cast<D*>(this)->fallback(x); }
154
154
  // selectors
155
- T operator()(Selector_Schema* x) { return static_cast<D*>(this)->fallback(x); }
156
- T operator()(Placeholder_Selector* x) { return static_cast<D*>(this)->fallback(x); }
157
- T operator()(Element_Selector* x) { return static_cast<D*>(this)->fallback(x); }
158
- T operator()(Class_Selector* x) { return static_cast<D*>(this)->fallback(x); }
159
- T operator()(Id_Selector* x) { return static_cast<D*>(this)->fallback(x); }
160
- T operator()(Attribute_Selector* x) { return static_cast<D*>(this)->fallback(x); }
161
- T operator()(Pseudo_Selector* x) { return static_cast<D*>(this)->fallback(x); }
162
- T operator()(Wrapped_Selector* x) { return static_cast<D*>(this)->fallback(x); }
163
- T operator()(SimpleSequence_Selector* x){ return static_cast<D*>(this)->fallback(x); }
164
- T operator()(Sequence_Selector* x) { return static_cast<D*>(this)->fallback(x); }
165
- T operator()(CommaSequence_Selector* x) { return static_cast<D*>(this)->fallback(x); }
155
+ T operator()(Selector_Schema_Ptr x) { return static_cast<D*>(this)->fallback(x); }
156
+ T operator()(Placeholder_Selector_Ptr x) { return static_cast<D*>(this)->fallback(x); }
157
+ T operator()(Element_Selector_Ptr x) { return static_cast<D*>(this)->fallback(x); }
158
+ T operator()(Class_Selector_Ptr x) { return static_cast<D*>(this)->fallback(x); }
159
+ T operator()(Id_Selector_Ptr x) { return static_cast<D*>(this)->fallback(x); }
160
+ T operator()(Attribute_Selector_Ptr x) { return static_cast<D*>(this)->fallback(x); }
161
+ T operator()(Pseudo_Selector_Ptr x) { return static_cast<D*>(this)->fallback(x); }
162
+ T operator()(Wrapped_Selector_Ptr x) { return static_cast<D*>(this)->fallback(x); }
163
+ T operator()(Compound_Selector_Ptr x){ return static_cast<D*>(this)->fallback(x); }
164
+ T operator()(Complex_Selector_Ptr x) { return static_cast<D*>(this)->fallback(x); }
165
+ T operator()(Selector_List_Ptr x) { return static_cast<D*>(this)->fallback(x); }
166
166
 
167
167
  template <typename U>
168
168
  T fallback(U x) { return T(); }