sassc 1.10.1 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -2
  3. data/ext/libsass/.github/CONTRIBUTING.md +65 -0
  4. data/ext/libsass/.github/ISSUE_TEMPLATE.md +29 -0
  5. data/ext/libsass/Makefile +8 -3
  6. data/ext/libsass/Makefile.conf +28 -22
  7. data/ext/libsass/Readme.md +14 -7
  8. data/ext/libsass/configure.ac +5 -8
  9. data/ext/libsass/docs/api-context-internal.md +3 -0
  10. data/ext/libsass/docs/api-context.md +7 -0
  11. data/ext/libsass/docs/api-doc.md +4 -0
  12. data/ext/libsass/docs/api-importer.md +2 -0
  13. data/ext/libsass/docs/api-value-example.md +55 -0
  14. data/ext/libsass/docs/api-value.md +49 -22
  15. data/ext/libsass/docs/implementations.md +4 -0
  16. data/ext/libsass/include/sass/base.h +5 -4
  17. data/ext/libsass/include/sass/context.h +3 -0
  18. data/ext/libsass/include/sass/values.h +28 -27
  19. data/ext/libsass/include/sass/version.h +1 -1
  20. data/ext/libsass/include/sass2scss.h +1 -1
  21. data/ext/libsass/script/ci-build-libsass +3 -3
  22. data/ext/libsass/script/ci-install-deps +12 -3
  23. data/ext/libsass/src/ast.cpp +321 -212
  24. data/ext/libsass/src/ast.hpp +273 -165
  25. data/ext/libsass/src/ast_factory.hpp +4 -5
  26. data/ext/libsass/src/ast_fwd_decl.hpp +8 -7
  27. data/ext/libsass/src/bind.cpp +2 -7
  28. data/ext/libsass/src/bind.hpp +0 -1
  29. data/ext/libsass/src/check_nesting.cpp +379 -0
  30. data/ext/libsass/src/check_nesting.hpp +60 -0
  31. data/ext/libsass/src/constants.cpp +7 -6
  32. data/ext/libsass/src/constants.hpp +2 -1
  33. data/ext/libsass/src/context.cpp +7 -1
  34. data/ext/libsass/src/context.hpp +1 -1
  35. data/ext/libsass/src/cssize.cpp +76 -32
  36. data/ext/libsass/src/cssize.hpp +7 -8
  37. data/ext/libsass/src/debugger.hpp +70 -40
  38. data/ext/libsass/src/error_handling.cpp +15 -2
  39. data/ext/libsass/src/error_handling.hpp +19 -0
  40. data/ext/libsass/src/eval.cpp +107 -161
  41. data/ext/libsass/src/eval.hpp +12 -8
  42. data/ext/libsass/src/expand.cpp +81 -74
  43. data/ext/libsass/src/expand.hpp +13 -12
  44. data/ext/libsass/src/extend.cpp +149 -142
  45. data/ext/libsass/src/extend.hpp +10 -3
  46. data/ext/libsass/src/file.cpp +2 -1
  47. data/ext/libsass/src/functions.cpp +96 -59
  48. data/ext/libsass/src/functions.hpp +2 -2
  49. data/ext/libsass/src/inspect.cpp +33 -45
  50. data/ext/libsass/src/inspect.hpp +7 -7
  51. data/ext/libsass/src/json.cpp +17 -5
  52. data/ext/libsass/src/lexer.cpp +3 -3
  53. data/ext/libsass/src/listize.cpp +10 -10
  54. data/ext/libsass/src/listize.hpp +3 -3
  55. data/ext/libsass/src/node.cpp +30 -30
  56. data/ext/libsass/src/node.hpp +13 -13
  57. data/ext/libsass/src/operation.hpp +21 -19
  58. data/ext/libsass/src/output.cpp +48 -103
  59. data/ext/libsass/src/output.hpp +0 -1
  60. data/ext/libsass/src/parser.cpp +161 -133
  61. data/ext/libsass/src/parser.hpp +10 -7
  62. data/ext/libsass/src/remove_placeholders.cpp +6 -6
  63. data/ext/libsass/src/remove_placeholders.hpp +1 -1
  64. data/ext/libsass/src/sass.cpp +21 -0
  65. data/ext/libsass/src/sass.hpp +8 -1
  66. data/ext/libsass/src/sass2scss.cpp +14 -3
  67. data/ext/libsass/src/sass_context.cpp +69 -24
  68. data/ext/libsass/src/sass_context.hpp +3 -0
  69. data/ext/libsass/src/source_map.cpp +22 -10
  70. data/ext/libsass/src/to_value.cpp +2 -2
  71. data/ext/libsass/src/to_value.hpp +1 -1
  72. data/ext/libsass/src/units.hpp +3 -1
  73. data/ext/libsass/src/util.cpp +20 -16
  74. data/ext/libsass/src/util.hpp +2 -1
  75. data/ext/libsass/win/libsass.targets +2 -0
  76. data/ext/libsass/win/libsass.vcxproj.filters +6 -0
  77. data/lib/sassc/engine.rb +5 -0
  78. data/lib/sassc/native/native_functions_api.rb +13 -1
  79. data/lib/sassc/script/value_conversion.rb +11 -1
  80. data/lib/sassc/script/value_conversion/list.rb +23 -0
  81. data/lib/sassc/version.rb +1 -1
  82. data/test/engine_test.rb +18 -2
  83. data/test/functions_test.rb +30 -0
  84. data/test/native_test.rb +1 -1
  85. metadata +8 -3
