sassc 1.8.3 → 1.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/ext/libsass/.editorconfig +1 -1
  4. data/ext/libsass/.gitignore +1 -0
  5. data/ext/libsass/LICENSE +1 -1
  6. data/ext/libsass/Makefile +20 -14
  7. data/ext/libsass/Makefile.conf +0 -1
  8. data/ext/libsass/Readme.md +3 -1
  9. data/ext/libsass/appveyor.yml +19 -11
  10. data/ext/libsass/docs/api-importer-example.md +2 -1235
  11. data/ext/libsass/docs/build-with-autotools.md +10 -0
  12. data/ext/libsass/docs/build-with-makefiles.md +18 -0
  13. data/ext/libsass/include/sass/base.h +4 -1
  14. data/ext/libsass/include/sass/values.h +2 -1
  15. data/ext/libsass/src/ast.cpp +279 -346
  16. data/ext/libsass/src/ast.hpp +234 -60
  17. data/ext/libsass/src/base64vlq.cpp +1 -0
  18. data/ext/libsass/src/bind.cpp +35 -45
  19. data/ext/libsass/src/bind.hpp +1 -0
  20. data/ext/libsass/src/color_maps.cpp +1 -0
  21. data/ext/libsass/src/constants.cpp +4 -1
  22. data/ext/libsass/src/constants.hpp +2 -1
  23. data/ext/libsass/src/context.cpp +41 -31
  24. data/ext/libsass/src/context.hpp +10 -10
  25. data/ext/libsass/src/cssize.cpp +7 -4
  26. data/ext/libsass/src/cssize.hpp +1 -3
  27. data/ext/libsass/src/debugger.hpp +73 -14
  28. data/ext/libsass/src/emitter.cpp +37 -25
  29. data/ext/libsass/src/emitter.hpp +10 -9
  30. data/ext/libsass/src/environment.cpp +16 -5
  31. data/ext/libsass/src/environment.hpp +5 -3
  32. data/ext/libsass/src/error_handling.cpp +91 -14
  33. data/ext/libsass/src/error_handling.hpp +105 -4
  34. data/ext/libsass/src/eval.cpp +519 -330
  35. data/ext/libsass/src/eval.hpp +12 -13
  36. data/ext/libsass/src/expand.cpp +92 -56
  37. data/ext/libsass/src/expand.hpp +5 -3
  38. data/ext/libsass/src/extend.cpp +60 -51
  39. data/ext/libsass/src/extend.hpp +1 -3
  40. data/ext/libsass/src/file.cpp +37 -27
  41. data/ext/libsass/src/functions.cpp +78 -62
  42. data/ext/libsass/src/functions.hpp +1 -0
  43. data/ext/libsass/src/inspect.cpp +293 -64
  44. data/ext/libsass/src/inspect.hpp +2 -0
  45. data/ext/libsass/src/lexer.cpp +1 -0
  46. data/ext/libsass/src/listize.cpp +14 -15
  47. data/ext/libsass/src/listize.hpp +3 -5
  48. data/ext/libsass/src/memory_manager.cpp +1 -0
  49. data/ext/libsass/src/node.cpp +2 -3
  50. data/ext/libsass/src/operation.hpp +70 -71
  51. data/ext/libsass/src/output.cpp +28 -32
  52. data/ext/libsass/src/output.hpp +1 -2
  53. data/ext/libsass/src/parser.cpp +402 -183
  54. data/ext/libsass/src/parser.hpp +19 -9
  55. data/ext/libsass/src/plugins.cpp +1 -0
  56. data/ext/libsass/src/position.cpp +1 -0
  57. data/ext/libsass/src/prelexer.cpp +134 -56
  58. data/ext/libsass/src/prelexer.hpp +51 -3
  59. data/ext/libsass/src/remove_placeholders.cpp +35 -9
  60. data/ext/libsass/src/remove_placeholders.hpp +4 -3
  61. data/ext/libsass/src/sass.cpp +1 -0
  62. data/ext/libsass/src/sass.hpp +129 -0
  63. data/ext/libsass/src/sass_context.cpp +31 -14
  64. data/ext/libsass/src/sass_context.hpp +2 -31
  65. data/ext/libsass/src/sass_functions.cpp +1 -0
  66. data/ext/libsass/src/sass_interface.cpp +5 -6
  67. data/ext/libsass/src/sass_util.cpp +1 -2
  68. data/ext/libsass/src/sass_util.hpp +5 -5
  69. data/ext/libsass/src/sass_values.cpp +13 -10
  70. data/ext/libsass/src/source_map.cpp +4 -3
  71. data/ext/libsass/src/source_map.hpp +2 -2
  72. data/ext/libsass/src/subset_map.hpp +0 -1
  73. data/ext/libsass/src/to_c.cpp +1 -0
  74. data/ext/libsass/src/to_c.hpp +1 -3
  75. data/ext/libsass/src/to_value.cpp +3 -5
  76. data/ext/libsass/src/to_value.hpp +1 -1
  77. data/ext/libsass/src/units.cpp +96 -59
  78. data/ext/libsass/src/units.hpp +10 -8
  79. data/ext/libsass/src/utf8_string.cpp +5 -0
  80. data/ext/libsass/src/util.cpp +23 -156
  81. data/ext/libsass/src/util.hpp +10 -14
  82. data/ext/libsass/src/values.cpp +1 -0
  83. data/ext/libsass/test/test_node.cpp +2 -6
  84. data/ext/libsass/test/test_selector_difference.cpp +1 -3
  85. data/ext/libsass/test/test_specificity.cpp +0 -2
  86. data/ext/libsass/test/test_superselector.cpp +0 -2
  87. data/ext/libsass/test/test_unification.cpp +1 -3
  88. data/ext/libsass/win/libsass.targets +18 -5
  89. data/ext/libsass/win/libsass.vcxproj +9 -7
  90. data/ext/libsass/win/libsass.vcxproj.filters +148 -106
  91. data/lib/sassc/version.rb +1 -1
  92. data/test/engine_test.rb +12 -0
  93. data/test/native_test.rb +1 -1
  94. metadata +3 -4
  95. data/ext/libsass/src/to_string.cpp +0 -48
  96. data/ext/libsass/src/to_string.hpp +0 -38
