brakeman 4.4.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of brakeman might be problematic. Click here for more details.

Files changed (362) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +17 -0
  3. data/bundle/load.rb +7 -8
  4. data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/History.rdoc +8 -0
  5. data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/Manifest.txt +0 -0
  6. data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/README.rdoc +0 -0
  7. data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/lib/ruby2ruby.rb +34 -36
  8. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/History.rdoc +47 -0
  9. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/Manifest.txt +5 -4
  10. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/README.rdoc +0 -0
  11. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/compare/normalize.rb +29 -2
  12. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/debugging.md +18 -0
  13. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/rp_extensions.rb +0 -7
  14. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/rp_stringscanner.rb +0 -0
  15. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby20_parser.rb +6874 -0
  16. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby20_parser.y +284 -201
  17. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby21_parser.rb +6952 -0
  18. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby21_parser.y +281 -197
  19. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby22_parser.rb +6983 -0
  20. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib/ruby_parser.yy → ruby_parser-3.13.0/lib/ruby22_parser.y} +280 -306
  21. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby23_parser.rb +6982 -0
  22. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby23_parser.y +282 -203
  23. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby24_parser.rb +6982 -0
  24. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby24_parser.y +282 -203
  25. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby25_parser.rb +6981 -0
  26. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby25_parser.y +282 -203
  27. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby26_parser.rb +6999 -0
  28. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby26_parser.y +2469 -0
  29. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_lexer.rb +116 -118
  30. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_lexer.rex +10 -8
  31. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_lexer.rex.rb +8 -8
  32. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_parser.rb +5 -7
  33. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby_parser.yy +2571 -0
  34. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby_parser_extras.rb +1360 -0
  35. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/tools/munge.rb +216 -0
  36. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/tools/ripper.rb +23 -0
  37. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/History.rdoc +6 -0
  38. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/Manifest.txt +19 -0
  39. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/README.rdoc +54 -0
  40. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy.rb +5 -0
  41. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby18_parser.rb +7 -6
  42. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby18_parser.y +5 -4
  43. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby19_parser.rb +7 -6
  44. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby19_parser.y +5 -4
  45. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rb +1412 -0
  46. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rex +179 -0
  47. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rex.rb +323 -0
  48. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_parser.rb +30 -0
  49. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby_parser_extras.rb +43 -33
  50. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/CHANGES.md +5 -0
  51. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/Gemfile +0 -0
  52. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/LICENSE.txt +0 -0
  53. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/README.md +0 -0
  54. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/bundle_install_all_ruby_versions.sh +0 -0
  55. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml.rb +0 -0
  56. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/deep.rb +0 -0
  57. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/libyaml_checker.rb +0 -0
  58. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/load.rb +0 -0
  59. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/parse/date.rb +2 -0
  60. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/parse/hexadecimal.rb +0 -0
  61. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/parse/sexagesimal.rb +0 -0
  62. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/psych_handler.rb +0 -0
  63. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/psych_resolver.rb +0 -0
  64. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/resolver.rb +0 -0
  65. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/safe_to_ruby_visitor.rb +0 -0
  66. data/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb +39 -0
  67. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/syck_hack.rb +0 -0
  68. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/syck_node_monkeypatch.rb +0 -0
  69. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/syck_resolver.rb +0 -0
  70. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform.rb +0 -0
  71. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_boolean.rb +0 -0
  72. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_date.rb +0 -0
  73. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_float.rb +0 -0
  74. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_integer.rb +0 -0
  75. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_nil.rb +0 -0
  76. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_symbol.rb +0 -0
  77. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/transformation_map.rb +0 -0
  78. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/version.rb +1 -1
  79. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/run_specs_all_ruby_versions.sh +0 -0
  80. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/safe_yaml.gemspec +0 -0
  81. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/History.rdoc +8 -0
  82. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/Manifest.txt +0 -0
  83. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/README.rdoc +0 -0
  84. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/composite_sexp_processor.rb +0 -0
  85. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/pt_testcase.rb +2 -2
  86. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/sexp.rb +4 -4
  87. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/sexp_processor.rb +1 -1
  88. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/strict_sexp.rb +3 -3
  89. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/unique.rb +0 -0
  90. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/CHANGES +6 -0
  91. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/EXPRESSIONS.md +1 -1
  92. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/Gemfile +0 -0
  93. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/LICENSE +0 -0
  94. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/README.md +1 -1
  95. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple.rb +0 -0
  96. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/engine.rb +0 -0
  97. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/engine.rb +0 -0
  98. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/parser.rb +0 -0
  99. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/template.rb +0 -0
  100. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/trimming.rb +0 -0
  101. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/exceptions.rb +0 -0
  102. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filter.rb +0 -0
  103. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/code_merger.rb +0 -0
  104. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/control_flow.rb +0 -0
  105. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/dynamic_inliner.rb +0 -0
  106. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/encoding.rb +0 -0
  107. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/eraser.rb +0 -0
  108. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/escapable.rb +0 -0
  109. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/multi_flattener.rb +0 -0
  110. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/remove_bom.rb +0 -0
  111. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/static_analyzer.rb +0 -0
  112. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/static_merger.rb +0 -0
  113. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/string_splitter.rb +0 -0
  114. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/validator.rb +0 -0
  115. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generator.rb +0 -0
  116. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/array.rb +0 -0
  117. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/array_buffer.rb +0 -0
  118. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/erb.rb +0 -0
  119. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/rails_output_buffer.rb +0 -0
  120. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/string_buffer.rb +0 -0
  121. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/grammar.rb +0 -0
  122. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/attribute_merger.rb +0 -0
  123. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/attribute_remover.rb +0 -0
  124. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/attribute_sorter.rb +0 -0
  125. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/dispatcher.rb +0 -0
  126. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/fast.rb +0 -0
  127. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/filter.rb +0 -0
  128. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/pretty.rb +0 -0
  129. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/safe.rb +0 -0
  130. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/map.rb +0 -0
  131. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/dispatcher.rb +2 -1
  132. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/engine_dsl.rb +0 -0
  133. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/grammar_dsl.rb +0 -0
  134. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/options.rb +0 -0
  135. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/template.rb +0 -0
  136. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/parser.rb +0 -0
  137. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/static_analyzer.rb +0 -0
  138. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/templates.rb +0 -0
  139. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/templates/rails.rb +2 -2
  140. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/templates/tilt.rb +0 -0
  141. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/utils.rb +0 -0
  142. data/bundle/ruby/2.5.0/gems/temple-0.8.1/lib/temple/version.rb +3 -0
  143. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/temple.gemspec +0 -0
  144. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/CHANGELOG.md +4 -0
  145. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/MIT-LICENSE.txt +1 -1
  146. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/README.md +10 -10
  147. data/bundle/ruby/2.5.0/gems/unicode-display_width-1.5.0/data/display_width.marshal.gz +0 -0
  148. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width.rb +0 -0
  149. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/constants.rb +2 -2
  150. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/index.rb +0 -0
  151. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/no_string_ext.rb +0 -0
  152. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/string_ext.rb +0 -0
  153. data/lib/brakeman/checks/base_check.rb +16 -0
  154. data/lib/brakeman/checks/check_content_tag.rb +12 -0
  155. data/lib/brakeman/checks/check_cross_site_scripting.rb +6 -6
  156. data/lib/brakeman/checks/check_evaluation.rb +0 -1
  157. data/lib/brakeman/checks/check_execute.rb +18 -0
  158. data/lib/brakeman/checks/check_send.rb +0 -1
  159. data/lib/brakeman/checks/check_session_manipulation.rb +0 -1
  160. data/lib/brakeman/checks/check_sql.rb +12 -3
  161. data/lib/brakeman/file_parser.rb +8 -4
  162. data/lib/brakeman/parsers/haml_embedded.rb +44 -0
  163. data/lib/brakeman/parsers/slim_embedded.rb +44 -0
  164. data/lib/brakeman/parsers/template_parser.rb +2 -4
  165. data/lib/brakeman/processors/alias_processor.rb +23 -1
  166. data/lib/brakeman/processors/lib/call_conversion_helper.rb +4 -0
  167. data/lib/brakeman/processors/slim_template_processor.rb +16 -0
  168. data/lib/brakeman/processors/template_alias_processor.rb +2 -2
  169. data/lib/brakeman/scanner.rb +11 -10
  170. data/lib/brakeman/tracker.rb +5 -1
  171. data/lib/brakeman/tracker/config.rb +32 -7
  172. data/lib/brakeman/util.rb +17 -0
  173. data/lib/brakeman/version.rb +1 -1
  174. metadata +157 -320
  175. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby20_parser.rb +0 -6687
  176. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby21_parser.rb +0 -6767
  177. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby22_parser.rb +0 -6803
  178. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby22_parser.y +0 -2376
  179. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby23_parser.rb +0 -6818
  180. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby24_parser.rb +0 -6818
  181. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby25_parser.rb +0 -6818
  182. data/bundle/ruby/2.5.0/gems/sass-3.4.25/CODE_OF_CONDUCT.md +0 -10
  183. data/bundle/ruby/2.5.0/gems/sass-3.4.25/CONTRIBUTING.md +0 -148
  184. data/bundle/ruby/2.5.0/gems/sass-3.4.25/MIT-LICENSE +0 -20
  185. data/bundle/ruby/2.5.0/gems/sass-3.4.25/README.md +0 -227
  186. data/bundle/ruby/2.5.0/gems/sass-3.4.25/REVISION +0 -1
  187. data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION +0 -1
  188. data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION_DATE +0 -1
  189. data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION_NAME +0 -1
  190. data/bundle/ruby/2.5.0/gems/sass-3.4.25/extra/sass-spec-ref.sh +0 -32
  191. data/bundle/ruby/2.5.0/gems/sass-3.4.25/extra/update_watch.rb +0 -13
  192. data/bundle/ruby/2.5.0/gems/sass-3.4.25/init.rb +0 -18
  193. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass.rb +0 -109
  194. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores.rb +0 -15
  195. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/base.rb +0 -88
  196. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/chain.rb +0 -34
  197. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/filesystem.rb +0 -60
  198. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/memory.rb +0 -46
  199. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/null.rb +0 -25
  200. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/callbacks.rb +0 -67
  201. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/css.rb +0 -408
  202. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/deprecation.rb +0 -55
  203. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/engine.rb +0 -1226
  204. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/environment.rb +0 -215
  205. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/error.rb +0 -198
  206. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec.rb +0 -9
  207. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/base.rb +0 -199
  208. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/sass_convert.rb +0 -283
  209. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/sass_scss.rb +0 -440
  210. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/features.rb +0 -47
  211. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers.rb +0 -23
  212. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/base.rb +0 -182
  213. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/deprecated_path.rb +0 -51
  214. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/filesystem.rb +0 -219
  215. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger.rb +0 -17
  216. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/base.rb +0 -36
  217. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/delayed.rb +0 -50
  218. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/log_level.rb +0 -45
  219. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/media.rb +0 -210
  220. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin.rb +0 -134
  221. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb +0 -582
  222. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/configuration.rb +0 -134
  223. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/generic.rb +0 -15
  224. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/merb.rb +0 -48
  225. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/rack.rb +0 -60
  226. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/rails.rb +0 -47
  227. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/staleness_checker.rb +0 -199
  228. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/railtie.rb +0 -10
  229. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/repl.rb +0 -57
  230. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/root.rb +0 -7
  231. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script.rb +0 -66
  232. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_lexer.rb +0 -33
  233. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_parser.rb +0 -33
  234. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_variable_warning.rb +0 -52
  235. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/functions.rb +0 -2693
  236. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/lexer.rb +0 -464
  237. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/parser.rb +0 -832
  238. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree.rb +0 -16
  239. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/funcall.rb +0 -313
  240. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/interpolation.rb +0 -223
  241. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/list_literal.rb +0 -104
  242. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/literal.rb +0 -49
  243. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/map_literal.rb +0 -64
  244. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/node.rb +0 -127
  245. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/operation.rb +0 -156
  246. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/selector.rb +0 -26
  247. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/string_interpolation.rb +0 -125
  248. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/unary_operation.rb +0 -69
  249. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/variable.rb +0 -57
  250. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value.rb +0 -11
  251. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/arg_list.rb +0 -36
  252. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/base.rb +0 -241
  253. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/bool.rb +0 -35
  254. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/color.rb +0 -698
  255. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/helpers.rb +0 -272
  256. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/list.rb +0 -113
  257. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/map.rb +0 -70
  258. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/null.rb +0 -44
  259. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/number.rb +0 -563
  260. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/string.rb +0 -138
  261. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss.rb +0 -14
  262. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/css_parser.rb +0 -56
  263. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/parser.rb +0 -1254
  264. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/rx.rb +0 -140
  265. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/static_parser.rb +0 -373
  266. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector.rb +0 -323
  267. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/abstract_sequence.rb +0 -111
  268. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/comma_sequence.rb +0 -191
  269. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/pseudo.rb +0 -266
  270. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/sequence.rb +0 -636
  271. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/simple.rb +0 -117
  272. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/simple_sequence.rb +0 -344
  273. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/shared.rb +0 -76
  274. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/map.rb +0 -213
  275. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/position.rb +0 -39
  276. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/range.rb +0 -41
  277. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/stack.rb +0 -120
  278. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/supports.rb +0 -225
  279. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/at_root_node.rb +0 -83
  280. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/charset_node.rb +0 -22
  281. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/comment_node.rb +0 -82
  282. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/content_node.rb +0 -9
  283. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/css_import_node.rb +0 -68
  284. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/debug_node.rb +0 -18
  285. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/directive_node.rb +0 -59
  286. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/each_node.rb +0 -24
  287. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/error_node.rb +0 -18
  288. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/extend_node.rb +0 -43
  289. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/for_node.rb +0 -36
  290. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/function_node.rb +0 -44
  291. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/if_node.rb +0 -52
  292. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/import_node.rb +0 -75
  293. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/keyframe_rule_node.rb +0 -15
  294. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/media_node.rb +0 -48
  295. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/mixin_def_node.rb +0 -38
  296. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/mixin_node.rb +0 -52
  297. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/node.rb +0 -240
  298. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/prop_node.rb +0 -170
  299. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/return_node.rb +0 -19
  300. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/root_node.rb +0 -44
  301. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/rule_node.rb +0 -155
  302. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/supports_node.rb +0 -38
  303. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/trace_node.rb +0 -33
  304. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/variable_node.rb +0 -36
  305. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/base.rb +0 -72
  306. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/check_nesting.rb +0 -173
  307. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/convert.rb +0 -351
  308. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/cssize.rb +0 -373
  309. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/deep_copy.rb +0 -107
  310. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/extend.rb +0 -70
  311. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/perform.rb +0 -564
  312. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/set_options.rb +0 -139
  313. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/to_css.rb +0 -409
  314. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/warn_node.rb +0 -18
  315. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/while_node.rb +0 -18
  316. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util.rb +0 -1375
  317. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/cross_platform_random.rb +0 -19
  318. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/multibyte_string_scanner.rb +0 -155
  319. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/normalized_map.rb +0 -129
  320. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/ordered_hash.rb +0 -192
  321. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/subset_map.rb +0 -109
  322. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/test.rb +0 -9
  323. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/version.rb +0 -124
  324. data/bundle/ruby/2.5.0/gems/sass-3.4.25/rails/init.rb +0 -1
  325. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/CHANGELOG.md +0 -1
  326. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/CONTRIBUTING.md +0 -38
  327. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Gemfile +0 -20
  328. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Guardfile +0 -8
  329. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/LICENSE +0 -20
  330. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/README.md +0 -349
  331. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Rakefile +0 -5
  332. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Vagrantfile +0 -96
  333. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen.rb +0 -54
  334. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapter.rb +0 -327
  335. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
  336. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
  337. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/linux.rb +0 -81
  338. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb +0 -58
  339. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/windows.rb +0 -91
  340. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/directory_record.rb +0 -406
  341. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/listener.rb +0 -323
  342. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/turnstile.rb +0 -32
  343. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/version.rb +0 -3
  344. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/listen.gemspec +0 -28
  345. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapter_spec.rb +0 -149
  346. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  347. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
  348. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
  349. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  350. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
  351. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
  352. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/listener_spec.rb +0 -258
  353. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  354. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen_spec.rb +0 -67
  355. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/spec_helper.rb +0 -25
  356. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/adapter_helper.rb +0 -666
  357. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/directory_record_helper.rb +0 -57
  358. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  359. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/listeners_helper.rb +0 -179
  360. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/platform_helper.rb +0 -15
  361. data/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/version.rb +0 -3
  362. data/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.1/data/display_width.marshal.gz +0 -0
