zuora_connect_ui 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (449) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/zuora_connect_ui.js +1 -0
  3. data/app/assets/javascripts/zuora_connect_ui/util.js +51 -0
  4. data/app/assets/stylesheets/_zuora_connect_ui.scss +4 -6
  5. data/app/assets/stylesheets/zuora_connect_ui/datatables.scss +3 -3
  6. data/app/helpers/zuora_connect_ui/application_helper.rb +28 -4
  7. data/app/views/partials/_table.html.erb +16 -7
  8. data/lib/zuora_connect_ui/version.rb +1 -1
  9. data/vendor/ruby/2.6.0/cache/autoprefixer-rails-9.6.1.1.gem +0 -0
  10. data/vendor/ruby/2.6.0/cache/parser-2.6.4.1.gem +0 -0
  11. data/vendor/ruby/2.6.0/cache/sassc-2.2.0.gem +0 -0
  12. data/vendor/ruby/2.6.0/cache/zeitwerk-2.1.10.gem +0 -0
  13. data/vendor/ruby/2.6.0/extensions/x86_64-linux/2.6.0/sassc-2.2.0/gem.build_complete +0 -0
  14. data/vendor/ruby/2.6.0/extensions/x86_64-linux/2.6.0/sassc-2.2.0/gem_make.out +75 -0
  15. data/vendor/ruby/2.6.0/extensions/x86_64-linux/2.6.0/sassc-2.2.0/sassc/libsass.so +0 -0
  16. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/CHANGELOG.md +1085 -0
  17. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/Gemfile +10 -0
  18. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/LICENSE +20 -0
  19. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/README.md +237 -0
  20. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/Rakefile +53 -0
  21. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/autoprefixer-rails.gemspec +32 -0
  22. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/lib/autoprefixer-rails.rb +41 -0
  23. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/lib/autoprefixer-rails/processor.rb +194 -0
  24. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/lib/autoprefixer-rails/railtie.rb +50 -0
  25. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/lib/autoprefixer-rails/result.rb +24 -0
  26. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/lib/autoprefixer-rails/sprockets.rb +62 -0
  27. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/lib/autoprefixer-rails/version.rb +3 -0
  28. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/lib/rake/autoprefixer_tasks.rb +28 -0
  29. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/Rakefile +2 -0
  30. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/app/assets/config/manifest.js +0 -0
  31. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/app/assets/stylesheets/evaluate.css.erb +1 -0
  32. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/app/assets/stylesheets/loaded.sass +2 -0
  33. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/app/assets/stylesheets/sass.sass +1 -0
  34. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/app/assets/stylesheets/test.css +3 -0
  35. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/app/assets/stylesheets/wrong.css +2 -0
  36. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/app/controllers/application_controller.rb +2 -0
  37. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/app/controllers/css_controller.rb +6 -0
  38. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/config.ru +2 -0
  39. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/config/application.rb +16 -0
  40. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/config/autoprefixer.yml +2 -0
  41. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/config/boot.rb +2 -0
  42. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/config/environment.rb +3 -0
  43. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/config/environments/test.rb +9 -0
  44. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/config/initializers/secret_token.rb +1 -0
  45. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/app/config/routes.rb +3 -0
  46. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/autoprefixer_spec.rb +121 -0
  47. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/processor_spec.rb +25 -0
  48. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/rails_spec.rb +40 -0
  49. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/railtie_spec.rb +29 -0
  50. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/spec/spec_helper.rb +16 -0
  51. data/vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/vendor/autoprefixer.js +67195 -0
  52. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/CHANGELOG.md +909 -0
  53. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/CONTRIBUTING.md +17 -0
  54. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/Gemfile +10 -0
  55. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/LICENSE.txt +25 -0
  56. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/README.md +301 -0
  57. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/Rakefile +166 -0
  58. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/bin/ruby-parse +7 -0
  59. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/bin/ruby-rewrite +7 -0
  60. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/ci/run_rubocop_specs +14 -0
  61. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/doc/AST_FORMAT.md +1816 -0
  62. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/doc/CUSTOMIZATION.md +37 -0
  63. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/doc/INTERNALS.md +21 -0
  64. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/doc/css/common.css +68 -0
  65. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/gauntlet_parser.rb +123 -0
  66. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser.rb +82 -0
  67. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/all.rb +12 -0
  68. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ast/node.rb +40 -0
  69. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ast/processor.rb +264 -0
  70. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/base.rb +270 -0
  71. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/builders/default.rb +1741 -0
  72. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/clobbering_error.rb +13 -0
  73. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/color.rb +32 -0
  74. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/context.rb +59 -0
  75. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/current.rb +92 -0
  76. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/deprecation.rb +13 -0
  77. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/diagnostic.rb +163 -0
  78. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/diagnostic/engine.rb +105 -0
  79. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/lexer.rb +23546 -0
  80. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/lexer.rl +2503 -0
  81. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/lexer/dedenter.rb +79 -0
  82. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/lexer/explanation.rb +55 -0
  83. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/lexer/literal.rb +269 -0
  84. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/lexer/max_numparam_stack.rb +42 -0
  85. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/lexer/stack_state.rb +49 -0
  86. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/macruby.rb +6124 -0
  87. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/macruby.y +2198 -0
  88. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/messages.rb +90 -0
  89. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/meta.rb +33 -0
  90. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/rewriter.rb +105 -0
  91. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby18.rb +5661 -0
  92. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby18.y +1934 -0
  93. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby19.rb +6084 -0
  94. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby19.y +2175 -0
  95. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby20.rb +6511 -0
  96. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby20.y +2353 -0
  97. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby21.rb +6570 -0
  98. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby21.y +2357 -0
  99. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby22.rb +6605 -0
  100. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby22.y +2364 -0
  101. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby23.rb +6624 -0
  102. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby23.y +2370 -0
  103. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby24.rb +6689 -0
  104. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby24.y +2408 -0
  105. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby25.rb +6656 -0
  106. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby25.y +2405 -0
  107. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby26.rb +6670 -0
  108. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby26.y +2413 -0
  109. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby27.rb +6893 -0
  110. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/ruby27.y +2470 -0
  111. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/rubymotion.rb +6078 -0
  112. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/rubymotion.y +2182 -0
  113. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/runner.rb +253 -0
  114. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/runner/ruby_parse.rb +157 -0
  115. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/runner/ruby_rewrite.rb +101 -0
  116. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/buffer.rb +330 -0
  117. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/comment.rb +121 -0
  118. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/comment/associator.rb +210 -0
  119. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map.rb +186 -0
  120. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/collection.rb +18 -0
  121. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/condition.rb +21 -0
  122. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/constant.rb +32 -0
  123. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/definition.rb +23 -0
  124. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/for.rb +19 -0
  125. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/heredoc.rb +19 -0
  126. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/index.rb +33 -0
  127. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/keyword.rb +20 -0
  128. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/objc_kwarg.rb +19 -0
  129. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/operator.rb +17 -0
  130. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/rescue_body.rb +21 -0
  131. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/send.rb +36 -0
  132. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/ternary.rb +18 -0
  133. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/map/variable.rb +31 -0
  134. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/range.rb +310 -0
  135. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/rewriter.rb +513 -0
  136. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/rewriter/action.rb +44 -0
  137. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/tree_rewriter.rb +301 -0
  138. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/source/tree_rewriter/action.rb +133 -0
  139. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/static_environment.rb +46 -0
  140. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/syntax_error.rb +21 -0
  141. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/tree_rewriter.rb +134 -0
  142. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/lib/parser/version.rb +5 -0
  143. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/parser.gemspec +51 -0
  144. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/bug_163/fixtures/input.rb +5 -0
  145. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/bug_163/fixtures/output.rb +5 -0
  146. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/bug_163/rewriter.rb +20 -0
  147. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/helper.rb +59 -0
  148. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/parse_helper.rb +316 -0
  149. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/racc_coverage_helper.rb +133 -0
  150. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_base.rb +31 -0
  151. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_current.rb +29 -0
  152. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_diagnostic.rb +96 -0
  153. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_diagnostic_engine.rb +62 -0
  154. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_encoding.rb +99 -0
  155. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_lexer.rb +3659 -0
  156. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_lexer_stack_state.rb +78 -0
  157. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_parse_helper.rb +80 -0
  158. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_parser.rb +7579 -0
  159. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_runner_parse.rb +35 -0
  160. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_runner_rewrite.rb +47 -0
  161. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_source_buffer.rb +162 -0
  162. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_source_comment.rb +36 -0
  163. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_source_comment_associator.rb +367 -0
  164. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_source_map.rb +15 -0
  165. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_source_range.rb +172 -0
  166. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_source_rewriter.rb +541 -0
  167. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_source_rewriter_action.rb +46 -0
  168. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_source_tree_rewriter.rb +173 -0
  169. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/test_static_environment.rb +45 -0
  170. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/using_tree_rewriter/fixtures/input.rb +3 -0
  171. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/using_tree_rewriter/fixtures/output.rb +3 -0
  172. data/vendor/ruby/2.6.0/gems/parser-2.6.4.1/test/using_tree_rewriter/using_tree_rewriter.rb +9 -0
  173. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/CHANGELOG.md +77 -0
  174. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/CODE_OF_CONDUCT.md +10 -0
  175. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/Gemfile +2 -0
  176. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/LICENSE.txt +22 -0
  177. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/README.md +68 -0
  178. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/Rakefile +53 -0
  179. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/Makefile +271 -0
  180. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/SharedPtr.o +0 -0
  181. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/ast.o +0 -0
  182. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/ast2c.o +0 -0
  183. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/ast_fwd_decl.o +0 -0
  184. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/ast_sel_cmp.o +0 -0
  185. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/ast_sel_unify.o +0 -0
  186. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/ast_selectors.o +0 -0
  187. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/ast_supports.o +0 -0
  188. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/ast_values.o +0 -0
  189. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/backtrace.o +0 -0
  190. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/base64vlq.o +0 -0
  191. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/bind.o +0 -0
  192. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/c2ast.o +0 -0
  193. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/c99func.o +0 -0
  194. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/cencode.o +0 -0
  195. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/check_nesting.o +0 -0
  196. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/color_maps.o +0 -0
  197. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/constants.o +0 -0
  198. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/context.o +0 -0
  199. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/cssize.o +0 -0
  200. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/depend +4 -0
  201. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/emitter.o +0 -0
  202. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/environment.o +0 -0
  203. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/error_handling.o +0 -0
  204. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/eval.o +0 -0
  205. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/expand.o +0 -0
  206. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/extconf.rb +84 -0
  207. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/extend.o +0 -0
  208. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/file.o +0 -0
  209. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/fn_colors.o +0 -0
  210. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/fn_lists.o +0 -0
  211. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/fn_maps.o +0 -0
  212. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/fn_miscs.o +0 -0
  213. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/fn_numbers.o +0 -0
  214. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/fn_selectors.o +0 -0
  215. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/fn_strings.o +0 -0
  216. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/fn_utils.o +0 -0
  217. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/inspect.o +0 -0
  218. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/json.o +0 -0
  219. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/lexer.o +0 -0
  220. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass.so +0 -0
  221. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/VERSION +1 -0
  222. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/contrib/plugin.cpp +60 -0
  223. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/include/sass.h +15 -0
  224. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/include/sass/base.h +96 -0
  225. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/include/sass/context.h +170 -0
  226. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/include/sass/functions.h +139 -0
  227. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/include/sass/values.h +145 -0
  228. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/include/sass/version.h +12 -0
  229. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/include/sass2scss.h +120 -0
  230. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast.cpp +963 -0
  231. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast.hpp +905 -0
  232. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast2c.cpp +80 -0
  233. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast2c.hpp +39 -0
  234. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_def_macros.hpp +132 -0
  235. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_fwd_decl.cpp +30 -0
  236. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_fwd_decl.hpp +341 -0
  237. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_sel_cmp.cpp +909 -0
  238. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_sel_unify.cpp +280 -0
  239. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_selectors.cpp +1475 -0
  240. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_selectors.hpp +568 -0
  241. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_supports.cpp +130 -0
  242. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_supports.hpp +121 -0
  243. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_values.cpp +967 -0
  244. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/ast_values.hpp +489 -0
  245. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/b64/cencode.h +32 -0
  246. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/b64/encode.h +79 -0
  247. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/backtrace.cpp +50 -0
  248. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/backtrace.hpp +29 -0
  249. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/base64vlq.cpp +47 -0
  250. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/base64vlq.hpp +30 -0
  251. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/bind.cpp +312 -0
  252. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/bind.hpp +15 -0
  253. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/c2ast.cpp +64 -0
  254. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/c2ast.hpp +14 -0
  255. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/c99func.c +54 -0
  256. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/cencode.c +108 -0
  257. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/check_nesting.cpp +394 -0
  258. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/check_nesting.hpp +66 -0
  259. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/color_maps.cpp +651 -0
  260. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/color_maps.hpp +331 -0
  261. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/constants.cpp +194 -0
  262. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/constants.hpp +194 -0
  263. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/context.cpp +890 -0
  264. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/context.hpp +152 -0
  265. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/cssize.cpp +604 -0
  266. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/cssize.hpp +77 -0
  267. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/debug.hpp +43 -0
  268. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/debugger.hpp +807 -0
  269. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/emitter.cpp +298 -0
  270. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/emitter.hpp +103 -0
  271. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/environment.cpp +260 -0
  272. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/environment.hpp +119 -0
  273. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/error_handling.cpp +212 -0
  274. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/error_handling.hpp +229 -0
  275. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/eval.cpp +1657 -0
  276. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/eval.hpp +112 -0
  277. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/expand.cpp +822 -0
  278. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/expand.hpp +78 -0
  279. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/extend.cpp +2132 -0
  280. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/extend.hpp +86 -0
  281. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/file.cpp +522 -0
  282. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/file.hpp +133 -0
  283. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_colors.cpp +594 -0
  284. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_colors.hpp +85 -0
  285. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_lists.cpp +284 -0
  286. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_lists.hpp +34 -0
  287. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_maps.cpp +94 -0
  288. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_maps.hpp +30 -0
  289. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_miscs.cpp +256 -0
  290. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_miscs.hpp +40 -0
  291. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_numbers.cpp +220 -0
  292. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_numbers.hpp +45 -0
  293. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_selectors.cpp +235 -0
  294. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_selectors.hpp +35 -0
  295. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_strings.cpp +254 -0
  296. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_strings.hpp +34 -0
  297. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_utils.cpp +156 -0
  298. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/fn_utils.hpp +56 -0
  299. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/inspect.cpp +1087 -0
  300. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/inspect.hpp +99 -0
  301. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/json.cpp +1436 -0
  302. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/json.hpp +117 -0
  303. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/kwd_arg_macros.hpp +28 -0
  304. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/lexer.cpp +184 -0
  305. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/lexer.hpp +315 -0
  306. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/listize.cpp +84 -0
  307. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/listize.hpp +38 -0
  308. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/mapping.hpp +18 -0
  309. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/memory/SharedPtr.cpp +33 -0
  310. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/memory/SharedPtr.hpp +286 -0
  311. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/node.cpp +322 -0
  312. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/node.hpp +118 -0
  313. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/operation.hpp +213 -0
  314. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/operators.cpp +266 -0
  315. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/operators.hpp +30 -0
  316. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/output.cpp +339 -0
  317. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/output.hpp +47 -0
  318. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/parser.cpp +3153 -0
  319. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/parser.hpp +402 -0
  320. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/paths.hpp +71 -0
  321. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/plugins.cpp +188 -0
  322. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/plugins.hpp +57 -0
  323. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/position.cpp +184 -0
  324. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/position.hpp +124 -0
  325. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/prelexer.cpp +1780 -0
  326. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/prelexer.hpp +484 -0
  327. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/remove_placeholders.cpp +87 -0
  328. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/remove_placeholders.hpp +34 -0
  329. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass.cpp +155 -0
  330. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass.hpp +142 -0
  331. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass2scss.cpp +895 -0
  332. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass_context.cpp +772 -0
  333. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass_context.hpp +129 -0
  334. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass_functions.cpp +210 -0
  335. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass_functions.hpp +50 -0
  336. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass_util.cpp +152 -0
  337. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass_util.hpp +256 -0
  338. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass_values.cpp +365 -0
  339. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/sass_values.hpp +82 -0
  340. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/source_map.cpp +198 -0
  341. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/source_map.hpp +62 -0
  342. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/subset_map.cpp +58 -0
  343. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/subset_map.hpp +76 -0
  344. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/to_value.cpp +114 -0
  345. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/to_value.hpp +46 -0
  346. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/units.cpp +505 -0
  347. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/units.hpp +110 -0
  348. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/utf8.h +34 -0
  349. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/utf8/checked.h +336 -0
  350. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/utf8/core.h +332 -0
  351. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/utf8/unchecked.h +235 -0
  352. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/utf8_string.cpp +105 -0
  353. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/utf8_string.hpp +37 -0
  354. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/util.cpp +725 -0
  355. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/util.hpp +106 -0
  356. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/util_string.cpp +75 -0
  357. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/util_string.hpp +19 -0
  358. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/values.cpp +140 -0
  359. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/values.hpp +12 -0
  360. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/listize.o +0 -0
  361. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/node.o +0 -0
  362. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/operators.o +0 -0
  363. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/output.o +0 -0
  364. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/parser.o +0 -0
  365. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/plugins.o +0 -0
  366. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/position.o +0 -0
  367. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/prelexer.o +0 -0
  368. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/remove_placeholders.o +0 -0
  369. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/sass.o +0 -0
  370. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/sass2scss.o +0 -0
  371. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/sass_context.o +0 -0
  372. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/sass_functions.o +0 -0
  373. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/sass_util.o +0 -0
  374. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/sass_values.o +0 -0
  375. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/source_map.o +0 -0
  376. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/subset_map.o +0 -0
  377. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/to_value.o +0 -0
  378. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/units.o +0 -0
  379. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/utf8_string.o +0 -0
  380. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/util.o +0 -0
  381. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/util_string.o +0 -0
  382. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/values.o +0 -0
  383. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc.rb +57 -0
  384. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/dependency.rb +17 -0
  385. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/engine.rb +139 -0
  386. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/error.rb +37 -0
  387. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/functions_handler.rb +73 -0
  388. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/import_handler.rb +50 -0
  389. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/importer.rb +31 -0
  390. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/libsass.so +0 -0
  391. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/native.rb +62 -0
  392. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/native/lib_c.rb +21 -0
  393. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/native/native_context_api.rb +147 -0
  394. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/native/native_functions_api.rb +159 -0
  395. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/native/sass2scss_api.rb +10 -0
  396. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/native/sass_input_style.rb +13 -0
  397. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/native/sass_output_style.rb +12 -0
  398. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/native/sass_value.rb +97 -0
  399. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/native/string_list.rb +10 -0
  400. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/sass_2_scss.rb +9 -0
  401. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script.rb +17 -0
  402. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/functions.rb +8 -0
  403. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value.rb +137 -0
  404. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value/bool.rb +32 -0
  405. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value/color.rb +95 -0
  406. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value/list.rb +136 -0
  407. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value/map.rb +69 -0
  408. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value/number.rb +389 -0
  409. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value/string.rb +96 -0
  410. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value_conversion.rb +69 -0
  411. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value_conversion/base.rb +13 -0
  412. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value_conversion/bool.rb +13 -0
  413. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value_conversion/color.rb +18 -0
  414. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value_conversion/list.rb +25 -0
  415. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value_conversion/map.rb +21 -0
  416. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value_conversion/number.rb +13 -0
  417. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/script/value_conversion/string.rb +17 -0
  418. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/util.rb +231 -0
  419. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/util/normalized_map.rb +117 -0
  420. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/lib/sassc/version.rb +5 -0
  421. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/sassc.gemspec +69 -0
  422. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/test/custom_importer_test.rb +127 -0
  423. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/test/engine_test.rb +314 -0
  424. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/test/error_test.rb +29 -0
  425. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/test/fixtures/paths.scss +10 -0
  426. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/test/functions_test.rb +323 -0
  427. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/test/native_test.rb +213 -0
  428. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/test/output_style_test.rb +107 -0
  429. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/test/sass_2_scss_test.rb +14 -0
  430. data/vendor/ruby/2.6.0/gems/sassc-2.2.0/test/test_helper.rb +45 -0
  431. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/README.md +533 -0
  432. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk.rb +12 -0
  433. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/error.rb +10 -0
  434. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/explicit_namespace.rb +80 -0
  435. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/gem_inflector.rb +19 -0
  436. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/inflector.rb +19 -0
  437. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb +33 -0
  438. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb +759 -0
  439. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/loader/callbacks.rb +71 -0
  440. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/real_mod_name.rb +15 -0
  441. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/registry.rb +147 -0
  442. data/vendor/ruby/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/version.rb +5 -0
  443. data/vendor/ruby/2.6.0/specifications/autoprefixer-rails-9.6.1.1.gemspec +47 -0
  444. data/vendor/ruby/2.6.0/specifications/parser-2.6.4.1.gemspec +62 -0
  445. data/vendor/ruby/2.6.0/specifications/sassc-2.2.0.gemspec +60 -0
  446. data/vendor/ruby/2.6.0/specifications/zeitwerk-2.1.10.gemspec +21 -0
  447. metadata +441 -4
  448. data/vendor/assets/anjuna/css/anjuna-application.css +0 -2
  449. data/vendor/assets/anjuna/css/anjuna-theme.css +0 -2
