sassc 0.0.9 → 0.0.10

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 (111) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/ext/libsass/.gitignore +13 -6
  4. data/ext/libsass/Makefile +42 -26
  5. data/ext/libsass/Makefile.am +43 -30
  6. data/ext/libsass/Readme.md +4 -2
  7. data/ext/libsass/appveyor.yml +10 -14
  8. data/ext/libsass/ast.cpp +54 -44
  9. data/ext/libsass/ast.hpp +404 -236
  10. data/ext/libsass/ast_def_macros.hpp +5 -0
  11. data/ext/libsass/ast_factory.hpp +6 -3
  12. data/ext/libsass/ast_fwd_decl.hpp +12 -0
  13. data/ext/libsass/b64/encode.h +2 -2
  14. data/ext/libsass/backtrace.hpp +13 -17
  15. data/ext/libsass/base64vlq.hpp +4 -1
  16. data/ext/libsass/bind.cpp +12 -15
  17. data/ext/libsass/bind.hpp +6 -6
  18. data/ext/libsass/color_names.hpp +4 -1
  19. data/ext/libsass/configure.ac +7 -21
  20. data/ext/libsass/constants.cpp +6 -4
  21. data/ext/libsass/constants.hpp +10 -4
  22. data/ext/libsass/context.cpp +89 -58
  23. data/ext/libsass/context.hpp +28 -35
  24. data/ext/libsass/contextualize.cpp +20 -10
  25. data/ext/libsass/contextualize.hpp +8 -23
  26. data/ext/libsass/contrib/libsass.spec +66 -0
  27. data/ext/libsass/cssize.cpp +547 -0
  28. data/ext/libsass/cssize.hpp +82 -0
  29. data/ext/libsass/debug.hpp +3 -3
  30. data/ext/libsass/debugger.hpp +358 -0
  31. data/ext/libsass/emitter.cpp +255 -0
  32. data/ext/libsass/emitter.hpp +83 -0
  33. data/ext/libsass/environment.hpp +7 -3
  34. data/ext/libsass/error_handling.cpp +11 -14
  35. data/ext/libsass/error_handling.hpp +9 -7
  36. data/ext/libsass/eval.cpp +253 -161
  37. data/ext/libsass/eval.hpp +13 -13
  38. data/ext/libsass/expand.cpp +135 -64
  39. data/ext/libsass/expand.hpp +11 -13
  40. data/ext/libsass/extend.cpp +66 -20
  41. data/ext/libsass/extend.hpp +6 -11
  42. data/ext/libsass/file.cpp +31 -26
  43. data/ext/libsass/file.hpp +6 -1
  44. data/ext/libsass/functions.cpp +270 -287
  45. data/ext/libsass/functions.hpp +8 -11
  46. data/ext/libsass/inspect.cpp +385 -255
  47. data/ext/libsass/inspect.hpp +15 -26
  48. data/ext/libsass/kwd_arg_macros.hpp +5 -0
  49. data/ext/libsass/mapping.hpp +4 -3
  50. data/ext/libsass/memory_manager.hpp +5 -2
  51. data/ext/libsass/node.cpp +50 -50
  52. data/ext/libsass/node.hpp +26 -27
  53. data/ext/libsass/operation.hpp +15 -4
  54. data/ext/libsass/output.cpp +401 -0
  55. data/ext/libsass/output.hpp +56 -0
  56. data/ext/libsass/parser.cpp +573 -399
  57. data/ext/libsass/parser.hpp +122 -88
  58. data/ext/libsass/paths.hpp +7 -2
  59. data/ext/libsass/plugins.cpp +155 -0
  60. data/ext/libsass/plugins.hpp +56 -0
  61. data/ext/libsass/position.cpp +128 -0
  62. data/ext/libsass/position.hpp +108 -11
  63. data/ext/libsass/prelexer.cpp +184 -110
  64. data/ext/libsass/prelexer.hpp +131 -24
  65. data/ext/libsass/remove_placeholders.cpp +1 -1
  66. data/ext/libsass/remove_placeholders.hpp +6 -6
  67. data/ext/libsass/sass.cpp +3 -3
  68. data/ext/libsass/sass.h +12 -4
  69. data/ext/libsass/sass2scss.cpp +3 -2
  70. data/ext/libsass/sass2scss.h +5 -0
  71. data/ext/libsass/sass_context.cpp +136 -37
  72. data/ext/libsass/sass_context.h +19 -10
  73. data/ext/libsass/sass_functions.cpp +29 -2
  74. data/ext/libsass/sass_functions.h +8 -2
  75. data/ext/libsass/sass_interface.cpp +32 -23
  76. data/ext/libsass/sass_interface.h +9 -4
  77. data/ext/libsass/sass_util.cpp +19 -23
  78. data/ext/libsass/sass_util.hpp +28 -27
  79. data/ext/libsass/sass_values.cpp +6 -4
  80. data/ext/libsass/sass_values.h +3 -3
  81. data/ext/libsass/script/ci-build-libsass +13 -1
  82. data/ext/libsass/script/ci-report-coverage +2 -1
  83. data/ext/libsass/source_map.cpp +79 -28
  84. data/ext/libsass/source_map.hpp +35 -16
  85. data/ext/libsass/subset_map.hpp +6 -4
  86. data/ext/libsass/to_c.hpp +4 -4
  87. data/ext/libsass/to_string.cpp +13 -8
  88. data/ext/libsass/to_string.hpp +6 -4
  89. data/ext/libsass/units.cpp +2 -1
  90. data/ext/libsass/units.hpp +6 -1
  91. data/ext/libsass/utf8_string.cpp +0 -5
  92. data/ext/libsass/utf8_string.hpp +3 -2
  93. data/ext/libsass/util.cpp +461 -49
  94. data/ext/libsass/util.hpp +34 -13
  95. data/ext/libsass/version.sh +10 -0
  96. data/ext/libsass/win/libsass.filters +20 -11
  97. data/ext/libsass/win/libsass.vcxproj +11 -8
  98. data/lib/sassc/importer.rb +1 -8
  99. data/lib/sassc/native.rb +7 -0
  100. data/lib/sassc/native/native_context_api.rb +5 -5
  101. data/lib/sassc/version.rb +1 -1
  102. data/test/native_test.rb +1 -1
  103. metadata +14 -10
  104. data/ext/libsass/copy_c_str.cpp +0 -13
  105. data/ext/libsass/copy_c_str.hpp +0 -5
  106. data/ext/libsass/output_compressed.cpp +0 -401
  107. data/ext/libsass/output_compressed.hpp +0 -95
  108. data/ext/libsass/output_nested.cpp +0 -364
  109. data/ext/libsass/output_nested.hpp +0 -108
  110. data/ext/libsass/test-driver +0 -127
  111. data/ext/libsass/token.hpp +0 -32