@@ -1,832 +0,0 @@
1
- require 'sass/script/lexer'
2
- require 'sass/script/css_variable_warning'
3
-
4
- module Sass
5
- module Script
6
- # The parser for SassScript.
7
- # It parses a string of code into a tree of {Script::Tree::Node}s.
8
- class Parser
9
- # The line number of the parser's current position.
10
- #
11
- # @return [Integer]
12
- def line
13
- @lexer.line
14
- end
15
-
16
- # The column number of the parser's current position.
17
- #
18
- # @return [Integer]
19
- def offset
20
- @lexer.offset
21
- end
22
-
23
- # @param str [String, StringScanner] The source text to parse
24
- # @param line [Integer] The line on which the SassScript appears.
25
- # Used for error reporting and sourcemap building
26
- # @param offset [Integer] The character (not byte) offset where the script starts in the line.
27
- # Used for error reporting and sourcemap building
28
- # @param options [{Symbol => Object}] An options hash; see
29
- # {file:SASS_REFERENCE.md#Options the Sass options documentation}.
30
- # This supports an additional `:allow_extra_text` option that controls
31
- # whether the parser throws an error when extra text is encountered
32
- # after the parsed construct.
33
- def initialize(str, line, offset, options = {})
34
- @options = options
35
- @allow_extra_text = options.delete(:allow_extra_text)
36
- @lexer = lexer_class.new(str, line, offset, options)
37
- @stop_at = nil
38
- @css_variable_warning = nil
39
- end
40
-
41
- # Parses a SassScript expression within an interpolated segment (`#{}`).
42
- # This means that it stops when it comes across an unmatched `}`,
43
- # which signals the end of an interpolated segment,
44
- # it returns rather than throwing an error.
45
- #
46
- # @param warn_for_color [Boolean] Whether raw color values passed to
47
- # interoplation should cause a warning.
48
- # @return [Script::Tree::Node] The root node of the parse tree
49
- # @raise [Sass::SyntaxError] if the expression isn't valid SassScript
50
- def parse_interpolated(warn_for_color = false)
51
- # Start two characters back to compensate for #{
52
- start_pos = Sass::Source::Position.new(line, offset - 2)
53
- expr = assert_expr :expr
54
- assert_tok :end_interpolation
55
- expr = Sass::Script::Tree::Interpolation.new(
56
- nil, expr, nil, false, false, :warn_for_color => warn_for_color)
57
- check_for_interpolation expr
58
- expr.options = @options
59
- node(expr, start_pos)
60
- rescue Sass::SyntaxError => e
61
- e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
62
- raise e
63
- end
64
-
65
- # Parses a SassScript expression.
66
- #
67
- # @param css_variable [Boolean] Whether this is the value of a CSS variable.
68
- # @return [Script::Tree::Node] The root node of the parse tree
69
- # @raise [Sass::SyntaxError] if the expression isn't valid SassScript
70
- def parse(css_variable = false)
71
- if css_variable
72
- @css_variable_warning = CssVariableWarning.new
73
- end
74
-
75
- expr = assert_expr :expr
76
- assert_done
77
- expr.options = @options
78
- check_for_interpolation expr
79
-
80
- if css_variable
81
- @css_variable_warning.value = expr
82
- end
83
-
84
- expr
85
- rescue Sass::SyntaxError => e
86
- e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
87
- raise e
88
- end
89
-
90
- # Parses a SassScript expression,
91
- # ending it when it encounters one of the given identifier tokens.
92
- #
93
- # @param tokens [#include?(String)] A set of strings that delimit the expression.
94
- # @return [Script::Tree::Node] The root node of the parse tree
95
- # @raise [Sass::SyntaxError] if the expression isn't valid SassScript
96
- def parse_until(tokens)
97
- @stop_at = tokens
98
- expr = assert_expr :expr
99
- assert_done
100
- expr.options = @options
101
- check_for_interpolation expr
102
- expr
103
- rescue Sass::SyntaxError => e
104
- e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
105
- raise e
106
- end
107
-
108
- # Parses the argument list for a mixin include.
109
- #
110
- # @return [(Array<Script::Tree::Node>,
111
- # {String => Script::Tree::Node},
112
- # Script::Tree::Node,
113
- # Script::Tree::Node)]
114
- # The root nodes of the positional arguments, keyword arguments, and
115
- # splat argument(s). Keyword arguments are in a hash from names to values.
116
- # @raise [Sass::SyntaxError] if the argument list isn't valid SassScript
117
- def parse_mixin_include_arglist
118
- args, keywords = [], {}
119
- if try_tok(:lparen)
120
- args, keywords, splat, kwarg_splat = mixin_arglist
121
- assert_tok(:rparen)
122
- end
123
- assert_done
124
-
125
- args.each do |a|
126
- check_for_interpolation a
127
- a.options = @options
128
- end
129
-
130
- keywords.each do |_k, v|
131
- check_for_interpolation v
132
- v.options = @options
133
- end
134
-
135
- if splat
136
- check_for_interpolation splat
137
- splat.options = @options
138
- end
139
-
140
- if kwarg_splat
141
- check_for_interpolation kwarg_splat
142
- kwarg_splat.options = @options
143
- end
144
-
145
- return args, keywords, splat, kwarg_splat
146
- rescue Sass::SyntaxError => e
147
- e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
148
- raise e
149
- end
150
-
151
- # Parses the argument list for a mixin definition.
152
- #
153
- # @return [(Array<Script::Tree::Node>, Script::Tree::Node)]
154
- # The root nodes of the arguments, and the splat argument.
155
- # @raise [Sass::SyntaxError] if the argument list isn't valid SassScript
156
- def parse_mixin_definition_arglist
157
- args, splat = defn_arglist!(false)
158
- assert_done
159
-
160
- args.each do |k, v|
161
- check_for_interpolation k
162
- k.options = @options
163
-
164
- if v
165
- check_for_interpolation v
166
- v.options = @options
167
- end
168
- end
169
-
170
- if splat
171
- check_for_interpolation splat
172
- splat.options = @options
173
- end
174
-
175
- return args, splat
176
- rescue Sass::SyntaxError => e
177
- e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
178
- raise e
179
- end
180
-
181
- # Parses the argument list for a function definition.
182
- #
183
- # @return [(Array<Script::Tree::Node>, Script::Tree::Node)]
184
- # The root nodes of the arguments, and the splat argument.
185
- # @raise [Sass::SyntaxError] if the argument list isn't valid SassScript
186
- def parse_function_definition_arglist
187
- args, splat = defn_arglist!(true)
188
- assert_done
189
-
190
- args.each do |k, v|
191
- check_for_interpolation k
192
- k.options = @options
193
-
194
- if v
195
- check_for_interpolation v
196
- v.options = @options
197
- end
198
- end
199
-
200
- if splat
201
- check_for_interpolation splat
202
- splat.options = @options
203
- end
204
-
205
- return args, splat
206
- rescue Sass::SyntaxError => e
207
- e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
208
- raise e
209
- end
210
-
211
- # Parse a single string value, possibly containing interpolation.
212
- # Doesn't assert that the scanner is finished after parsing.
213
- #
214
- # @return [Script::Tree::Node] The root node of the parse tree.
215
- # @raise [Sass::SyntaxError] if the string isn't valid SassScript
216
- def parse_string
217
- unless (peek = @lexer.peek) &&
218
- (peek.type == :string ||
219
- (peek.type == :funcall && peek.value.downcase == 'url'))
220
- lexer.expected!("string")
221
- end
222
-
223
- expr = assert_expr :funcall
224
- check_for_interpolation expr
225
- expr.options = @options
226
- @lexer.unpeek!
227
- expr
228
- rescue Sass::SyntaxError => e
229
- e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
230
- raise e
231
- end
232
-
233
- # Parses a SassScript expression.
234
- #
235
- # @return [Script::Tree::Node] The root node of the parse tree
236
- # @see Parser#initialize
237
- # @see Parser#parse
238
- def self.parse(value, line, offset, options = {})
239
- css_variable = options.delete :css_variable
240
- new(value, line, offset, options).parse(css_variable)
241
- end
242
-
243
- PRECEDENCE = [
244
- :comma, :single_eq, :space, :or, :and,
245
- [:eq, :neq],
246
- [:gt, :gte, :lt, :lte],
247
- [:plus, :minus],
248
- [:times, :div, :mod],
249
- ]
250
-
251
- ASSOCIATIVE = [:plus, :times]
252
-
253
- VALID_CSS_OPS = [:comma, :single_eq, :space, :div]
254
-
255
- class << self
256
- # Returns an integer representing the precedence
257
- # of the given operator.
258
- # A lower integer indicates a looser binding.
259
- #
260
- # @private
261
- def precedence_of(op)
262
- PRECEDENCE.each_with_index do |e, i|
263
- return i if Array(e).include?(op)
264
- end
265
- raise "[BUG] Unknown operator #{op.inspect}"
266
- end
267
-
268
- # Returns whether or not the given operation is associative.
269
- #
270
- # @private
271
- def associative?(op)
272
- ASSOCIATIVE.include?(op)
273
- end
274
-
275
- private
276
-
277
- # Defines a simple left-associative production.
278
- # name is the name of the production,
279
- # sub is the name of the production beneath it,
280
- # and ops is a list of operators for this precedence level
281
- def production(name, sub, *ops)
282
- class_eval <<RUBY, __FILE__, __LINE__ + 1
283
- def #{name}
284
- interp = try_ops_after_interp(#{ops.inspect}, #{name.inspect})
285
- return interp if interp
286
- return unless e = #{sub}
287
- while tok = try_toks(#{ops.map {|o| o.inspect}.join(', ')})
288
- if interp = try_op_before_interp(tok, e)
289
- other_interp = try_ops_after_interp(#{ops.inspect}, #{name.inspect}, interp)
290
- return interp unless other_interp
291
- return other_interp
292
- end
293
-
294
- if @css_variable_warning && !VALID_CSS_OPS.include?(tok.type)
295
- @css_variable_warning.warn!
296
- end
297
-
298
- e = node(Tree::Operation.new(e, assert_expr(#{sub.inspect}), tok.type),
299
- e.source_range.start_pos)
300
- end
301
- e
302
- end
303
- RUBY
304
- end
305
-
306
- def unary(op, sub)
307
- class_eval <<RUBY, __FILE__, __LINE__ + 1
308
- def unary_#{op}
309
- return #{sub} unless tok = try_tok(:#{op})
310
- interp = try_op_before_interp(tok)
311
- return interp if interp
312
- start_pos = source_position
313
-
314
- @css_variable_warning.warn! if @css_variable_warning
315
- node(Tree::UnaryOperation.new(assert_expr(:unary_#{op}), :#{op}), start_pos)
316
- end
317
- RUBY
318
- end
319
- end
320
-
321
- private
322
-
323
- def source_position
324
- Sass::Source::Position.new(line, offset)
325
- end
326
-
327
- def range(start_pos, end_pos = source_position)
328
- Sass::Source::Range.new(start_pos, end_pos, @options[:filename], @options[:importer])
329
- end
330
-
331
- # @private
332
- def lexer_class; Lexer; end
333
-
334
- def map
335
- start_pos = source_position
336
- e = interpolation
337
- return unless e
338
- return list e, start_pos unless @lexer.peek && @lexer.peek.type == :colon
339
-
340
- pair = map_pair(e)
341
- @css_variable_warning.warn! if @css_variable_warning
342
- map = node(Sass::Script::Tree::MapLiteral.new([pair]), start_pos)
343
- while try_tok(:comma)
344
- pair = map_pair
345
- return map unless pair
346
- map.pairs << pair
347
- end
348
- map
349
- end
350
-
351
- def map_pair(key = nil)
352
- return unless key ||= interpolation
353
- assert_tok :colon
354
- return key, assert_expr(:interpolation)
355
- end
356
-
357
- def expr
358
- start_pos = source_position
359
- e = interpolation
360
- return unless e
361
- list e, start_pos
362
- end
363
-
364
- def list(first, start_pos)
365
- return first unless @lexer.peek && @lexer.peek.type == :comma
366
-
367
- list = node(Sass::Script::Tree::ListLiteral.new([first], :comma), start_pos)
368
- while (tok = try_tok(:comma))
369
- element_before_interp = list.elements.length == 1 ? list.elements.first : list
370
- if (interp = try_op_before_interp(tok, element_before_interp))
371
- other_interp = try_ops_after_interp([:comma], :expr, interp)
372
- return interp unless other_interp
373
- return other_interp
374
- end
375
- return list unless (e = interpolation)
376
- list.elements << e
377
- list.source_range.end_pos = list.elements.last.source_range.end_pos
378
- end
379
- list
380
- end
381
-
382
- production :equals, :interpolation, :single_eq
383
-
384
- def try_op_before_interp(op, prev = nil, after_interp = false)
385
- return unless @lexer.peek && @lexer.peek.type == :begin_interpolation
386
- unary = !prev && !after_interp
387
- wb = @lexer.whitespace?(op)
388
- str = literal_node(Script::Value::String.new(Lexer::OPERATORS_REVERSE[op.type]),
389
- op.source_range)
390
-
391
- deprecation =
392
- case op.type
393
- when :comma; :potential
394
- when :div, :single_eq; :none
395
- when :plus; unary ? :none : :immediate
396
- when :minus; @lexer.whitespace?(@lexer.peek) ? :immediate : :none
397
- else; :immediate
398
- end
399
-
400
- interp = node(
401
- Script::Tree::Interpolation.new(
402
- prev, str, nil, wb, false, :originally_text => true, :deprecation => deprecation),
403
- (prev || str).source_range.start_pos)
404
- interpolation(interp)
405
- end
406
-
407
- def try_ops_after_interp(ops, name, prev = nil)
408
- return unless @lexer.after_interpolation?
409
- op = try_toks(*ops)
410
- return unless op
411
- interp = try_op_before_interp(op, prev, :after_interp)
412
- return interp if interp
413
-
414
- wa = @lexer.whitespace?
415
- str = literal_node(Script::Value::String.new(Lexer::OPERATORS_REVERSE[op.type]),
416
- op.source_range)
417
- str.line = @lexer.line
418
-
419
- deprecation =
420
- case op.type
421
- when :comma; :potential
422
- when :div, :single_eq; :none
423
- when :minus; @lexer.whitespace?(op) ? :immediate : :none
424
- else; :immediate
425
- end
426
- interp = node(
427
- Script::Tree::Interpolation.new(
428
- prev, str, assert_expr(name), false, wa,
429
- :originally_text => true, :deprecation => deprecation),
430
- (prev || str).source_range.start_pos)
431
- interp
432
- end
433
-
434
- def interpolation(first = space)
435
- e = first
436
- while (interp = try_tok(:begin_interpolation))
437
- wb = @lexer.whitespace?(interp)
438
- char_before = @lexer.char(interp.pos - 1)
439
- mid = without_css_variable_warning {assert_expr :expr}
440
- assert_tok :end_interpolation
441
- wa = @lexer.whitespace?
442
- char_after = @lexer.char
443
-
444
- after = space
445
- before_deprecation = e.is_a?(Script::Tree::Interpolation) ? e.deprecation : :none
446
- after_deprecation = after.is_a?(Script::Tree::Interpolation) ? after.deprecation : :none
447
-
448
- deprecation =
449
- if before_deprecation == :immediate || after_deprecation == :immediate ||
450
- # Warn for #{foo}$var and #{foo}(1) but not #{$foo}1.
451
- (after && !wa && char_after =~ /[$(]/) ||
452
- # Warn for $var#{foo} and (a)#{foo} but not a#{foo}.
453
- (e && !wb && is_unsafe_before?(e, char_before))
454
- :immediate
455
- else
456
- :potential
457
- end
458
-
459
- e = node(
460
- Script::Tree::Interpolation.new(e, mid, after, wb, wa, :deprecation => deprecation),
461
- (e || interp).source_range.start_pos)
462
- end
463
- e
464
- end
465
-
466
- # Returns whether `expr` is unsafe to include before an interpolation.
467
- #
468
- # @param expr [Node] The expression to check.
469
- # @param char_before [String] The character immediately before the
470
- # interpolation being checked (and presumably the last character of
471
- # `expr`).
472
- # @return [Boolean]
473
- def is_unsafe_before?(expr, char_before)
474
- return char_before == ')' if is_safe_value?(expr)
475
-
476
- # Otherwise, it's only safe if it was another interpolation.
477
- !expr.is_a?(Script::Tree::Interpolation)
478
- end
479
-
480
- # Returns whether `expr` is safe as the value immediately before an
481
- # interpolation.
482
- #
483
- # It's safe as long as the previous expression is an identifier or number,
484
- # or a list whose last element is also safe.
485
- def is_safe_value?(expr)
486
- return is_safe_value?(expr.elements.last) if expr.is_a?(Script::Tree::ListLiteral)
487
- return false unless expr.is_a?(Script::Tree::Literal)
488
- expr.value.is_a?(Script::Value::Number) ||
489
- (expr.value.is_a?(Script::Value::String) && expr.value.type == :identifier)
490
- end
491
-
492
- def space
493
- start_pos = source_position
494
- e = or_expr
495
- return unless e
496
- arr = [e]
497
- while (e = or_expr)
498
- arr << e
499
- end
500
- if arr.size == 1
501
- arr.first
502
- else
503
- node(Sass::Script::Tree::ListLiteral.new(arr, :space), start_pos)
504
- end
505
- end
506
-
507
- production :or_expr, :and_expr, :or
508
- production :and_expr, :eq_or_neq, :and
509
- production :eq_or_neq, :relational, :eq, :neq
510
- production :relational, :plus_or_minus, :gt, :gte, :lt, :lte
511
- production :plus_or_minus, :times_div_or_mod, :plus, :minus
512
- production :times_div_or_mod, :unary_plus, :times, :div, :mod
513
-
514
- unary :plus, :unary_minus
515
- unary :minus, :unary_div
516
- unary :div, :unary_not # For strings, so /foo/bar works
517
- unary :not, :ident
518
-
519
- def ident
520
- return funcall unless @lexer.peek && @lexer.peek.type == :ident
521
- return if @stop_at && @stop_at.include?(@lexer.peek.value)
522
-
523
- name = @lexer.next
524
- if (color = Sass::Script::Value::Color::COLOR_NAMES[name.value.downcase])
525
- literal_node(Sass::Script::Value::Color.new(color, name.value), name.source_range)
526
- elsif name.value == "true"
527
- literal_node(Sass::Script::Value::Bool.new(true), name.source_range)
528
- elsif name.value == "false"
529
- literal_node(Sass::Script::Value::Bool.new(false), name.source_range)
530
- elsif name.value == "null"
531
- literal_node(Sass::Script::Value::Null.new, name.source_range)
532
- else
533
- literal_node(Sass::Script::Value::String.new(name.value, :identifier), name.source_range)
534
- end
535
- end
536
-
537
- def funcall
538
- tok = try_tok(:funcall)
539
- return raw unless tok
540
- args, keywords, splat, kwarg_splat = fn_arglist
541
- assert_tok(:rparen)
542
- node(Script::Tree::Funcall.new(tok.value, args, keywords, splat, kwarg_splat),
543
- tok.source_range.start_pos, source_position)
544
- end
545
-
546
- def defn_arglist!(must_have_parens)
547
- if must_have_parens
548
- assert_tok(:lparen)
549
- else
550
- return [], nil unless try_tok(:lparen)
551
- end
552
- return [], nil if try_tok(:rparen)
553
-
554
- res = []
555
- splat = nil
556
- must_have_default = false
557
- loop do
558
- c = assert_tok(:const)
559
- var = node(Script::Tree::Variable.new(c.value), c.source_range)
560
- if try_tok(:colon)
561
- val = assert_expr(:space)
562
- must_have_default = true
563
- elsif try_tok(:splat)
564
- splat = var
565
- break
566
- elsif must_have_default
567
- raise SyntaxError.new(
568
- "Required argument #{var.inspect} must come before any optional arguments.")
569
- end
570
- res << [var, val]
571
- break unless try_tok(:comma)
572
- end
573
- assert_tok(:rparen)
574
- return res, splat
575
- end
576
-
577
- def fn_arglist
578
- arglist(:equals, "function argument")
579
- end
580
-
581
- def mixin_arglist
582
- arglist(:interpolation, "mixin argument")
583
- end
584
-
585
- def arglist(subexpr, description)
586
- args = []
587
- keywords = Sass::Util::NormalizedMap.new
588
- e = send(subexpr)
589
-
590
- return [args, keywords] unless e
591
-
592
- splat = nil
593
- loop do
594
- if @lexer.peek && @lexer.peek.type == :colon
595
- name = e
596
- @lexer.expected!("comma") unless name.is_a?(Tree::Variable)
597
- assert_tok(:colon)
598
- value = assert_expr(subexpr, description)
599
-
600
- if keywords[name.name]
601
- raise SyntaxError.new("Keyword argument \"#{name.to_sass}\" passed more than once")
602
- end
603
-
604
- keywords[name.name] = value
605
- else
606
- if try_tok(:splat)
607
- return args, keywords, splat, e if splat
608
- splat, e = e, nil
609
- elsif splat
610
- raise SyntaxError.new("Only keyword arguments may follow variable arguments (...).")
611
- elsif !keywords.empty?
612
- raise SyntaxError.new("Positional arguments must come before keyword arguments.")
613
- end
614
-
615
- args << e if e
616
- end
617
-
618
- return args, keywords, splat unless try_tok(:comma)
619
- e = assert_expr(subexpr, description)
620
- end
621
- end
622
-
623
- def raw
624
- tok = try_tok(:raw)
625
- return special_fun unless tok
626
- literal_node(Script::Value::String.new(tok.value), tok.source_range)
627
- end
628
-
629
- def special_fun
630
- first = try_tok(:special_fun)
631
- return paren unless first
632
- str = literal_node(first.value, first.source_range)
633
- return str unless try_tok(:string_interpolation)
634
- mid = without_css_variable_warning {assert_expr :expr}
635
- assert_tok :end_interpolation
636
- last = assert_expr(:special_fun)
637
- node(
638
- Tree::Interpolation.new(str, mid, last, false, false),
639
- first.source_range.start_pos)
640
- end
641
-
642
- def paren
643
- return variable unless try_tok(:lparen)
644
- start_pos = source_position
645
- e = map
646
- e.force_division! if e
647
- end_pos = source_position
648
- assert_tok(:rparen)
649
-
650
- @css_variable_warning.warn! if @css_variable_warning
651
- e || node(Sass::Script::Tree::ListLiteral.new([], nil), start_pos, end_pos)
652
- end
653
-
654
- def variable
655
- start_pos = source_position
656
- c = try_tok(:const)
657
- return string unless c
658
-
659
- @css_variable_warning.warn! if @css_variable_warning
660
- node(Tree::Variable.new(*c.value), start_pos)
661
- end
662
-
663
- def string
664
- first = try_tok(:string)
665
- return number unless first
666
- str = literal_node(first.value, first.source_range)
667
- return str unless try_tok(:string_interpolation)
668
- mid = without_css_variable_warning {assert_expr :expr}
669
- assert_tok :end_interpolation
670
- last = assert_expr(:string)
671
- node(Tree::StringInterpolation.new(str, mid, last), first.source_range.start_pos)
672
- end
673
-
674
- def number
675
- tok = try_tok(:number)
676
- return selector unless tok
677
- num = tok.value
678
- num.options = @options
679
- num.original = num.to_s
680
- literal_node(num, tok.source_range.start_pos)
681
- end
682
-
683
- def selector
684
- tok = try_tok(:selector)
685
- return literal unless tok
686
- @css_variable_warning.warn! if @css_variable_warning
687
- node(tok.value, tok.source_range.start_pos)
688
- end
689
-
690
- def literal
691
- t = try_tok(:color)
692
- return literal_node(t.value, t.source_range) if t
693
- end
694
-
695
- # It would be possible to have unified #assert and #try methods,
696
- # but detecting the method/token difference turns out to be quite expensive.
697
-
698
- EXPR_NAMES = {
699
- :string => "string",
700
- :default => "expression (e.g. 1px, bold)",
701
- :mixin_arglist => "mixin argument",
702
- :fn_arglist => "function argument",
703
- :splat => "...",
704
- :special_fun => '")"',
705
- }
706
-
707
- def assert_expr(name, expected = nil)
708
- e = send(name)
709
- return e if e
710
- @lexer.expected!(expected || EXPR_NAMES[name] || EXPR_NAMES[:default])
711
- end
712
-
713
- def assert_tok(name)
714
- # Avoids an array allocation caused by argument globbing in assert_toks.
715
- t = try_tok(name)
716
- return t if t
717
- @lexer.expected!(Lexer::TOKEN_NAMES[name] || name.to_s)
718
- end
719
-
720
- def assert_toks(*names)
721
- t = try_toks(*names)
722
- return t if t
723
- @lexer.expected!(names.map {|tok| Lexer::TOKEN_NAMES[tok] || tok}.join(" or "))
724
- end
725
-
726
- def try_tok(name)
727
- # Avoids an array allocation caused by argument globbing in the try_toks method.
728
- peeked = @lexer.peek
729
- peeked && name == peeked.type && @lexer.next
730
- end
731
-
732
- def try_toks(*names)
733
- peeked = @lexer.peek
734
- peeked && names.include?(peeked.type) && @lexer.next
735
- end
736
-
737
- def assert_done
738
- if @allow_extra_text
739
- # If extra text is allowed, just rewind the lexer so that the
740
- # StringScanner is pointing to the end of the parsed text.
741
- @lexer.unpeek!
742
- else
743
- return if @lexer.done?
744
- @lexer.expected!(EXPR_NAMES[:default])
745
- end
746
- end
747
-
748
- # @overload node(value, source_range)
749
- # @param value [Sass::Script::Value::Base]
750
- # @param source_range [Sass::Source::Range]
751
- # @overload node(value, start_pos, end_pos = source_position)
752
- # @param value [Sass::Script::Value::Base]
753
- # @param start_pos [Sass::Source::Position]
754
- # @param end_pos [Sass::Source::Position]
755
- def literal_node(value, source_range_or_start_pos, end_pos = source_position)
756
- node(Sass::Script::Tree::Literal.new(value), source_range_or_start_pos, end_pos)
757
- end
758
-
759
- # @overload node(node, source_range)
760
- # @param node [Sass::Script::Tree::Node]
761
- # @param source_range [Sass::Source::Range]
762
- # @overload node(node, start_pos, end_pos = source_position)
763
- # @param node [Sass::Script::Tree::Node]
764
- # @param start_pos [Sass::Source::Position]
765
- # @param end_pos [Sass::Source::Position]
766
- def node(node, source_range_or_start_pos, end_pos = source_position)
767
- source_range =
768
- if source_range_or_start_pos.is_a?(Sass::Source::Range)
769
- source_range_or_start_pos
770
- else
771
- range(source_range_or_start_pos, end_pos)
772
- end
773
-
774
- node.css_variable_warning = @css_variable_warning
775
- node.line = source_range.start_pos.line
776
- node.source_range = source_range
777
- node.filename = @options[:filename]
778
- node
779
- end
780
-
781
- # Runs the given block without CSS variable warnings enabled.
782
- #
783
- # CSS warnings don't apply within interpolation, so this is used to
784
- # disable them.
785
- #
786
- # @yield []
787
- def without_css_variable_warning
788
- old_css_variable_warning = @css_variable_warning
789
- @css_variable_warning = nil
790
- yield
791
- ensure
792
- @css_variable_warning = old_css_variable_warning
793
- end
794
-
795
- # Checks a script node for any immediately-deprecated interpolations, and
796
- # emits warnings for them.
797
- #
798
- # @param node [Sass::Script::Tree::Node]
799
- def check_for_interpolation(node)
800
- nodes = [node]
801
- until nodes.empty?
802
- node = nodes.pop
803
- unless node.is_a?(Sass::Script::Tree::Interpolation) &&
804
- node.deprecation == :immediate
805
- nodes.concat node.children
806
- next
807
- end
808
-
809
- interpolation_deprecation(node)
810
- end
811
- end
812
-
813
- # Emits a deprecation warning for an interpolation node.
814
- #
815
- # @param node [Sass::Script::Tree::Node]
816
- def interpolation_deprecation(interpolation)
817
- return if @options[:_convert]
818
- location = "on line #{interpolation.line}"
819
- location << " of #{interpolation.filename}" if interpolation.filename
820
- Sass::Util.sass_warn <<WARNING
821
- DEPRECATION WARNING #{location}:
822
- \#{} interpolation near operators will be simplified in a future version of Sass.
823
- To preserve the current behavior, use quotes:
824
-
825
- #{interpolation.to_quoted_equivalent.to_sass}
826
-
827
- You can use the sass-convert command to automatically fix most cases.
828
- WARNING
829
- end
830
- end
831
- end
832
- end