sassc 2.0.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.gitmodules +1 -1
  4. data/.travis.yml +9 -3
  5. data/CHANGELOG.md +36 -0
  6. data/CODE_OF_CONDUCT.md +1 -1
  7. data/README.md +1 -1
  8. data/Rakefile +43 -7
  9. data/ext/depend +4 -0
  10. data/ext/extconf.rb +92 -0
  11. data/ext/libsass/VERSION +1 -0
  12. data/ext/libsass/include/sass/base.h +9 -1
  13. data/ext/libsass/include/sass/context.h +5 -1
  14. data/ext/libsass/src/MurmurHash2.hpp +91 -0
  15. data/ext/libsass/src/ast.cpp +755 -2028
  16. data/ext/libsass/src/ast.hpp +492 -2477
  17. data/ext/libsass/src/{to_c.cpp → ast2c.cpp} +22 -16
  18. data/ext/libsass/src/ast2c.hpp +39 -0
  19. data/ext/libsass/src/ast_def_macros.hpp +70 -10
  20. data/ext/libsass/src/ast_fwd_decl.cpp +5 -3
  21. data/ext/libsass/src/ast_fwd_decl.hpp +107 -296
  22. data/ext/libsass/src/ast_helpers.hpp +292 -0
  23. data/ext/libsass/src/ast_sel_cmp.cpp +396 -0
  24. data/ext/libsass/src/ast_sel_super.cpp +539 -0
  25. data/ext/libsass/src/ast_sel_unify.cpp +275 -0
  26. data/ext/libsass/src/ast_sel_weave.cpp +616 -0
  27. data/ext/libsass/src/ast_selectors.cpp +1043 -0
  28. data/ext/libsass/src/ast_selectors.hpp +522 -0
  29. data/ext/libsass/src/ast_supports.cpp +114 -0
  30. data/ext/libsass/src/ast_supports.hpp +121 -0
  31. data/ext/libsass/src/ast_values.cpp +1154 -0
  32. data/ext/libsass/src/ast_values.hpp +498 -0
  33. data/ext/libsass/src/backtrace.cpp +11 -7
  34. data/ext/libsass/src/backtrace.hpp +5 -5
  35. data/ext/libsass/src/base64vlq.cpp +5 -2
  36. data/ext/libsass/src/base64vlq.hpp +1 -1
  37. data/ext/libsass/src/bind.cpp +35 -34
  38. data/ext/libsass/src/bind.hpp +3 -1
  39. data/ext/libsass/src/c2ast.cpp +64 -0
  40. data/ext/libsass/src/c2ast.hpp +14 -0
  41. data/ext/libsass/src/cencode.c +4 -6
  42. data/ext/libsass/src/check_nesting.cpp +83 -88
  43. data/ext/libsass/src/check_nesting.hpp +39 -34
  44. data/ext/libsass/src/color_maps.cpp +168 -164
  45. data/ext/libsass/src/color_maps.hpp +152 -160
  46. data/ext/libsass/src/constants.cpp +20 -0
  47. data/ext/libsass/src/constants.hpp +19 -0
  48. data/ext/libsass/src/context.cpp +104 -121
  49. data/ext/libsass/src/context.hpp +43 -55
  50. data/ext/libsass/src/cssize.cpp +103 -188
  51. data/ext/libsass/src/cssize.hpp +45 -51
  52. data/ext/libsass/src/dart_helpers.hpp +199 -0
  53. data/ext/libsass/src/debugger.hpp +524 -361
  54. data/ext/libsass/src/emitter.cpp +26 -26
  55. data/ext/libsass/src/emitter.hpp +20 -18
  56. data/ext/libsass/src/environment.cpp +41 -27
  57. data/ext/libsass/src/environment.hpp +33 -22
  58. data/ext/libsass/src/error_handling.cpp +92 -94
  59. data/ext/libsass/src/error_handling.hpp +73 -50
  60. data/ext/libsass/src/eval.cpp +380 -515
  61. data/ext/libsass/src/eval.hpp +64 -57
  62. data/ext/libsass/src/eval_selectors.cpp +75 -0
  63. data/ext/libsass/src/expand.cpp +322 -263
  64. data/ext/libsass/src/expand.hpp +55 -39
  65. data/ext/libsass/src/extender.cpp +1188 -0
  66. data/ext/libsass/src/extender.hpp +399 -0
  67. data/ext/libsass/src/extension.cpp +43 -0
  68. data/ext/libsass/src/extension.hpp +89 -0
  69. data/ext/libsass/src/file.cpp +134 -88
  70. data/ext/libsass/src/file.hpp +28 -37
  71. data/ext/libsass/src/fn_colors.cpp +596 -0
  72. data/ext/libsass/src/fn_colors.hpp +85 -0
  73. data/ext/libsass/src/fn_lists.cpp +285 -0
  74. data/ext/libsass/src/fn_lists.hpp +34 -0
  75. data/ext/libsass/src/fn_maps.cpp +94 -0
  76. data/ext/libsass/src/fn_maps.hpp +30 -0
  77. data/ext/libsass/src/fn_miscs.cpp +244 -0
  78. data/ext/libsass/src/fn_miscs.hpp +40 -0
  79. data/ext/libsass/src/fn_numbers.cpp +227 -0
  80. data/ext/libsass/src/fn_numbers.hpp +45 -0
  81. data/ext/libsass/src/fn_selectors.cpp +205 -0
  82. data/ext/libsass/src/fn_selectors.hpp +35 -0
  83. data/ext/libsass/src/fn_strings.cpp +268 -0
  84. data/ext/libsass/src/fn_strings.hpp +34 -0
  85. data/ext/libsass/src/fn_utils.cpp +158 -0
  86. data/ext/libsass/src/fn_utils.hpp +62 -0
  87. data/ext/libsass/src/inspect.cpp +253 -266
  88. data/ext/libsass/src/inspect.hpp +72 -74
  89. data/ext/libsass/src/json.cpp +2 -2
  90. data/ext/libsass/src/lexer.cpp +25 -84
  91. data/ext/libsass/src/lexer.hpp +5 -16
  92. data/ext/libsass/src/listize.cpp +27 -43
  93. data/ext/libsass/src/listize.hpp +14 -11
  94. data/ext/libsass/src/mapping.hpp +1 -0
  95. data/ext/libsass/src/memory.hpp +12 -0
  96. data/ext/libsass/src/memory/allocator.cpp +48 -0
  97. data/ext/libsass/src/memory/allocator.hpp +138 -0
  98. data/ext/libsass/src/memory/config.hpp +20 -0
  99. data/ext/libsass/src/memory/memory_pool.hpp +186 -0
  100. data/ext/libsass/src/memory/shared_ptr.cpp +33 -0
  101. data/ext/libsass/src/memory/shared_ptr.hpp +332 -0
  102. data/ext/libsass/src/operation.hpp +193 -143
  103. data/ext/libsass/src/operators.cpp +56 -29
  104. data/ext/libsass/src/operators.hpp +11 -11
  105. data/ext/libsass/src/ordered_map.hpp +112 -0
  106. data/ext/libsass/src/output.cpp +59 -75
  107. data/ext/libsass/src/output.hpp +15 -22
  108. data/ext/libsass/src/parser.cpp +662 -818
  109. data/ext/libsass/src/parser.hpp +96 -100
  110. data/ext/libsass/src/parser_selectors.cpp +189 -0
  111. data/ext/libsass/src/permutate.hpp +164 -0
  112. data/ext/libsass/src/plugins.cpp +12 -8
  113. data/ext/libsass/src/plugins.hpp +8 -8
  114. data/ext/libsass/src/position.cpp +10 -26
  115. data/ext/libsass/src/position.hpp +44 -21
  116. data/ext/libsass/src/prelexer.cpp +14 -8
  117. data/ext/libsass/src/prelexer.hpp +9 -9
  118. data/ext/libsass/src/remove_placeholders.cpp +59 -57
  119. data/ext/libsass/src/remove_placeholders.hpp +20 -18
  120. data/ext/libsass/src/sass.cpp +25 -18
  121. data/ext/libsass/src/sass.hpp +22 -14
  122. data/ext/libsass/src/sass2scss.cpp +49 -18
  123. data/ext/libsass/src/sass_context.cpp +104 -132
  124. data/ext/libsass/src/sass_context.hpp +2 -2
  125. data/ext/libsass/src/sass_functions.cpp +7 -4
  126. data/ext/libsass/src/sass_functions.hpp +1 -1
  127. data/ext/libsass/src/sass_values.cpp +26 -21
  128. data/ext/libsass/src/settings.hpp +19 -0
  129. data/ext/libsass/src/source.cpp +69 -0
  130. data/ext/libsass/src/source.hpp +95 -0
  131. data/ext/libsass/src/source_data.hpp +32 -0
  132. data/ext/libsass/src/source_map.cpp +27 -20
  133. data/ext/libsass/src/source_map.hpp +14 -11
  134. data/ext/libsass/src/stylesheet.cpp +22 -0
  135. data/ext/libsass/src/stylesheet.hpp +57 -0
  136. data/ext/libsass/src/to_value.cpp +24 -22
  137. data/ext/libsass/src/to_value.hpp +18 -22
  138. data/ext/libsass/src/units.cpp +28 -22
  139. data/ext/libsass/src/units.hpp +9 -8
  140. data/ext/libsass/src/utf8/checked.h +12 -10
  141. data/ext/libsass/src/utf8/core.h +3 -0
  142. data/ext/libsass/src/utf8_string.cpp +12 -10
  143. data/ext/libsass/src/utf8_string.hpp +7 -6
  144. data/ext/libsass/src/util.cpp +97 -107
  145. data/ext/libsass/src/util.hpp +74 -30
  146. data/ext/libsass/src/util_string.cpp +125 -0
  147. data/ext/libsass/src/util_string.hpp +73 -0
  148. data/ext/libsass/src/values.cpp +33 -24
  149. data/ext/libsass/src/values.hpp +2 -2
  150. data/lib/sassc.rb +24 -0
  151. data/lib/sassc/engine.rb +7 -5
  152. data/lib/sassc/functions_handler.rb +11 -13
  153. data/lib/sassc/native.rb +10 -9
  154. data/lib/sassc/native/native_functions_api.rb +0 -5
  155. data/lib/sassc/script.rb +4 -6
  156. data/lib/sassc/version.rb +1 -1
  157. data/sassc.gemspec +32 -12
  158. data/test/engine_test.rb +32 -2
  159. data/test/functions_test.rb +38 -1
  160. data/test/native_test.rb +4 -4
  161. metadata +95 -109
  162. data/ext/Rakefile +0 -3
  163. data/ext/libsass/.editorconfig +0 -15
  164. data/ext/libsass/.gitattributes +0 -2
  165. data/ext/libsass/.github/CONTRIBUTING.md +0 -65
  166. data/ext/libsass/.github/ISSUE_TEMPLATE.md +0 -54
  167. data/ext/libsass/.gitignore +0 -85
  168. data/ext/libsass/.travis.yml +0 -64
  169. data/ext/libsass/COPYING +0 -25
  170. data/ext/libsass/GNUmakefile.am +0 -88
  171. data/ext/libsass/INSTALL +0 -1
  172. data/ext/libsass/LICENSE +0 -25
  173. data/ext/libsass/Makefile +0 -351
  174. data/ext/libsass/Makefile.conf +0 -55
  175. data/ext/libsass/Readme.md +0 -104
  176. data/ext/libsass/SECURITY.md +0 -10
  177. data/ext/libsass/appveyor.yml +0 -91
  178. data/ext/libsass/configure.ac +0 -138
  179. data/ext/libsass/contrib/libsass.spec +0 -66
  180. data/ext/libsass/docs/README.md +0 -20
  181. data/ext/libsass/docs/api-context-example.md +0 -45
  182. data/ext/libsass/docs/api-context-internal.md +0 -163
  183. data/ext/libsass/docs/api-context.md +0 -295
  184. data/ext/libsass/docs/api-doc.md +0 -215
  185. data/ext/libsass/docs/api-function-example.md +0 -67
  186. data/ext/libsass/docs/api-function-internal.md +0 -8
  187. data/ext/libsass/docs/api-function.md +0 -74
  188. data/ext/libsass/docs/api-importer-example.md +0 -112
  189. data/ext/libsass/docs/api-importer-internal.md +0 -20
  190. data/ext/libsass/docs/api-importer.md +0 -86
  191. data/ext/libsass/docs/api-value-example.md +0 -55
  192. data/ext/libsass/docs/api-value-internal.md +0 -76
  193. data/ext/libsass/docs/api-value.md +0 -154
  194. data/ext/libsass/docs/build-on-darwin.md +0 -27
  195. data/ext/libsass/docs/build-on-gentoo.md +0 -55
  196. data/ext/libsass/docs/build-on-windows.md +0 -139
  197. data/ext/libsass/docs/build-shared-library.md +0 -35
  198. data/ext/libsass/docs/build-with-autotools.md +0 -78
  199. data/ext/libsass/docs/build-with-makefiles.md +0 -68
  200. data/ext/libsass/docs/build-with-mingw.md +0 -107
  201. data/ext/libsass/docs/build-with-visual-studio.md +0 -90
  202. data/ext/libsass/docs/build.md +0 -97
  203. data/ext/libsass/docs/compatibility-plan.md +0 -48
  204. data/ext/libsass/docs/contributing.md +0 -17
  205. data/ext/libsass/docs/custom-functions-internal.md +0 -122
  206. data/ext/libsass/docs/dev-ast-memory.md +0 -223
  207. data/ext/libsass/docs/implementations.md +0 -56
  208. data/ext/libsass/docs/plugins.md +0 -47
  209. data/ext/libsass/docs/setup-environment.md +0 -68
  210. data/ext/libsass/docs/source-map-internals.md +0 -51
  211. data/ext/libsass/docs/trace.md +0 -26
  212. data/ext/libsass/docs/triage.md +0 -17
  213. data/ext/libsass/docs/unicode.md +0 -39
  214. data/ext/libsass/extconf.rb +0 -6
  215. data/ext/libsass/include/sass/version.h.in +0 -12
  216. data/ext/libsass/m4/.gitkeep +0 -0
  217. data/ext/libsass/m4/m4-ax_cxx_compile_stdcxx_11.m4 +0 -167
  218. data/ext/libsass/res/resource.rc +0 -35
  219. data/ext/libsass/script/bootstrap +0 -13
  220. data/ext/libsass/script/branding +0 -10
  221. data/ext/libsass/script/ci-build-libsass +0 -134
  222. data/ext/libsass/script/ci-build-plugin +0 -62
  223. data/ext/libsass/script/ci-install-compiler +0 -6
  224. data/ext/libsass/script/ci-install-deps +0 -20
  225. data/ext/libsass/script/ci-report-coverage +0 -42
  226. data/ext/libsass/script/spec +0 -5
  227. data/ext/libsass/script/tap-driver +0 -652
  228. data/ext/libsass/script/tap-runner +0 -1
  229. data/ext/libsass/script/test-leaks.pl +0 -103
  230. data/ext/libsass/src/GNUmakefile.am +0 -54
  231. data/ext/libsass/src/extend.cpp +0 -2130
  232. data/ext/libsass/src/extend.hpp +0 -86
  233. data/ext/libsass/src/functions.cpp +0 -2234
  234. data/ext/libsass/src/functions.hpp +0 -198
  235. data/ext/libsass/src/memory/SharedPtr.cpp +0 -114
  236. data/ext/libsass/src/memory/SharedPtr.hpp +0 -206
  237. data/ext/libsass/src/node.cpp +0 -319
  238. data/ext/libsass/src/node.hpp +0 -118
  239. data/ext/libsass/src/paths.hpp +0 -71
  240. data/ext/libsass/src/sass_util.cpp +0 -149
  241. data/ext/libsass/src/sass_util.hpp +0 -256
  242. data/ext/libsass/src/subset_map.cpp +0 -55
  243. data/ext/libsass/src/subset_map.hpp +0 -76
  244. data/ext/libsass/src/support/libsass.pc.in +0 -11
  245. data/ext/libsass/src/to_c.hpp +0 -39
  246. data/ext/libsass/test/test_node.cpp +0 -94
  247. data/ext/libsass/test/test_paths.cpp +0 -28
  248. data/ext/libsass/test/test_selector_difference.cpp +0 -25
  249. data/ext/libsass/test/test_specificity.cpp +0 -25
  250. data/ext/libsass/test/test_subset_map.cpp +0 -472
  251. data/ext/libsass/test/test_superselector.cpp +0 -69
  252. data/ext/libsass/test/test_unification.cpp +0 -31
  253. data/ext/libsass/version.sh +0 -10
  254. data/ext/libsass/win/libsass.sln +0 -39
  255. data/ext/libsass/win/libsass.sln.DotSettings +0 -9
  256. data/ext/libsass/win/libsass.targets +0 -118
  257. data/ext/libsass/win/libsass.vcxproj +0 -188
  258. data/ext/libsass/win/libsass.vcxproj.filters +0 -357
  259. data/lib/sassc/native/lib_c.rb +0 -21
  260. data/lib/tasks/libsass.rb +0 -33
