sassc 1.11.4 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +2 -2
  3. data/CODE_OF_CONDUCT.md +10 -0
  4. data/README.md +4 -1
  5. data/ext/libsass/.editorconfig +1 -1
  6. data/ext/libsass/.github/CONTRIBUTING.md +7 -7
  7. data/ext/libsass/.github/ISSUE_TEMPLATE.md +31 -6
  8. data/ext/libsass/.gitignore +3 -0
  9. data/ext/libsass/.travis.yml +37 -18
  10. data/ext/libsass/GNUmakefile.am +23 -37
  11. data/ext/libsass/Makefile +10 -6
  12. data/ext/libsass/Makefile.conf +3 -0
  13. data/ext/libsass/Readme.md +68 -63
  14. data/ext/libsass/appveyor.yml +7 -3
  15. data/ext/libsass/configure.ac +10 -14
  16. data/ext/libsass/docs/api-context-internal.md +29 -21
  17. data/ext/libsass/docs/api-context.md +26 -6
  18. data/ext/libsass/docs/api-doc.md +49 -16
  19. data/ext/libsass/docs/api-function-example.md +1 -1
  20. data/ext/libsass/docs/api-function.md +31 -7
  21. data/ext/libsass/docs/api-importer.md +19 -19
  22. data/ext/libsass/docs/api-value.md +4 -2
  23. data/ext/libsass/docs/build-on-windows.md +4 -4
  24. data/ext/libsass/docs/build-with-mingw.md +3 -3
  25. data/ext/libsass/docs/build.md +9 -9
  26. data/ext/libsass/docs/custom-functions-internal.md +10 -8
  27. data/ext/libsass/docs/implementations.md +20 -8
  28. data/ext/libsass/docs/unicode.md +16 -10
  29. data/ext/libsass/include/sass/base.h +0 -3
  30. data/ext/libsass/include/sass/context.h +20 -2
  31. data/ext/libsass/include/sass/functions.h +31 -0
  32. data/ext/libsass/include/sass/values.h +3 -1
  33. data/ext/libsass/include/sass/version.h +1 -1
  34. data/ext/libsass/include/sass/version.h.in +1 -1
  35. data/ext/libsass/include/sass2scss.h +1 -1
  36. data/ext/libsass/res/resource.rc +6 -6
  37. data/ext/libsass/script/ci-build-libsass +10 -5
  38. data/ext/libsass/script/ci-build-plugin +62 -0
  39. data/ext/libsass/script/ci-install-compiler +1 -1
  40. data/ext/libsass/script/ci-install-deps +4 -7
  41. data/ext/libsass/script/ci-report-coverage +13 -3
  42. data/ext/libsass/script/tap-driver +1 -1
  43. data/ext/libsass/script/tap-runner +1 -1
  44. data/ext/libsass/src/GNUmakefile.am +1 -1
  45. data/ext/libsass/src/ast.cpp +537 -762
  46. data/ext/libsass/src/ast.hpp +377 -419
  47. data/ext/libsass/src/ast_def_macros.hpp +26 -1
  48. data/ext/libsass/src/ast_fwd_decl.cpp +29 -0
  49. data/ext/libsass/src/ast_fwd_decl.hpp +94 -21
  50. data/ext/libsass/src/b64/encode.h +3 -1
  51. data/ext/libsass/src/backtrace.cpp +46 -0
  52. data/ext/libsass/src/backtrace.hpp +7 -54
  53. data/ext/libsass/src/bind.cpp +72 -50
  54. data/ext/libsass/src/bind.hpp +0 -1
  55. data/ext/libsass/src/cencode.c +6 -0
  56. data/ext/libsass/src/check_nesting.cpp +157 -135
  57. data/ext/libsass/src/check_nesting.hpp +11 -10
  58. data/ext/libsass/src/color_maps.cpp +10 -6
  59. data/ext/libsass/src/color_maps.hpp +6 -8
  60. data/ext/libsass/src/constants.cpp +4 -3
  61. data/ext/libsass/src/constants.hpp +4 -3
  62. data/ext/libsass/src/context.cpp +110 -47
  63. data/ext/libsass/src/context.hpp +11 -1
  64. data/ext/libsass/src/cssize.cpp +105 -94
  65. data/ext/libsass/src/cssize.hpp +4 -5
  66. data/ext/libsass/src/debugger.hpp +247 -244
  67. data/ext/libsass/src/emitter.cpp +30 -6
  68. data/ext/libsass/src/emitter.hpp +7 -0
  69. data/ext/libsass/src/environment.cpp +67 -16
  70. data/ext/libsass/src/environment.hpp +28 -7
  71. data/ext/libsass/src/error_handling.cpp +92 -64
  72. data/ext/libsass/src/error_handling.hpp +64 -43
  73. data/ext/libsass/src/eval.cpp +494 -544
  74. data/ext/libsass/src/eval.hpp +17 -23
  75. data/ext/libsass/src/expand.cpp +182 -154
  76. data/ext/libsass/src/expand.hpp +4 -5
  77. data/ext/libsass/src/extend.cpp +299 -291
  78. data/ext/libsass/src/extend.hpp +46 -11
  79. data/ext/libsass/src/file.cpp +103 -36
  80. data/ext/libsass/src/file.hpp +21 -4
  81. data/ext/libsass/src/functions.cpp +561 -312
  82. data/ext/libsass/src/functions.hpp +8 -5
  83. data/ext/libsass/src/inspect.cpp +108 -53
  84. data/ext/libsass/src/inspect.hpp +5 -2
  85. data/ext/libsass/src/lexer.cpp +15 -7
  86. data/ext/libsass/src/lexer.hpp +13 -4
  87. data/ext/libsass/src/listize.cpp +3 -2
  88. data/ext/libsass/src/listize.hpp +0 -1
  89. data/ext/libsass/src/memory/SharedPtr.cpp +16 -18
  90. data/ext/libsass/src/memory/SharedPtr.hpp +47 -43
  91. data/ext/libsass/src/node.cpp +34 -38
  92. data/ext/libsass/src/node.hpp +6 -8
  93. data/ext/libsass/src/operation.hpp +2 -2
  94. data/ext/libsass/src/operators.cpp +240 -0
  95. data/ext/libsass/src/operators.hpp +30 -0
  96. data/ext/libsass/src/output.cpp +22 -20
  97. data/ext/libsass/src/parser.cpp +719 -358
  98. data/ext/libsass/src/parser.hpp +57 -22
  99. data/ext/libsass/src/plugins.cpp +28 -10
  100. data/ext/libsass/src/position.cpp +21 -3
  101. data/ext/libsass/src/position.hpp +2 -1
  102. data/ext/libsass/src/prelexer.cpp +104 -19
  103. data/ext/libsass/src/prelexer.hpp +10 -3
  104. data/ext/libsass/src/remove_placeholders.cpp +9 -10
  105. data/ext/libsass/src/remove_placeholders.hpp +1 -5
  106. data/ext/libsass/src/sass.cpp +62 -4
  107. data/ext/libsass/src/sass.hpp +5 -2
  108. data/ext/libsass/src/sass_context.cpp +96 -58
  109. data/ext/libsass/src/sass_context.hpp +7 -5
  110. data/ext/libsass/src/sass_functions.cpp +63 -1
  111. data/ext/libsass/src/sass_functions.hpp +19 -1
  112. data/ext/libsass/src/sass_util.cpp +3 -3
  113. data/ext/libsass/src/sass_util.hpp +4 -4
  114. data/ext/libsass/src/sass_values.cpp +42 -39
  115. data/ext/libsass/src/sass_values.hpp +2 -1
  116. data/ext/libsass/src/source_map.cpp +16 -18
  117. data/ext/libsass/src/subset_map.cpp +6 -8
  118. data/ext/libsass/src/subset_map.hpp +6 -6
  119. data/ext/libsass/src/to_c.cpp +2 -2
  120. data/ext/libsass/src/to_value.cpp +8 -3
  121. data/ext/libsass/src/to_value.hpp +1 -0
  122. data/ext/libsass/src/units.cpp +349 -45
  123. data/ext/libsass/src/units.hpp +39 -22
  124. data/ext/libsass/src/utf8/checked.h +7 -0
  125. data/ext/libsass/src/utf8/unchecked.h +7 -0
  126. data/ext/libsass/src/utf8_string.cpp +1 -1
  127. data/ext/libsass/src/util.cpp +139 -45
  128. data/ext/libsass/src/util.hpp +4 -7
  129. data/ext/libsass/src/values.cpp +15 -23
  130. data/ext/libsass/win/libsass.sln +13 -2
  131. data/ext/libsass/win/libsass.sln.DotSettings +9 -0
  132. data/ext/libsass/win/libsass.targets +3 -0
  133. data/ext/libsass/win/libsass.vcxproj.filters +9 -0
  134. data/lib/sassc/version.rb +1 -1
  135. data/sassc.gemspec +1 -1
  136. data/test/native_test.rb +1 -1
  137. metadata +11 -4