@@ -1,24 +1,45 @@
1
- #ifndef SASS_UTIL
2
- #define SASS_UTIL
3
-
4
- #ifndef SASS_AST
5
- #include "ast.hpp"
6
- #endif
1
+ #ifndef SASS_UTIL_H
2
+ #define SASS_UTIL_H
7
3
 
4
+ #include <vector>
8
5
  #include <string>
6
+ #include "ast_fwd_decl.hpp"
7
+
9
8
  namespace Sass {
9
+ using namespace std;
10
+
11
+ char* sass_strdup(const char* str);
12
+ double sass_atof(const char* str);
13
+ string string_escape(const string& str);
14
+ string string_unescape(const string& str);
15
+ string evacuate_quotes(const string& str);
16
+ string evacuate_escapes(const string& str);
17
+ string string_to_output(const string& str);
18
+ string comment_to_string(const string& text);
19
+ string normalize_wspace(const string& str);
20
+
21
+ string quote(const string&, char q = 0);
22
+ string unquote(const string&, char* q = 0);
23
+ char detect_best_quotemark(const char* s, char qm = '"');
24
+
25
+ bool is_hex_doublet(double n);
26
+ bool is_color_doublet(double r, double g, double b);
27
+
28
+ bool peek_linefeed(const char* start);
29
+
10
30
  namespace Util {
11
31
 
12
- std::string normalize_underscores(const std::string& str);
13
- std::string normalize_decimals(const std::string& str);
14
- std::string normalize_sixtuplet(const std::string& col);
32
+ string normalize_underscores(const string& str);
33
+ string normalize_decimals(const string& str);
34
+ string normalize_sixtuplet(const string& col);
15
35
 
36
+ string vecJoin(const vector<string>& vec, const string& sep);
16
37
  bool containsAnyPrintableStatements(Block* b);
17
38
 
18
- bool isPrintable(Ruleset* r);
19
- bool isPrintable(Feature_Block* r);
20
- bool isPrintable(Media_Block* r);
21
- bool isPrintable(Block* b);
39
+ bool isPrintable(Ruleset* r, Output_Style style = NESTED);
40
+ bool isPrintable(Feature_Block* r, Output_Style style = NESTED);
41
+ bool isPrintable(Media_Block* r, Output_Style style = NESTED);
42
+ bool isPrintable(Block* b, Output_Style style = NESTED);
22
43
  bool isAscii(int ch);
23
44
 
24
45
  }
@@ -0,0 +1,10 @@
1
+ if test "x$LIBSASS_VERSION" = "x"; then
2
+ LIBSASS_VERSION=`git describe --abbrev=4 --dirty --always --tags 2>/dev/null`
3
+ fi
4
+ if test "x$LIBSASS_VERSION" = "x"; then
5
+ LIBSASS_VERSION=`cat VERSION 2>/dev/null`
6
+ fi
7
+ if test "x$LIBSASS_VERSION" = "x"; then
8
+ LIBSASS_VERSION="[na]"
9
+ fi
10
+ echo $LIBSASS_VERSION
@@ -39,9 +39,6 @@
39
39
  <ClCompile Include="..\contextualize.cpp">
40
40
  <Filter>Source Files</Filter>
41
41
  </ClCompile>
42
- <ClCompile Include="..\copy_c_str.cpp">
43
- <Filter>Source Files</Filter>
44
- </ClCompile>
45
42
  <ClCompile Include="..\error_handling.cpp">
46
43
  <Filter>Source Files</Filter>
47
44
  </ClCompile>
@@ -51,6 +48,9 @@
51
48
  <ClCompile Include="..\expand.cpp">
52
49
  <Filter>Source Files</Filter>
53
50
  </ClCompile>
51
+ <ClCompile Include="..\cssize.cpp">
52
+ <Filter>Source Files</Filter>
53
+ </ClCompile>
54
54
  <ClCompile Include="..\extend.cpp">
55
55
  <Filter>Source Files</Filter>
56
56
  </ClCompile>
@@ -66,15 +66,21 @@
66
66
  <ClCompile Include="..\node.cpp">
67
67
  <Filter>Source Files</Filter>
68
68
  </ClCompile>
69
- <ClCompile Include="..\output_compressed.cpp">
69
+ <ClCompile Include="..\output.cpp">
70
70
  <Filter>Source Files</Filter>
71
71
  </ClCompile>
72
- <ClCompile Include="..\output_nested.cpp">
72
+ <ClCompile Include="..\emitter.cpp">
73
73
  <Filter>Source Files</Filter>
74
74
  </ClCompile>
75
75
  <ClCompile Include="..\parser.cpp">
76
76
  <Filter>Source Files</Filter>
77
77
  </ClCompile>
78
+ <ClCompile Include="..\plugins.cpp">
79
+ <Filter>Source Files</Filter>
80
+ </ClCompile>
81
+ <ClCompile Include="..\position.cpp">
82
+ <Filter>Source Files</Filter>
83
+ </ClCompile>
78
84
  <ClCompile Include="..\prelexer.cpp">
79
85
  <Filter>Source Files</Filter>
80
86
  </ClCompile>
@@ -170,9 +176,6 @@
170
176
  <ClInclude Include="..\contextualize.hpp">
171
177
  <Filter>Header Files</Filter>
172
178
  </ClInclude>
173
- <ClInclude Include="..\copy_c_str.hpp">
174
- <Filter>Header Files</Filter>
175
- </ClInclude>
176
179
  <ClInclude Include="..\debug.hpp">
177
180
  <Filter>Header Files</Filter>
178
181
  </ClInclude>
@@ -188,6 +191,9 @@
188
191
  <ClInclude Include="..\expand.hpp">
189
192
  <Filter>Header Files</Filter>
190
193
  </ClInclude>
194
+ <ClInclude Include="..\cssize.hpp">
195
+ <Filter>Header Files</Filter>
196
+ </ClInclude>
191
197
  <ClInclude Include="..\extend.hpp">
192
198
  <Filter>Header Files</Filter>
193
199
  </ClInclude>
@@ -215,15 +221,18 @@
215
221
  <ClInclude Include="..\operation.hpp">
216
222
  <Filter>Header Files</Filter>
217
223
  </ClInclude>
218
- <ClInclude Include="..\output_compressed.hpp">
224
+ <ClInclude Include="..\output.hpp">
219
225
  <Filter>Header Files</Filter>
220
226
  </ClInclude>
221
- <ClInclude Include="..\output_nested.hpp">
227
+ <ClInclude Include="..\emitter.hpp">
222
228
  <Filter>Header Files</Filter>
223
229
  </ClInclude>
224
230
  <ClInclude Include="..\parser.hpp">
225
231
  <Filter>Header Files</Filter>
226
232
  </ClInclude>
233
+ <ClInclude Include="..\plugins.hpp">
234
+ <Filter>Header Files</Filter>
235
+ </ClInclude>
227
236
  <ClInclude Include="..\paths.hpp">
228
237
  <Filter>Header Files</Filter>
229
238
  </ClInclude>
@@ -288,4 +297,4 @@
288
297
  <Filter>Header Files</Filter>
289
298
  </ClInclude>
290
299
  </ItemGroup>
291
- </Project>
300
+ </Project>
@@ -164,19 +164,21 @@
164
164
  <ClCompile Include="..\constants.cpp" />
165
165
  <ClCompile Include="..\context.cpp" />
166
166
  <ClCompile Include="..\contextualize.cpp" />
167
- <ClCompile Include="..\copy_c_str.cpp" />
168
167
  <ClCompile Include="..\error_handling.cpp" />
169
168
  <ClCompile Include="..\eval.cpp" />
170
169
  <ClCompile Include="..\expand.cpp" />
170
+ <ClCompile Include="..\cssize.cpp" />
171
171
  <ClCompile Include="..\extend.cpp" />
172
172
  <ClCompile Include="..\file.cpp" />
173
173
  <ClCompile Include="..\functions.cpp" />
174
174
  <ClCompile Include="..\inspect.cpp" />
175
175
  <ClCompile Include="..\json.cpp" />
176
176
  <ClCompile Include="..\node.cpp" />
177
- <ClCompile Include="..\output_compressed.cpp" />
178
- <ClCompile Include="..\output_nested.cpp" />
177
+ <ClCompile Include="..\emitter.cpp" />
178
+ <ClCompile Include="..\output.cpp" />
179
179
  <ClCompile Include="..\parser.cpp" />
180
+ <ClCompile Include="..\plugins.cpp" />
181
+ <ClCompile Include="..\position.cpp" />
180
182
  <ClCompile Include="..\prelexer.cpp" />
181
183
  <ClCompile Include="..\remove_placeholders.cpp" />
182
184
  <ClCompile Include="..\sass.cpp" />
@@ -184,7 +186,7 @@
184
186
  <ClCompile Include="..\sass_interface.cpp" />
185
187
  <ClCompile Include="..\sass_context.cpp" />
186
188
  <ClCompile Include="..\sass_functions.cpp" />
187
- <ClCompile Include="..\sass_values.cpp" />
189
+ <ClCompile Include="..\sass_values.cpp" />
188
190
  <ClCompile Include="..\sass_util.cpp" />
189
191
  <ClCompile Include="..\source_map.cpp" />
190
192
  <ClCompile Include="..\to_c.cpp" />
@@ -206,12 +208,12 @@
206
208
  <ClInclude Include="..\constants.hpp" />
207
209
  <ClInclude Include="..\context.hpp" />
208
210
  <ClInclude Include="..\contextualize.hpp" />
209
- <ClInclude Include="..\copy_c_str.hpp" />
210
211
  <ClInclude Include="..\debug.hpp" />
211
212
  <ClInclude Include="..\environment.hpp" />
212
213
  <ClInclude Include="..\error_handling.hpp" />
213
214
  <ClInclude Include="..\eval.hpp" />
214
215
  <ClInclude Include="..\expand.hpp" />
216
+ <ClInclude Include="..\cssize.hpp" />
215
217
  <ClInclude Include="..\extend.hpp" />
216
218
  <ClInclude Include="..\file.hpp" />
217
219
  <ClInclude Include="..\functions.hpp" />
@@ -222,9 +224,10 @@
222
224
  <ClInclude Include="..\memory_manager.hpp" />
223
225
  <ClInclude Include="..\node.hpp" />
224
226
  <ClInclude Include="..\operation.hpp" />
225
- <ClInclude Include="..\output_compressed.hpp" />
226
- <ClInclude Include="..\output_nested.hpp" />
227
+ <ClInclude Include="..\emitter.hpp" />
228
+ <ClInclude Include="..\output.hpp" />
227
229
  <ClInclude Include="..\parser.hpp" />
230
+ <ClInclude Include="..\plugins.hpp" />
228
231
  <ClInclude Include="..\paths.hpp" />
229
232
  <ClInclude Include="..\position.hpp" />
230
233
  <ClInclude Include="..\prelexer.hpp" />
@@ -252,4 +255,4 @@
252
255
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
253
256
  <ImportGroup Label="ExtensionTargets">
254
257
  </ImportGroup>
255
- </Project>
258
+ </Project>
@@ -29,7 +29,7 @@ module SassC
29
29
  import_list = SassC::Native.make_import_list(imports.size)
30
30
 
31
31
  imports.each_with_index do |import, i|
32
- source = import.source ? native_string(import.source) : nil
32
+ source = import.source ? Native.native_string(import.source) : nil
33
33
  source_map_path = nil
34
34
 
35
35
  entry = SassC::Native.make_import_entry(import.path, source, source_map_path)
@@ -39,13 +39,6 @@ module SassC
39
39
  import_list
40
40
  end
41
41
 
42
- def self.native_string(string)
43
- string += "\0"
44
- data = SassC::Native::LibC.malloc(string.size)
45
- data.write_string(string)
46
- data
47
- end
48
-
49
42
  class Import
50
43
  attr_accessor :path, :source, :source_map_path
51
44
 
@@ -47,6 +47,13 @@ module SassC
47
47
  ptr.null? ? [] : ptr.get_array_of_string(0).compact
48
48
  end
49
49
 
50
+ def self.native_string(string)
51
+ string += "\0"
52
+ data = SassC::Native::LibC.malloc(string.size)
53
+ data.write_string(string)
54
+ data
55
+ end
56
+
50
57
  require_relative "native/native_context_api"
51
58
  require_relative "native/native_functions_api"
52
59
  end
@@ -10,7 +10,11 @@ module SassC
10
10
  # ADDAPI struct Sass_File_Context* ADDCALL sass_make_file_context (const char* input_path);
11
11
  # ADDAPI struct Sass_Data_Context* ADDCALL sass_make_data_context (char* source_string);
12
12
  attach_function :sass_make_file_context, [:string], :sass_file_context_ptr
13
- attach_function :sass_make_data_context, [:string], :sass_data_context_ptr
13
+ attach_function :_make_data_context, :sass_make_data_context, [:pointer], :sass_data_context_ptr
14
+
15
+ def self.make_data_context(data)
16
+ _make_data_context(Native.native_string(data))
17
+ end
14
18
 
15
19
  # Call the compilation step for the specific context
16
20
  # ADDAPI int ADDCALL sass_compile_file_context (struct Sass_File_Context* ctx);
@@ -65,7 +69,6 @@ module SassC
65
69
  # ADDAPI bool ADDCALL sass_option_get_is_indented_syntax_src (struct Sass_Options* options);
66
70
  # ADDAPI const char* ADDCALL sass_option_get_input_path (struct Sass_Options* options);
67
71
  # ADDAPI const char* ADDCALL sass_option_get_output_path (struct Sass_Options* options);
68
- # ADDAPI const char* ADDCALL sass_option_get_image_path (struct Sass_Options* options);
69
72
  # ADDAPI const char* ADDCALL sass_option_get_include_path (struct Sass_Options* options);
70
73
  # ADDAPI const char* ADDCALL sass_option_get_source_map_file (struct Sass_Options* options);
71
74
  # ADDAPI Sass_C_Function_List ADDCALL sass_option_get_c_functions (struct Sass_Options* options);
@@ -78,7 +81,6 @@ module SassC
78
81
  attach_function :sass_option_get_is_indented_syntax_src, [:sass_options_ptr], :bool
79
82
  attach_function :sass_option_get_input_path, [:sass_options_ptr], :string
80
83
  attach_function :sass_option_get_output_path, [:sass_options_ptr], :string
81
- attach_function :sass_option_get_image_path, [:sass_options_ptr], :string
82
84
  attach_function :sass_option_get_include_path, [:sass_options_ptr], :string
83
85
  attach_function :sass_option_get_source_map_file, [:sass_options_ptr], :string
84
86
  attach_function :sass_option_get_c_functions, [:sass_options_ptr], :sass_c_function_list_ptr
@@ -94,7 +96,6 @@ module SassC
94
96
  # ADDAPI void ADDCALL sass_option_set_is_indented_syntax_src (struct Sass_Options* options, bool is_indented_syntax_src);
95
97
  # ADDAPI void ADDCALL sass_option_set_input_path (struct Sass_Options* options, const char* input_path);
96
98
  # ADDAPI void ADDCALL sass_option_set_output_path (struct Sass_Options* options, const char* output_path);
97
- # ADDAPI void ADDCALL sass_option_set_image_path (struct Sass_Options* options, const char* image_path);
98
99
  # ADDAPI void ADDCALL sass_option_set_include_path (struct Sass_Options* options, const char* include_path);
99
100
  # ADDAPI void ADDCALL sass_option_set_source_map_file (struct Sass_Options* options, const char* source_map_file);
100
101
  # ADDAPI void ADDCALL sass_option_set_c_functions (struct Sass_Options* options, Sass_C_Function_List c_functions);
@@ -108,7 +109,6 @@ module SassC
108
109
  attach_function :sass_option_set_is_indented_syntax_src, [:sass_options_ptr, :bool], :void
109
110
  attach_function :sass_option_set_input_path, [:sass_options_ptr, :string], :void
110
111
  attach_function :sass_option_set_output_path, [:sass_options_ptr, :string], :void
111
- attach_function :sass_option_set_image_path, [:sass_options_ptr, :string], :void
112
112
  attach_function :sass_option_set_include_path, [:sass_options_ptr, :string], :void
113
113
  attach_function :sass_option_set_source_map_file, [:sass_options_ptr, :string], :void
114
114
  attach_function :sass_option_set_c_functions, [:sass_options_ptr, :pointer], :void
@@ -1,3 +1,3 @@
1
1
  module SassC
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -7,7 +7,7 @@ module NativeTest
7
7
 
8
8
  class General < SassCTest
9
9
  def test_it_reports_the_libsass_version
10
- assert_equal "3.1.0", SassC::Native.version
10
+ assert_equal "3.2.0-beta.1", SassC::Native.version
11
11
  end
12
12
  end
13
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sassc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Boland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-10 00:00:00.000000000 Z
11
+ date: 2015-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -141,9 +141,13 @@ files:
141
141
  - ext/libsass/context.hpp
142
142
  - ext/libsass/contextualize.cpp
143
143
  - ext/libsass/contextualize.hpp
144
- - ext/libsass/copy_c_str.cpp
145
- - ext/libsass/copy_c_str.hpp
144
+ - ext/libsass/contrib/libsass.spec
145
+ - ext/libsass/cssize.cpp
146
+ - ext/libsass/cssize.hpp
146
147
  - ext/libsass/debug.hpp
148
+ - ext/libsass/debugger.hpp
149
+ - ext/libsass/emitter.cpp
150
+ - ext/libsass/emitter.hpp
147
151
  - ext/libsass/environment.hpp
148
152
  - ext/libsass/error_handling.cpp
149
153
  - ext/libsass/error_handling.hpp
@@ -169,13 +173,14 @@ files:
169
173
  - ext/libsass/node.cpp
170
174
  - ext/libsass/node.hpp
171
175
  - ext/libsass/operation.hpp
172
- - ext/libsass/output_compressed.cpp
173
- - ext/libsass/output_compressed.hpp
174
- - ext/libsass/output_nested.cpp
175
- - ext/libsass/output_nested.hpp
176
+ - ext/libsass/output.cpp
177
+ - ext/libsass/output.hpp
176
178
  - ext/libsass/parser.cpp
177
179
  - ext/libsass/parser.hpp
178
180
  - ext/libsass/paths.hpp
181
+ - ext/libsass/plugins.cpp
182
+ - ext/libsass/plugins.hpp
183
+ - ext/libsass/position.cpp
179
184
  - ext/libsass/position.hpp
180
185
  - ext/libsass/posix/getopt.c
181
186
  - ext/libsass/posix/getopt.h
@@ -212,7 +217,6 @@ files:
212
217
  - ext/libsass/source_map.hpp
213
218
  - ext/libsass/subset_map.hpp
214
219
  - ext/libsass/support/libsass.pc.in
215
- - ext/libsass/test-driver
216
220
  - ext/libsass/test/test_node.cpp
217
221
  - ext/libsass/test/test_paths.cpp
218
222
  - ext/libsass/test/test_selector_difference.cpp
@@ -224,7 +228,6 @@ files:
224
228
  - ext/libsass/to_c.hpp
225
229
  - ext/libsass/to_string.cpp
226
230
  - ext/libsass/to_string.hpp
227
- - ext/libsass/token.hpp
228
231
  - ext/libsass/units.cpp
229
232
  - ext/libsass/units.hpp
230
233
  - ext/libsass/utf8.h
@@ -235,6 +238,7 @@ files:
235
238
  - ext/libsass/utf8_string.hpp
236
239
  - ext/libsass/util.cpp
237
240
  - ext/libsass/util.hpp
241
+ - ext/libsass/version.sh
238
242
  - ext/libsass/win/libsass.filters
239
243
  - ext/libsass/win/libsass.sln
240
244
  - ext/libsass/win/libsass.vcxproj
@@ -1,13 +0,0 @@
1
- #include <cstdlib>
2
- #include <cstring>
3
-
4
- namespace Sass {
5
- using namespace std;
6
-
7
- char* copy_c_str(const char* orig)
8
- {
9
- char* copy = (char*) malloc(sizeof(char) * strlen(orig) + 1);
10
- strcpy(copy, orig);
11
- return copy;
12
- }
13
- }
@@ -1,5 +0,0 @@
1
- namespace Sass {
2
-
3
- char* copy_c_str(const char*);
4
-
5
- }
@@ -1,401 +0,0 @@
1
- #include "output_compressed.hpp"
2
- #include "inspect.hpp"
3
- #include "ast.hpp"
4
- #include "context.hpp"
5
- #include "to_string.hpp"
6
- #include "util.hpp"
7
- #include <cmath>
8
- #include <iomanip>
9
-
10
- namespace Sass {
11
- using namespace std;
12
-
13
- Output_Compressed::Output_Compressed(Context* ctx) : buffer(""), rendered_imports(""), ctx(ctx), seen_utf8(false) { }
14
- Output_Compressed::~Output_Compressed() { }
15
-
16
- inline void Output_Compressed::fallback_impl(AST_Node* n)
17
- {
18
- Inspect i(ctx);
19
- n->perform(&i);
20
- const string& text = i.get_buffer();
21
- for(const char& chr : text) {
22
- // abort clause
23
- if (seen_utf8) break;
24
- // skip all normal ascii chars
25
- if (Util::isAscii(chr)) continue;
26
- // singleton
27
- seen_utf8 = true;
28
- }
29
- buffer += text;
30
- if (ctx && !ctx->_skip_source_map_update)
31
- ctx->source_map.update_column(text);
32
- }
33
-
34
- void Output_Compressed::operator()(Import* imp)
35
- {
36
- Inspect insp(ctx);
37
- imp->perform(&insp);
38
- rendered_imports += insp.get_buffer();
39
- }
40
-
41
- void Output_Compressed::operator()(Block* b)
42
- {
43
- if (!b->is_root()) return;
44
- for (size_t i = 0, L = b->length(); i < L; ++i) {
45
- (*b)[i]->perform(this);
46
- }
47
- }
48
-
49
- void Output_Compressed::operator()(Ruleset* r)
50
- {
51
- Selector* s = r->selector();
52
- Block* b = r->block();
53
-
54
- // Filter out rulesets that aren't printable (process its children though)
55
- if (!Util::isPrintable(r)) {
56
- for (size_t i = 0, L = b->length(); i < L; ++i) {
57
- Statement* stm = (*b)[i];
58
- if (dynamic_cast<Has_Block*>(stm)) {
59
- stm->perform(this);
60
- }
61
- }
62
- return;
63
- }
64
-
65
- if (b->has_non_hoistable()) {
66
- s->perform(this);
67
- append_singleline_part_to_buffer("{");
68
- for (size_t i = 0, L = b->length(); i < L; ++i) {
69
- Statement* stm = (*b)[i];
70
- if (!stm->is_hoistable()) {
71
- stm->perform(this);
72
- }
73
- }
74
- size_t l = buffer.length();
75
- if (l > 0 && buffer.at(l - 1) == ';') buffer.erase(l - 1);
76
- append_singleline_part_to_buffer("}");
77
- }
78
-
79
- if (b->has_hoistable()) {
80
- for (size_t i = 0, L = b->length(); i < L; ++i) {
81
- Statement* stm = (*b)[i];
82
- if (stm->is_hoistable()) {
83
- stm->perform(this);
84
- }
85
- }
86
- }
87
- }
88
-
89
- void Output_Compressed::operator()(Media_Block* m)
90
- {
91
- List* q = m->media_queries();
92
- Block* b = m->block();
93
-
94
- // Filter out media blocks that aren't printable (process its children though)
95
- if (!Util::isPrintable(m)) {
96
- for (size_t i = 0, L = b->length(); i < L; ++i) {
97
- Statement* stm = (*b)[i];
98
- if (dynamic_cast<Has_Block*>(stm)) {
99
- stm->perform(this);
100
- }
101
- }
102
- return;
103
- }
104
-
105
- ctx->source_map.add_mapping(m);
106
- append_singleline_part_to_buffer("@media ");
107
- q->perform(this);
108
- append_singleline_part_to_buffer("{");
109
-
110
- Selector* e = m->selector();
111
- if (e && b->has_non_hoistable()) {
112
- // JMA - hoisted, output the non-hoistable in a nested block, followed by the hoistable
113
- e->perform(this);
114
- append_singleline_part_to_buffer("{");
115
-
116
- for (size_t i = 0, L = b->length(); i < L; ++i) {
117
- Statement* stm = (*b)[i];
118
- if (!stm->is_hoistable()) {
119
- stm->perform(this);
120
- }
121
- }
122
-
123
- append_singleline_part_to_buffer("}");
124
-
125
- for (size_t i = 0, L = b->length(); i < L; ++i) {
126
- Statement* stm = (*b)[i];
127
- if (stm->is_hoistable()) {
128
- stm->perform(this);
129
- }
130
- }
131
- }
132
- else {
133
- // JMA - not hoisted, just output in order
134
- for (size_t i = 0, L = b->length(); i < L; ++i) {
135
- Statement* stm = (*b)[i];
136
- stm->perform(this);
137
- }
138
- }
139
-
140
- append_singleline_part_to_buffer("}");
141
- }
142
-
143
- void Output_Compressed::operator()(At_Rule* a)
144
- {
145
- string kwd = a->keyword();
146
- Selector* s = a->selector();
147
- Expression* v = a->value();
148
- Block* b = a->block();
149
-
150
- append_singleline_part_to_buffer(kwd);
151
- if (s) {
152
- append_singleline_part_to_buffer(" ");
153
- s->perform(this);
154
- }
155
- else if (v) {
156
- append_singleline_part_to_buffer(" ");
157
- v->perform(this);
158
- }
159
-
160
- if (!b) {
161
- append_singleline_part_to_buffer(";");
162
- return;
163
- }
164
-
165
- append_singleline_part_to_buffer("{");
166
- for (size_t i = 0, L = b->length(); i < L; ++i) {
167
- Statement* stm = (*b)[i];
168
- if (!stm->is_hoistable()) {
169
- stm->perform(this);
170
- }
171
- }
172
-
173
- for (size_t i = 0, L = b->length(); i < L; ++i) {
174
- Statement* stm = (*b)[i];
175
- if (stm->is_hoistable()) {
176
- stm->perform(this);
177
- }
178
- }
179
-
180
- append_singleline_part_to_buffer("}");
181
- }
182
-
183
- void Output_Compressed::operator()(Declaration* d)
184
- {
185
- bool bPrintExpression = true;
186
- // Check print conditions
187
- if (d->value()->concrete_type() == Expression::NULL_VAL) {
188
- bPrintExpression = false;
189
- }
190
- if (d->value()->concrete_type() == Expression::STRING) {
191
- String_Constant* valConst = static_cast<String_Constant*>(d->value());
192
- string val(valConst->value());
193
- if (val.empty()) {
194
- bPrintExpression = false;
195
- }
196
- }
197
- // Print if OK
198
- if(bPrintExpression) {
199
- if (ctx) ctx->source_map.add_mapping(d->property());
200
- d->property()->perform(this);
201
- append_singleline_part_to_buffer(":");
202
- if (ctx) ctx->source_map.add_mapping(d->value());
203
- d->value()->perform(this);
204
- if (d->is_important()) append_singleline_part_to_buffer("!important");
205
- append_singleline_part_to_buffer(";");
206
- }
207
- }
208
-
209
- void Output_Compressed::operator()(Comment* c)
210
- {
211
- To_String to_string;
212
- string txt = c->text()->perform(&to_string);
213
- if(txt[2] != '!') {
214
- return;
215
- }
216
- else {
217
- Inspect i(ctx);
218
- c->perform(&i);
219
- const string& text = i.get_buffer();
220
- for(const char& chr : text) {
221
- // abort clause
222
- if (seen_utf8) break;
223
- // skip all normal ascii chars
224
- if (Util::isAscii(chr)) continue;
225
- // singleton
226
- seen_utf8 = true;
227
- }
228
- buffer += text;
229
- if (ctx && !ctx->_skip_source_map_update)
230
- ctx->source_map.update_column(text);
231
- }
232
- }
233
-
234
- void Output_Compressed::operator()(List* list)
235
- {
236
- string sep(list->separator() == List::SPACE ? " " : ",");
237
- if (list->empty()) return;
238
- Expression* first = (*list)[0];
239
- bool first_invisible = first->is_invisible();
240
- if (!first_invisible) first->perform(this);
241
- for (size_t i = 1, L = list->length(); i < L; ++i) {
242
- Expression* next = (*list)[i];
243
- bool next_invisible = next->is_invisible();
244
- if (i == 1 && !first_invisible && !next_invisible) append_singleline_part_to_buffer(sep);
245
- else if (!next_invisible) append_singleline_part_to_buffer(sep);
246
- next->perform(this);
247
- }
248
- }
249
-
250
- // helper function for serializing colors
251
- template <size_t range>
252
- static double cap_channel(double c) {
253
- if (c > range) return range;
254
- else if (c < 0) return 0;
255
- else return c;
256
- }
257
-
258
- void Output_Compressed::operator()(Color* c)
259
- {
260
- stringstream ss;
261
- double r = round(cap_channel<0xff>(c->r()));
262
- double g = round(cap_channel<0xff>(c->g()));
263
- double b = round(cap_channel<0xff>(c->b()));
264
- double a = cap_channel<1> (c->a());
265
-
266
- // retain the originally specified color definition if unchanged
267
- if (!c->disp().empty()) {
268
- ss << c->disp();
269
- }
270
- else if (r == 0 && g == 0 && b == 0 && a == 0) {
271
- ss << "transparent";
272
- }
273
- else if (a >= 1) {
274
- // see if it's a named color
275
- int numval = r * 0x10000;
276
- numval += g * 0x100;
277
- numval += b;
278
- if (ctx && ctx->colors_to_names.count(numval)) {
279
- ss << ctx->colors_to_names[numval];
280
- }
281
- else {
282
- // otherwise output the hex triplet
283
- ss << '#' << setw(2) << setfill('0');
284
- ss << hex << setw(2) << static_cast<unsigned long>(r);
285
- ss << hex << setw(2) << static_cast<unsigned long>(g);
286
- ss << hex << setw(2) << static_cast<unsigned long>(b);
287
- }
288
- }
289
- else {
290
- ss << "rgba(";
291
- ss << static_cast<unsigned long>(r) << ",";
292
- ss << static_cast<unsigned long>(g) << ",";
293
- ss << static_cast<unsigned long>(b) << ",";
294
- ss << a << ')';
295
- }
296
- append_singleline_part_to_buffer(ss.str());
297
- }
298
-
299
- void Output_Compressed::operator()(Media_Query_Expression* mqe)
300
- {
301
- if (mqe->is_interpolated()) {
302
- mqe->feature()->perform(this);
303
- }
304
- else {
305
- append_singleline_part_to_buffer("(");
306
- mqe->feature()->perform(this);
307
- if (mqe->value()) {
308
- append_singleline_part_to_buffer(":");
309
- mqe->value()->perform(this);
310
- }
311
- append_singleline_part_to_buffer(")");
312
- }
313
- }
314
-
315
- void Output_Compressed::operator()(Null* n)
316
- {
317
- // noop
318
- }
319
-
320
- void Output_Compressed::operator()(Argument* a)
321
- {
322
- if (!a->name().empty()) {
323
- append_singleline_part_to_buffer(a->name());
324
- append_singleline_part_to_buffer(":");
325
- }
326
- a->value()->perform(this);
327
- if (a->is_rest_argument()) {
328
- append_singleline_part_to_buffer("...");
329
- }
330
- }
331
-
332
- void Output_Compressed::operator()(Arguments* a)
333
- {
334
- append_singleline_part_to_buffer("(");
335
- if (!a->empty()) {
336
- (*a)[0]->perform(this);
337
- for (size_t i = 1, L = a->length(); i < L; ++i) {
338
- append_singleline_part_to_buffer(",");
339
- (*a)[i]->perform(this);
340
- }
341
- }
342
- append_singleline_part_to_buffer(")");
343
- }
344
-
345
- void Output_Compressed::operator()(Complex_Selector* c)
346
- {
347
- Compound_Selector* head = c->head();
348
- Complex_Selector* tail = c->tail();
349
- Complex_Selector::Combinator comb = c->combinator();
350
- if (head && head->is_empty_reference() && tail)
351
- {
352
- tail->perform(this);
353
- return;
354
- }
355
- if (head && !head->is_empty_reference()) head->perform(this);
356
- switch (comb) {
357
- case Complex_Selector::ANCESTOR_OF:
358
- if (tail) append_singleline_part_to_buffer(" ");
359
- break;
360
- case Complex_Selector::PARENT_OF:
361
- append_singleline_part_to_buffer(">");
362
- break;
363
- case Complex_Selector::PRECEDES:
364
- // Apparently need to preserve spaces around this combinator?
365
- if (head && !head->is_empty_reference()) append_singleline_part_to_buffer(" ");
366
- append_singleline_part_to_buffer("~");
367
- if (tail) append_singleline_part_to_buffer(" ");
368
- break;
369
- case Complex_Selector::ADJACENT_TO:
370
- append_singleline_part_to_buffer("+");
371
- break;
372
- }
373
- if (tail) tail->perform(this);
374
- }
375
-
376
- void Output_Compressed::operator()(Selector_List* g)
377
- {
378
- if (g->empty()) return;
379
- (*g)[0]->perform(this);
380
- for (size_t i = 1, L = g->length(); i < L; ++i) {
381
- append_singleline_part_to_buffer(",");
382
- (*g)[i]->perform(this);
383
- }
384
- }
385
-
386
- void Output_Compressed::append_singleline_part_to_buffer(const string& text)
387
- {
388
- buffer += text;
389
- if (ctx && !ctx->_skip_source_map_update)
390
- ctx->source_map.update_column(text);
391
- for(const char& chr : text) {
392
- // abort clause
393
- if (seen_utf8) break;
394
- // skip all normal ascii chars
395
- if (Util::isAscii(chr)) continue;
396
- // singleton
397
- seen_utf8 = true;
398
- }
399
- }
400
-
401
- }