@@ -1,56 +0,0 @@
1
- There are several implementations of `libsass` for a variety of languages. Here are just a few of them. Note, some implementations may or may not be up to date. We have not verified whether they work.
2
-
3
- ### C
4
- * [sassc](https://github.com/hcatlin/sassc)
5
-
6
- ### Crystal
7
- * [sass.cr](https://github.com/straight-shoota/sass.cr)
8
-
9
- ### Elixir
10
- * [sass.ex](https://github.com/scottdavis/sass.ex)
11
-
12
- ### Go
13
- * [go-libsass](https://github.com/wellington/go-libsass)
14
- * [go_sass](https://github.com/suapapa/go_sass)
15
- * [go-sass](https://github.com/SamWhited/go-sass)
16
-
17
- ### Lua
18
- * [lua-sass](https://github.com/craigbarnes/lua-sass)
19
-
20
- ### .NET
21
- * [libsass-net](https://github.com/darrenkopp/libsass-net)
22
- * [NSass](https://github.com/TBAPI-0KA/NSass)
23
- * [Sass.Net](https://github.com/andyalm/Sass.Net)
24
-
25
- ### node.js
26
- * [node-sass](https://github.com/andrew/node-sass)
27
-
28
- ### Java
29
- * [libsass-maven-plugin](https://github.com/warmuuh/libsass-maven-plugin)
30
- * [jsass](https://github.com/bit3/jsass)
31
-
32
- ### JavaScript
33
- * [sass.js](https://github.com/medialize/sass.js)
34
-
35
- ### Perl
36
- * [CSS::Sass](https://github.com/caldwell/CSS-Sass)
37
- * [Text::Sass::XS](https://github.com/ysasaki/Text-Sass-XS)
38
-
39
- ### PHP
40
- * [sassphp](https://github.com/sensational/sassphp)
41
- * [php-sass](https://github.com/lesstif/php-sass)
42
-
43
- ### Python
44
- * [libsass-python](https://github.com/dahlia/libsass-python)
45
- * [SassPython](https://github.com/marianoguerra/SassPython)
46
- * [pylibsass](https://github.com/rsenk330/pylibsass)
47
- * [python-scss](https://github.com/pistolero/python-scss)
48
-
49
- ### Ruby
50
- * [sassruby](https://github.com/hcatlin/sassruby)
51
-
52
- ### Scala
53
- * [Sass-Scala](https://github.com/kkung/Sass-Scala)
54
-
55
- ### Tcl
56
- * [tclsass](https://github.com/flightaware/tclsass)
@@ -1,47 +0,0 @@
1
- Plugins are shared object files (.so on *nix and .dll on win) that can be loaded by LibSass on runtime. Currently we only provide a way to load internal/custom functions from plugins. In the future we probably will also add a way to provide custom importers via plugins (needs more refactoring to [support multiple importers with some kind of priority system](https://github.com/sass/libsass/issues/962)).
2
-
3
- ## plugin.cpp
4
-
5
- ```C++
6
- #include <cstring>
7
- #include <iostream>
8
- #include <stdint.h>
9
- #include "sass_values.h"
10
-
11
- union Sass_Value* ADDCALL call_fn_foo(const union Sass_Value* s_args, void* cookie)
12
- {
13
- // we actually abuse the void* to store an "int"
14
- return sass_make_number((intptr_t)cookie, "px");
15
- }
16
-
17
- extern "C" const char* ADDCALL libsass_get_version() {
18
- return libsass_version();
19
- }
20
-
21
- extern "C" Sass_C_Function_List ADDCALL libsass_load_functions()
22
- {
23
- // allocate a custom function caller
24
- Sass_C_Function_Callback fn_foo =
25
- sass_make_function("foo()", call_fn_foo, (void*)42);
26
- // create list of all custom functions
27
- Sass_C_Function_List fn_list = sass_make_function_list(1);
28
- // put the only function in this plugin to the list
29
- sass_function_set_list_entry(fn_list, 0, fn_foo);
30
- // return the list
31
- return fn_list;
32
- }
33
- ```
34
-
35
- To compile the plugin you need to have LibSass already built as a shared library (to link against it). The commands below expect the shared library in the `lib` sub-directory (`-Llib`). The plugin and the main LibSass process should "consume" the same shared LibSass library on runtime. It will propably also work if they use different LibSass versions. In this case we check if the major versions are compatible (i.e. 3.1.3 and 3.1.1 would be considered compatible).
36
-
37
- ## Compile with gcc on linux
38
-
39
- ```bash
40
- g++ -O2 -shared plugin.cpp -o plugin.so -fPIC -Llib -lsass
41
- ```
42
-
43
- ## Compile with mingw on windows
44
-
45
- ```bash
46
- g++ -O2 -shared plugin.cpp -o plugin.dll -Llib -lsass
47
- ```
@@ -1,68 +0,0 @@
1
- ## Requirements
2
- In order to install and setup your local development environment, there are some prerequisites:
3
-
4
- * git
5
- * gcc/clang/llvm (Linux: build tools, Mac OS X: XCode w/ Command Line Tools)
6
- * ruby w/ bundler
7
-
8
- OS X:
9
- First you'll need to install XCode which you can now get from the AppStore installed on your mac. After you download that and run it, then run this on the command line:
10
-
11
- ````
12
- xcode-select --install
13
- ````
14
-
15
- ## Cloning the Projects
16
-
17
- First, clone the project and then add a line to your `~/.bash_profile` that will let other programs know where the LibSass dev files are.
18
-
19
- ````
20
- git clone git@github.com:sass/libsass.git
21
- cd libsass
22
- echo "export SASS_LIBSASS_PATH=$(pwd)" >> ~/.bash_profile
23
-
24
- ````
25
-
26
- Then, if you run the "bootstrap" script, it should clone all the other required projects.
27
-
28
- ````
29
- ./script/bootstrap
30
- ````
31
-
32
- You should now have a `sass-spec` and `sassc` folder within the libsass folder. Both of these are clones of their respective git projects. If you want to do a pull request, remember to work in those folders. For instance, if you want to add a test (see other documentation for how to do that), make sure to commit it to your *fork* of the sass-spec github project. Also, whenever you are running tests, make sure to `pull` from the origin! We want to make sure we are testing against the newest libsass, sassc, and sass-spec!
33
-
34
- Now, try and see if you can build the project. We do that with the `make` command.
35
-
36
- ````
37
- make
38
- ````
39
-
40
- At this point, if you get an error, something is most likely wrong with your compiler installation. Yikes. It's hard to cover how to fix this in an article. Feel free to open an issue and we'll try and help! But, remember, before you do that, googling the error message is your friend! Many problems are solved quickly that way.
41
-
42
- ## Running The Spec Against LibSass
43
-
44
- Then, to run the spec against LibSass, just run:
45
-
46
- ````
47
- ./script/spec
48
- ````
49
-
50
- If you get an error about `SASS_LIBSASS_PATH`, you may still need to set a variable pointing to the libsass folder, like this:
51
-
52
- ````
53
- export SASS_LIBSASS_PATH=/Users/you/path/libsass
54
- ````
55
-
56
- ...where the latter part is to the `libsass` directory you've cloned. You can get this path by typing `pwd` in the Terminal
57
-
58
- ## Running the Spec Against Ruby Sass
59
-
60
- Go into the sass-spec folder that should have been cloned earlier with the "bootstrap" command. Run the following.
61
-
62
- ````
63
- bundle install
64
- ./sass-spec.rb
65
- ````
66
-
67
- Voila! Now you are testing against Sass too!
68
-
@@ -1,51 +0,0 @@
1
- This document is mainly intended for developers!
2
-
3
- # Documenting some of the source map internals
4
-
5
- Since source maps are somewhat a black box to all LibSass maintainers, [I](@mgreter) will try to document my findings with source maps in LibSass, as I come across them. This document will also brievely explain how LibSass parses the source and how it outputs the result.
6
-
7
- The main storage for SourceMap mappings is the `mappings` vector:
8
-
9
- ```
10
- # in source_map.hpp
11
- vector<Mapping> mappings
12
- # in mappings.hpp
13
- struct Mapping ...
14
- Position original_position;
15
- Position generated_position;
16
- ```
17
-
18
- ## Every parsed token has its source associated
19
-
20
- LibSass uses a lexical parser. Whenever LibSass finds a token of interest, it creates a specific `AST_Node`, which will hold a reference to the input source with line/column information. `AST_Node` is the base class for all parsed items. They are declared in `ast.hpp` and are used in `parser.hpp`. Here a simple example:
21
-
22
- ```
23
- if (lex< custom_property_name >()) {
24
- Sass::String* prop = new (ctx.mem) String_Constant(path, source_position, lexed);
25
- return new (ctx.mem) Declaration(path, prop->position(), prop, ...);
26
- }
27
- ```
28
-
29
- ## How is the `source_position` calculated
30
-
31
- This is automatically done with `lex` in `parser.hpp`. Whenever something is lexed, the `source_position` is updated. But be aware that `source_position` points to the begining of the parsed text. If you need a mapping for the position where the parsing ended, you need to add another call to `lex` (to match nothing)!
32
-
33
- ```
34
- lex< exactly < empty_str > >();
35
- end = new (ctx.mem) String_Constant(path, source_position, lexed);
36
- ```
37
-
38
- ## How are mappings for the output created
39
-
40
- So far we have collected all needed data for all tokens in the input stream. We can now use this information to create mappings when we put things into the output stream. Mappings are created via the `add_mappings` method:
41
-
42
- ```
43
- # in source_map.hpp
44
- void add_mapping(AST_Node* node);
45
- ```
46
-
47
- This method is called in two places:
48
- - `Inspect::append_to_buffer`
49
- - `Output_[Nested|Compressed]::append_to_buffer`
50
-
51
- Mappings can only be created for things that have been parsed into a `AST_Node`. Otherwise we do not have the information to create the mappings, which is the reason why LibSass currently only maps the most important tokens in source maps.
@@ -1,26 +0,0 @@
1
- ## This is proposed interface in https://github.com/sass/libsass/pull/1288
2
-
3
- Additional debugging macros with low overhead are available, `TRACE()` and `TRACEINST()`.
4
-
5
- Both macros simulate a string stream, so they can be used like this:
6
-
7
- TRACE() << "Reached.";
8
-
9
- produces:
10
-
11
- [LibSass] parse_value parser.cpp:1384 Reached.
12
-
13
- `TRACE()`
14
- logs function name, source filename, source file name to the standard error and the attached
15
- stream to the standard error.
16
-
17
- `TRACEINST(obj)`
18
- logs object instance address, function name, source filename, source file name to the standard error and the attached stream to the standard error, for example:
19
-
20
- TRACEINST(this) << "String_Constant created " << this;
21
-
22
- produces:
23
-
24
- [LibSass] 0x8031ba980:String_Constant ./ast.hpp:1371 String_Constant created (0,"auto")
25
-
26
- The macros generate output only of `LibSass_TRACE` is set in the environment.
@@ -1,17 +0,0 @@
1
- This is an article about how to help with LibSass issues. Issue triage is a fancy word for explaining how we deal with incoming issues and make sure that the right problems get worked on. The lifecycle of an issue goes like this:
2
-
3
- 1. Issue is reported by a user.
4
- 2. If the issue seems like a bug, then the "bug" tag is added.
5
- 3. If the reporting user didn't also create a spec test over at sass/sass-spec, the "needs test" tag is added.
6
- 4. Verify that Ruby Sass *does not* have the same bug. LibSass strives to be an exact replica of how Ruby Sass works. If it's an issue that neither project has solved, please close the ticket with the "not in sass" label.
7
- 5. The smallest possible breaking test is created in sass-spec. Cut away any extra information or non-breaking code until the core issue is made clear.
8
- 6. Again, verify that the expected output matches the latest Ruby Sass release. Do this by using your own tool OR by running ./sass-spec.rb in the spec folder and making sure that your test passes!
9
- 7. Create the test cases in sass-spec with the name spec/LibSass-todo-issues/issue_XXX/input.scss and expected_output.css where the XXX is the issue number here.
10
- 8. Commit that test to sass-spec, making sure to reference the issue in the comment message like "Test to demonstrate sass/LibSass#XXX".
11
- 9. Once the spec test exists, remove the "needs test" tag and replace it with "test written".
12
- 10. A C++ developer will then work on the issue and issue a pull request to fix the issue.
13
- 11. A core member verifies that the fix does actually fix the spec tests.
14
- 12. The fix is merged into the project.
15
- 13. The spec is moved from the LibSass-todo-issues folder into LibSass-closed-issues
16
- 14. The issue is closed
17
- 15. Have a soda pop or enjoyable beverage of your choice
@@ -1,39 +0,0 @@
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.
2
-
3
- ### [Declaring character encodings in CSS](http://www.w3.org/International/questions/qa-css-charset.en)
4
-
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.
6
-
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).
8
-
9
- ### Current status on LibSass unicode support
10
-
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).
12
-
13
- ### Current encoding auto detection
14
-
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).
16
-
17
- ### What is currently not supported
18
-
19
- - Using non ASCII compatible encodings (like UTF-16)
20
- - Using non ASCII characters in different encodings in different includes
21
-
22
- ### What is missing to support the above cases
23
-
24
- - A way to convert between encodings (like libiconv)
25
- - Sniffing the charset inside the file (source is available)
26
- - Handling the conversion on import (and export)
27
- - Optional: Make output encoding configurable
28
- - Optional: Add optional/mandatory BOM (configurable)
29
-
30
- ### Low priority feature
31
-
32
- I guess the current implementation should handle more than 99% of all real world use cases.
33
- 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!
36
-
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).
38
-
39
- 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.
@@ -1,6 +0,0 @@
1
- require 'mkmf'
2
- # .. more stuff
3
- #$LIBPATH.push(Config::CONFIG['libdir'])
4
- $CFLAGS << " #{ENV["CFLAGS"]}"
5
- $LIBS << " #{ENV["LIBS"]}"
6
- create_makefile("libsass")
@@ -1,12 +0,0 @@
1
- #ifndef SASS_VERSION_H
2
- #define SASS_VERSION_H
3
-
4
- #ifndef LIBSASS_VERSION
5
- #define LIBSASS_VERSION "@PACKAGE_VERSION@"
6
- #endif
7
-
8
- #ifndef LIBSASS_LANGUAGE_VERSION
9
- #define LIBSASS_LANGUAGE_VERSION "3.5"
10
- #endif
11
-
12
- #endif
File without changes
@@ -1,167 +0,0 @@
1
- # ============================================================================
2
- # http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
3
- # ============================================================================
4
- #
5
- # SYNOPSIS
6
- #
7
- # AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
8
- #
9
- # DESCRIPTION
10
- #
11
- # Check for baseline language coverage in the compiler for the C++11
12
- # standard; if necessary, add switches to CXXFLAGS to enable support.
13
- #
14
- # The first argument, if specified, indicates whether you insist on an
15
- # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
16
- # -std=c++11). If neither is specified, you get whatever works, with
17
- # preference for an extended mode.
18
- #
19
- # The second argument, if specified 'mandatory' or if left unspecified,
20
- # indicates that baseline C++11 support is required and that the macro
21
- # should error out if no mode with that support is found. If specified
22
- # 'optional', then configuration proceeds regardless, after defining
23
- # HAVE_CXX11 if and only if a supporting mode is found.
24
- #
25
- # LICENSE
26
- #
27
- # Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
28
- # Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
29
- # Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
30
- # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
31
- #
32
- # Copying and distribution of this file, with or without modification, are
33
- # permitted in any medium without royalty provided the copyright notice
34
- # and this notice are preserved. This file is offered as-is, without any
35
- # warranty.
36
-
37
- #serial 11
38
-
39
- m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
40
- template <typename T>
41
- struct check
42
- {
43
- static_assert(sizeof(int) <= sizeof(T), "not big enough");
44
- };
45
-
46
- struct Base {
47
- virtual void f() {}
48
- };
49
- struct Child : public Base {
50
- virtual void f() override {}
51
- };
52
-
53
- typedef check<check<bool>> right_angle_brackets;
54
-
55
- int a;
56
- decltype(a) b;
57
-
58
- typedef check<int> check_type;
59
- check_type c;
60
- check_type&& cr = static_cast<check_type&&>(c);
61
-
62
- auto d = a;
63
- auto l = [](){};
64
- // Prevent Clang error: unused variable 'l' [-Werror,-Wunused-variable]
65
- struct use_l { use_l() { l(); } };
66
-
67
- // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
68
- // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this
69
- namespace test_template_alias_sfinae {
70
- struct foo {};
71
-
72
- template<typename T>
73
- using member = typename T::member_type;
74
-
75
- template<typename T>
76
- void func(...) {}
77
-
78
- template<typename T>
79
- void func(member<T>*) {}
80
-
81
- void test();
82
-
83
- void test() {
84
- func<foo>(0);
85
- }
86
- }
87
- ]])
88
-
89
- AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
90
- m4_if([$1], [], [],
91
- [$1], [ext], [],
92
- [$1], [noext], [],
93
- [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
94
- m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
95
- [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
96
- [$2], [optional], [ax_cxx_compile_cxx11_required=false],
97
- [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
98
- AC_LANG_PUSH([C++])dnl
99
- ac_success=no
100
- AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
101
- ax_cv_cxx_compile_cxx11,
102
- [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
103
- [ax_cv_cxx_compile_cxx11=yes],
104
- [ax_cv_cxx_compile_cxx11=no])])
105
- if test x$ax_cv_cxx_compile_cxx11 = xyes; then
106
- ac_success=yes
107
- fi
108
-
109
- m4_if([$1], [noext], [], [dnl
110
- if test x$ac_success = xno; then
111
- for switch in -std=gnu++11 -std=gnu++0x; do
112
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
113
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
114
- $cachevar,
115
- [ac_save_CXXFLAGS="$CXXFLAGS"
116
- CXXFLAGS="$CXXFLAGS $switch"
117
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
118
- [eval $cachevar=yes],
119
- [eval $cachevar=no])
120
- CXXFLAGS="$ac_save_CXXFLAGS"])
121
- if eval test x\$$cachevar = xyes; then
122
- CXXFLAGS="$CXXFLAGS $switch"
123
- ac_success=yes
124
- break
125
- fi
126
- done
127
- fi])
128
-
129
- m4_if([$1], [ext], [], [dnl
130
- if test x$ac_success = xno; then
131
- dnl HP's aCC needs +std=c++11 according to:
132
- dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
133
- for switch in -std=c++11 -std=c++0x +std=c++11; do
134
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
135
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
136
- $cachevar,
137
- [ac_save_CXXFLAGS="$CXXFLAGS"
138
- CXXFLAGS="$CXXFLAGS $switch"
139
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
140
- [eval $cachevar=yes],
141
- [eval $cachevar=no])
142
- CXXFLAGS="$ac_save_CXXFLAGS"])
143
- if eval test x\$$cachevar = xyes; then
144
- CXXFLAGS="$CXXFLAGS $switch"
145
- ac_success=yes
146
- break
147
- fi
148
- done
149
- fi])
150
- AC_LANG_POP([C++])
151
- if test x$ax_cxx_compile_cxx11_required = xtrue; then
152
- if test x$ac_success = xno; then
153
- AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
154
- fi
155
- else
156
- if test x$ac_success = xno; then
157
- HAVE_CXX11=0
158
- AC_MSG_NOTICE([No compiler with C++11 support was found])
159
- else
160
- HAVE_CXX11=1
161
- AC_DEFINE(HAVE_CXX11,1,
162
- [define if the compiler supports basic C++11 syntax])
163
- fi
164
-
165
- AC_SUBST(HAVE_CXX11)
166
- fi
167
- ])