@@ -7,7 +7,7 @@
7
7
  #include "sass/functions.h"
8
8
 
9
9
  #define BUILT_IN(name) Expression*\
10
- name(Env& env, Env& d_env, Context& ctx, Signature sig, ParserState pstate, Backtrace* backtrace)
10
+ name(Env& env, Env& d_env, Context& ctx, Signature sig, ParserState pstate, Backtrace* backtrace, std::vector<CommaSequence_Selector*> selector_stack)
11
11
 
12
12
  namespace Sass {
13
13
  class Context;
@@ -17,7 +17,7 @@ namespace Sass {
17
17
  class Definition;
18
18
  typedef Environment<AST_Node*> Env;
19
19
  typedef const char* Signature;
20
- typedef Expression* (*Native_Function)(Env&, Env&, Context&, Signature, ParserState, Backtrace*);
20
+ typedef Expression* (*Native_Function)(Env&, Env&, Context&, Signature, ParserState, Backtrace*, std::vector<CommaSequence_Selector*>);
21
21
 
22
22
  Definition* make_native_function(Signature, Native_Function, Context& ctx);
23
23
  Definition* make_c_function(Sass_Function_Entry c_func, Context& ctx);
@@ -51,13 +51,6 @@ namespace Sass {
51
51
  if (rule->block()) rule->block()->perform(this);
52
52
  }
53
53
 
54
- void Inspect::operator()(Propset* propset)
55
- {
56
- propset->property_fragment()->perform(this);
57
- append_colon_separator();
58
- propset->block()->perform(this);
59
- }
60
-
61
54
  void Inspect::operator()(Bubble* bubble)
62
55
  {
63
56
  append_indentation();
@@ -166,10 +159,6 @@ namespace Sass {
166
159
  append_token("@import", import);
167
160
  append_mandatory_space();
168
161
 
169
- if (String_Quoted* strq = dynamic_cast<String_Quoted*>(import->urls().front())) {
170
- strq->is_delayed(false);
171
- }
172
-
173
162
  import->urls().front()->perform(this);
174
163
  if (import->urls().size() == 1) {
175
164
  if (import->media_queries()) {
@@ -183,10 +172,6 @@ namespace Sass {
183
172
  append_token("@import", import);
184
173
  append_mandatory_space();
185
174
 
186
- if (String_Quoted* strq = dynamic_cast<String_Quoted*>(import->urls()[i])) {
187
- strq->is_delayed(false);
188
- }
189
-
190
175
  import->urls()[i]->perform(this);
191
176
  if (import->urls().size() - 1 == i) {
192
177
  if (import->media_queries()) {
@@ -390,7 +375,7 @@ namespace Sass {
390
375
  !list->from_selector() &&
391
376
  !dynamic_cast<List*>((*list)[0]) &&
392
377
  !dynamic_cast<List*>((*list)[0]) &&
393
- !dynamic_cast<Selector_List*>((*list)[0])) {
378
+ !dynamic_cast<CommaSequence_Selector*>((*list)[0])) {
394
379
  append_string("(");
395
380
  }
396
381
  else if (!in_declaration && (list->separator() == SASS_HASH ||
@@ -432,7 +417,7 @@ namespace Sass {
432
417
  !list->from_selector() &&
433
418
  !dynamic_cast<List*>((*list)[0]) &&
434
419
  !dynamic_cast<List*>((*list)[0]) &&
435
- !dynamic_cast<Selector_List*>((*list)[0])) {
420
+ !dynamic_cast<CommaSequence_Selector*>((*list)[0])) {
436
421
  append_string(",)");
437
422
  }
438
423
  else if (!in_declaration && (list->separator() == SASS_HASH ||
@@ -451,10 +436,8 @@ namespace Sass {
451
436
  (output_style() == INSPECT) || (
452
437
  expr->op().ws_before
453
438
  && (!expr->is_interpolant())
454
- && (!expr->is_delayed() ||
455
- expr->is_left_interpolant() ||
456
- expr->is_right_interpolant()
457
- )
439
+ && (expr->is_left_interpolant() ||
440
+ expr->is_right_interpolant())
458
441
 
459
442
  )) append_string(" ");
460
443
  switch (expr->type()) {
@@ -477,10 +460,8 @@ namespace Sass {
477
460
  (output_style() == INSPECT) || (
478
461
  expr->op().ws_after
479
462
  && (!expr->is_interpolant())
480
- && (!expr->is_delayed()
481
- || expr->is_left_interpolant()
482
- || expr->is_right_interpolant()
483
- )
463
+ && (expr->is_left_interpolant() ||
464
+ expr->is_right_interpolant())
484
465
  )) append_string(" ");
485
466
  expr->right()->perform(this);
486
467
  }
@@ -895,10 +876,10 @@ namespace Sass {
895
876
 
896
877
  void Inspect::operator()(Parent_Selector* p)
897
878
  {
898
- append_string("&");
879
+ if (p->is_real_parent_ref()) append_string("&");
899
880
  }
900
881
 
901
- void Inspect::operator()(Selector_Placeholder* s)
882
+ void Inspect::operator()(Placeholder_Selector* s)
902
883
  {
903
884
  append_token(s->name(), s);
904
885
  if (s->has_line_break()) append_optional_linefeed();
@@ -906,12 +887,19 @@ namespace Sass {
906
887
 
907
888
  }
908
889
 
909
- void Inspect::operator()(Type_Selector* s)
890
+ void Inspect::operator()(Element_Selector* s)
910
891
  {
911
892
  append_token(s->ns_name(), s);
912
893
  }
913
894
 
914
- void Inspect::operator()(Selector_Qualifier* s)
895
+ void Inspect::operator()(Class_Selector* s)
896
+ {
897
+ append_token(s->ns_name(), s);
898
+ if (s->has_line_break()) append_optional_linefeed();
899
+ if (s->has_line_break()) append_indentation();
900
+ }
901
+
902
+ void Inspect::operator()(Id_Selector* s)
915
903
  {
916
904
  append_token(s->ns_name(), s);
917
905
  if (s->has_line_break()) append_optional_linefeed();
@@ -957,7 +945,7 @@ namespace Sass {
957
945
  in_wrapped = was;
958
946
  }
959
947
 
960
- void Inspect::operator()(Compound_Selector* s)
948
+ void Inspect::operator()(SimpleSequence_Selector* s)
961
949
  {
962
950
  for (size_t i = 0, L = s->length(); i < L; ++i) {
963
951
  (*s)[i]->perform(this);
@@ -969,13 +957,13 @@ namespace Sass {
969
957
  }
970
958
  }
971
959
 
972
- void Inspect::operator()(Complex_Selector* c)
960
+ void Inspect::operator()(Sequence_Selector* c)
973
961
  {
974
- Compound_Selector* head = c->head();
975
- Complex_Selector* tail = c->tail();
976
- Complex_Selector::Combinator comb = c->combinator();
962
+ SimpleSequence_Selector* head = c->head();
963
+ Sequence_Selector* tail = c->tail();
964
+ Sequence_Selector::Combinator comb = c->combinator();
977
965
 
978
- if (comb == Complex_Selector::ANCESTOR_OF && (!head || head->empty())) {
966
+ if (comb == Sequence_Selector::ANCESTOR_OF && (!head || head->empty())) {
979
967
  if (tail) tail->perform(this);
980
968
  return;
981
969
  }
@@ -990,30 +978,30 @@ namespace Sass {
990
978
  if (head && head->length() != 0) head->perform(this);
991
979
  bool is_empty = !head || head->length() == 0 || head->is_empty_reference();
992
980
  bool is_tail = head && !head->is_empty_reference() && tail;
993
- if (output_style() == COMPRESSED && comb != Complex_Selector::ANCESTOR_OF) scheduled_space = 0;
981
+ if (output_style() == COMPRESSED && comb != Sequence_Selector::ANCESTOR_OF) scheduled_space = 0;
994
982
 
995
983
  switch (comb) {
996
- case Complex_Selector::ANCESTOR_OF:
984
+ case Sequence_Selector::ANCESTOR_OF:
997
985
  if (is_tail) append_mandatory_space();
998
986
  break;
999
- case Complex_Selector::PARENT_OF:
987
+ case Sequence_Selector::PARENT_OF:
1000
988
  append_optional_space();
1001
989
  append_string(">");
1002
990
  append_optional_space();
1003
991
  break;
1004
- case Complex_Selector::ADJACENT_TO:
992
+ case Sequence_Selector::ADJACENT_TO:
1005
993
  append_optional_space();
1006
994
  append_string("+");
1007
995
  append_optional_space();
1008
996
  break;
1009
- case Complex_Selector::REFERENCE:
997
+ case Sequence_Selector::REFERENCE:
1010
998
  append_mandatory_space();
1011
999
  append_string("/");
1012
1000
  c->reference()->perform(this);
1013
1001
  append_string("/");
1014
1002
  append_mandatory_space();
1015
1003
  break;
1016
- case Complex_Selector::PRECEDES:
1004
+ case Sequence_Selector::PRECEDES:
1017
1005
  if (is_empty) append_optional_space();
1018
1006
  else append_mandatory_space();
1019
1007
  append_string("~");
@@ -1021,7 +1009,7 @@ namespace Sass {
1021
1009
  else append_optional_space();
1022
1010
  break;
1023
1011
  }
1024
- if (tail && comb != Complex_Selector::ANCESTOR_OF) {
1012
+ if (tail && comb != Sequence_Selector::ANCESTOR_OF) {
1025
1013
  if (c->has_line_break()) append_optional_linefeed();
1026
1014
  }
1027
1015
  if (tail) tail->perform(this);
@@ -1032,7 +1020,7 @@ namespace Sass {
1032
1020
  }
1033
1021
  }
1034
1022
 
1035
- void Inspect::operator()(Selector_List* g)
1023
+ void Inspect::operator()(CommaSequence_Selector* g)
1036
1024
  {
1037
1025
 
1038
1026
  if (g->empty()) {
@@ -1047,7 +1035,7 @@ namespace Sass {
1047
1035
  // probably ruby sass eqivalent of element_needs_parens
1048
1036
  if (output_style() == TO_SASS && g->length() == 1 &&
1049
1037
  (!dynamic_cast<List*>((*g)[0]) &&
1050
- !dynamic_cast<Selector_List*>((*g)[0]))) {
1038
+ !dynamic_cast<CommaSequence_Selector*>((*g)[0]))) {
1051
1039
  append_string("(");
1052
1040
  }
1053
1041
  else if (!in_declaration && in_comma_array) {
@@ -1073,7 +1061,7 @@ namespace Sass {
1073
1061
  // probably ruby sass eqivalent of element_needs_parens
1074
1062
  if (output_style() == TO_SASS && g->length() == 1 &&
1075
1063
  (!dynamic_cast<List*>((*g)[0]) &&
1076
- !dynamic_cast<Selector_List*>((*g)[0]))) {
1064
+ !dynamic_cast<CommaSequence_Selector*>((*g)[0]))) {
1077
1065
  append_string(",)");
1078
1066
  }
1079
1067
  else if (!in_declaration && in_comma_array) {
@@ -23,7 +23,6 @@ namespace Sass {
23
23
  // statements
24
24
  virtual void operator()(Block*);
25
25
  virtual void operator()(Ruleset*);
26
- virtual void operator()(Propset*);
27
26
  virtual void operator()(Bubble*);
28
27
  virtual void operator()(Supports_Block*);
29
28
  virtual void operator()(Media_Block*);
@@ -82,15 +81,16 @@ namespace Sass {
82
81
  virtual void operator()(Arguments*);
83
82
  // selectors
84
83
  virtual void operator()(Selector_Schema*);
85
- virtual void operator()(Selector_Placeholder*);
86
- virtual void operator()(Type_Selector*);
87
- virtual void operator()(Selector_Qualifier*);
84
+ virtual void operator()(Placeholder_Selector*);
85
+ virtual void operator()(Element_Selector*);
86
+ virtual void operator()(Class_Selector*);
87
+ virtual void operator()(Id_Selector*);
88
88
  virtual void operator()(Attribute_Selector*);
89
89
  virtual void operator()(Pseudo_Selector*);
90
90
  virtual void operator()(Wrapped_Selector*);
91
- virtual void operator()(Compound_Selector*);
92
- virtual void operator()(Complex_Selector*);
93
- virtual void operator()(Selector_List*);
91
+ virtual void operator()(SimpleSequence_Selector*);
92
+ virtual void operator()(Sequence_Selector*);
93
+ virtual void operator()(CommaSequence_Selector*);
94
94
 
95
95
  // template <typename U>
96
96
  // void fallback(U x) { fallback_impl(reinterpret_cast<AST_Node*>(x)); }
@@ -399,7 +399,13 @@ char *json_encode_string(const char *str)
399
399
  SB sb;
400
400
  sb_init(&sb);
401
401
 
402
- emit_string(&sb, str);
402
+ try {
403
+ emit_string(&sb, str);
404
+ }
405
+ catch (std::exception) {
406
+ sb_free(&sb);
407
+ throw;
408
+ }
403
409
 
404
410
  return sb_finish(&sb);
405
411
  }
@@ -409,10 +415,16 @@ char *json_stringify(const JsonNode *node, const char *space)
409
415
  SB sb;
410
416
  sb_init(&sb);
411
417
 
412
- if (space != NULL)
413
- emit_value_indented(&sb, node, space, 0);
414
- else
415
- emit_value(&sb, node);
418
+ try {
419
+ if (space != NULL)
420
+ emit_value_indented(&sb, node, space, 0);
421
+ else
422
+ emit_value(&sb, node);
423
+ }
424
+ catch (std::exception) {
425
+ sb_free(&sb);
426
+ throw;
427
+ }
416
428
 
417
429
  return sb_finish(&sb);
418
430
  }
@@ -81,9 +81,9 @@ namespace Sass {
81
81
  bool is_nonascii(const char& chr)
82
82
  {
83
83
  return (
84
- (unsigned(chr) > 127 && unsigned(chr) < 55296) ||
85
- (unsigned(chr) > 57343 && unsigned(chr) < 65534) ||
86
- (unsigned(chr) > 65535 && unsigned(chr) < 1114111)
84
+ (unsigned(chr) >= 128 && unsigned(chr) <= 15572911) ||
85
+ (unsigned(chr) >= 15630464 && unsigned(chr) <= 15712189) ||
86
+ (unsigned(chr) >= 4036001920)
87
87
  );
88
88
  }
89
89
 
@@ -14,7 +14,7 @@ namespace Sass {
14
14
  : mem(mem)
15
15
  { }
16
16
 
17
- Expression* Listize::operator()(Selector_List* sel)
17
+ Expression* Listize::operator()(CommaSequence_Selector* sel)
18
18
  {
19
19
  List* l = SASS_MEMORY_NEW(mem, List, sel->pstate(), sel->length(), SASS_COMMA);
20
20
  l->from_selector(true);
@@ -26,7 +26,7 @@ namespace Sass {
26
26
  return SASS_MEMORY_NEW(mem, Null, l->pstate());
27
27
  }
28
28
 
29
- Expression* Listize::operator()(Compound_Selector* sel)
29
+ Expression* Listize::operator()(SimpleSequence_Selector* sel)
30
30
  {
31
31
  std::string str;
32
32
  for (size_t i = 0, L = sel->length(); i < L; ++i) {
@@ -36,11 +36,11 @@ namespace Sass {
36
36
  return SASS_MEMORY_NEW(mem, String_Quoted, sel->pstate(), str);
37
37
  }
38
38
 
39
- Expression* Listize::operator()(Complex_Selector* sel)
39
+ Expression* Listize::operator()(Sequence_Selector* sel)
40
40
  {
41
41
  List* l = SASS_MEMORY_NEW(mem, List, sel->pstate(), 2);
42
42
  l->from_selector(true);
43
- Compound_Selector* head = sel->head();
43
+ SimpleSequence_Selector* head = sel->head();
44
44
  if (head && !head->is_empty_reference())
45
45
  {
46
46
  Expression* hh = head->perform(this);
@@ -51,23 +51,23 @@ namespace Sass {
51
51
  : sel->reference()->to_string();
52
52
  switch(sel->combinator())
53
53
  {
54
- case Complex_Selector::PARENT_OF:
54
+ case Sequence_Selector::PARENT_OF:
55
55
  *l << SASS_MEMORY_NEW(mem, String_Quoted, sel->pstate(), ">");
56
56
  break;
57
- case Complex_Selector::ADJACENT_TO:
57
+ case Sequence_Selector::ADJACENT_TO:
58
58
  *l << SASS_MEMORY_NEW(mem, String_Quoted, sel->pstate(), "+");
59
59
  break;
60
- case Complex_Selector::REFERENCE:
60
+ case Sequence_Selector::REFERENCE:
61
61
  *l << SASS_MEMORY_NEW(mem, String_Quoted, sel->pstate(), "/" + reference + "/");
62
62
  break;
63
- case Complex_Selector::PRECEDES:
63
+ case Sequence_Selector::PRECEDES:
64
64
  *l << SASS_MEMORY_NEW(mem, String_Quoted, sel->pstate(), "~");
65
65
  break;
66
- case Complex_Selector::ANCESTOR_OF:
66
+ case Sequence_Selector::ANCESTOR_OF:
67
67
  break;
68
68
  }
69
69
 
70
- Complex_Selector* tail = sel->tail();
70
+ Sequence_Selector* tail = sel->tail();
71
71
  if (tail)
72
72
  {
73
73
  Expression* tt = tail->perform(this);
@@ -24,9 +24,9 @@ namespace Sass {
24
24
  Listize(Memory_Manager&);
25
25
  ~Listize() { }
26
26
 
27
- Expression* operator()(Selector_List*);
28
- Expression* operator()(Complex_Selector*);
29
- Expression* operator()(Compound_Selector*);
27
+ Expression* operator()(CommaSequence_Selector*);
28
+ Expression* operator()(Sequence_Selector*);
29
+ Expression* operator()(SimpleSequence_Selector*);
30
30
 
31
31
  template <typename U>
32
32
  Expression* fallback(U x) { return fallback_impl(x); }
@@ -8,20 +8,20 @@
8
8
  namespace Sass {
9
9
 
10
10
 
11
- Node Node::createCombinator(const Complex_Selector::Combinator& combinator) {
11
+ Node Node::createCombinator(const Sequence_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(Complex_Selector* pSelector, Context& ctx) {
17
+ Node Node::createSelector(Sequence_Selector* pSelector, Context& ctx) {
18
18
  NodeDequePtr null;
19
19
 
20
- Complex_Selector* pStripped = pSelector->clone(ctx);
20
+ Sequence_Selector* pStripped = pSelector->clone(ctx);
21
21
  pStripped->tail(NULL);
22
- pStripped->combinator(Complex_Selector::ANCESTOR_OF);
22
+ pStripped->combinator(Sequence_Selector::ANCESTOR_OF);
23
23
 
24
- Node n(SELECTOR, Complex_Selector::ANCESTOR_OF, pStripped, null /*pCollection*/);
24
+ Node n(SELECTOR, Sequence_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,23 +29,23 @@ namespace Sass {
29
29
 
30
30
  Node Node::createCollection() {
31
31
  NodeDequePtr pEmptyCollection = std::make_shared<NodeDeque>();
32
- return Node(COLLECTION, Complex_Selector::ANCESTOR_OF, NULL /*pSelector*/, pEmptyCollection);
32
+ return Node(COLLECTION, Sequence_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, Complex_Selector::ANCESTOR_OF, NULL /*pSelector*/, pShallowCopiedCollection);
38
+ return Node(COLLECTION, Sequence_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, Complex_Selector::ANCESTOR_OF, NULL /*pSelector*/, null /*pCollection*/);
44
+ return Node(NIL, Sequence_Selector::ANCESTOR_OF, NULL /*pSelector*/, null /*pCollection*/);
45
45
  }
46
46
 
47
47
 
48
- Node::Node(const TYPE& type, Complex_Selector::Combinator combinator, Complex_Selector* pSelector, NodeDequePtr& pCollection)
48
+ Node::Node(const TYPE& type, Sequence_Selector::Combinator combinator, Sequence_Selector* 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
 
@@ -140,11 +140,11 @@ namespace Sass {
140
140
  if (node.isCombinator()) {
141
141
 
142
142
  switch (node.combinator()) {
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;
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;
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(Complex_Selector* pToConvert, Context& ctx) {
180
+ Node complexSelectorToNode(Sequence_Selector* pToConvert, Context& ctx) {
181
181
  if (pToConvert == NULL) {
182
182
  return Node::createNil();
183
183
  }
@@ -187,7 +187,7 @@ namespace Sass {
187
187
 
188
188
  // unwrap the selector from parent ref
189
189
  if (pToConvert->head() && pToConvert->head()->has_parent_ref()) {
190
- Complex_Selector* tail = pToConvert->tail();
190
+ Sequence_Selector* tail = pToConvert->tail();
191
191
  if (tail) tail->has_line_feed(pToConvert->has_line_feed());
192
192
  pToConvert = tail;
193
193
  }
@@ -199,14 +199,14 @@ namespace Sass {
199
199
  if (pToConvert->head() == NULL || empty_parent_ref) {
200
200
  }
201
201
 
202
- // the first Complex_Selector may contain a dummy head pointer, skip it.
202
+ // the first Sequence_Selector may contain a dummy head pointer, skip it.
203
203
  if (pToConvert->head() != NULL && !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() != Complex_Selector::ANCESTOR_OF) {
209
+ if (pToConvert->combinator() != Sequence_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;
@@ -223,14 +223,14 @@ namespace Sass {
223
223
  }
224
224
 
225
225
 
226
- Complex_Selector* nodeToComplexSelector(const Node& toConvert, Context& ctx) {
226
+ Sequence_Selector* 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 Complex_Selector* must be a collection type or nil.";
233
+ throw "The node to convert to a Sequence_Selector* 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
- Complex_Selector* pFirst = SASS_MEMORY_NEW(ctx.mem, Complex_Selector, ParserState("[NODE]"), Complex_Selector::ANCESTOR_OF, NULL, NULL);
241
+ Sequence_Selector* pFirst = SASS_MEMORY_NEW(ctx.mem, Sequence_Selector, ParserState("[NODE]"), Sequence_Selector::ANCESTOR_OF, NULL, NULL);
242
242
 
243
- Complex_Selector* pCurrent = pFirst;
243
+ Sequence_Selector* 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);
@@ -257,11 +257,11 @@ namespace Sass {
257
257
  pCurrent->combinator(child.combinator());
258
258
  if (child.got_line_feed) pCurrent->has_line_feed(child.got_line_feed);
259
259
 
260
- // if the next node is also a combinator, create another Complex_Selector to hold it so it doesn't replace the current combinator
260
+ // if the next node is also a combinator, create another Sequence_Selector to hold it so it doesn't replace the current combinator
261
261
  if (childIter+1 != childIterEnd) {
262
262
  Node& nextNode = *(childIter+1);
263
263
  if (nextNode.isCombinator()) {
264
- pCurrent->tail(SASS_MEMORY_NEW(ctx.mem, Complex_Selector, ParserState("[NODE]"), Complex_Selector::ANCESTOR_OF, NULL, NULL));
264
+ pCurrent->tail(SASS_MEMORY_NEW(ctx.mem, Sequence_Selector, ParserState("[NODE]"), Sequence_Selector::ANCESTOR_OF, NULL, NULL));
265
265
  if (nextNode.got_line_feed) pCurrent->tail()->has_line_feed(nextNode.got_line_feed);
266
266
  pCurrent = pCurrent->tail();
267
267
  }
@@ -271,8 +271,8 @@ namespace Sass {
271
271
  }
272
272
  }
273
273
 
274
- // Put the dummy Compound_Selector in the first position, for consistency with the rest of libsass
275
- Compound_Selector* fakeHead = SASS_MEMORY_NEW(ctx.mem, Compound_Selector, ParserState("[NODE]"), 1);
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
276
  Parent_Selector* selectorRef = SASS_MEMORY_NEW(ctx.mem, Parent_Selector, ParserState("[NODE]"));
277
277
  fakeHead->elements().push_back(selectorRef);
278
278
  if (toConvert.got_line_feed) pFirst->has_line_feed(toConvert.got_line_feed);
@@ -282,11 +282,11 @@ namespace Sass {
282
282
  }
283
283
 
284
284
  // A very naive trim function, which removes duplicates in a node
285
- // This is only used in Complex_Selector::unify_with for now, may need modifications to fit other needs
285
+ // This is only used in Sequence_Selector::unify_with for now, may need modifications to fit other needs
286
286
  Node Node::naiveTrim(Node& seqses, Context& ctx) {
287
287
 
288
288
  std::vector<Node*> res;
289
- std::vector<Complex_Selector*> known;
289
+ std::vector<Sequence_Selector*> known;
290
290
 
291
291
  NodeDeque::reverse_iterator seqsesIter = seqses.collection()->rbegin(),
292
292
  seqsesIterEnd = seqses.collection()->rend();
@@ -295,8 +295,8 @@ namespace Sass {
295
295
  {
296
296
  Node& seqs1 = *seqsesIter;
297
297
  if( seqs1.isSelector() ) {
298
- Complex_Selector* sel = seqs1.selector();
299
- std::vector<Complex_Selector*>::iterator it;
298
+ Sequence_Selector* sel = seqs1.selector();
299
+ std::vector<Sequence_Selector*>::iterator it;
300
300
  bool found = false;
301
301
  for (it = known.begin(); it != known.end(); ++it) {
302
302
  if (**it == *sel) { found = true; break; }