@@ -0,0 +1,270 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Parser
4
+
5
+ ##
6
+ # Base class for version-specific parsers.
7
+ #
8
+ # @api public
9
+ #
10
+ # @!attribute [r] diagnostics
11
+ # @return [Parser::Diagnostic::Engine]
12
+ #
13
+ # @!attribute [r] static_env
14
+ # @return [Parser::StaticEnvironment]
15
+ #
16
+ class Base < Racc::Parser
17
+ ##
18
+ # Parses a string of Ruby code and returns the AST. If the source
19
+ # cannot be parsed, {SyntaxError} is raised and a diagnostic is
20
+ # printed to `stderr`.
21
+ #
22
+ # @example
23
+ # Parser::Base.parse('puts "hello"')
24
+ #
25
+ # @param [String] string The block of code to parse.
26
+ # @param [String] file The name of the file the code originated from.
27
+ # @param [Numeric] line The initial line number.
28
+ # @return [Parser::AST::Node]
29
+ #
30
+ def self.parse(string, file='(string)', line=1)
31
+ parser = default_parser
32
+ source_buffer = setup_source_buffer(file, line, string, parser.default_encoding)
33
+ parser.parse(source_buffer)
34
+ end
35
+
36
+ ##
37
+ # Parses a string of Ruby code and returns the AST and comments. If the
38
+ # source cannot be parsed, {SyntaxError} is raised and a diagnostic is
39
+ # printed to `stderr`.
40
+ #
41
+ # @example
42
+ # Parser::Base.parse_with_comments('puts "hello"')
43
+ #
44
+ # @param [String] string The block of code to parse.
45
+ # @param [String] file The name of the file the code originated from.
46
+ # @param [Numeric] line The initial line number.
47
+ # @return [Array]
48
+ #
49
+ def self.parse_with_comments(string, file='(string)', line=1)
50
+ parser = default_parser
51
+ source_buffer = setup_source_buffer(file, line, string, parser.default_encoding)
52
+ parser.parse_with_comments(source_buffer)
53
+ end
54
+
55
+ ##
56
+ # Parses Ruby source code by reading it from a file. If the source
57
+ # cannot be parsed, {SyntaxError} is raised and a diagnostic is
58
+ # printed to `stderr`.
59
+ #
60
+ # @param [String] filename Path to the file to parse.
61
+ # @return [Parser::AST::Node]
62
+ # @see #parse
63
+ #
64
+ def self.parse_file(filename)
65
+ parse(File.read(filename), filename)
66
+ end
67
+
68
+ ##
69
+ # Parses Ruby source code by reading it from a file and returns the AST and
70
+ # comments. If the source cannot be parsed, {SyntaxError} is raised and a
71
+ # diagnostic is printed to `stderr`.
72
+ #
73
+ # @param [String] filename Path to the file to parse.
74
+ # @return [Array]
75
+ # @see #parse
76
+ #
77
+ def self.parse_file_with_comments(filename)
78
+ parse_with_comments(File.read(filename), filename)
79
+ end
80
+
81
+ ##
82
+ # @return [Parser::Base] parser with the default options set.
83
+ #
84
+ def self.default_parser
85
+ parser = new
86
+
87
+ parser.diagnostics.all_errors_are_fatal = true
88
+ parser.diagnostics.ignore_warnings = true
89
+
90
+ parser.diagnostics.consumer = lambda do |diagnostic|
91
+ $stderr.puts(diagnostic.render)
92
+ end
93
+
94
+ parser
95
+ end
96
+
97
+ def self.setup_source_buffer(file, line, string, encoding)
98
+ string = string.dup.force_encoding(encoding)
99
+
100
+ source_buffer = Source::Buffer.new(file, line)
101
+
102
+ if name == 'Parser::Ruby18'
103
+ source_buffer.raw_source = string
104
+ else
105
+ source_buffer.source = string
106
+ end
107
+
108
+ source_buffer
109
+ end
110
+ private_class_method :setup_source_buffer
111
+
112
+ attr_reader :diagnostics
113
+ attr_reader :builder
114
+ attr_reader :static_env
115
+ attr_reader :source_buffer
116
+ attr_reader :context
117
+
118
+ ##
119
+ # @param [Parser::Builders::Default] builder The AST builder to use.
120
+ #
121
+ def initialize(builder=Parser::Builders::Default.new)
122
+ @diagnostics = Diagnostic::Engine.new
123
+
124
+ @static_env = StaticEnvironment.new
125
+
126
+ # Stack that holds current parsing context
127
+ @context = Context.new
128
+
129
+ @lexer = Lexer.new(version)
130
+ @lexer.diagnostics = @diagnostics
131
+ @lexer.static_env = @static_env
132
+ @lexer.context = @context
133
+
134
+ @builder = builder
135
+ @builder.parser = self
136
+
137
+ # Last emitted token
138
+ @last_token = nil
139
+
140
+ if self.class::Racc_debug_parser && ENV['RACC_DEBUG']
141
+ @yydebug = true
142
+ end
143
+
144
+ reset
145
+ end
146
+
147
+ ##
148
+ # Resets the state of the parser.
149
+ #
150
+ def reset
151
+ @source_buffer = nil
152
+
153
+ @lexer.reset
154
+ @static_env.reset
155
+ @context.reset
156
+
157
+ self
158
+ end
159
+
160
+ ##
161
+ # Parses a source buffer and returns the AST.
162
+ #
163
+ # @param [Parser::Source::Buffer] source_buffer The source buffer to parse.
164
+ # @return [Parser::AST::Node]
165
+ #
166
+ def parse(source_buffer)
167
+ @lexer.source_buffer = source_buffer
168
+ @source_buffer = source_buffer
169
+
170
+ do_parse
171
+ ensure
172
+ # Don't keep references to the source file.
173
+ @source_buffer = nil
174
+ @lexer.source_buffer = nil
175
+ end
176
+
177
+ ##
178
+ # Parses a source buffer and returns the AST and the source code comments.
179
+ #
180
+ # @see #parse
181
+ # @see Parser::Source::Comment#associate
182
+ # @return [Array]
183
+ #
184
+ def parse_with_comments(source_buffer)
185
+ @lexer.comments = []
186
+
187
+ [ parse(source_buffer), @lexer.comments ]
188
+ ensure
189
+ @lexer.comments = nil
190
+ end
191
+
192
+ ##
193
+ # Parses a source buffer and returns the AST, the source code comments,
194
+ # and the tokens emitted by the lexer. If `recover` is true and a fatal
195
+ # {SyntaxError} is encountered, `nil` is returned instead of the AST, and
196
+ # comments as well as tokens are only returned up to the location of
197
+ # the error.
198
+ #
199
+ # Currently, token stream format returned by #tokenize is not documented,
200
+ # but is considered part of a public API and only changed according
201
+ # to Semantic Versioning.
202
+ #
203
+ # However, note that the exact token composition of various constructs
204
+ # might vary. For example, a string `"foo"` is represented equally well
205
+ # by `:tSTRING_BEG " :tSTRING_CONTENT foo :tSTRING_END "` and
206
+ # `:tSTRING "foo"`; such details must not be relied upon.
207
+ #
208
+ # @param [Parser::Source::Buffer] source_buffer
209
+ # @param [Boolean] recover If true, recover from syntax errors. False by default.
210
+ # @return [Array]
211
+ #
212
+ def tokenize(source_buffer, recover=false)
213
+ @lexer.tokens = []
214
+ @lexer.comments = []
215
+
216
+ begin
217
+ ast = parse(source_buffer)
218
+ rescue Parser::SyntaxError
219
+ raise if !recover
220
+ end
221
+
222
+ [ ast, @lexer.comments, @lexer.tokens ]
223
+ ensure
224
+ @lexer.tokens = nil
225
+ @lexer.comments = nil
226
+ end
227
+
228
+ private
229
+
230
+ def next_token
231
+ token = @lexer.advance
232
+ @last_token = token
233
+ token
234
+ end
235
+
236
+ def check_kwarg_name(name_t)
237
+ case name_t[0]
238
+ when /^[a-z_]/
239
+ # OK
240
+ when /^[A-Z]/
241
+ diagnostic :error, :argument_const, nil, name_t
242
+ end
243
+ end
244
+
245
+ def diagnostic(level, reason, arguments, location_t, highlights_ts=[])
246
+ _, location = location_t
247
+
248
+ highlights = highlights_ts.map do |token|
249
+ _, range = token
250
+ range
251
+ end
252
+
253
+ @diagnostics.process(
254
+ Diagnostic.new(level, reason, arguments, location, highlights))
255
+
256
+ if level == :error
257
+ yyerror
258
+ end
259
+ end
260
+
261
+ def on_error(error_token_id, error_value, value_stack)
262
+ token_name = token_to_str(error_token_id)
263
+ _, location = error_value
264
+
265
+ @diagnostics.process(Diagnostic.new(
266
+ :error, :unexpected_token, { :token => token_name }, location))
267
+ end
268
+ end
269
+
270
+ end
@@ -0,0 +1,1741 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Parser
4
+
5
+ ##
6
+ # Default AST builder. Uses {AST::Node}s.
7
+ #
8
+ class Builders::Default
9
+ class << self
10
+ ##
11
+ # AST compatibility attribute; since `-> {}` is not semantically
12
+ # equivalent to `lambda {}`, all new code should set this attribute
13
+ # to true.
14
+ #
15
+ # If set to false (the default), `-> {}` is emitted as
16
+ # `s(:block, s(:send, nil, :lambda), s(:args), nil)`.
17
+ #
18
+ # If set to true, `-> {}` is emitted as
19
+ # `s(:block, s(:lambda), s(:args), nil)`.
20
+ #
21
+ # @return [Boolean]
22
+ attr_accessor :emit_lambda
23
+ end
24
+
25
+ @emit_lambda = false
26
+
27
+ class << self
28
+ ##
29
+ # AST compatibility attribute; block arguments of `m { |a| }` are
30
+ # not semantically equivalent to block arguments of `m { |a,| }` or `m { |a, b| }`,
31
+ # all new code should set this attribute to true.
32
+ #
33
+ # If set to false (the default), arguments of `m { |a| }` are emitted as
34
+ # `s(:args, s(:arg, :a))`.
35
+ #
36
+ # If set to true, arguments of `m { |a| }` are emitted as
37
+ # `s(:args, s(:procarg0, :a)).
38
+ #
39
+ # @return [Boolean]
40
+ attr_accessor :emit_procarg0
41
+ end
42
+
43
+ @emit_procarg0 = false
44
+
45
+ class << self
46
+ ##
47
+ # AST compatibility attribute; locations of `__ENCODING__` are not the same
48
+ # as locations of `Encoding::UTF_8` causing problems during rewriting,
49
+ # all new code should set this attribute to true.
50
+ #
51
+ # If set to false (the default), `__ENCODING__` is emitted as
52
+ # ` s(:const, s(:const, nil, :Encoding), :UTF_8)`.
53
+ #
54
+ # If set to true, `__ENCODING__` is emitted as
55
+ # `s(:__ENCODING__)`.
56
+ #
57
+ # @return [Boolean]
58
+ attr_accessor :emit_encoding
59
+ end
60
+
61
+ @emit_encoding = false
62
+
63
+ class << self
64
+ ##
65
+ # AST compatibility attribute; indexed assignment, `x[] = 1`, is not
66
+ # semantically equivalent to calling the method directly, `x.[]=(1)`.
67
+ # Specifically, in the former case, the expression's value is always 1,
68
+ # and in the latter case, the expression's value is the return value
69
+ # of the `[]=` method.
70
+ #
71
+ # If set to false (the default), `self[1]` is emitted as
72
+ # `s(:send, s(:self), :[], s(:int, 1))`, and `self[1] = 2` is
73
+ # emitted as `s(:send, s(:self), :[]=, s(:int, 1), s(:int, 2))`.
74
+ #
75
+ # If set to true, `self[1]` is emitted as
76
+ # `s(:index, s(:self), s(:int, 1))`, and `self[1] = 2` is
77
+ # emitted as `s(:indexasgn, s(:self), s(:int, 1), s(:int, 2))`.
78
+ #
79
+ # @return [Boolean]
80
+ attr_accessor :emit_index
81
+ end
82
+
83
+ class << self
84
+ ##
85
+ # AST compatibility attribute; causes a single non-mlhs
86
+ # block argument to be wrapped in s(:procarg0).
87
+ #
88
+ # If set to false (the default), block arguments `|a|` are emitted as
89
+ # `s(:args, s(:procarg0, :a))`
90
+ #
91
+ # If set to true, block arguments `|a|` are emitted as
92
+ # `s(:args, s(:procarg0, s(:arg, :a))`
93
+ #
94
+ # @return [Boolean]
95
+ attr_accessor :emit_arg_inside_procarg0
96
+ end
97
+
98
+ @emit_index = false
99
+
100
+ class << self
101
+ ##
102
+ # @api private
103
+ def modernize
104
+ @emit_lambda = true
105
+ @emit_procarg0 = true
106
+ @emit_encoding = true
107
+ @emit_index = true
108
+ @emit_arg_inside_procarg0 = true
109
+ end
110
+ end
111
+
112
+ ##
113
+ # @api private
114
+ attr_accessor :parser
115
+
116
+ ##
117
+ # If set to true (the default), `__FILE__` and `__LINE__` are transformed to
118
+ # literal nodes. For example, `s(:str, "lib/foo.rb")` and `s(:int, 10)`.
119
+ #
120
+ # If set to false, `__FILE__` and `__LINE__` are emitted as-is,
121
+ # i.e. as `s(:__FILE__)` and `s(:__LINE__)` nodes.
122
+ #
123
+ # Source maps are identical in both cases.
124
+ #
125
+ # @return [Boolean]
126
+ attr_accessor :emit_file_line_as_literals
127
+
128
+ ##
129
+ # Initializes attributes:
130
+ #
131
+ # * `emit_file_line_as_literals`: `true`
132
+ def initialize
133
+ @emit_file_line_as_literals = true
134
+ end
135
+
136
+ # @!parse private
137
+
138
+ #
139
+ # Literals
140
+ #
141
+
142
+ # Singletons
143
+
144
+ def nil(nil_t)
145
+ n0(:nil,
146
+ token_map(nil_t))
147
+ end
148
+
149
+ def true(true_t)
150
+ n0(:true,
151
+ token_map(true_t))
152
+ end
153
+
154
+ def false(false_t)
155
+ n0(:false,
156
+ token_map(false_t))
157
+ end
158
+
159
+ # Numerics
160
+
161
+ def integer(integer_t)
162
+ numeric(:int, integer_t)
163
+ end
164
+
165
+ def float(float_t)
166
+ numeric(:float, float_t)
167
+ end
168
+
169
+ def rational(rational_t)
170
+ numeric(:rational, rational_t)
171
+ end
172
+
173
+ def complex(complex_t)
174
+ numeric(:complex, complex_t)
175
+ end
176
+
177
+ def numeric(kind, token)
178
+ n(kind, [ value(token) ],
179
+ Source::Map::Operator.new(nil, loc(token)))
180
+ end
181
+ private :numeric
182
+
183
+ def unary_num(unary_t, numeric)
184
+ value, = *numeric
185
+ operator_loc = loc(unary_t)
186
+
187
+ case value(unary_t)
188
+ when '+'
189
+ value = +value
190
+ when '-'
191
+ value = -value
192
+ end
193
+
194
+ numeric.updated(nil, [ value ],
195
+ :location =>
196
+ Source::Map::Operator.new(
197
+ operator_loc,
198
+ operator_loc.join(numeric.loc.expression)))
199
+ end
200
+
201
+ def __LINE__(__LINE__t)
202
+ n0(:__LINE__,
203
+ token_map(__LINE__t))
204
+ end
205
+
206
+ # Strings
207
+
208
+ def string(string_t)
209
+ n(:str, [ string_value(string_t) ],
210
+ delimited_string_map(string_t))
211
+ end
212
+
213
+ def string_internal(string_t)
214
+ n(:str, [ string_value(string_t) ],
215
+ unquoted_map(string_t))
216
+ end
217
+
218
+ def string_compose(begin_t, parts, end_t)
219
+ if collapse_string_parts?(parts)
220
+ if begin_t.nil? && end_t.nil?
221
+ parts.first
222
+ else
223
+ n(:str, parts.first.children,
224
+ string_map(begin_t, parts, end_t))
225
+ end
226
+ else
227
+ n(:dstr, [ *parts ],
228
+ string_map(begin_t, parts, end_t))
229
+ end
230
+ end
231
+
232
+ def character(char_t)
233
+ n(:str, [ string_value(char_t) ],
234
+ prefix_string_map(char_t))
235
+ end
236
+
237
+ def __FILE__(__FILE__t)
238
+ n0(:__FILE__,
239
+ token_map(__FILE__t))
240
+ end
241
+
242
+ # Symbols
243
+
244
+ def symbol(symbol_t)
245
+ n(:sym, [ string_value(symbol_t).to_sym ],
246
+ prefix_string_map(symbol_t))
247
+ end
248
+
249
+ def symbol_internal(symbol_t)
250
+ n(:sym, [ string_value(symbol_t).to_sym ],
251
+ unquoted_map(symbol_t))
252
+ end
253
+
254
+ def symbol_compose(begin_t, parts, end_t)
255
+ if collapse_string_parts?(parts)
256
+ str = parts.first
257
+
258
+ n(:sym, [ str.children.first.to_sym ],
259
+ collection_map(begin_t, str.loc.expression, end_t))
260
+ elsif @parser.version == 18 && parts.empty?
261
+ diagnostic :error, :empty_symbol, nil, loc(begin_t).join(loc(end_t))
262
+ else
263
+ n(:dsym, [ *parts ],
264
+ collection_map(begin_t, parts, end_t))
265
+ end
266
+ end
267
+
268
+ # Executable strings
269
+
270
+ def xstring_compose(begin_t, parts, end_t)
271
+ n(:xstr, [ *parts ],
272
+ string_map(begin_t, parts, end_t))
273
+ end
274
+
275
+ # Indented (interpolated, noninterpolated, executable) strings
276
+
277
+ def dedent_string(node, dedent_level)
278
+ if !dedent_level.nil?
279
+ dedenter = Lexer::Dedenter.new(dedent_level)
280
+
281
+ if node.type == :str
282
+ str = node.children.first
283
+ dedenter.dedent(str)
284
+ elsif node.type == :dstr || node.type == :xstr
285
+ node.children.each do |str_node|
286
+ if str_node.type == :str
287
+ str = str_node.children.first
288
+ dedenter.dedent(str)
289
+ else
290
+ dedenter.interrupt
291
+ end
292
+ end
293
+ end
294
+ end
295
+
296
+ node
297
+ end
298
+
299
+ # Regular expressions
300
+
301
+ def regexp_options(regopt_t)
302
+ options = value(regopt_t).
303
+ each_char.sort.uniq.
304
+ map(&:to_sym)
305
+
306
+ n(:regopt, options,
307
+ token_map(regopt_t))
308
+ end
309
+
310
+ def regexp_compose(begin_t, parts, end_t, options)
311
+ begin
312
+ static_regexp(parts, options)
313
+ rescue RegexpError => e
314
+ diagnostic :error, :invalid_regexp, { :message => e.message },
315
+ loc(begin_t).join(loc(end_t))
316
+ end
317
+
318
+ n(:regexp, (parts << options),
319
+ regexp_map(begin_t, end_t, options))
320
+ end
321
+
322
+ # Arrays
323
+
324
+ def array(begin_t, elements, end_t)
325
+ n(:array, elements,
326
+ collection_map(begin_t, elements, end_t))
327
+ end
328
+
329
+ def splat(star_t, arg=nil)
330
+ if arg.nil?
331
+ n0(:splat,
332
+ unary_op_map(star_t))
333
+ else
334
+ n(:splat, [ arg ],
335
+ unary_op_map(star_t, arg))
336
+ end
337
+ end
338
+
339
+ def word(parts)
340
+ if collapse_string_parts?(parts)
341
+ parts.first
342
+ else
343
+ n(:dstr, [ *parts ],
344
+ collection_map(nil, parts, nil))
345
+ end
346
+ end
347
+
348
+ def words_compose(begin_t, parts, end_t)
349
+ n(:array, [ *parts ],
350
+ collection_map(begin_t, parts, end_t))
351
+ end
352
+
353
+ def symbols_compose(begin_t, parts, end_t)
354
+ parts = parts.map do |part|
355
+ case part.type
356
+ when :str
357
+ value, = *part
358
+ part.updated(:sym, [ value.to_sym ])
359
+ when :dstr
360
+ part.updated(:dsym)
361
+ else
362
+ part
363
+ end
364
+ end
365
+
366
+ n(:array, [ *parts ],
367
+ collection_map(begin_t, parts, end_t))
368
+ end
369
+
370
+ # Hashes
371
+
372
+ def pair(key, assoc_t, value)
373
+ n(:pair, [ key, value ],
374
+ binary_op_map(key, assoc_t, value))
375
+ end
376
+
377
+ def pair_list_18(list)
378
+ if list.size % 2 != 0
379
+ diagnostic :error, :odd_hash, nil, list.last.loc.expression
380
+ else
381
+ list.
382
+ each_slice(2).map do |key, value|
383
+ n(:pair, [ key, value ],
384
+ binary_op_map(key, nil, value))
385
+ end
386
+ end
387
+ end
388
+
389
+ def pair_keyword(key_t, value)
390
+ key_map, pair_map = pair_keyword_map(key_t, value)
391
+
392
+ key = n(:sym, [ value(key_t).to_sym ], key_map)
393
+
394
+ n(:pair, [ key, value ], pair_map)
395
+ end
396
+
397
+ def pair_quoted(begin_t, parts, end_t, value)
398
+ end_t, pair_map = pair_quoted_map(begin_t, end_t, value)
399
+
400
+ key = symbol_compose(begin_t, parts, end_t)
401
+
402
+ n(:pair, [ key, value ], pair_map)
403
+ end
404
+
405
+ def kwsplat(dstar_t, arg)
406
+ n(:kwsplat, [ arg ],
407
+ unary_op_map(dstar_t, arg))
408
+ end
409
+
410
+ def associate(begin_t, pairs, end_t)
411
+ n(:hash, [ *pairs ],
412
+ collection_map(begin_t, pairs, end_t))
413
+ end
414
+
415
+ # Ranges
416
+
417
+ def range_inclusive(lhs, dot2_t, rhs)
418
+ n(:irange, [ lhs, rhs ],
419
+ range_map(lhs, dot2_t, rhs))
420
+ end
421
+
422
+ def range_exclusive(lhs, dot3_t, rhs)
423
+ n(:erange, [ lhs, rhs ],
424
+ range_map(lhs, dot3_t, rhs))
425
+ end
426
+
427
+ #
428
+ # Access
429
+ #
430
+
431
+ def self(token)
432
+ n0(:self,
433
+ token_map(token))
434
+ end
435
+
436
+ def ident(token)
437
+ n(:ident, [ value(token).to_sym ],
438
+ variable_map(token))
439
+ end
440
+
441
+ def ivar(token)
442
+ n(:ivar, [ value(token).to_sym ],
443
+ variable_map(token))
444
+ end
445
+
446
+ def gvar(token)
447
+ n(:gvar, [ value(token).to_sym ],
448
+ variable_map(token))
449
+ end
450
+
451
+ def cvar(token)
452
+ n(:cvar, [ value(token).to_sym ],
453
+ variable_map(token))
454
+ end
455
+
456
+ def numparam(token)
457
+ n(:numparam, [ value(token).to_i ],
458
+ variable_map(token))
459
+ end
460
+
461
+ def back_ref(token)
462
+ n(:back_ref, [ value(token).to_sym ],
463
+ token_map(token))
464
+ end
465
+
466
+ def nth_ref(token)
467
+ n(:nth_ref, [ value(token) ],
468
+ token_map(token))
469
+ end
470
+
471
+ def accessible(node)
472
+ case node.type
473
+ when :__FILE__
474
+ if @emit_file_line_as_literals
475
+ n(:str, [ node.loc.expression.source_buffer.name ],
476
+ node.loc.dup)
477
+ else
478
+ node
479
+ end
480
+
481
+ when :__LINE__
482
+ if @emit_file_line_as_literals
483
+ n(:int, [ node.loc.expression.line ],
484
+ node.loc.dup)
485
+ else
486
+ node
487
+ end
488
+
489
+ when :__ENCODING__
490
+ if !self.class.emit_encoding
491
+ n(:const, [ n(:const, [ nil, :Encoding], nil), :UTF_8 ],
492
+ node.loc.dup)
493
+ else
494
+ node
495
+ end
496
+
497
+ when :ident
498
+ name, = *node
499
+
500
+ if @parser.static_env.declared?(name)
501
+ node.updated(:lvar)
502
+ else
503
+ name, = *node
504
+ n(:send, [ nil, name ],
505
+ var_send_map(node))
506
+ end
507
+
508
+ else
509
+ node
510
+ end
511
+ end
512
+
513
+ def const(name_t)
514
+ n(:const, [ nil, value(name_t).to_sym ],
515
+ constant_map(nil, nil, name_t))
516
+ end
517
+
518
+ def const_global(t_colon3, name_t)
519
+ cbase = n0(:cbase, token_map(t_colon3))
520
+
521
+ n(:const, [ cbase, value(name_t).to_sym ],
522
+ constant_map(cbase, t_colon3, name_t))
523
+ end
524
+
525
+ def const_fetch(scope, t_colon2, name_t)
526
+ n(:const, [ scope, value(name_t).to_sym ],
527
+ constant_map(scope, t_colon2, name_t))
528
+ end
529
+
530
+ def __ENCODING__(__ENCODING__t)
531
+ n0(:__ENCODING__,
532
+ token_map(__ENCODING__t))
533
+ end
534
+
535
+ #
536
+ # Assignment
537
+ #
538
+
539
+ def assignable(node)
540
+ case node.type
541
+ when :cvar
542
+ node.updated(:cvasgn)
543
+
544
+ when :ivar
545
+ node.updated(:ivasgn)
546
+
547
+ when :gvar
548
+ node.updated(:gvasgn)
549
+
550
+ when :const
551
+ unless @parser.context.dynamic_const_definition_allowed?
552
+ diagnostic :error, :dynamic_const, nil, node.loc.expression
553
+ end
554
+
555
+ node.updated(:casgn)
556
+
557
+ when :ident
558
+ name, = *node
559
+ @parser.static_env.declare(name)
560
+
561
+ node.updated(:lvasgn)
562
+
563
+ when :nil, :self, :true, :false,
564
+ :__FILE__, :__LINE__, :__ENCODING__
565
+ diagnostic :error, :invalid_assignment, nil, node.loc.expression
566
+
567
+ when :back_ref, :nth_ref
568
+ diagnostic :error, :backref_assignment, nil, node.loc.expression
569
+ end
570
+ end
571
+
572
+ def const_op_assignable(node)
573
+ node.updated(:casgn)
574
+ end
575
+
576
+ def assign(lhs, eql_t, rhs)
577
+ (lhs << rhs).updated(nil, nil,
578
+ :location => lhs.loc.
579
+ with_operator(loc(eql_t)).
580
+ with_expression(join_exprs(lhs, rhs)))
581
+ end
582
+
583
+ def op_assign(lhs, op_t, rhs)
584
+ case lhs.type
585
+ when :gvasgn, :ivasgn, :lvasgn, :cvasgn, :casgn, :send, :csend, :index
586
+ operator = value(op_t)[0..-1].to_sym
587
+ source_map = lhs.loc.
588
+ with_operator(loc(op_t)).
589
+ with_expression(join_exprs(lhs, rhs))
590
+
591
+ if lhs.type == :index
592
+ lhs = lhs.updated(:indexasgn)
593
+ end
594
+
595
+ case operator
596
+ when :'&&'
597
+ n(:and_asgn, [ lhs, rhs ], source_map)
598
+ when :'||'
599
+ n(:or_asgn, [ lhs, rhs ], source_map)
600
+ else
601
+ n(:op_asgn, [ lhs, operator, rhs ], source_map)
602
+ end
603
+
604
+ when :back_ref, :nth_ref
605
+ diagnostic :error, :backref_assignment, nil, lhs.loc.expression
606
+ end
607
+ end
608
+
609
+ def multi_lhs(begin_t, items, end_t)
610
+ n(:mlhs, [ *items ],
611
+ collection_map(begin_t, items, end_t))
612
+ end
613
+
614
+ def multi_assign(lhs, eql_t, rhs)
615
+ n(:masgn, [ lhs, rhs ],
616
+ binary_op_map(lhs, eql_t, rhs))
617
+ end
618
+
619
+ #
620
+ # Class and module definition
621
+ #
622
+
623
+ def def_class(class_t, name,
624
+ lt_t, superclass,
625
+ body, end_t)
626
+ n(:class, [ name, superclass, body ],
627
+ module_definition_map(class_t, name, lt_t, end_t))
628
+ end
629
+
630
+ def def_sclass(class_t, lshft_t, expr,
631
+ body, end_t)
632
+ n(:sclass, [ expr, body ],
633
+ module_definition_map(class_t, nil, lshft_t, end_t))
634
+ end
635
+
636
+ def def_module(module_t, name,
637
+ body, end_t)
638
+ n(:module, [ name, body ],
639
+ module_definition_map(module_t, name, nil, end_t))
640
+ end
641
+
642
+ #
643
+ # Method (un)definition
644
+ #
645
+
646
+ def def_method(def_t, name_t, args,
647
+ body, end_t)
648
+ n(:def, [ value(name_t).to_sym, args, body ],
649
+ definition_map(def_t, nil, name_t, end_t))
650
+ end
651
+
652
+ def def_singleton(def_t, definee, dot_t,
653
+ name_t, args,
654
+ body, end_t)
655
+ case definee.type
656
+ when :int, :str, :dstr, :sym, :dsym,
657
+ :regexp, :array, :hash
658
+
659
+ diagnostic :error, :singleton_literal, nil, definee.loc.expression
660
+
661
+ else
662
+ n(:defs, [ definee, value(name_t).to_sym, args, body ],
663
+ definition_map(def_t, dot_t, name_t, end_t))
664
+ end
665
+ end
666
+
667
+ def undef_method(undef_t, names)
668
+ n(:undef, [ *names ],
669
+ keyword_map(undef_t, nil, names, nil))
670
+ end
671
+
672
+ def alias(alias_t, to, from)
673
+ n(:alias, [ to, from ],
674
+ keyword_map(alias_t, nil, [to, from], nil))
675
+ end
676
+
677
+ #
678
+ # Formal arguments
679
+ #
680
+
681
+ def args(begin_t, args, end_t, check_args=true)
682
+ args = check_duplicate_args(args) if check_args
683
+ n(:args, args,
684
+ collection_map(begin_t, args, end_t))
685
+ end
686
+
687
+ def numargs(max_numparam)
688
+ n(:numargs, [ max_numparam ], nil)
689
+ end
690
+
691
+ def arg(name_t)
692
+ n(:arg, [ value(name_t).to_sym ],
693
+ variable_map(name_t))
694
+ end
695
+
696
+ def optarg(name_t, eql_t, value)
697
+ n(:optarg, [ value(name_t).to_sym, value ],
698
+ variable_map(name_t).
699
+ with_operator(loc(eql_t)).
700
+ with_expression(loc(name_t).join(value.loc.expression)))
701
+ end
702
+
703
+ def restarg(star_t, name_t=nil)
704
+ if name_t
705
+ n(:restarg, [ value(name_t).to_sym ],
706
+ arg_prefix_map(star_t, name_t))
707
+ else
708
+ n0(:restarg,
709
+ arg_prefix_map(star_t))
710
+ end
711
+ end
712
+
713
+ def kwarg(name_t)
714
+ n(:kwarg, [ value(name_t).to_sym ],
715
+ kwarg_map(name_t))
716
+ end
717
+
718
+ def kwoptarg(name_t, value)
719
+ n(:kwoptarg, [ value(name_t).to_sym, value ],
720
+ kwarg_map(name_t, value))
721
+ end
722
+
723
+ def kwrestarg(dstar_t, name_t=nil)
724
+ if name_t
725
+ n(:kwrestarg, [ value(name_t).to_sym ],
726
+ arg_prefix_map(dstar_t, name_t))
727
+ else
728
+ n0(:kwrestarg,
729
+ arg_prefix_map(dstar_t))
730
+ end
731
+ end
732
+
733
+ def kwnilarg(dstar_t, nil_t)
734
+ n0(:kwnilarg,
735
+ arg_prefix_map(dstar_t, nil_t))
736
+ end
737
+
738
+ def shadowarg(name_t)
739
+ n(:shadowarg, [ value(name_t).to_sym ],
740
+ variable_map(name_t))
741
+ end
742
+
743
+ def blockarg(amper_t, name_t)
744
+ n(:blockarg, [ value(name_t).to_sym ],
745
+ arg_prefix_map(amper_t, name_t))
746
+ end
747
+
748
+ def procarg0(arg)
749
+ if self.class.emit_procarg0
750
+ if arg.type == :arg && self.class.emit_arg_inside_procarg0
751
+ n(:procarg0, [ arg ],
752
+ Source::Map::Collection.new(nil, nil, arg.location.expression))
753
+ else
754
+ arg.updated(:procarg0)
755
+ end
756
+ else
757
+ arg
758
+ end
759
+ end
760
+
761
+ # Ruby 1.8 block arguments
762
+
763
+ def arg_expr(expr)
764
+ if expr.type == :lvasgn
765
+ expr.updated(:arg)
766
+ else
767
+ n(:arg_expr, [ expr ],
768
+ expr.loc.dup)
769
+ end
770
+ end
771
+
772
+ def restarg_expr(star_t, expr=nil)
773
+ if expr.nil?
774
+ n0(:restarg, token_map(star_t))
775
+ elsif expr.type == :lvasgn
776
+ expr.updated(:restarg)
777
+ else
778
+ n(:restarg_expr, [ expr ],
779
+ expr.loc.dup)
780
+ end
781
+ end
782
+
783
+ def blockarg_expr(amper_t, expr)
784
+ if expr.type == :lvasgn
785
+ expr.updated(:blockarg)
786
+ else
787
+ n(:blockarg_expr, [ expr ],
788
+ expr.loc.dup)
789
+ end
790
+ end
791
+
792
+ # MacRuby Objective-C arguments
793
+
794
+ def objc_kwarg(kwname_t, assoc_t, name_t)
795
+ kwname_l = loc(kwname_t)
796
+ if assoc_t.nil? # a: b, not a => b
797
+ kwname_l = kwname_l.resize(kwname_l.size - 1)
798
+ operator_l = kwname_l.end.resize(1)
799
+ else
800
+ operator_l = loc(assoc_t)
801
+ end
802
+
803
+ n(:objc_kwarg, [ value(kwname_t).to_sym, value(name_t).to_sym ],
804
+ Source::Map::ObjcKwarg.new(kwname_l, operator_l, loc(name_t),
805
+ kwname_l.join(loc(name_t))))
806
+ end
807
+
808
+ def objc_restarg(star_t, name=nil)
809
+ if name.nil?
810
+ n0(:restarg, arg_prefix_map(star_t))
811
+ elsif name.type == :arg # regular restarg
812
+ name.updated(:restarg, nil,
813
+ { :location => name.loc.with_operator(loc(star_t)) })
814
+ else # restarg with objc_kwarg inside
815
+ n(:objc_restarg, [ name ],
816
+ unary_op_map(star_t, name))
817
+ end
818
+ end
819
+
820
+ #
821
+ # Method calls
822
+ #
823
+
824
+ def call_type_for_dot(dot_t)
825
+ if !dot_t.nil? && value(dot_t) == :anddot
826
+ :csend
827
+ else
828
+ # This case is a bit tricky. ruby23.y returns the token tDOT with
829
+ # the value :dot, and the token :tANDDOT with the value :anddot.
830
+ #
831
+ # But, ruby{18..22}.y (which unconditionally expect tDOT) just
832
+ # return "." there, since they are to be kept close to the corresponding
833
+ # Ruby MRI grammars.
834
+ #
835
+ # Thankfully, we don't have to care.
836
+ :send
837
+ end
838
+ end
839
+
840
+ def call_method(receiver, dot_t, selector_t,
841
+ lparen_t=nil, args=[], rparen_t=nil)
842
+ type = call_type_for_dot(dot_t)
843
+ if selector_t.nil?
844
+ n(type, [ receiver, :call, *args ],
845
+ send_map(receiver, dot_t, nil, lparen_t, args, rparen_t))
846
+ else
847
+ n(type, [ receiver, value(selector_t).to_sym, *args ],
848
+ send_map(receiver, dot_t, selector_t, lparen_t, args, rparen_t))
849
+ end
850
+ end
851
+
852
+ def call_lambda(lambda_t)
853
+ if self.class.emit_lambda
854
+ n0(:lambda, expr_map(loc(lambda_t)))
855
+ else
856
+ n(:send, [ nil, :lambda ],
857
+ send_map(nil, nil, lambda_t))
858
+ end
859
+ end
860
+
861
+ def block(method_call, begin_t, args, body, end_t)
862
+ _receiver, _selector, *call_args = *method_call
863
+
864
+ if method_call.type == :yield
865
+ diagnostic :error, :block_given_to_yield, nil, method_call.loc.keyword, [loc(begin_t)]
866
+ end
867
+
868
+ last_arg = call_args.last
869
+ if last_arg && last_arg.type == :block_pass
870
+ diagnostic :error, :block_and_blockarg, nil, last_arg.loc.expression, [loc(begin_t)]
871
+ end
872
+
873
+
874
+ if args.type == :numargs
875
+ block_type = :numblock
876
+ args = args.children[0]
877
+ else
878
+ block_type = :block
879
+ end
880
+
881
+ if [:send, :csend, :index, :super, :zsuper, :lambda].include?(method_call.type)
882
+ n(block_type, [ method_call, args, body ],
883
+ block_map(method_call.loc.expression, begin_t, end_t))
884
+ else
885
+ # Code like "return foo 1 do end" is reduced in a weird sequence.
886
+ # Here, method_call is actually (return).
887
+ actual_send, = *method_call
888
+ block =
889
+ n(block_type, [ actual_send, args, body ],
890
+ block_map(actual_send.loc.expression, begin_t, end_t))
891
+
892
+ n(method_call.type, [ block ],
893
+ method_call.loc.with_expression(join_exprs(method_call, block)))
894
+ end
895
+ end
896
+
897
+ def block_pass(amper_t, arg)
898
+ n(:block_pass, [ arg ],
899
+ unary_op_map(amper_t, arg))
900
+ end
901
+
902
+ def objc_varargs(pair, rest_of_varargs)
903
+ value, first_vararg = *pair
904
+ vararg_array = array(nil, [ first_vararg, *rest_of_varargs ], nil).
905
+ updated(:objc_varargs)
906
+ pair.updated(nil, [ value, vararg_array ],
907
+ { :location => pair.loc.with_expression(
908
+ pair.loc.expression.join(vararg_array.loc.expression)) })
909
+ end
910
+
911
+ def attr_asgn(receiver, dot_t, selector_t)
912
+ method_name = (value(selector_t) + '=').to_sym
913
+ type = call_type_for_dot(dot_t)
914
+
915
+ # Incomplete method call.
916
+ n(type, [ receiver, method_name ],
917
+ send_map(receiver, dot_t, selector_t))
918
+ end
919
+
920
+ def index(receiver, lbrack_t, indexes, rbrack_t)
921
+ if self.class.emit_index
922
+ n(:index, [ receiver, *indexes ],
923
+ index_map(receiver, lbrack_t, rbrack_t))
924
+ else
925
+ n(:send, [ receiver, :[], *indexes ],
926
+ send_index_map(receiver, lbrack_t, rbrack_t))
927
+ end
928
+ end
929
+
930
+ def index_asgn(receiver, lbrack_t, indexes, rbrack_t)
931
+ if self.class.emit_index
932
+ n(:indexasgn, [ receiver, *indexes ],
933
+ index_map(receiver, lbrack_t, rbrack_t))
934
+ else
935
+ # Incomplete method call.
936
+ n(:send, [ receiver, :[]=, *indexes ],
937
+ send_index_map(receiver, lbrack_t, rbrack_t))
938
+ end
939
+ end
940
+
941
+ def binary_op(receiver, operator_t, arg)
942
+ source_map = send_binary_op_map(receiver, operator_t, arg)
943
+
944
+ if @parser.version == 18
945
+ operator = value(operator_t)
946
+
947
+ if operator == '!='
948
+ method_call = n(:send, [ receiver, :==, arg ], source_map)
949
+ elsif operator == '!~'
950
+ method_call = n(:send, [ receiver, :=~, arg ], source_map)
951
+ end
952
+
953
+ if %w(!= !~).include?(operator)
954
+ return n(:not, [ method_call ],
955
+ expr_map(source_map.expression))
956
+ end
957
+ end
958
+
959
+ n(:send, [ receiver, value(operator_t).to_sym, arg ],
960
+ source_map)
961
+ end
962
+
963
+ def match_op(receiver, match_t, arg)
964
+ source_map = send_binary_op_map(receiver, match_t, arg)
965
+
966
+ if (regexp = static_regexp_node(receiver))
967
+ regexp.names.each do |name|
968
+ @parser.static_env.declare(name)
969
+ end
970
+
971
+ n(:match_with_lvasgn, [ receiver, arg ],
972
+ source_map)
973
+ else
974
+ n(:send, [ receiver, :=~, arg ],
975
+ source_map)
976
+ end
977
+ end
978
+
979
+ def unary_op(op_t, receiver)
980
+ case value(op_t)
981
+ when '+', '-'
982
+ method = value(op_t) + '@'
983
+ else
984
+ method = value(op_t)
985
+ end
986
+
987
+ n(:send, [ receiver, method.to_sym ],
988
+ send_unary_op_map(op_t, receiver))
989
+ end
990
+
991
+ def not_op(not_t, begin_t=nil, receiver=nil, end_t=nil)
992
+ if @parser.version == 18
993
+ n(:not, [ check_condition(receiver) ],
994
+ unary_op_map(not_t, receiver))
995
+ else
996
+ if receiver.nil?
997
+ nil_node = n0(:begin, collection_map(begin_t, nil, end_t))
998
+
999
+ n(:send, [
1000
+ nil_node, :'!'
1001
+ ], send_unary_op_map(not_t, nil_node))
1002
+ else
1003
+ n(:send, [ check_condition(receiver), :'!' ],
1004
+ send_map(nil, nil, not_t, begin_t, [receiver], end_t))
1005
+ end
1006
+ end
1007
+ end
1008
+
1009
+ def method_ref(receiver, dot_t, selector_t)
1010
+ n(:meth_ref, [ receiver, value(selector_t).to_sym ],
1011
+ send_map(receiver, dot_t, selector_t, nil, [], nil))
1012
+ end
1013
+
1014
+ #
1015
+ # Control flow
1016
+ #
1017
+
1018
+ # Logical operations: and, or
1019
+
1020
+ def logical_op(type, lhs, op_t, rhs)
1021
+ n(type, [ lhs, rhs ],
1022
+ binary_op_map(lhs, op_t, rhs))
1023
+ end
1024
+
1025
+ # Conditionals
1026
+
1027
+ def condition(cond_t, cond, then_t,
1028
+ if_true, else_t, if_false, end_t)
1029
+ n(:if, [ check_condition(cond), if_true, if_false ],
1030
+ condition_map(cond_t, cond, then_t, if_true, else_t, if_false, end_t))
1031
+ end
1032
+
1033
+ def condition_mod(if_true, if_false, cond_t, cond)
1034
+ n(:if, [ check_condition(cond), if_true, if_false ],
1035
+ keyword_mod_map(if_true || if_false, cond_t, cond))
1036
+ end
1037
+
1038
+ def ternary(cond, question_t, if_true, colon_t, if_false)
1039
+ n(:if, [ check_condition(cond), if_true, if_false ],
1040
+ ternary_map(cond, question_t, if_true, colon_t, if_false))
1041
+ end
1042
+
1043
+ # Case matching
1044
+
1045
+ def when(when_t, patterns, then_t, body)
1046
+ children = patterns << body
1047
+ n(:when, children,
1048
+ keyword_map(when_t, then_t, children, nil))
1049
+ end
1050
+
1051
+ def case(case_t, expr, when_bodies, else_t, else_body, end_t)
1052
+ n(:case, [ expr, *(when_bodies << else_body)],
1053
+ condition_map(case_t, expr, nil, nil, else_t, else_body, end_t))
1054
+ end
1055
+
1056
+ # Loops
1057
+
1058
+ def loop(type, keyword_t, cond, do_t, body, end_t)
1059
+ n(type, [ check_condition(cond), body ],
1060
+ keyword_map(keyword_t, do_t, nil, end_t))
1061
+ end
1062
+
1063
+ def loop_mod(type, body, keyword_t, cond)
1064
+ if body.type == :kwbegin
1065
+ type = :"#{type}_post"
1066
+ end
1067
+
1068
+ n(type, [ check_condition(cond), body ],
1069
+ keyword_mod_map(body, keyword_t, cond))
1070
+ end
1071
+
1072
+ def for(for_t, iterator, in_t, iteratee,
1073
+ do_t, body, end_t)
1074
+ n(:for, [ iterator, iteratee, body ],
1075
+ for_map(for_t, in_t, do_t, end_t))
1076
+ end
1077
+
1078
+ # Keywords
1079
+
1080
+ def keyword_cmd(type, keyword_t, lparen_t=nil, args=[], rparen_t=nil)
1081
+ if type == :yield && args.count > 0
1082
+ last_arg = args.last
1083
+ if last_arg.type == :block_pass
1084
+ diagnostic :error, :block_given_to_yield, nil, loc(keyword_t), [last_arg.loc.expression]
1085
+ end
1086
+ end
1087
+
1088
+ n(type, args,
1089
+ keyword_map(keyword_t, lparen_t, args, rparen_t))
1090
+ end
1091
+
1092
+ # BEGIN, END
1093
+
1094
+ def preexe(preexe_t, lbrace_t, compstmt, rbrace_t)
1095
+ n(:preexe, [ compstmt ],
1096
+ keyword_map(preexe_t, lbrace_t, [], rbrace_t))
1097
+ end
1098
+
1099
+ def postexe(postexe_t, lbrace_t, compstmt, rbrace_t)
1100
+ n(:postexe, [ compstmt ],
1101
+ keyword_map(postexe_t, lbrace_t, [], rbrace_t))
1102
+ end
1103
+
1104
+ # Exception handling
1105
+
1106
+ def rescue_body(rescue_t,
1107
+ exc_list, assoc_t, exc_var,
1108
+ then_t, compound_stmt)
1109
+ n(:resbody, [ exc_list, exc_var, compound_stmt ],
1110
+ rescue_body_map(rescue_t, exc_list, assoc_t,
1111
+ exc_var, then_t, compound_stmt))
1112
+ end
1113
+
1114
+ def begin_body(compound_stmt, rescue_bodies=[],
1115
+ else_t=nil, else_=nil,
1116
+ ensure_t=nil, ensure_=nil)
1117
+ if rescue_bodies.any?
1118
+ if else_t
1119
+ compound_stmt =
1120
+ n(:rescue,
1121
+ [ compound_stmt, *(rescue_bodies + [ else_ ]) ],
1122
+ eh_keyword_map(compound_stmt, nil, rescue_bodies, else_t, else_))
1123
+ else
1124
+ compound_stmt =
1125
+ n(:rescue,
1126
+ [ compound_stmt, *(rescue_bodies + [ nil ]) ],
1127
+ eh_keyword_map(compound_stmt, nil, rescue_bodies, nil, nil))
1128
+ end
1129
+ elsif else_t
1130
+ statements = []
1131
+ if !compound_stmt.nil?
1132
+ if compound_stmt.type == :begin
1133
+ statements += compound_stmt.children
1134
+ else
1135
+ statements.push(compound_stmt)
1136
+ end
1137
+ end
1138
+ statements.push(
1139
+ n(:begin, [ else_ ],
1140
+ collection_map(else_t, [ else_ ], nil)))
1141
+ compound_stmt =
1142
+ n(:begin, statements,
1143
+ collection_map(nil, statements, nil))
1144
+ end
1145
+
1146
+ if ensure_t
1147
+ compound_stmt =
1148
+ n(:ensure,
1149
+ [ compound_stmt, ensure_ ],
1150
+ eh_keyword_map(compound_stmt, ensure_t, [ ensure_ ], nil, nil))
1151
+ end
1152
+
1153
+ compound_stmt
1154
+ end
1155
+
1156
+ #
1157
+ # Expression grouping
1158
+ #
1159
+
1160
+ def compstmt(statements)
1161
+ case
1162
+ when statements.none?
1163
+ nil
1164
+ when statements.one?
1165
+ statements.first
1166
+ else
1167
+ n(:begin, statements,
1168
+ collection_map(nil, statements, nil))
1169
+ end
1170
+ end
1171
+
1172
+ def begin(begin_t, body, end_t)
1173
+ if body.nil?
1174
+ # A nil expression: `()'.
1175
+ n0(:begin,
1176
+ collection_map(begin_t, nil, end_t))
1177
+ elsif body.type == :mlhs ||
1178
+ (body.type == :begin &&
1179
+ body.loc.begin.nil? && body.loc.end.nil?)
1180
+ # Synthesized (begin) from compstmt "a; b" or (mlhs)
1181
+ # from multi_lhs "(a, b) = *foo".
1182
+ n(body.type, body.children,
1183
+ collection_map(begin_t, body.children, end_t))
1184
+ else
1185
+ n(:begin, [ body ],
1186
+ collection_map(begin_t, [ body ], end_t))
1187
+ end
1188
+ end
1189
+
1190
+ def begin_keyword(begin_t, body, end_t)
1191
+ if body.nil?
1192
+ # A nil expression: `begin end'.
1193
+ n0(:kwbegin,
1194
+ collection_map(begin_t, nil, end_t))
1195
+ elsif (body.type == :begin &&
1196
+ body.loc.begin.nil? && body.loc.end.nil?)
1197
+ # Synthesized (begin) from compstmt "a; b".
1198
+ n(:kwbegin, body.children,
1199
+ collection_map(begin_t, body.children, end_t))
1200
+ else
1201
+ n(:kwbegin, [ body ],
1202
+ collection_map(begin_t, [ body ], end_t))
1203
+ end
1204
+ end
1205
+
1206
+ private
1207
+
1208
+ #
1209
+ # VERIFICATION
1210
+ #
1211
+
1212
+ def check_condition(cond)
1213
+ case cond.type
1214
+ when :masgn
1215
+ if @parser.version <= 23
1216
+ diagnostic :error, :masgn_as_condition, nil, cond.loc.expression
1217
+ else
1218
+ cond
1219
+ end
1220
+
1221
+ when :begin
1222
+ if cond.children.count == 1
1223
+ cond.updated(nil, [
1224
+ check_condition(cond.children.last)
1225
+ ])
1226
+ else
1227
+ cond
1228
+ end
1229
+
1230
+ when :and, :or, :irange, :erange
1231
+ lhs, rhs = *cond
1232
+
1233
+ type = case cond.type
1234
+ when :irange then :iflipflop
1235
+ when :erange then :eflipflop
1236
+ end
1237
+
1238
+ if [:and, :or].include?(cond.type) &&
1239
+ @parser.version == 18
1240
+ cond
1241
+ else
1242
+ cond.updated(type, [
1243
+ check_condition(lhs),
1244
+ check_condition(rhs)
1245
+ ])
1246
+ end
1247
+
1248
+ when :regexp
1249
+ n(:match_current_line, [ cond ], expr_map(cond.loc.expression))
1250
+
1251
+ else
1252
+ cond
1253
+ end
1254
+ end
1255
+
1256
+ def check_duplicate_args(args, map={})
1257
+ args.each do |this_arg|
1258
+ case this_arg.type
1259
+ when :arg, :optarg, :restarg, :blockarg,
1260
+ :kwarg, :kwoptarg, :kwrestarg,
1261
+ :shadowarg
1262
+
1263
+ check_duplicate_arg(this_arg, map)
1264
+
1265
+ when :procarg0
1266
+
1267
+ if this_arg.children[0].is_a?(Symbol)
1268
+ # s(:procarg0, :a)
1269
+ check_duplicate_arg(this_arg, map)
1270
+ else
1271
+ # s(:procarg0, s(:arg, :a), ...)
1272
+ check_duplicate_args(this_arg.children, map)
1273
+ end
1274
+
1275
+ when :mlhs
1276
+ check_duplicate_args(this_arg.children, map)
1277
+ end
1278
+ end
1279
+ end
1280
+
1281
+ def check_duplicate_arg(this_arg, map={})
1282
+ this_name, = *this_arg
1283
+
1284
+ that_arg = map[this_name]
1285
+ that_name, = *that_arg
1286
+
1287
+ if that_arg.nil?
1288
+ map[this_name] = this_arg
1289
+ elsif arg_name_collides?(this_name, that_name)
1290
+ diagnostic :error, :duplicate_argument, nil,
1291
+ this_arg.loc.name, [ that_arg.loc.name ]
1292
+ end
1293
+ end
1294
+
1295
+ def arg_name_collides?(this_name, that_name)
1296
+ case @parser.version
1297
+ when 18
1298
+ this_name == that_name
1299
+ when 19
1300
+ # Ignore underscore.
1301
+ this_name != :_ &&
1302
+ this_name == that_name
1303
+ else
1304
+ # Ignore everything beginning with underscore.
1305
+ this_name && this_name[0] != '_' &&
1306
+ this_name == that_name
1307
+ end
1308
+ end
1309
+
1310
+ #
1311
+ # SOURCE MAPS
1312
+ #
1313
+
1314
+ def n(type, children, source_map)
1315
+ AST::Node.new(type, children, :location => source_map)
1316
+ end
1317
+
1318
+ def n0(type, source_map)
1319
+ n(type, [], source_map)
1320
+ end
1321
+
1322
+ def join_exprs(left_expr, right_expr)
1323
+ left_expr.loc.expression.
1324
+ join(right_expr.loc.expression)
1325
+ end
1326
+
1327
+ def token_map(token)
1328
+ Source::Map.new(loc(token))
1329
+ end
1330
+
1331
+ def delimited_string_map(string_t)
1332
+ str_range = loc(string_t)
1333
+
1334
+ begin_l = str_range.with(end_pos: str_range.begin_pos + 1)
1335
+
1336
+ end_l = str_range.with(begin_pos: str_range.end_pos - 1)
1337
+
1338
+ Source::Map::Collection.new(begin_l, end_l,
1339
+ loc(string_t))
1340
+ end
1341
+
1342
+ def prefix_string_map(symbol)
1343
+ str_range = loc(symbol)
1344
+
1345
+ begin_l = str_range.with(end_pos: str_range.begin_pos + 1)
1346
+
1347
+ Source::Map::Collection.new(begin_l, nil,
1348
+ loc(symbol))
1349
+ end
1350
+
1351
+ def unquoted_map(token)
1352
+ Source::Map::Collection.new(nil, nil,
1353
+ loc(token))
1354
+ end
1355
+
1356
+ def pair_keyword_map(key_t, value_e)
1357
+ key_range = loc(key_t)
1358
+
1359
+ key_l = key_range.adjust(end_pos: -1)
1360
+
1361
+ colon_l = key_range.with(begin_pos: key_range.end_pos - 1)
1362
+
1363
+ [ # key map
1364
+ Source::Map::Collection.new(nil, nil,
1365
+ key_l),
1366
+ # pair map
1367
+ Source::Map::Operator.new(colon_l,
1368
+ key_range.join(value_e.loc.expression)) ]
1369
+ end
1370
+
1371
+ def pair_quoted_map(begin_t, end_t, value_e)
1372
+ end_l = loc(end_t)
1373
+
1374
+ quote_l = end_l.with(begin_pos: end_l.end_pos - 2,
1375
+ end_pos: end_l.end_pos - 1)
1376
+
1377
+ colon_l = end_l.with(begin_pos: end_l.end_pos - 1)
1378
+
1379
+ [ # modified end token
1380
+ [ value(end_t), quote_l ],
1381
+ # pair map
1382
+ Source::Map::Operator.new(colon_l,
1383
+ loc(begin_t).join(value_e.loc.expression)) ]
1384
+ end
1385
+
1386
+ def expr_map(loc)
1387
+ Source::Map.new(loc)
1388
+ end
1389
+
1390
+ def collection_map(begin_t, parts, end_t)
1391
+ if begin_t.nil? || end_t.nil?
1392
+ if parts.any?
1393
+ expr_l = join_exprs(parts.first, parts.last)
1394
+ elsif !begin_t.nil?
1395
+ expr_l = loc(begin_t)
1396
+ elsif !end_t.nil?
1397
+ expr_l = loc(end_t)
1398
+ end
1399
+ else
1400
+ expr_l = loc(begin_t).join(loc(end_t))
1401
+ end
1402
+
1403
+ Source::Map::Collection.new(loc(begin_t), loc(end_t), expr_l)
1404
+ end
1405
+
1406
+ def string_map(begin_t, parts, end_t)
1407
+ if begin_t && value(begin_t).start_with?('<<')
1408
+ if parts.any?
1409
+ expr_l = join_exprs(parts.first, parts.last)
1410
+ else
1411
+ expr_l = loc(end_t).begin
1412
+ end
1413
+
1414
+ Source::Map::Heredoc.new(loc(begin_t), expr_l, loc(end_t))
1415
+ else
1416
+ collection_map(begin_t, parts, end_t)
1417
+ end
1418
+ end
1419
+
1420
+ def regexp_map(begin_t, end_t, options_e)
1421
+ Source::Map::Collection.new(loc(begin_t), loc(end_t),
1422
+ loc(begin_t).join(options_e.loc.expression))
1423
+ end
1424
+
1425
+ def constant_map(scope, colon2_t, name_t)
1426
+ if scope.nil?
1427
+ expr_l = loc(name_t)
1428
+ else
1429
+ expr_l = scope.loc.expression.join(loc(name_t))
1430
+ end
1431
+
1432
+ Source::Map::Constant.new(loc(colon2_t), loc(name_t), expr_l)
1433
+ end
1434
+
1435
+ def variable_map(name_t)
1436
+ Source::Map::Variable.new(loc(name_t))
1437
+ end
1438
+
1439
+ def binary_op_map(left_e, op_t, right_e)
1440
+ Source::Map::Operator.new(loc(op_t), join_exprs(left_e, right_e))
1441
+ end
1442
+
1443
+ def unary_op_map(op_t, arg_e=nil)
1444
+ if arg_e.nil?
1445
+ expr_l = loc(op_t)
1446
+ else
1447
+ expr_l = loc(op_t).join(arg_e.loc.expression)
1448
+ end
1449
+
1450
+ Source::Map::Operator.new(loc(op_t), expr_l)
1451
+ end
1452
+
1453
+ def range_map(start_e, op_t, end_e)
1454
+ if start_e && end_e
1455
+ expr_l = join_exprs(start_e, end_e)
1456
+ elsif start_e
1457
+ expr_l = start_e.loc.expression.join(loc(op_t))
1458
+ elsif end_e
1459
+ expr_l = loc(op_t).join(end_e.loc.expression)
1460
+ end
1461
+
1462
+ Source::Map::Operator.new(loc(op_t), expr_l)
1463
+ end
1464
+
1465
+ def arg_prefix_map(op_t, name_t=nil)
1466
+ if name_t.nil?
1467
+ expr_l = loc(op_t)
1468
+ else
1469
+ expr_l = loc(op_t).join(loc(name_t))
1470
+ end
1471
+
1472
+ Source::Map::Variable.new(loc(name_t), expr_l)
1473
+ end
1474
+
1475
+ def kwarg_map(name_t, value_e=nil)
1476
+ label_range = loc(name_t)
1477
+ name_range = label_range.adjust(end_pos: -1)
1478
+
1479
+ if value_e
1480
+ expr_l = loc(name_t).join(value_e.loc.expression)
1481
+ else
1482
+ expr_l = loc(name_t)
1483
+ end
1484
+
1485
+ Source::Map::Variable.new(name_range, expr_l)
1486
+ end
1487
+
1488
+ def module_definition_map(keyword_t, name_e, operator_t, end_t)
1489
+ if name_e
1490
+ name_l = name_e.loc.expression
1491
+ end
1492
+
1493
+ Source::Map::Definition.new(loc(keyword_t),
1494
+ loc(operator_t), name_l,
1495
+ loc(end_t))
1496
+ end
1497
+
1498
+ def definition_map(keyword_t, operator_t, name_t, end_t)
1499
+ Source::Map::Definition.new(loc(keyword_t),
1500
+ loc(operator_t), loc(name_t),
1501
+ loc(end_t))
1502
+ end
1503
+
1504
+ def send_map(receiver_e, dot_t, selector_t, begin_t=nil, args=[], end_t=nil)
1505
+ if receiver_e
1506
+ begin_l = receiver_e.loc.expression
1507
+ elsif selector_t
1508
+ begin_l = loc(selector_t)
1509
+ end
1510
+
1511
+ if end_t
1512
+ end_l = loc(end_t)
1513
+ elsif args.any?
1514
+ end_l = args.last.loc.expression
1515
+ elsif selector_t
1516
+ end_l = loc(selector_t)
1517
+ end
1518
+
1519
+ Source::Map::Send.new(loc(dot_t), loc(selector_t),
1520
+ loc(begin_t), loc(end_t),
1521
+ begin_l.join(end_l))
1522
+ end
1523
+
1524
+ def var_send_map(variable_e)
1525
+ Source::Map::Send.new(nil, variable_e.loc.expression,
1526
+ nil, nil,
1527
+ variable_e.loc.expression)
1528
+ end
1529
+
1530
+ def send_binary_op_map(lhs_e, selector_t, rhs_e)
1531
+ Source::Map::Send.new(nil, loc(selector_t),
1532
+ nil, nil,
1533
+ join_exprs(lhs_e, rhs_e))
1534
+ end
1535
+
1536
+ def send_unary_op_map(selector_t, arg_e)
1537
+ if arg_e.nil?
1538
+ expr_l = loc(selector_t)
1539
+ else
1540
+ expr_l = loc(selector_t).join(arg_e.loc.expression)
1541
+ end
1542
+
1543
+ Source::Map::Send.new(nil, loc(selector_t),
1544
+ nil, nil,
1545
+ expr_l)
1546
+ end
1547
+
1548
+ def index_map(receiver_e, lbrack_t, rbrack_t)
1549
+ Source::Map::Index.new(loc(lbrack_t), loc(rbrack_t),
1550
+ receiver_e.loc.expression.join(loc(rbrack_t)))
1551
+ end
1552
+
1553
+ def send_index_map(receiver_e, lbrack_t, rbrack_t)
1554
+ Source::Map::Send.new(nil, loc(lbrack_t).join(loc(rbrack_t)),
1555
+ nil, nil,
1556
+ receiver_e.loc.expression.join(loc(rbrack_t)))
1557
+ end
1558
+
1559
+ def block_map(receiver_l, begin_t, end_t)
1560
+ Source::Map::Collection.new(loc(begin_t), loc(end_t),
1561
+ receiver_l.join(loc(end_t)))
1562
+ end
1563
+
1564
+ def keyword_map(keyword_t, begin_t, args, end_t)
1565
+ args ||= []
1566
+
1567
+ if end_t
1568
+ end_l = loc(end_t)
1569
+ elsif args.any? && !args.last.nil?
1570
+ end_l = args.last.loc.expression
1571
+ elsif args.any? && args.count > 1
1572
+ end_l = args[-2].loc.expression
1573
+ else
1574
+ end_l = loc(keyword_t)
1575
+ end
1576
+
1577
+ Source::Map::Keyword.new(loc(keyword_t), loc(begin_t), loc(end_t),
1578
+ loc(keyword_t).join(end_l))
1579
+ end
1580
+
1581
+ def keyword_mod_map(pre_e, keyword_t, post_e)
1582
+ Source::Map::Keyword.new(loc(keyword_t), nil, nil,
1583
+ join_exprs(pre_e, post_e))
1584
+ end
1585
+
1586
+ def condition_map(keyword_t, cond_e, begin_t, body_e, else_t, else_e, end_t)
1587
+ if end_t
1588
+ end_l = loc(end_t)
1589
+ elsif else_e && else_e.loc.expression
1590
+ end_l = else_e.loc.expression
1591
+ elsif loc(else_t)
1592
+ end_l = loc(else_t)
1593
+ elsif body_e && body_e.loc.expression
1594
+ end_l = body_e.loc.expression
1595
+ elsif loc(begin_t)
1596
+ end_l = loc(begin_t)
1597
+ else
1598
+ end_l = cond_e.loc.expression
1599
+ end
1600
+
1601
+ Source::Map::Condition.new(loc(keyword_t),
1602
+ loc(begin_t), loc(else_t), loc(end_t),
1603
+ loc(keyword_t).join(end_l))
1604
+ end
1605
+
1606
+ def ternary_map(begin_e, question_t, mid_e, colon_t, end_e)
1607
+ Source::Map::Ternary.new(loc(question_t), loc(colon_t),
1608
+ join_exprs(begin_e, end_e))
1609
+ end
1610
+
1611
+ def for_map(keyword_t, in_t, begin_t, end_t)
1612
+ Source::Map::For.new(loc(keyword_t), loc(in_t),
1613
+ loc(begin_t), loc(end_t),
1614
+ loc(keyword_t).join(loc(end_t)))
1615
+ end
1616
+
1617
+ def rescue_body_map(keyword_t, exc_list_e, assoc_t,
1618
+ exc_var_e, then_t,
1619
+ compstmt_e)
1620
+ end_l = compstmt_e.loc.expression if compstmt_e
1621
+ end_l = loc(then_t) if end_l.nil? && then_t
1622
+ end_l = exc_var_e.loc.expression if end_l.nil? && exc_var_e
1623
+ end_l = exc_list_e.loc.expression if end_l.nil? && exc_list_e
1624
+ end_l = loc(keyword_t) if end_l.nil?
1625
+
1626
+ Source::Map::RescueBody.new(loc(keyword_t), loc(assoc_t), loc(then_t),
1627
+ loc(keyword_t).join(end_l))
1628
+ end
1629
+
1630
+ def eh_keyword_map(compstmt_e, keyword_t, body_es,
1631
+ else_t, else_e)
1632
+ if compstmt_e.nil?
1633
+ if keyword_t.nil?
1634
+ begin_l = body_es.first.loc.expression
1635
+ else
1636
+ begin_l = loc(keyword_t)
1637
+ end
1638
+ else
1639
+ begin_l = compstmt_e.loc.expression
1640
+ end
1641
+
1642
+ if else_t
1643
+ if else_e.nil?
1644
+ end_l = loc(else_t)
1645
+ else
1646
+ end_l = else_e.loc.expression
1647
+ end
1648
+ elsif !body_es.last.nil?
1649
+ end_l = body_es.last.loc.expression
1650
+ else
1651
+ end_l = loc(keyword_t)
1652
+ end
1653
+
1654
+ Source::Map::Condition.new(loc(keyword_t), nil, loc(else_t), nil,
1655
+ begin_l.join(end_l))
1656
+ end
1657
+
1658
+ #
1659
+ # HELPERS
1660
+ #
1661
+
1662
+ # Extract a static string from e.g. a regular expression,
1663
+ # honoring the fact that MRI expands interpolations like #{""}
1664
+ # at parse time.
1665
+ def static_string(nodes)
1666
+ nodes.map do |node|
1667
+ case node.type
1668
+ when :str
1669
+ node.children[0]
1670
+ when :begin
1671
+ if (string = static_string(node.children))
1672
+ string
1673
+ else
1674
+ return nil
1675
+ end
1676
+ else
1677
+ return nil
1678
+ end
1679
+ end.join
1680
+ end
1681
+
1682
+ def static_regexp(parts, options)
1683
+ source = static_string(parts)
1684
+ return nil if source.nil?
1685
+
1686
+ source = case
1687
+ when options.children.include?(:u)
1688
+ source.encode(Encoding::UTF_8)
1689
+ when options.children.include?(:e)
1690
+ source.encode(Encoding::EUC_JP)
1691
+ when options.children.include?(:s)
1692
+ source.encode(Encoding::WINDOWS_31J)
1693
+ when options.children.include?(:n)
1694
+ source.encode(Encoding::BINARY)
1695
+ else
1696
+ source
1697
+ end
1698
+
1699
+ Regexp.new(source, (Regexp::EXTENDED if options.children.include?(:x)))
1700
+ end
1701
+
1702
+ def static_regexp_node(node)
1703
+ if node.type == :regexp
1704
+ parts, options = node.children[0..-2], node.children[-1]
1705
+ static_regexp(parts, options)
1706
+ end
1707
+ end
1708
+
1709
+ def collapse_string_parts?(parts)
1710
+ parts.one? &&
1711
+ [:str, :dstr].include?(parts.first.type)
1712
+ end
1713
+
1714
+ def value(token)
1715
+ token[0]
1716
+ end
1717
+
1718
+ def string_value(token)
1719
+ unless token[0].valid_encoding?
1720
+ diagnostic(:error, :invalid_encoding, nil, token[1])
1721
+ end
1722
+
1723
+ token[0]
1724
+ end
1725
+
1726
+ def loc(token)
1727
+ # Pass through `nil`s and return nil for tNL.
1728
+ token[1] if token && token[0]
1729
+ end
1730
+
1731
+ def diagnostic(type, reason, arguments, location, highlights=[])
1732
+ @parser.diagnostics.process(
1733
+ Diagnostic.new(type, reason, arguments, location, highlights))
1734
+
1735
+ if type == :error
1736
+ @parser.send :yyerror
1737
+ end
1738
+ end
1739
+ end
1740
+
1741
+ end