@@ -1,7 +1,7 @@
1
1
  `Sass_Values` are used to pass values and their types between the implementer
2
2
  and LibSass. Sass knows various different value types (including nested arrays
3
3
  and hash-maps). If you implement a binding to another programming language, you
4
- have to find a way to [marshal] [1] (convert) `Sass_Values` between the target
4
+ have to find a way to [marshal][1] (convert) `Sass_Values` between the target
5
5
  language and C. `Sass_Values` are currently only used by custom functions, but
6
6
  it should also be possible to use them without a compiler context.
7
7
 
@@ -58,7 +58,7 @@ union Sass_Value* sass_make_string (const char* val);
58
58
  union Sass_Value* sass_make_qstring (const char* val);
59
59
  union Sass_Value* sass_make_number (double val, const char* unit);
60
60
  union Sass_Value* sass_make_color (double r, double g, double b, double a);
61
- union Sass_Value* sass_make_list (size_t len, enum Sass_Separator sep);
61
+ union Sass_Value* sass_make_list (size_t len, enum Sass_Separator sep, bool is_bracketed);
62
62
  union Sass_Value* sass_make_map (size_t len);
63
63
  union Sass_Value* sass_make_error (const char* msg);
64
64
  union Sass_Value* sass_make_warning (const char* msg);
@@ -124,6 +124,8 @@ size_t sass_list_get_length (const union Sass_Value* v);
124
124
  // Getters and setters for Sass_List
125
125
  enum Sass_Separator sass_list_get_separator (const union Sass_Value* v);
126
126
  void sass_list_set_separator (union Sass_Value* v, enum Sass_Separator value);
127
+ bool sass_list_get_is_bracketed (const union Sass_Value* v);
128
+ void sass_list_set_is_bracketed (union Sass_Value* v, bool value);
127
129
  // Getters and setters for Sass_List values
128
130
  union Sass_Value* sass_list_get_value (const union Sass_Value* v, size_t i);
129
131
  void sass_list_set_value (union Sass_Value* v, size_t i, union Sass_Value* value);