@@ -17,11 +17,12 @@ namespace Sass {
17
17
 
18
18
  void fallback_impl(AST_Node* n) {}
19
19
 
20
+ private:
21
+ Selector_List* remove_placeholders(Selector_List*);
22
+
20
23
  public:
21
24
  Remove_Placeholders(Context&);
22
- virtual ~Remove_Placeholders() { }
23
-
24
- using Operation<void>::operator();
25
+ ~Remove_Placeholders() { }
25
26
 
26
27
  void operator()(Block*);
27
28
  void operator()(Ruleset*);
@@ -1,3 +1,4 @@
1
+ #include "sass.hpp"
1
2
  #include <cstdlib>
2
3
  #include <cstring>
3
4
  #include <vector>
@@ -0,0 +1,129 @@
1
+ // must be the first include in all compile units
2
+ #ifndef SASS_SASS_H
3
+ #define SASS_SASS_H
4
+
5
+ // undefine extensions macro to tell sys includes
6
+ // that we do not want any macros to be exported
7
+ // mainly fixes an issue on SmartOS (SEC macro)
8
+ #undef __EXTENSIONS__
9
+
10
+ #ifdef _MSC_VER
11
+ #pragma warning(disable : 4005)
12
+ #endif
13
+
14
+ // aplies to MSVC and MinGW
15
+ #ifdef _WIN32
16
+ // we do not want the ERROR macro
17
+ # define NOGDI
18
+ // we do not want the min/max macro
19
+ # define NOMINMAX
20
+ // we do not want the IN/OUT macro
21
+ # define _NO_W32_PSEUDO_MODIFIERS
22
+ #endif
23
+
24
+
25
+ // should we be case insensitive
26
+ // when dealing with files or paths
27
+ #ifndef FS_CASE_SENSITIVE
28
+ # ifdef _WIN32
29
+ # define FS_CASE_SENSITIVE 0
30
+ # else
31
+ # define FS_CASE_SENSITIVE 1
32
+ # endif
33
+ #endif
34
+
35
+ // path separation char
36
+ #ifndef PATH_SEP
37
+ # ifdef _WIN32
38
+ # define PATH_SEP ';'
39
+ # else
40
+ # define PATH_SEP ':'
41
+ # endif
42
+ #endif
43
+
44
+
45
+ // include C-API header
46
+ #include "sass/base.h"
47
+
48
+ // output behaviours
49
+ namespace Sass {
50
+
51
+ // create some C++ aliases for the most used options
52
+ const static Sass_Output_Style NESTED = SASS_STYLE_NESTED;
53
+ const static Sass_Output_Style COMPACT = SASS_STYLE_COMPACT;
54
+ const static Sass_Output_Style EXPANDED = SASS_STYLE_EXPANDED;
55
+ const static Sass_Output_Style COMPRESSED = SASS_STYLE_COMPRESSED;
56
+ // only used internal to trigger ruby inspect behavior
57
+ const static Sass_Output_Style INSPECT = SASS_STYLE_INSPECT;
58
+ const static Sass_Output_Style TO_SASS = SASS_STYLE_TO_SASS;
59
+
60
+ };
61
+
62
+ // input behaviours
63
+ enum Sass_Input_Style {
64
+ SASS_CONTEXT_NULL,
65
+ SASS_CONTEXT_FILE,
66
+ SASS_CONTEXT_DATA,
67
+ SASS_CONTEXT_FOLDER
68
+ };
69
+
70
+ // simple linked list
71
+ struct string_list {
72
+ string_list* next;
73
+ char* string;
74
+ };
75
+
76
+ // sass config options structure
77
+ struct Sass_Inspect_Options {
78
+
79
+ // Output style for the generated css code
80
+ // A value from above SASS_STYLE_* constants
81
+ enum Sass_Output_Style output_style;
82
+
83
+ // Precision for fractional numbers
84
+ int precision;
85
+
86
+ // initialization list (constructor with defaults)
87
+ Sass_Inspect_Options(Sass_Output_Style style = Sass::NESTED,
88
+ int precision = 5)
89
+ : output_style(style), precision(precision)
90
+ { }
91
+
92
+ };
93
+
94
+ // sass config options structure
95
+ struct Sass_Output_Options : Sass_Inspect_Options {
96
+
97
+ // String to be used for indentation
98
+ const char* indent;
99
+ // String to be used to for line feeds
100
+ const char* linefeed;
101
+
102
+ // Emit comments in the generated CSS indicating
103
+ // the corresponding source line.
104
+ bool source_comments;
105
+
106
+ // initialization list (constructor with defaults)
107
+ Sass_Output_Options(struct Sass_Inspect_Options opt,
108
+ const char* indent = " ",
109
+ const char* linefeed = "\n",
110
+ bool source_comments = false)
111
+ : Sass_Inspect_Options(opt),
112
+ indent(indent), linefeed(linefeed),
113
+ source_comments(source_comments)
114
+ { }
115
+
116
+ // initialization list (constructor with defaults)
117
+ Sass_Output_Options(Sass_Output_Style style = Sass::NESTED,
118
+ int precision = 5,
119
+ const char* indent = " ",
120
+ const char* linefeed = "\n",
121
+ bool source_comments = false)
122
+ : Sass_Inspect_Options(style, precision),
123
+ indent(indent), linefeed(linefeed),
124
+ source_comments(source_comments)
125
+ { }
126
+
127
+ };
128
+
129
+ #endif
@@ -1,3 +1,4 @@
1
+ #include "sass.hpp"
1
2
  #include <cstring>
2
3
  #include <stdexcept>
3
4
  #include <sstream>
@@ -10,6 +11,7 @@
10
11
  #include "util.hpp"
11
12
  #include "context.hpp"
12
13
  #include "sass_context.hpp"
14
+ #include "sass_functions.hpp"
13
15
  #include "ast_fwd_decl.hpp"
14
16
  #include "error_handling.hpp"
15
17
 
@@ -41,11 +43,10 @@ extern "C" {
41
43
  catch (Exception::Base& e) {
42
44
  std::stringstream msg_stream;
43
45
  std::string cwd(Sass::File::get_cwd());
44
- std::string rel_path(Sass::File::abs2rel(e.pstate.path, cwd, cwd));
45
46
 
46
- std::string msg_prefix("Error: ");
47
+ std::string msg_prefix(e.errtype());
47
48
  bool got_newline = false;
48
- msg_stream << msg_prefix;
49
+ msg_stream << msg_prefix << ": ";
49
50
  const char* msg = e.what();
50
51
  while(msg && *msg) {
51
52
  if (*msg == '\r') {
@@ -53,15 +54,26 @@ extern "C" {
53
54
  } else if (*msg == '\n') {
54
55
  got_newline = true;
55
56
  } else if (got_newline) {
56
- msg_stream << std::string(msg_prefix.size(), ' ');
57
+ msg_stream << std::string(msg_prefix.size() + 2, ' ');
57
58
  got_newline = false;
58
59
  }
59
60
  msg_stream << *msg;
60
61
  ++ msg;
61
62
  }
62
63
  if (!got_newline) msg_stream << "\n";
63
- msg_stream << std::string(msg_prefix.size(), ' ');
64
- msg_stream << " on line " << e.pstate.line+1 << " of " << rel_path << "\n";
64
+ if (e.import_stack) {
65
+ for (size_t i = 1; i < e.import_stack->size() - 1; ++i) {
66
+ std::string path((*e.import_stack)[i]->imp_path);
67
+ std::string rel_path(Sass::File::abs2rel(path, cwd, cwd));
68
+ msg_stream << std::string(msg_prefix.size() + 2, ' ');
69
+ msg_stream << (i == 1 ? " on line " : " from line ");
70
+ msg_stream << e.pstate.line+1 << " of " << rel_path << "\n";
71
+ }
72
+ } else {
73
+ std::string rel_path(Sass::File::abs2rel(e.pstate.path, cwd, cwd));
74
+ msg_stream << std::string(msg_prefix.size() + 2, ' ');
75
+ msg_stream << " on line " << e.pstate.line+1 << " of " << rel_path << "\n";
76
+ }
65
77
 
66
78
  // now create the code trace (ToDo: maybe have util functions?)
67
79
  if (e.pstate.line != std::string::npos && e.pstate.column != std::string::npos) {
@@ -111,6 +123,7 @@ extern "C" {
111
123
  msg_stream << "Unable to allocate memory: " << ba.what() << std::endl;
112
124
  json_append_member(json_err, "status", json_mknumber(2));
113
125
  json_append_member(json_err, "message", json_mkstring(ba.what()));
126
+ json_append_member(json_err, "formatted", json_mkstring(msg_stream.str().c_str()));
114
127
  c_ctx->error_json = json_stringify(json_err, " ");;
115
128
  c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
116
129
  c_ctx->error_text = sass_strdup(ba.what());
@@ -122,9 +135,10 @@ extern "C" {
122
135
  catch (std::exception& e) {
123
136
  std::stringstream msg_stream;
124
137
  JsonNode* json_err = json_mkobject();
125
- msg_stream << "Error: " << e.what() << std::endl;
138
+ msg_stream << "Internal Error: " << e.what() << std::endl;
126
139
  json_append_member(json_err, "status", json_mknumber(3));
127
140
  json_append_member(json_err, "message", json_mkstring(e.what()));
141
+ json_append_member(json_err, "formatted", json_mkstring(msg_stream.str().c_str()));
128
142
  c_ctx->error_json = json_stringify(json_err, " ");;
129
143
  c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
130
144
  c_ctx->error_text = sass_strdup(e.what());
@@ -136,9 +150,10 @@ extern "C" {
136
150
  catch (std::string& e) {
137
151
  std::stringstream msg_stream;
138
152
  JsonNode* json_err = json_mkobject();
139
- msg_stream << "Error: " << e << std::endl;
153
+ msg_stream << "Internal Error: " << e << std::endl;
140
154
  json_append_member(json_err, "status", json_mknumber(4));
141
155
  json_append_member(json_err, "message", json_mkstring(e.c_str()));
156
+ json_append_member(json_err, "formatted", json_mkstring(msg_stream.str().c_str()));
142
157
  c_ctx->error_json = json_stringify(json_err, " ");;
143
158
  c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
144
159
  c_ctx->error_text = sass_strdup(e.c_str());
@@ -150,9 +165,10 @@ extern "C" {
150
165
  catch (const char* e) {
151
166
  std::stringstream msg_stream;
152
167
  JsonNode* json_err = json_mkobject();
153
- msg_stream << "Error: " << e << std::endl;
168
+ msg_stream << "Internal Error: " << e << std::endl;
154
169
  json_append_member(json_err, "status", json_mknumber(4));
155
170
  json_append_member(json_err, "message", json_mkstring(e));
171
+ json_append_member(json_err, "formatted", json_mkstring(msg_stream.str().c_str()));
156
172
  c_ctx->error_json = json_stringify(json_err, " ");;
157
173
  c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
158
174
  c_ctx->error_text = sass_strdup(e);
@@ -398,14 +414,14 @@ extern "C" {
398
414
  struct Sass_Compiler* ADDCALL sass_make_data_compiler (struct Sass_Data_Context* data_ctx)
399
415
  {
400
416
  if (data_ctx == 0) return 0;
401
- Context* cpp_ctx = new Data_Context(data_ctx);
417
+ Context* cpp_ctx = new Data_Context(*data_ctx);
402
418
  return sass_prepare_context(data_ctx, cpp_ctx);
403
419
  }
404
420
 
405
421
  struct Sass_Compiler* ADDCALL sass_make_file_compiler (struct Sass_File_Context* file_ctx)
406
422
  {
407
423
  if (file_ctx == 0) return 0;
408
- Context* cpp_ctx = new File_Context(file_ctx);
424
+ Context* cpp_ctx = new File_Context(*file_ctx);
409
425
  return sass_prepare_context(file_ctx, cpp_ctx);
410
426
  }
411
427
 
@@ -416,10 +432,11 @@ extern "C" {
416
432
  return data_ctx->error_status;
417
433
  try {
418
434
  if (data_ctx->source_string == 0) { throw(std::runtime_error("Data context has no source string")); }
419
- if (*data_ctx->source_string == 0) { throw(std::runtime_error("Data context has empty source string")); }
435
+ // empty source string is a valid case, even if not really usefull (different than with file context)
436
+ // if (*data_ctx->source_string == 0) { throw(std::runtime_error("Data context has empty source string")); }
420
437
  }
421
438
  catch (...) { return handle_errors(data_ctx) | 1; }
422
- Context* cpp_ctx = new Data_Context(data_ctx);
439
+ Context* cpp_ctx = new Data_Context(*data_ctx);
423
440
  return sass_compile_context(data_ctx, cpp_ctx);
424
441
  }
425
442
 
@@ -433,7 +450,7 @@ extern "C" {
433
450
  if (*file_ctx->input_path == 0) { throw(std::runtime_error("File context has empty input path")); }
434
451
  }
435
452
  catch (...) { return handle_errors(file_ctx) | 1; }
436
- Context* cpp_ctx = new File_Context(file_ctx);
453
+ Context* cpp_ctx = new File_Context(*file_ctx);
437
454
  return sass_compile_context(file_ctx, cpp_ctx);
438
455
  }
439
456
 
@@ -2,36 +2,12 @@
2
2
  #define SASS_SASS_CONTEXT_H
3
3
 
4
4
  #include "sass.h"
5
+ #include "sass.hpp"
5
6
  #include "context.hpp"
6
7
  #include "ast_fwd_decl.hpp"
7
8
 
8
- // Input behaviours
9
- enum Sass_Input_Style {
10
- SASS_CONTEXT_NULL,
11
- SASS_CONTEXT_FILE,
12
- SASS_CONTEXT_DATA,
13
- SASS_CONTEXT_FOLDER
14
- };
15
-
16
- // simple linked list
17
- struct string_list {
18
- string_list* next;
19
- char* string;
20
- };
21
-
22
9
  // sass config options structure
23
- struct Sass_Options {
24
-
25
- // Precision for fractional numbers
26
- int precision;
27
-
28
- // Output style for the generated css code
29
- // A value from above SASS_STYLE_* constants
30
- enum Sass_Output_Style output_style;
31
-
32
- // Emit comments in the generated CSS indicating
33
- // the corresponding source line.
34
- bool source_comments;
10
+ struct Sass_Options : Sass_Output_Options {
35
11
 
36
12
  // embed sourceMappingUrl as data uri
37
13
  bool source_map_embed;
@@ -59,11 +35,6 @@ struct Sass_Options {
59
35
  // information in source-maps etc.
60
36
  char* output_path;
61
37
 
62
- // String to be used for indentation
63
- const char* indent;
64
- // String to be used to for line feeds
65
- const char* linefeed;
66
-
67
38
  // Colon-separated list of paths
68
39
  // Semicolon-separated on Windows
69
40
  // Maybe use array interface instead?
@@ -1,3 +1,4 @@
1
+ #include "sass.hpp"
1
2
  #include <cstring>
2
3
  #include "util.hpp"
3
4
  #include "context.hpp"
@@ -1,3 +1,4 @@
1
+ #include "sass.hpp"
1
2
  #include <string>
2
3
  #include <cstdlib>
3
4
  #include <cstring>
@@ -69,9 +70,8 @@ extern "C" {
69
70
  else {
70
71
  output_path = c_ctx->output_path;
71
72
  }
72
- Data_Context cpp_ctx(
73
- (Sass_Data_Context*) 0
74
- );
73
+ struct Sass_Data_Context opt;
74
+ Data_Context cpp_ctx(opt);
75
75
  if (c_ctx->c_functions) {
76
76
  Sass_Function_List this_func_data = c_ctx->c_functions;
77
77
  while ((this_func_data) && (*this_func_data)) {
@@ -145,9 +145,8 @@ extern "C" {
145
145
  else {
146
146
  output_path = c_ctx->output_path;
147
147
  }
148
- File_Context cpp_ctx(
149
- (Sass_File_Context*) 0
150
- );
148
+ struct Sass_File_Context opt;
149
+ File_Context cpp_ctx(opt);
151
150
  if (c_ctx->c_functions) {
152
151
  Sass_Function_List this_func_data = c_ctx->c_functions;
153
152
  while ((this_func_data) && (*this_func_data)) {
@@ -1,5 +1,5 @@
1
+ #include "sass.hpp"
1
2
  #include "node.hpp"
2
- #include "to_string.hpp"
3
3
 
4
4
  namespace Sass {
5
5
 
@@ -38,7 +38,6 @@ namespace Sass {
38
38
  end
39
39
  */
40
40
  Node paths(const Node& arrs, Context& ctx) {
41
- To_String to_string(&ctx);
42
41
 
43
42
  Node loopStart = Node::createCollection();
44
43
  loopStart.collection()->push_back(Node::createCollection());
@@ -221,28 +221,28 @@ namespace Sass {
221
221
 
222
222
  std::map<unsigned int, KeyType> order;
223
223
 
224
- std::map<KeyType, std::vector<EnumType> > grouped;
224
+ std::map<size_t, std::vector<EnumType> > grouped;
225
225
 
226
226
  for (typename std::vector<EnumType>::iterator enumIter = enumeration.begin(), enumIterEnd = enumeration.end(); enumIter != enumIterEnd; enumIter++) {
227
227
  EnumType& e = *enumIter;
228
228
 
229
229
  KeyType key = keyFunc(e);
230
230
 
231
- if (grouped.find(key) == grouped.end()) {
231
+ if (grouped.find(key.hash()) == grouped.end()) {
232
232
  order.insert(std::make_pair((unsigned int)order.size(), key));
233
233
 
234
234
  std::vector<EnumType> newCollection;
235
235
  newCollection.push_back(e);
236
- grouped.insert(std::make_pair(key, newCollection));
236
+ grouped.insert(std::make_pair(key.hash(), newCollection));
237
237
  } else {
238
- std::vector<EnumType>& collection = grouped.at(key);
238
+ std::vector<EnumType>& collection = grouped.at(key.hash());
239
239
  collection.push_back(e);
240
240
  }
241
241
  }
242
242
 
243
243
  for (unsigned int index = 0; index < order.size(); index++) {
244
244
  KeyType& key = order.at(index);
245
- std::vector<EnumType>& values = grouped.at(key);
245
+ std::vector<EnumType>& values = grouped.at(key.hash());
246
246
 
247
247
  std::pair<KeyType, std::vector<EnumType> > grouping = std::make_pair(key, values);
248
248
 
@@ -1,3 +1,4 @@
1
+ #include "sass.hpp"
1
2
  #include <cstdlib>
2
3
  #include <cstring>
3
4
  #include "util.hpp"
@@ -276,7 +277,8 @@ extern "C" {
276
277
  {
277
278
  Memory_Manager mem;
278
279
  Value* val = sass_value_to_ast_node(mem, v);
279
- std::string str(val->to_string(compressed, precision));
280
+ Sass_Inspect_Options options(compressed ? COMPRESSED : NESTED, precision);
281
+ std::string str(val->to_string(options));
280
282
  return sass_make_qstring(str.c_str());
281
283
  }
282
284
 
@@ -290,42 +292,43 @@ extern "C" {
290
292
 
291
293
  Value* lhs = sass_value_to_ast_node(mem, a);
292
294
  Value* rhs = sass_value_to_ast_node(mem, b);
295
+ struct Sass_Inspect_Options options(NESTED, 5);
293
296
 
294
297
  // see if it's a relational expression
295
298
  switch(op) {
296
299
  case Sass_OP::EQ: return sass_make_boolean(Eval::eq(lhs, rhs));
297
300
  case Sass_OP::NEQ: return sass_make_boolean(!Eval::eq(lhs, rhs));
298
- case Sass_OP::GT: return sass_make_boolean(!Eval::lt(lhs, rhs) && !Eval::eq(lhs, rhs));
299
- case Sass_OP::GTE: return sass_make_boolean(!Eval::lt(lhs, rhs));
300
- case Sass_OP::LT: return sass_make_boolean(Eval::lt(lhs, rhs));
301
- case Sass_OP::LTE: return sass_make_boolean(Eval::lt(lhs, rhs) || Eval::eq(lhs, rhs));
301
+ case Sass_OP::GT: return sass_make_boolean(!Eval::lt(lhs, rhs, "gt") && !Eval::eq(lhs, rhs));
302
+ case Sass_OP::GTE: return sass_make_boolean(!Eval::lt(lhs, rhs, "gte"));
303
+ case Sass_OP::LT: return sass_make_boolean(Eval::lt(lhs, rhs, "lt"));
304
+ case Sass_OP::LTE: return sass_make_boolean(Eval::lt(lhs, rhs, "lte") || Eval::eq(lhs, rhs));
302
305
  default: break;
303
306
  }
304
307
 
305
308
  if (sass_value_is_number(a) && sass_value_is_number(b)) {
306
309
  const Number* l_n = dynamic_cast<const Number*>(lhs);
307
310
  const Number* r_n = dynamic_cast<const Number*>(rhs);
308
- rv = Eval::op_numbers(mem, op, *l_n, *r_n);
311
+ rv = Eval::op_numbers(mem, op, *l_n, *r_n, options);
309
312
  }
310
313
  else if (sass_value_is_number(a) && sass_value_is_color(a)) {
311
314
  const Number* l_n = dynamic_cast<const Number*>(lhs);
312
315
  const Color* r_c = dynamic_cast<const Color*>(rhs);
313
- rv = Eval::op_number_color(mem, op, *l_n, *r_c);
316
+ rv = Eval::op_number_color(mem, op, *l_n, *r_c, options);
314
317
  }
315
318
  else if (sass_value_is_color(a) && sass_value_is_number(b)) {
316
319
  const Color* l_c = dynamic_cast<const Color*>(lhs);
317
320
  const Number* r_n = dynamic_cast<const Number*>(rhs);
318
- rv = Eval::op_color_number(mem, op, *l_c, *r_n);
321
+ rv = Eval::op_color_number(mem, op, *l_c, *r_n, options);
319
322
  }
320
323
  else if (sass_value_is_color(a) && sass_value_is_color(b)) {
321
324
  const Color* l_c = dynamic_cast<const Color*>(lhs);
322
325
  const Color* r_c = dynamic_cast<const Color*>(rhs);
323
- rv = Eval::op_colors(mem, op, *l_c, *r_c);
326
+ rv = Eval::op_colors(mem, op, *l_c, *r_c, options);
324
327
  }
325
328
  else /* convert other stuff to string and apply operation */ {
326
329
  Value* l_v = dynamic_cast<Value*>(lhs);
327
330
  Value* r_v = dynamic_cast<Value*>(rhs);
328
- rv = Eval::op_strings(mem, op, *l_v, *r_v);
331
+ rv = Eval::op_strings(mem, op, *l_v, *r_v, options);
329
332
  }
330
333
 
331
334
  // ToDo: maybe we should should return null value?