@@ -3,14 +3,14 @@ Both should be considered experimental (MinGW was better tested)!
3
3
 
4
4
  ## Building via MingGW (makefiles)
5
5
 
6
- First grab the latest [MinGW for windows] [1] installer. Once it is installed, you can click on continue or open the Installation Manager via `bin\mingw-get.exe`.
6
+ First grab the latest [MinGW for windows][1] installer. Once it is installed, you can click on continue or open the Installation Manager via `bin\mingw-get.exe`.
7
7
 
8
8
  You need to have the following components installed:
9
9
  ![Visualization of components installed in the interface](https://cloud.githubusercontent.com/assets/282293/5525466/947bf396-89e6-11e4-841d-4aa916f14de1.png)
10
10
 
11
- Next we need to install [git for windows] [2]. You probably want to check the option to add it to the global path, but you do not need to install the unix tools.
11
+ Next we need to install [git for windows][2]. You probably want to check the option to add it to the global path, but you do not need to install the unix tools.
12
12
 
13
- If you want to run the spec test-suite you also need [ruby] [3] and a few gems available. Grab the [latest installer] [3] and make sure to add it the global path. Then install the missing gems:
13
+ If you want to run the spec test-suite you also need [ruby][3] and a few gems available. Grab the [latest installer][3] and make sure to add it the global path. Then install the missing gems:
14
14
 
15
15
  ```bash
16
16
  gem install minitest
@@ -130,7 +130,7 @@ cd libsass
130
130
  REM set PATH=%PATH%;%PROGRAMFILES%\MSBuild\12.0\Bin
131
131
  msbuild /m:4 /p:Configuration=Release win\libsass.sln
132
132
  REM running the spec test-suite manually (needs ruby and minitest gem)
133
- ruby sass-spec\sass-spec.rb -V 3.4 -c win\bin\sassc.exe -s --impl libsass sass-spec/spec
133
+ ruby sass-spec\sass-spec.rb -V 3.5 -c win\bin\sassc.exe -s --impl libsass sass-spec/spec
134
134
  cd ..
135
135
  ```
136
136
 
@@ -1,13 +1,13 @@
1
1
  ## Building LibSass with MingGW (makefiles)
2
2
 
3
- First grab the latest [MinGW for windows] [1] installer. Once it is installed, you can click on continue or open the Installation Manager via `bin\mingw-get.exe`.
3
+ First grab the latest [MinGW for windows][1] installer. Once it is installed, you can click on continue or open the Installation Manager via `bin\mingw-get.exe`.
4
4
 
5
5
  You need to have the following components installed:
6
6
  ![](https://cloud.githubusercontent.com/assets/282293/5525466/947bf396-89e6-11e4-841d-4aa916f14de1.png)
7
7
 
8
- Next we need to install [git for windows] [2]. You probably want to check the option to add it to the global path, but you do not need to install the unix tools.
8
+ Next we need to install [git for windows][2]. You probably want to check the option to add it to the global path, but you do not need to install the unix tools.
9
9
 
10
- If you want to run the spec test-suite you also need [ruby] [3] and a few gems available. Grab the [latest installer] [3] and make sure to add it the global path. Then install the missing gems:
10
+ If you want to run the spec test-suite you also need [ruby][3] and a few gems available. Grab the [latest installer][3] and make sure to add it the global path. Then install the missing gems:
11
11
 
12
12
  ```bash
13
13
  gem install minitest
@@ -1,4 +1,4 @@
1
- `libsass` is only a library and does not do much on its own. You need an implementation that you can use from the [command line] [6]. Or some [[bindings|Implementations]] to use it within your favorite programming language. You should be able to get [`sassc`] [6] running by following the instructions in this guide.
1
+ `libsass` is only a library and does not do much on its own. You need an implementation that you can use from the [command line][6]. Or some [bindings|Implementations][9] to use it within your favorite programming language. You should be able to get [`sassc`][6] running by following the instructions in this guide.
2
2
 
3
3
  Before starting, see [setup dev environment](setup-environment.md).
4
4
 
@@ -11,27 +11,27 @@ We try to keep the code as OS independent and standard compliant as possible. Re
11
11
 
12
12
  Linux is the main target for `libsass` and we support two ways to build `libsass` here. The old plain makefiles should still work on most systems (including MinGW), while the autotools build is preferred if you want to create a [system library] (experimental).
13
13
 
14
- - [Building with makefiles] [1]
15
- - [Building with autotools] [2]
14
+ - [Building with makefiles][1]
15
+ - [Building with autotools][2]
16
16
 
17
17
  ### Building on Windows (experimental)
18
18
 
19
19
  Windows build support was added very recently and should be considered experimental. Credits go to @darrenkopp and @am11 for their work on getting `libsass` and `sassc` to compile with visual studio!
20
20
 
21
- - [Building with MinGW] [3]
22
- - [Building with Visual Studio] [11]
21
+ - [Building with MinGW][3]
22
+ - [Building with Visual Studio][11]
23
23
 
24
24
  ### Building on Max OS X (untested)
25
25
 
26
26
  Works the same as on linux, but you can also install LibSass via `homebrew`.
27
27
 
28
- - [Building on Mac OS X] [10]
28
+ - [Building on Mac OS X][10]
29
29
 
30
30
  ### Building a system library (experimental)
31
31
 
32
32
  Since `libsass` is a library, it makes sense to install it as a shared library on your system. On linux this means creating a `.so` library via autotools. This should work pretty well already, but we are not yet committed to keep the ABI 100% stable. This should be the case once we increase the version number for the library to 1.0.0 or higher. On Windows you should be able get a `dll` by creating a shared build with MinGW. There is currently no target in the MSVC project files to do this.
33
33
 
34
- - [Building shared system library] [4]
34
+ - [Building shared system library][4]
35
35
 
36
36
  Compiling with clang instead of gcc
37
37
  --
@@ -46,7 +46,7 @@ export CXX=/usr/bin/clang++
46
46
  Running the spec test-suite
47
47
  --
48
48
 
49
- We constantly and automatically test `libsass` against the official [spec test-suite] [5]. To do this we need to have a test-runner (which is written in ruby) and a command-line tool ([`sassc`] [6]) to run the tests. Therefore we need to additionally compile `sassc`. To do this, the build files of all three projects need to work together. This may not have the same quality for all build flavors. You definitely need to have ruby (2.1?) installed (version 1.9 seems to cause problems at least on windows). You also need some gems installed:
49
+ We constantly and automatically test `libsass` against the official [spec test-suite][5]. To do this we need to have a test-runner (which is written in ruby) and a command-line tool ([`sassc`][6]) to run the tests. Therefore we need to additionally compile `sassc`. To do this, the build files of all three projects need to work together. This may not have the same quality for all build flavors. You definitely need to have ruby (2.1?) installed (version 1.9 seems to cause problems at least on windows). You also need some gems installed:
50
50
 
51
51
  ```bash
52
52
  ruby -v
@@ -67,7 +67,7 @@ export LIBSASS_VERSION="x.y.z."
67
67
  Continuous Integration
68
68
  --
69
69
 
70
- We use two CI services to automatically test all commits against the latest [spec test-suite] [5].
70
+ We use two CI services to automatically test all commits against the latest [spec test-suite][5].
71
71
 
72
72
  - [LibSass on Travis-CI (linux)][7]
73
73
  [![Build Status](https://travis-ci.org/sass/libsass.png?branch=master)](https://travis-ci.org/sass/libsass)
@@ -45,14 +45,16 @@ The cookie can hold any pointer you want. In the `perl-libsass` implementation i
45
45
 
46
46
  ```C
47
47
  // allocate memory (copies passed strings)
48
- union Sass_Value* make_sass_boolean (int val);
49
- union Sass_Value* make_sass_number (double val, const char* unit);
50
- union Sass_Value* make_sass_color (double r, double g, double b, double a);
51
- union Sass_Value* make_sass_string (const char* val);
52
- union Sass_Value* make_sass_list (size_t len, enum Sass_Separator sep);
53
- union Sass_Value* make_sass_map (size_t len);
54
- union Sass_Value* make_sass_null ();
55
- union Sass_Value* make_sass_error (const char* msg);
48
+ union Sass_Value* sass_make_null (void);
49
+ union Sass_Value* sass_make_boolean (bool val);
50
+ union Sass_Value* sass_make_string (const char* val);
51
+ union Sass_Value* sass_make_qstring (const char* val);
52
+ union Sass_Value* sass_make_number (double val, const char* unit);
53
+ union Sass_Value* sass_make_color (double r, double g, double b, double a);
54
+ union Sass_Value* sass_make_list (size_t len, enum Sass_Separator sep, bool is_bracketed);
55
+ union Sass_Value* sass_make_map (size_t len);
56
+ union Sass_Value* sass_make_error (const char* msg);
57
+ union Sass_Value* sass_make_warning (const char* msg);
56
58
 
57
59
  // Make a deep cloned copy of the given sass value
58
60
  union Sass_Value* sass_clone_value (const union Sass_Value* val);
@@ -3,6 +3,9 @@ There are several implementations of `libsass` for a variety of languages. Here
3
3
  ### C
4
4
  * [sassc](https://github.com/hcatlin/sassc)
5
5
 
6
+ ### Crystal
7
+ * [sass.cr](https://github.com/straight-shoota/sass.cr)
8
+
6
9
  ### Elixir
7
10
  * [sass.ex](https://github.com/scottdavis/sass.ex)
8
11
 
@@ -11,6 +14,17 @@ There are several implementations of `libsass` for a variety of languages. Here
11
14
  * [go_sass](https://github.com/suapapa/go_sass)
12
15
  * [go-sass](https://github.com/SamWhited/go-sass)
13
16
 
17
+ ### Haskell
18
+ * [hLibsass](https://github.com/jakubfijalkowski/hlibsass)
19
+ * [hSass](https://github.com/jakubfijalkowski/hsass)
20
+
21
+ ### Java
22
+ * [libsass-maven-plugin](https://github.com/warmuuh/libsass-maven-plugin)
23
+ * [jsass](https://github.com/bit3/jsass)
24
+
25
+ ### JavaScript
26
+ * [sass.js](https://github.com/medialize/sass.js)
27
+
14
28
  ### Lua
15
29
  * [lua-sass](https://github.com/craigbarnes/lua-sass)
16
30
 
@@ -18,16 +32,14 @@ There are several implementations of `libsass` for a variety of languages. Here
18
32
  * [libsass-net](https://github.com/darrenkopp/libsass-net)
19
33
  * [NSass](https://github.com/TBAPI-0KA/NSass)
20
34
  * [Sass.Net](https://github.com/andyalm/Sass.Net)
35
+ * [SharpScss](https://github.com/xoofx/SharpScss)
36
+ * [LibSassHost](https://github.com/Taritsyn/LibSassHost)
21
37
 
22
- ### node.js
23
- * [node-sass](https://github.com/andrew/node-sass)
24
-
25
- ### Java
26
- * [libsass-maven-plugin](https://github.com/warmuuh/libsass-maven-plugin)
27
- * [jsass](https://github.com/bit3/jsass)
38
+ ### Nim
39
+ * [nim-sass](https://github.com/zacharycarter/nim-sass)
28
40
 
29
- ### JavaScript
30
- * [sass.js](https://github.com/medialize/sass.js)
41
+ ### node.js
42
+ * [node-sass](https://github.com/sass/node-sass)
31
43
 
32
44
  ### Perl
33
45
  * [CSS::Sass](https://github.com/caldwell/CSS-Sass)
@@ -1,27 +1,33 @@
1
- LibSass currently expects all input to be utf8 encoded (and outputs only utf8), if you actually have any unicode characters at all. We do not support conversion between encodings, even if you declare it with a `@charset` rule. The text below was originally posted as an [issue](https://github.com/sass/libsass/issues/381) on the LibSass tracker.
1
+ LibSass currently expects all input to be utf8 encoded (and outputs only utf8), if you actually have any unicode characters at all. We do not support conversion between encodings, even if you declare it with a `@charset` rule. The text below was originally posted as an [issue](https://github.com/sass/libsass/issues/381) on the LibSass tracker. Since then the status is outdated as LibSass now expects your
2
+ input to be utf8/ascii compatible, as it has been proven that reading ANSI (e.g. single byte encodings) as utf8 can lead to unexpected
3
+ behavior, which can in the worst case lead to buffer overruns/segfaults. Therefore LibSass now checks your input to be valid utf8 encoded!
2
4
 
3
5
  ### [Declaring character encodings in CSS](http://www.w3.org/International/questions/qa-css-charset.en)
4
6
 
5
- This [explains](http://www.w3.org/International/questions/qa-css-charset.en) how the character encoding of a css file is determined. Since we are only dealing with local files, we never have a HTTP header. So the precedence should be 'charset' rule, byte-order mark (BOM) or auto-detection (finally falling back to system default/UTF-8). This may not sound too hard to implement, but what about import rules? The CSS specs do not forbid the mixing of different encodings! I solved that by converting all files to UTF-8 internally. On writing there is an option to tell the tool what encoding it should be (UTF-8 by default). One can also define if it should write a BOM or not and if it should add the charset declaration.
7
+ This [explains](http://www.w3.org/International/questions/qa-css-charset.en) how the character encoding of a css file is determined. Since we are only dealing with local files, we never have a HTTP header. So the precedence should be 'charset' rule, byte-order mark (BOM) or auto-detection (finally falling back to system default/UTF-8). This may not sound too hard to implement, but what about import rules? The CSS specs do not forbid the mixing of different encodings! I [solved that](https://github.com/mgreter/webmerge/) by converting all files to UTF-8 internally. On writing there is an option to tell the tool what encoding it should be (UTF-8 by default). One can also define if it should write a BOM or not and if it should add the charset declaration.
6
8
 
7
- Since my tool is written in perl, I have a lot of utilities at hand to deal with different unicode charsets. I'm pretty sure that most OSS uses [libiconv](https://www.gnu.org/software/libiconv/) to convert between different encodings. But I have now idea how easy/hard this would be to integrate platform independent (it seems doable).
9
+ Since my [tool]((https://github.com/mgreter/webmerge/)) is written in perl, I have a lot of utilities at hand to deal with different unicode charsets. I'm pretty sure that most OSS uses [ICU](http://site.icu-project.org/) or [libiconv](https://www.gnu.org/software/libiconv/) to convert between different encodings. But I have now idea how easy/hard this would be to integrate platform independent (it seems doable). ANSII (single byte encoding) to utf8 is basically just a conversion table (for every supported code-page).
8
10
 
9
11
  ### Current status on LibSass unicode support
10
12
 
11
- Currently LibSass seems to handle the common UTF-8 case pretty well. I believe it should correctly support all ASCII compatible encodings (like UTF-8 or Latin-1). If all includes use the same encoding, the output should be correct (in the same encoding). It should also handle unicode chars in [selectors, variable names and other identifiers](https://github.com/hcatlin/libsass/issues/244#issuecomment-34681227). This is true for all ASCII compatible encodings. So the main incompatible encodings (I'm aware of) are UTF-16/UTF-32 (which could be converted to UTF-8 with libiconv).
13
+ LibSass should/is fully UTF (and therefore plain ASCII) compatible.
14
+
15
+ ~~Currently LibSass seems to handle the common UTF-8 case pretty well. I believe it should correctly support all ASCII compatible encodings (like UTF-8 or Latin-1). If all includes use the same encoding, the output should be correct (in the same encoding). It should also handle unicode chars in [selectors, variable names and other identifiers](https://github.com/hcatlin/libsass/issues/244#issuecomment-34681227). This is true for all ASCII compatible encodings. So the main incompatible encodings (I'm aware of) are UTF-16/UTF-32 (which could be converted to UTF-8 with libiconv).~~
16
+
17
+ LibSass 3.5 will enforce that your input is either plain ASCII (chars below 127) or utf8. It does not handle anything else, but therefore ensures that the output is in a valid form. Before version 3.5 you were able to mix different code-pages, which yielded unexpected behavior.
12
18
 
13
19
  ### Current encoding auto detection
14
20
 
15
- LibSass currently reads all kind of BOMs and will error out if it finds something it doesn't know how to handle! It seems that it throws away the optional UTF-8 BOM (if any is found). IMO it would be nice if users could configure that (also if a charset rule should be added to the output).
21
+ LibSass currently reads all kind of BOMs and will error out if it finds something it doesn't know how to handle! It seems that it throws away the optional UTF-8 BOM (if any is found). IMO it would be nice if users could configure that (also if a charset rule should be added to the output). But it does not really take any `@charset` into account, it always assumes your input is utf8 and ignores any given `@charset`!
16
22
 
17
23
  ### What is currently not supported
18
24
 
19
- - Using non ASCII compatible encodings (like UTF-16)
25
+ - Using non ASCII compatible encodings (like UTF-16, Latin-1 etc.)
20
26
  - Using non ASCII characters in different encodings in different includes
21
27
 
22
28
  ### What is missing to support the above cases
23
29
 
24
- - A way to convert between encodings (like libiconv)
30
+ - A way to convert between encodings (like libiconv/ICU)
25
31
  - Sniffing the charset inside the file (source is available)
26
32
  - Handling the conversion on import (and export)
27
33
  - Optional: Make output encoding configurable
@@ -31,9 +37,9 @@ LibSass currently reads all kind of BOMs and will error out if it finds somethin
31
37
 
32
38
  I guess the current implementation should handle more than 99% of all real world use cases.
33
39
  A) Unicode characters are still seldomly seen (as they can be written escaped)
34
- B) It will still work if it's UTF-8 or in any of the most common known western ISO codepages.
35
- Although I'm not sure how this applies to asian and other "exotic" codepages!
40
+ ~~B) It will still work if it's UTF-8 or in any of the most common known western ISO codepages.
41
+ Although I'm not sure how this applies to asian and other "exotic" codepages!~~
36
42
 
37
- I guess the biggest Problem is to have libiconv (or some other) library as a dependency. Since it contains a lot of rules for the conversions, I see it as the only way to handle this correctly. Once that is sorted out it should be pretty much straight forward to implement the missing pieces (in parser.cpp - Parser::parse should return encoding and add Parser::sniff_charset, then convert the source byte stream to UTF-8).
43
+ I guess the biggest Problem is to have libiconv/ICU (or some other) library as a dependency. Since it contains a lot of rules for the conversions, I see it as the only way to handle this correctly. Once that is sorted out it should be pretty much straight forward to implement the missing pieces (in parser.cpp - Parser::parse should return encoding and add Parser::sniff_charset, then convert the source byte stream to UTF-8).
38
44
 
39
45
  I hope the statements above all hold true. Unicode is really not the easiest topic to wrap your head around. But since I did all the above recently in Perl, I wanted to document it here. Feel free to extend or criticize.
@@ -75,9 +75,6 @@ ADDAPI void ADDCALL sass_free_memory(void* ptr);
75
75
  ADDAPI char* ADDCALL sass_string_quote (const char* str, const char quote_mark);
76
76
  ADDAPI char* ADDCALL sass_string_unquote (const char* str);
77
77
 
78
- // Resolve a file via the given include paths in the include char* array
79
- ADDAPI char* ADDCALL sass_resolve_file (const char* path, const char* incs[]);
80
-
81
78
  // Implemented sass language version
82
79
  // Hardcoded version 3.4 for time being
83
80
  ADDAPI const char* ADDCALL libsass_version(void);
@@ -81,8 +81,6 @@ ADDAPI const char* ADDCALL sass_option_get_indent (struct Sass_Options* options)
81
81
  ADDAPI const char* ADDCALL sass_option_get_linefeed (struct Sass_Options* options);
82
82
  ADDAPI const char* ADDCALL sass_option_get_input_path (struct Sass_Options* options);
83
83
  ADDAPI const char* ADDCALL sass_option_get_output_path (struct Sass_Options* options);
84
- ADDAPI const char* ADDCALL sass_option_get_plugin_path (struct Sass_Options* options);
85
- ADDAPI const char* ADDCALL sass_option_get_include_path (struct Sass_Options* options);
86
84
  ADDAPI const char* ADDCALL sass_option_get_source_map_file (struct Sass_Options* options);
87
85
  ADDAPI const char* ADDCALL sass_option_get_source_map_root (struct Sass_Options* options);
88
86
  ADDAPI Sass_Importer_List ADDCALL sass_option_get_c_headers (struct Sass_Options* options);
@@ -124,6 +122,10 @@ ADDAPI size_t ADDCALL sass_context_get_error_column (struct Sass_Context* ctx);
124
122
  ADDAPI const char* ADDCALL sass_context_get_source_map_string (struct Sass_Context* ctx);
125
123
  ADDAPI char** ADDCALL sass_context_get_included_files (struct Sass_Context* ctx);
126
124
 
125
+ // Getters for options include path array
126
+ ADDAPI size_t ADDCALL sass_option_get_include_path_size(struct Sass_Options* options);
127
+ ADDAPI const char* ADDCALL sass_option_get_include_path(struct Sass_Options* options, size_t i);
128
+
127
129
  // Calculate the size of the stored null terminated array
128
130
  ADDAPI size_t ADDCALL sass_context_get_included_files_size (struct Sass_Context* ctx);
129
131
 
@@ -143,11 +145,27 @@ ADDAPI struct Sass_Options* ADDCALL sass_compiler_get_options(struct Sass_Compil
143
145
  ADDAPI size_t ADDCALL sass_compiler_get_import_stack_size(struct Sass_Compiler* compiler);
144
146
  ADDAPI Sass_Import_Entry ADDCALL sass_compiler_get_last_import(struct Sass_Compiler* compiler);
145
147
  ADDAPI Sass_Import_Entry ADDCALL sass_compiler_get_import_entry(struct Sass_Compiler* compiler, size_t idx);
148
+ ADDAPI size_t ADDCALL sass_compiler_get_callee_stack_size(struct Sass_Compiler* compiler);
149
+ ADDAPI Sass_Callee_Entry ADDCALL sass_compiler_get_last_callee(struct Sass_Compiler* compiler);
150
+ ADDAPI Sass_Callee_Entry ADDCALL sass_compiler_get_callee_entry(struct Sass_Compiler* compiler, size_t idx);
151
+
152
+ // Push function for import extenions
153
+ ADDAPI void ADDCALL sass_option_push_import_extension (struct Sass_Options* options, const char* ext);
146
154
 
147
155
  // Push function for paths (no manipulation support for now)
148
156
  ADDAPI void ADDCALL sass_option_push_plugin_path (struct Sass_Options* options, const char* path);
149
157
  ADDAPI void ADDCALL sass_option_push_include_path (struct Sass_Options* options, const char* path);
150
158
 
159
+ // Resolve a file via the given include paths in the sass option struct
160
+ // find_file looks for the exact file name while find_include does a regular sass include
161
+ ADDAPI char* ADDCALL sass_find_file (const char* path, struct Sass_Options* opt);
162
+ ADDAPI char* ADDCALL sass_find_include (const char* path, struct Sass_Options* opt);
163
+
164
+ // Resolve a file relative to last import or include paths in the sass option struct
165
+ // find_file looks for the exact file name while find_include does a regular sass include
166
+ ADDAPI char* ADDCALL sass_compiler_find_file (const char* path, struct Sass_Compiler* compiler);
167
+ ADDAPI char* ADDCALL sass_compiler_find_include (const char* path, struct Sass_Compiler* compiler);
168
+
151
169
  #ifdef __cplusplus
152
170
  } // __cplusplus defined.
153
171
  #endif
@@ -11,12 +11,18 @@ extern "C" {
11
11
 
12
12
 
13
13
  // Forward declaration
14
+ struct Sass_Env;
15
+ struct Sass_Callee;
14
16
  struct Sass_Import;
15
17
  struct Sass_Options;
16
18
  struct Sass_Compiler;
17
19
  struct Sass_Importer;
18
20
  struct Sass_Function;
19
21
 
22
+ // Typedef helpers for callee lists
23
+ typedef struct Sass_Env (*Sass_Env_Frame);
24
+ // Typedef helpers for callee lists
25
+ typedef struct Sass_Callee (*Sass_Callee_Entry);
20
26
  // Typedef helpers for import lists
21
27
  typedef struct Sass_Import (*Sass_Import_Entry);
22
28
  typedef struct Sass_Import* (*Sass_Import_List);
@@ -34,11 +40,18 @@ typedef struct Sass_Function* (*Sass_Function_List);
34
40
  typedef union Sass_Value* (*Sass_Function_Fn)
35
41
  (const union Sass_Value*, Sass_Function_Entry cb, struct Sass_Compiler* compiler);
36
42
 
43
+ // Type of function calls
44
+ enum Sass_Callee_Type {
45
+ SASS_CALLEE_MIXIN,
46
+ SASS_CALLEE_FUNCTION,
47
+ SASS_CALLEE_C_FUNCTION,
48
+ };
37
49
 
38
50
  // Creator for sass custom importer return argument list
39
51
  ADDAPI Sass_Importer_List ADDCALL sass_make_importer_list (size_t length);
40
52
  ADDAPI Sass_Importer_Entry ADDCALL sass_importer_get_list_entry (Sass_Importer_List list, size_t idx);
41
53
  ADDAPI void ADDCALL sass_importer_set_list_entry (Sass_Importer_List list, size_t idx, Sass_Importer_Entry entry);
54
+ ADDAPI void ADDCALL sass_delete_importer_list (Sass_Importer_List list);
42
55
 
43
56
 
44
57
  // Creators for custom importer callback (with some additional pointer)
@@ -66,6 +79,22 @@ ADDAPI Sass_Import_Entry ADDCALL sass_import_set_error(Sass_Import_Entry import,
66
79
  ADDAPI void ADDCALL sass_import_set_list_entry (Sass_Import_List list, size_t idx, Sass_Import_Entry entry);
67
80
  ADDAPI Sass_Import_Entry ADDCALL sass_import_get_list_entry (Sass_Import_List list, size_t idx);
68
81
 
82
+ // Getters for callee entry
83
+ ADDAPI const char* ADDCALL sass_callee_get_name (Sass_Callee_Entry);
84
+ ADDAPI const char* ADDCALL sass_callee_get_path (Sass_Callee_Entry);
85
+ ADDAPI size_t ADDCALL sass_callee_get_line (Sass_Callee_Entry);
86
+ ADDAPI size_t ADDCALL sass_callee_get_column (Sass_Callee_Entry);
87
+ ADDAPI enum Sass_Callee_Type ADDCALL sass_callee_get_type (Sass_Callee_Entry);
88
+ ADDAPI Sass_Env_Frame ADDCALL sass_callee_get_env (Sass_Callee_Entry);
89
+
90
+ // Getters and Setters for environments (lexical, local and global)
91
+ ADDAPI union Sass_Value* ADDCALL sass_env_get_lexical (Sass_Env_Frame, const char*);
92
+ ADDAPI void ADDCALL sass_env_set_lexical (Sass_Env_Frame, const char*, union Sass_Value*);
93
+ ADDAPI union Sass_Value* ADDCALL sass_env_get_local (Sass_Env_Frame, const char*);
94
+ ADDAPI void ADDCALL sass_env_set_local (Sass_Env_Frame, const char*, union Sass_Value*);
95
+ ADDAPI union Sass_Value* ADDCALL sass_env_get_global (Sass_Env_Frame, const char*);
96
+ ADDAPI void ADDCALL sass_env_set_global (Sass_Env_Frame, const char*, union Sass_Value*);
97
+
69
98
  // Getters for import entry
70
99
  ADDAPI const char* ADDCALL sass_import_get_imp_path (Sass_Import_Entry);
71
100
  ADDAPI const char* ADDCALL sass_import_get_abs_path (Sass_Import_Entry);
@@ -90,6 +119,8 @@ ADDAPI void ADDCALL sass_delete_import (Sass_Import_Entry);
90
119
  // Creators for sass function list and function descriptors
91
120
  ADDAPI Sass_Function_List ADDCALL sass_make_function_list (size_t length);
92
121
  ADDAPI Sass_Function_Entry ADDCALL sass_make_function (const char* signature, Sass_Function_Fn cb, void* cookie);
122
+ ADDAPI void ADDCALL sass_delete_function (Sass_Function_Entry entry);
123
+ ADDAPI void ADDCALL sass_delete_function_list (Sass_Function_List list);
93
124
 
94
125
  // Setters and getters for callbacks on function lists
95
126
  ADDAPI Sass_Function_Entry ADDCALL sass_function_get_list_entry(Sass_Function_List list, size_t pos);
@@ -50,7 +50,7 @@ ADDAPI union Sass_Value* ADDCALL sass_make_string (const char* val);
50
50
  ADDAPI union Sass_Value* ADDCALL sass_make_qstring (const char* val);
51
51
  ADDAPI union Sass_Value* ADDCALL sass_make_number (double val, const char* unit);
52
52
  ADDAPI union Sass_Value* ADDCALL sass_make_color (double r, double g, double b, double a);
53
- ADDAPI union Sass_Value* ADDCALL sass_make_list (size_t len, enum Sass_Separator sep);
53
+ ADDAPI union Sass_Value* ADDCALL sass_make_list (size_t len, enum Sass_Separator sep, bool is_bracketed);
54
54
  ADDAPI union Sass_Value* ADDCALL sass_make_map (size_t len);
55
55
  ADDAPI union Sass_Value* ADDCALL sass_make_error (const char* msg);
56
56
  ADDAPI union Sass_Value* ADDCALL sass_make_warning (const char* msg);
@@ -116,6 +116,8 @@ ADDAPI size_t ADDCALL sass_list_get_length (const union Sass_Value* v);
116
116
  // Getters and setters for Sass_List
117
117
  ADDAPI enum Sass_Separator ADDCALL sass_list_get_separator (const union Sass_Value* v);
118
118
  ADDAPI void ADDCALL sass_list_set_separator (union Sass_Value* v, enum Sass_Separator value);
119
+ ADDAPI bool ADDCALL sass_list_get_is_bracketed (const union Sass_Value* v);
120
+ ADDAPI void ADDCALL sass_list_set_is_bracketed (union Sass_Value* v, bool value);
119
121
  // Getters and setters for Sass_List values
120
122
  ADDAPI union Sass_Value* ADDCALL sass_list_get_value (const union Sass_Value* v, size_t i);
121
123
  ADDAPI void ADDCALL sass_list_set_value (union Sass_Value* v, size_t i, union Sass_Value* value);
@@ -6,7 +6,7 @@
6
6
  #endif
7
7
 
8
8
  #ifndef LIBSASS_LANGUAGE_VERSION
9
- #define LIBSASS_LANGUAGE_VERSION "3.4"
9
+ #define LIBSASS_LANGUAGE_VERSION "3.5"
10
10
  #endif
11
11
 
12
12
  #endif
@@ -6,7 +6,7 @@
6
6
  #endif
7
7
 
8
8
  #ifndef LIBSASS_LANGUAGE_VERSION
9
- #define LIBSASS_LANGUAGE_VERSION "3.4"
9
+ #define LIBSASS_LANGUAGE_VERSION "3.5"
10
10
  #endif
11
11
 
12
12
  #endif
@@ -37,7 +37,7 @@
37
37
  #ifndef SASS2SCSS_VERSION
38
38
  // Hardcode once the file is copied from
39
39
  // https://github.com/mgreter/sass2scss
40
- #define SASS2SCSS_VERSION "1.1.0"
40
+ #define SASS2SCSS_VERSION "1.1.1"
41
41
  #endif
42
42
 
43
43
  // add namespace for c++
@@ -18,18 +18,18 @@ BEGIN
18
18
  BEGIN
19
19
  BLOCK "080904b0"
20
20
  BEGIN
21
- VALUE "CompanyName", "Libsass Organization"
21
+ VALUE "CompanyName", "Sass Open Source Foundation"
22
22
  VALUE "FileDescription", "A C/C++ implementation of a Sass compiler"
23
- VALUE "FileVersion", "0.9.0.0"
23
+ VALUE "FileVersion", "1.0.0.0"
24
24
  VALUE "InternalName", "libsass"
25
- VALUE "LegalCopyright", "©2014 libsass.org"
25
+ VALUE "LegalCopyright", "\251 2017 libsass.org"
26
26
  VALUE "OriginalFilename", "libsass.dll"
27
- VALUE "ProductName", "Libsass Library"
28
- VALUE "ProductVersion", "0.9.0.0"
27
+ VALUE "ProductName", "LibSass Library"
28
+ VALUE "ProductVersion", "1.0.0.0"
29
29
  END
30
30
  END
31
31
  BLOCK "VarFileInfo"
32
32
  BEGIN
33
33
  VALUE "Translation", 0x809, 1200
34
34
  END
35
- END
35
+ END