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,138 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module Sass::Script::Value
3
- # A SassScript object representing a CSS string *or* a CSS identifier.
4
- class String < Base
5
- @@interpolation_deprecation = Sass::Deprecation.new
6
-
7
- # The Ruby value of the string.
8
- #
9
- # @return [String]
10
- attr_reader :value
11
-
12
- # Whether this is a CSS string or a CSS identifier.
13
- # The difference is that strings are written with double-quotes,
14
- # while identifiers aren't.
15
- #
16
- # @return [Symbol] `:string` or `:identifier`
17
- attr_reader :type
18
-
19
- def self.value(contents)
20
- contents.gsub("\\\n", "").gsub(/\\(?:([0-9a-fA-F]{1,6})\s?|(.))/) do
21
- next $2 if $2
22
- # Handle unicode escapes as per CSS Syntax Level 3 section 4.3.8.
23
- code_point = $1.to_i(16)
24
- if code_point == 0 || code_point > 0x10FFFF ||
25
- (code_point >= 0xD800 && code_point <= 0xDFFF)
26
- '�'
27
- else
28
- [code_point].pack("U")
29
- end
30
- end
31
- end
32
-
33
- # Returns the quoted string representation of `contents`.
34
- #
35
- # @options opts :quote [String]
36
- # The preferred quote style for quoted strings. If `:none`, strings are
37
- # always emitted unquoted. If `nil`, quoting is determined automatically.
38
- # @options opts :sass [String]
39
- # Whether to quote strings for Sass source, as opposed to CSS. Defaults to `false`.
40
- def self.quote(contents, opts = {})
41
- quote = opts[:quote]
42
-
43
- # Short-circuit if there are no characters that need quoting.
44
- unless contents =~ /[\n\\"']|\#\{/
45
- quote ||= '"'
46
- return "#{quote}#{contents}#{quote}"
47
- end
48
-
49
- if quote.nil?
50
- if contents.include?('"')
51
- if contents.include?("'")
52
- quote = '"'
53
- else
54
- quote = "'"
55
- end
56
- else
57
- quote = '"'
58
- end
59
- end
60
-
61
- # Replace single backslashes with multiples.
62
- contents = contents.gsub("\\", "\\\\\\\\")
63
-
64
- # Escape interpolation.
65
- contents = contents.gsub('#{', "\\\#{") if opts[:sass]
66
-
67
- if quote == '"'
68
- contents = contents.gsub('"', "\\\"")
69
- else
70
- contents = contents.gsub("'", "\\'")
71
- end
72
-
73
- contents = contents.gsub(/\n(?![a-fA-F0-9\s])/, "\\a").gsub("\n", "\\a ")
74
- "#{quote}#{contents}#{quote}"
75
- end
76
-
77
- # Creates a new string.
78
- #
79
- # @param value [String] See \{#value}
80
- # @param type [Symbol] See \{#type}
81
- # @param deprecated_interp_equivalent [String?]
82
- # If this was created via a potentially-deprecated string interpolation,
83
- # this is the replacement expression that should be suggested to the user.
84
- def initialize(value, type = :identifier, deprecated_interp_equivalent = nil)
85
- super(value)
86
- @type = type
87
- @deprecated_interp_equivalent = deprecated_interp_equivalent
88
- end
89
-
90
- # @see Value#plus
91
- def plus(other)
92
- other_value = if other.is_a?(Sass::Script::Value::String)
93
- other.value
94
- else
95
- other.to_s(:quote => :none)
96
- end
97
- Sass::Script::Value::String.new(value + other_value, type)
98
- end
99
-
100
- # @see Value#to_s
101
- def to_s(opts = {})
102
- return @value.gsub(/\n\s*/, ' ') if opts[:quote] == :none || @type == :identifier
103
- String.quote(value, opts)
104
- end
105
-
106
- # @see Value#to_sass
107
- def to_sass(opts = {})
108
- to_s(opts.merge(:sass => true))
109
- end
110
-
111
- def separator
112
- check_deprecated_interp
113
- super
114
- end
115
-
116
- def to_a
117
- check_deprecated_interp
118
- super
119
- end
120
-
121
- # Prints a warning if this string was created using potentially-deprecated
122
- # interpolation.
123
- def check_deprecated_interp
124
- return unless @deprecated_interp_equivalent
125
-
126
- @@interpolation_deprecation.warn(source_range.file, source_range.start_pos.line, <<WARNING)
127
- \#{} interpolation near operators will be simplified in a future version of Sass.
128
- To preserve the current behavior, use quotes:
129
-
130
- #{@deprecated_interp_equivalent}
131
- WARNING
132
- end
133
-
134
- def inspect
135
- String.quote(value)
136
- end
137
- end
138
- end
@@ -1,14 +0,0 @@
1
- require 'sass/scss/rx'
2
- require 'sass/scss/parser'
3
- require 'sass/scss/static_parser'
4
- require 'sass/scss/css_parser'
5
-
6
- module Sass
7
- # SCSS is the CSS syntax for Sass.
8
- # It parses into the same syntax tree as Sass,
9
- # and generates the same sort of output CSS.
10
- #
11
- # This module contains code for the parsing of SCSS.
12
- # The evaluation is handled by the broader {Sass} module.
13
- module SCSS; end
14
- end
@@ -1,56 +0,0 @@
1
- require 'sass/script/css_parser'
2
-
3
- module Sass
4
- module SCSS
5
- # This is a subclass of {Parser} which only parses plain CSS.
6
- # It doesn't support any Sass extensions, such as interpolation,
7
- # parent references, nested selectors, and so forth.
8
- # It does support all the same CSS hacks as the SCSS parser, though.
9
- class CssParser < StaticParser
10
- private
11
-
12
- def placeholder_selector; nil; end
13
- def parent_selector; nil; end
14
- def interpolation(warn_for_color = false); nil; end
15
- def use_css_import?; true; end
16
-
17
- def block_contents(node, context)
18
- if node.is_a?(Sass::Tree::DirectiveNode) && node.normalized_name == '@keyframes'
19
- context = :keyframes
20
- end
21
- super(node, context)
22
- end
23
-
24
- def block_child(context)
25
- case context
26
- when :ruleset
27
- declaration
28
- when :stylesheet
29
- directive || ruleset
30
- when :directive
31
- directive || declaration_or_ruleset
32
- when :keyframes
33
- keyframes_ruleset
34
- end
35
- end
36
-
37
- def nested_properties!(node)
38
- expected('expression (e.g. 1px, bold)')
39
- end
40
-
41
- def ruleset
42
- start_pos = source_position
43
- return unless (selector = selector_comma_sequence)
44
- block(node(Sass::Tree::RuleNode.new(selector, range(start_pos)), start_pos), :ruleset)
45
- end
46
-
47
- def keyframes_ruleset
48
- start_pos = source_position
49
- return unless (selector = keyframes_selector)
50
- block(node(Sass::Tree::KeyframeRuleNode.new(selector.strip), start_pos), :ruleset)
51
- end
52
-
53
- @sass_script_parser = Sass::Script::CssParser
54
- end
55
- end
56
- end
@@ -1,1254 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'set'
3
-
4
- module Sass
5
- module SCSS
6
- # The parser for SCSS.
7
- # It parses a string of code into a tree of {Sass::Tree::Node}s.
8
- class Parser
9
- # Expose for the SASS parser.
10
- attr_accessor :offset
11
-
12
- # @param str [String, StringScanner] The source document to parse.
13
- # Note that `Parser` *won't* raise a nice error message if this isn't properly parsed;
14
- # for that, you should use the higher-level {Sass::Engine} or {Sass::CSS}.
15
- # @param filename [String] The name of the file being parsed. Used for
16
- # warnings and source maps.
17
- # @param importer [Sass::Importers::Base] The importer used to import the
18
- # file being parsed. Used for source maps.
19
- # @param line [Integer] The 1-based line on which the source string appeared,
20
- # if it's part of another document.
21
- # @param offset [Integer] The 1-based character (not byte) offset in the line on
22
- # which the source string starts. Used for error reporting and sourcemap
23
- # building.
24
- def initialize(str, filename, importer, line = 1, offset = 1)
25
- @template = str
26
- @filename = filename
27
- @importer = importer
28
- @line = line
29
- @offset = offset
30
- @strs = []
31
- @expected = nil
32
- @throw_error = false
33
- end
34
-
35
- # Parses an SCSS document.
36
- #
37
- # @return [Sass::Tree::RootNode] The root node of the document tree
38
- # @raise [Sass::SyntaxError] if there's a syntax error in the document
39
- def parse
40
- init_scanner!
41
- root = stylesheet
42
- expected("selector or at-rule") unless root && @scanner.eos?
43
- root
44
- end
45
-
46
- # Parses an identifier with interpolation.
47
- # Note that this won't assert that the identifier takes up the entire input string;
48
- # it's meant to be used with `StringScanner`s as part of other parsers.
49
- #
50
- # @return [Array<String, Sass::Script::Tree::Node>, nil]
51
- # The interpolated identifier, or nil if none could be parsed
52
- def parse_interp_ident
53
- init_scanner!
54
- interp_ident
55
- end
56
-
57
- # Parses a supports clause for an @import directive
58
- def parse_supports_clause
59
- init_scanner!
60
- ss
61
- clause = supports_clause
62
- ss
63
- clause
64
- end
65
-
66
- # Parses a media query list.
67
- #
68
- # @return [Sass::Media::QueryList] The parsed query list
69
- # @raise [Sass::SyntaxError] if there's a syntax error in the query list,
70
- # or if it doesn't take up the entire input string.
71
- def parse_media_query_list
72
- init_scanner!
73
- ql = media_query_list
74
- expected("media query list") unless ql && @scanner.eos?
75
- ql
76
- end
77
-
78
- # Parses an at-root query.
79
- #
80
- # @return [Array<String, Sass::Script;:Tree::Node>] The interpolated query.
81
- # @raise [Sass::SyntaxError] if there's a syntax error in the query,
82
- # or if it doesn't take up the entire input string.
83
- def parse_at_root_query
84
- init_scanner!
85
- query = at_root_query
86
- expected("@at-root query list") unless query && @scanner.eos?
87
- query
88
- end
89
-
90
- # Parses a supports query condition.
91
- #
92
- # @return [Sass::Supports::Condition] The parsed condition
93
- # @raise [Sass::SyntaxError] if there's a syntax error in the condition,
94
- # or if it doesn't take up the entire input string.
95
- def parse_supports_condition
96
- init_scanner!
97
- condition = supports_condition
98
- expected("supports condition") unless condition && @scanner.eos?
99
- condition
100
- end
101
-
102
- private
103
-
104
- include Sass::SCSS::RX
105
-
106
- def source_position
107
- Sass::Source::Position.new(@line, @offset)
108
- end
109
-
110
- def range(start_pos, end_pos = source_position)
111
- Sass::Source::Range.new(start_pos, end_pos, @filename, @importer)
112
- end
113
-
114
- def init_scanner!
115
- @scanner =
116
- if @template.is_a?(StringScanner)
117
- @template
118
- else
119
- Sass::Util::MultibyteStringScanner.new(@template.tr("\r", ""))
120
- end
121
- end
122
-
123
- def stylesheet
124
- node = node(Sass::Tree::RootNode.new(@scanner.string), source_position)
125
- block_contents(node, :stylesheet) {s(node)}
126
- end
127
-
128
- def s(node)
129
- while tok(S) || tok(CDC) || tok(CDO) || (c = tok(SINGLE_LINE_COMMENT)) || (c = tok(COMMENT))
130
- next unless c
131
- process_comment c, node
132
- c = nil
133
- end
134
- true
135
- end
136
-
137
- def ss
138
- nil while tok(S) || tok(SINGLE_LINE_COMMENT) || tok(COMMENT)
139
- true
140
- end
141
-
142
- def ss_comments(node)
143
- while tok(S) || (c = tok(SINGLE_LINE_COMMENT)) || (c = tok(COMMENT))
144
- next unless c
145
- process_comment c, node
146
- c = nil
147
- end
148
-
149
- true
150
- end
151
-
152
- def whitespace
153
- return unless tok(S) || tok(SINGLE_LINE_COMMENT) || tok(COMMENT)
154
- ss
155
- end
156
-
157
- def process_comment(text, node)
158
- silent = text =~ %r{\A//}
159
- loud = !silent && text =~ %r{\A/[/*]!}
160
- line = @line - text.count("\n")
161
- comment_start = @scanner.pos - text.length
162
- index_before_line = @scanner.string.rindex("\n", comment_start) || -1
163
- offset = comment_start - index_before_line
164
-
165
- if silent
166
- value = [text.sub(%r{\A\s*//}, '/*').gsub(%r{^\s*//}, ' *') + ' */']
167
- else
168
- value = Sass::Engine.parse_interp(text, line, offset, :filename => @filename)
169
- line_before_comment = @scanner.string[index_before_line + 1...comment_start]
170
- value.unshift(line_before_comment.gsub(/[^\s]/, ' '))
171
- end
172
-
173
- type = if silent
174
- :silent
175
- elsif loud
176
- :loud
177
- else
178
- :normal
179
- end
180
- start_pos = Sass::Source::Position.new(line, offset)
181
- comment = node(Sass::Tree::CommentNode.new(value, type), start_pos)
182
- node << comment
183
- end
184
-
185
- DIRECTIVES = Set[:mixin, :include, :function, :return, :debug, :warn, :for,
186
- :each, :while, :if, :else, :extend, :import, :media, :charset, :content,
187
- :_moz_document, :at_root, :error]
188
-
189
- PREFIXED_DIRECTIVES = Set[:supports]
190
-
191
- def directive
192
- start_pos = source_position
193
- return unless tok(/@/)
194
- name = tok!(IDENT)
195
- ss
196
-
197
- if (dir = special_directive(name, start_pos))
198
- return dir
199
- elsif (dir = prefixed_directive(name, start_pos))
200
- return dir
201
- end
202
-
203
- val = almost_any_value
204
- val = val ? ["@#{name} "] + Sass::Util.strip_string_array(val) : ["@#{name}"]
205
- directive_body(val, start_pos)
206
- end
207
-
208
- def directive_body(value, start_pos)
209
- node = Sass::Tree::DirectiveNode.new(value)
210
-
211
- if tok(/\{/)
212
- node.has_children = true
213
- block_contents(node, :directive)
214
- tok!(/\}/)
215
- end
216
-
217
- node(node, start_pos)
218
- end
219
-
220
- def special_directive(name, start_pos)
221
- sym = name.tr('-', '_').to_sym
222
- DIRECTIVES.include?(sym) && send("#{sym}_directive", start_pos)
223
- end
224
-
225
- def prefixed_directive(name, start_pos)
226
- sym = deprefix(name).tr('-', '_').to_sym
227
- PREFIXED_DIRECTIVES.include?(sym) && send("#{sym}_directive", name, start_pos)
228
- end
229
-
230
- def mixin_directive(start_pos)
231
- name = tok! IDENT
232
- args, splat = sass_script(:parse_mixin_definition_arglist)
233
- ss
234
- block(node(Sass::Tree::MixinDefNode.new(name, args, splat), start_pos), :directive)
235
- end
236
-
237
- def include_directive(start_pos)
238
- name = tok! IDENT
239
- args, keywords, splat, kwarg_splat = sass_script(:parse_mixin_include_arglist)
240
- ss
241
- include_node = node(
242
- Sass::Tree::MixinNode.new(name, args, keywords, splat, kwarg_splat), start_pos)
243
- if tok?(/\{/)
244
- include_node.has_children = true
245
- block(include_node, :directive)
246
- else
247
- include_node
248
- end
249
- end
250
-
251
- def content_directive(start_pos)
252
- ss
253
- node(Sass::Tree::ContentNode.new, start_pos)
254
- end
255
-
256
- def function_directive(start_pos)
257
- name = tok! IDENT
258
- args, splat = sass_script(:parse_function_definition_arglist)
259
- ss
260
- block(node(Sass::Tree::FunctionNode.new(name, args, splat), start_pos), :function)
261
- end
262
-
263
- def return_directive(start_pos)
264
- node(Sass::Tree::ReturnNode.new(sass_script(:parse)), start_pos)
265
- end
266
-
267
- def debug_directive(start_pos)
268
- node(Sass::Tree::DebugNode.new(sass_script(:parse)), start_pos)
269
- end
270
-
271
- def warn_directive(start_pos)
272
- node(Sass::Tree::WarnNode.new(sass_script(:parse)), start_pos)
273
- end
274
-
275
- def for_directive(start_pos)
276
- tok!(/\$/)
277
- var = tok! IDENT
278
- ss
279
-
280
- tok!(/from/)
281
- from = sass_script(:parse_until, Set["to", "through"])
282
- ss
283
-
284
- @expected = '"to" or "through"'
285
- exclusive = (tok(/to/) || tok!(/through/)) == 'to'
286
- to = sass_script(:parse)
287
- ss
288
-
289
- block(node(Sass::Tree::ForNode.new(var, from, to, exclusive), start_pos), :directive)
290
- end
291
-
292
- def each_directive(start_pos)
293
- tok!(/\$/)
294
- vars = [tok!(IDENT)]
295
- ss
296
- while tok(/,/)
297
- ss
298
- tok!(/\$/)
299
- vars << tok!(IDENT)
300
- ss
301
- end
302
-
303
- tok!(/in/)
304
- list = sass_script(:parse)
305
- ss
306
-
307
- block(node(Sass::Tree::EachNode.new(vars, list), start_pos), :directive)
308
- end
309
-
310
- def while_directive(start_pos)
311
- expr = sass_script(:parse)
312
- ss
313
- block(node(Sass::Tree::WhileNode.new(expr), start_pos), :directive)
314
- end
315
-
316
- def if_directive(start_pos)
317
- expr = sass_script(:parse)
318
- ss
319
- node = block(node(Sass::Tree::IfNode.new(expr), start_pos), :directive)
320
- pos = @scanner.pos
321
- line = @line
322
- ss
323
-
324
- else_block(node) ||
325
- begin
326
- # Backtrack in case there are any comments we want to parse
327
- @scanner.pos = pos
328
- @line = line
329
- node
330
- end
331
- end
332
-
333
- def else_block(node)
334
- start_pos = source_position
335
- return unless tok(/@else/)
336
- ss
337
- else_node = block(
338
- node(Sass::Tree::IfNode.new((sass_script(:parse) if tok(/if/))), start_pos),
339
- :directive)
340
- node.add_else(else_node)
341
- pos = @scanner.pos
342
- line = @line
343
- ss
344
-
345
- else_block(node) ||
346
- begin
347
- # Backtrack in case there are any comments we want to parse
348
- @scanner.pos = pos
349
- @line = line
350
- node
351
- end
352
- end
353
-
354
- def else_directive(start_pos)
355
- err("Invalid CSS: @else must come after @if")
356
- end
357
-
358
- def extend_directive(start_pos)
359
- selector_start_pos = source_position
360
- @expected = "selector"
361
- selector = Sass::Util.strip_string_array(expr!(:almost_any_value))
362
- optional = tok(OPTIONAL)
363
- ss
364
- node(Sass::Tree::ExtendNode.new(selector, !!optional, range(selector_start_pos)), start_pos)
365
- end
366
-
367
- def import_directive(start_pos)
368
- values = []
369
-
370
- loop do
371
- values << expr!(:import_arg)
372
- break if use_css_import?
373
- break unless tok(/,/)
374
- ss
375
- end
376
-
377
- values
378
- end
379
-
380
- def import_arg
381
- start_pos = source_position
382
- return unless (str = string) || (uri = tok?(/url\(/i))
383
- if uri
384
- str = sass_script(:parse_string)
385
- ss
386
- supports = supports_clause
387
- ss
388
- media = media_query_list
389
- ss
390
- return node(Tree::CssImportNode.new(str, media.to_a, supports), start_pos)
391
- end
392
- ss
393
-
394
- supports = supports_clause
395
- ss
396
- media = media_query_list
397
- if str =~ %r{^(https?:)?//} || media || supports || use_css_import?
398
- return node(
399
- Sass::Tree::CssImportNode.new(
400
- Sass::Script::Value::String.quote(str), media.to_a, supports), start_pos)
401
- end
402
-
403
- node(Sass::Tree::ImportNode.new(str.strip), start_pos)
404
- end
405
-
406
- def use_css_import?; false; end
407
-
408
- def media_directive(start_pos)
409
- block(node(Sass::Tree::MediaNode.new(expr!(:media_query_list).to_a), start_pos), :directive)
410
- end
411
-
412
- # http://www.w3.org/TR/css3-mediaqueries/#syntax
413
- def media_query_list
414
- query = media_query
415
- return unless query
416
- queries = [query]
417
-
418
- ss
419
- while tok(/,/)
420
- ss; queries << expr!(:media_query)
421
- end
422
- ss
423
-
424
- Sass::Media::QueryList.new(queries)
425
- end
426
-
427
- def media_query
428
- if (ident1 = interp_ident)
429
- ss
430
- ident2 = interp_ident
431
- ss
432
- if ident2 && ident2.length == 1 && ident2[0].is_a?(String) && ident2[0].downcase == 'and'
433
- query = Sass::Media::Query.new([], ident1, [])
434
- else
435
- if ident2
436
- query = Sass::Media::Query.new(ident1, ident2, [])
437
- else
438
- query = Sass::Media::Query.new([], ident1, [])
439
- end
440
- return query unless tok(/and/i)
441
- ss
442
- end
443
- end
444
-
445
- if query
446
- expr = expr!(:media_expr)
447
- else
448
- expr = media_expr
449
- return unless expr
450
- end
451
- query ||= Sass::Media::Query.new([], [], [])
452
- query.expressions << expr
453
-
454
- ss
455
- while tok(/and/i)
456
- ss; query.expressions << expr!(:media_expr)
457
- end
458
-
459
- query
460
- end
461
-
462
- def query_expr
463
- interp = interpolation
464
- return interp if interp
465
- return unless tok(/\(/)
466
- res = ['(']
467
- ss
468
- res << sass_script(:parse)
469
-
470
- if tok(/:/)
471
- res << ': '
472
- ss
473
- res << sass_script(:parse)
474
- end
475
- res << tok!(/\)/)
476
- ss
477
- res
478
- end
479
-
480
- # Aliases allow us to use different descriptions if the same
481
- # expression fails in different contexts.
482
- alias_method :media_expr, :query_expr
483
- alias_method :at_root_query, :query_expr
484
-
485
- def charset_directive(start_pos)
486
- name = expr!(:string)
487
- ss
488
- node(Sass::Tree::CharsetNode.new(name), start_pos)
489
- end
490
-
491
- # The document directive is specified in
492
- # http://www.w3.org/TR/css3-conditional/, but Gecko allows the
493
- # `url-prefix` and `domain` functions to omit quotation marks, contrary to
494
- # the standard.
495
- #
496
- # We could parse all document directives according to Mozilla's syntax,
497
- # but if someone's using e.g. @-webkit-document we don't want them to
498
- # think WebKit works sans quotes.
499
- def _moz_document_directive(start_pos)
500
- res = ["@-moz-document "]
501
- loop do
502
- res << str {ss} << expr!(:moz_document_function)
503
- if (c = tok(/,/))
504
- res << c
505
- else
506
- break
507
- end
508
- end
509
- directive_body(res.flatten, start_pos)
510
- end
511
-
512
- def moz_document_function
513
- val = interp_uri || _interp_string(:url_prefix) ||
514
- _interp_string(:domain) || function(false) || interpolation
515
- return unless val
516
- ss
517
- val
518
- end
519
-
520
- def at_root_directive(start_pos)
521
- if tok?(/\(/) && (expr = at_root_query)
522
- return block(node(Sass::Tree::AtRootNode.new(expr), start_pos), :directive)
523
- end
524
-
525
- at_root_node = node(Sass::Tree::AtRootNode.new, start_pos)
526
- rule_node = ruleset
527
- return block(at_root_node, :stylesheet) unless rule_node
528
- at_root_node << rule_node
529
- at_root_node
530
- end
531
-
532
- def at_root_directive_list
533
- return unless (first = tok(IDENT))
534
- arr = [first]
535
- ss
536
- while (e = tok(IDENT))
537
- arr << e
538
- ss
539
- end
540
- arr
541
- end
542
-
543
- def error_directive(start_pos)
544
- node(Sass::Tree::ErrorNode.new(sass_script(:parse)), start_pos)
545
- end
546
-
547
- # http://www.w3.org/TR/css3-conditional/
548
- def supports_directive(name, start_pos)
549
- condition = expr!(:supports_condition)
550
- node = Sass::Tree::SupportsNode.new(name, condition)
551
-
552
- tok!(/\{/)
553
- node.has_children = true
554
- block_contents(node, :directive)
555
- tok!(/\}/)
556
-
557
- node(node, start_pos)
558
- end
559
-
560
- def supports_clause
561
- return unless tok(/supports\(/i)
562
- ss
563
- supports = import_supports_condition
564
- ss
565
- tok!(/\)/)
566
- supports
567
- end
568
-
569
- def supports_condition
570
- supports_negation || supports_operator || supports_interpolation
571
- end
572
-
573
- def import_supports_condition
574
- supports_condition || supports_declaration
575
- end
576
-
577
- def supports_negation
578
- return unless tok(/not/i)
579
- ss
580
- Sass::Supports::Negation.new(expr!(:supports_condition_in_parens))
581
- end
582
-
583
- def supports_operator
584
- cond = supports_condition_in_parens
585
- return unless cond
586
- re = /and|or/i
587
- while (op = tok(re))
588
- re = /#{op}/i
589
- ss
590
- cond = Sass::Supports::Operator.new(
591
- cond, expr!(:supports_condition_in_parens), op)
592
- end
593
- cond
594
- end
595
-
596
- def supports_declaration
597
- name = sass_script(:parse)
598
- tok!(/:/); ss
599
- value = sass_script(:parse)
600
- Sass::Supports::Declaration.new(name, value)
601
- end
602
-
603
- def supports_condition_in_parens
604
- interp = supports_interpolation
605
- return interp if interp
606
- return unless tok(/\(/); ss
607
- if (cond = supports_condition)
608
- tok!(/\)/); ss
609
- cond
610
- else
611
- decl = supports_declaration
612
- tok!(/\)/); ss
613
- decl
614
- end
615
- end
616
-
617
- def supports_interpolation
618
- interp = interpolation
619
- return unless interp
620
- ss
621
- Sass::Supports::Interpolation.new(interp)
622
- end
623
-
624
- def variable
625
- return unless tok(/\$/)
626
- start_pos = source_position
627
- name = tok!(IDENT)
628
- ss; tok!(/:/); ss
629
-
630
- expr = sass_script(:parse)
631
- while tok(/!/)
632
- flag_name = tok!(IDENT)
633
- if flag_name == 'default'
634
- guarded ||= true
635
- elsif flag_name == 'global'
636
- global ||= true
637
- else
638
- raise Sass::SyntaxError.new("Invalid flag \"!#{flag_name}\".", :line => @line)
639
- end
640
- ss
641
- end
642
-
643
- result = Sass::Tree::VariableNode.new(name, expr, guarded, global)
644
- node(result, start_pos)
645
- end
646
-
647
- def operator
648
- # Many of these operators (all except / and ,)
649
- # are disallowed by the CSS spec,
650
- # but they're included here for compatibility
651
- # with some proprietary MS properties
652
- str {ss if tok(%r{[/,:.=]})}
653
- end
654
-
655
- def ruleset
656
- start_pos = source_position
657
- return unless (rules = almost_any_value)
658
- block(
659
- node(
660
- Sass::Tree::RuleNode.new(rules, range(start_pos)), start_pos), :ruleset)
661
- end
662
-
663
- def block(node, context)
664
- node.has_children = true
665
- tok!(/\{/)
666
- block_contents(node, context)
667
- tok!(/\}/)
668
- node
669
- end
670
-
671
- # A block may contain declarations and/or rulesets
672
- def block_contents(node, context)
673
- block_given? ? yield : ss_comments(node)
674
- node << (child = block_child(context))
675
- while tok(/;/) || has_children?(child)
676
- block_given? ? yield : ss_comments(node)
677
- node << (child = block_child(context))
678
- end
679
- node
680
- end
681
-
682
- def block_child(context)
683
- return variable || directive if context == :function
684
- return variable || directive || ruleset if context == :stylesheet
685
- variable || directive || declaration_or_ruleset
686
- end
687
-
688
- def has_children?(child_or_array)
689
- return false unless child_or_array
690
- return child_or_array.last.has_children if child_or_array.is_a?(Array)
691
- child_or_array.has_children
692
- end
693
-
694
- # When parsing the contents of a ruleset, it can be difficult to tell
695
- # declarations apart from nested rulesets. Since we don't thoroughly parse
696
- # selectors until after resolving interpolation, we can share a bunch of
697
- # the parsing of the two, but we need to disambiguate them first. We use
698
- # the following criteria:
699
- #
700
- # * If the entity doesn't start with an identifier followed by a colon,
701
- # it's a selector. There are some additional mostly-unimportant cases
702
- # here to support various declaration hacks.
703
- #
704
- # * If the colon is followed by another colon, it's a selector.
705
- #
706
- # * Otherwise, if the colon is followed by anything other than
707
- # interpolation or a character that's valid as the beginning of an
708
- # identifier, it's a declaration.
709
- #
710
- # * If the colon is followed by interpolation or a valid identifier, try
711
- # parsing it as a declaration value. If this fails, backtrack and parse
712
- # it as a selector.
713
- #
714
- # * If the declaration value value valid but is followed by "{", backtrack
715
- # and parse it as a selector anyway. This ensures that ".foo:bar {" is
716
- # always parsed as a selector and never as a property with nested
717
- # properties beneath it.
718
- def declaration_or_ruleset
719
- start_pos = source_position
720
- declaration = try_declaration
721
-
722
- if declaration.nil?
723
- return unless (selector = almost_any_value)
724
- elsif declaration.is_a?(Array)
725
- selector = declaration
726
- else
727
- # Declaration should be a PropNode.
728
- return declaration
729
- end
730
-
731
- if (additional_selector = almost_any_value)
732
- selector << additional_selector
733
- end
734
-
735
- block(
736
- node(
737
- Sass::Tree::RuleNode.new(merge(selector), range(start_pos)), start_pos), :ruleset)
738
- end
739
-
740
- # Tries to parse a declaration, and returns the value parsed so far if it
741
- # fails.
742
- #
743
- # This has three possible return types. It can return `nil`, indicating
744
- # that parsing failed completely and the scanner hasn't moved forward at
745
- # all. It can return an Array, indicating that parsing failed after
746
- # consuming some text (possibly containing interpolation), which is
747
- # returned. Or it can return a PropNode, indicating that parsing
748
- # succeeded.
749
- def try_declaration
750
- # This allows the "*prop: val", ":prop: val", "#prop: val", and ".prop:
751
- # val" hacks.
752
- name_start_pos = source_position
753
- if (s = tok(/[:\*\.]|\#(?!\{)/))
754
- name = [s, str {ss}]
755
- return name unless (ident = interp_ident)
756
- name << ident
757
- else
758
- return unless (name = interp_ident)
759
- name = Array(name)
760
- end
761
-
762
- if (comment = tok(COMMENT))
763
- name << comment
764
- end
765
- name_end_pos = source_position
766
-
767
- mid = [str {ss}]
768
- return name + mid unless tok(/:/)
769
- mid << ':'
770
- return name + mid + [':'] if tok(/:/)
771
- mid << str {ss}
772
- post_colon_whitespace = !mid.last.empty?
773
- could_be_selector = !post_colon_whitespace && (tok?(IDENT_START) || tok?(INTERP_START))
774
-
775
- value_start_pos = source_position
776
- value = nil
777
- error = catch_error do
778
- value = value!(name.first.is_a?(String) && name.first.start_with?("--"))
779
- if tok?(/\{/)
780
- # Properties that are ambiguous with selectors can't have additional
781
- # properties nested beneath them.
782
- tok!(/;/) if could_be_selector
783
- elsif !tok?(/[;{}]/)
784
- # We want an exception if there's no valid end-of-property character
785
- # exists, but we don't want to consume it if it does.
786
- tok!(/[;{}]/)
787
- end
788
- end
789
-
790
- if error
791
- rethrow error unless could_be_selector
792
-
793
- # If the value would be followed by a semicolon, it's definitely
794
- # supposed to be a property, not a selector.
795
- additional_selector = almost_any_value
796
- rethrow error if tok?(/;/)
797
-
798
- return name + mid + (additional_selector || [])
799
- end
800
-
801
- value_end_pos = source_position
802
- ss
803
- require_block = tok?(/\{/)
804
-
805
- node = node(Sass::Tree::PropNode.new(name.flatten.compact, value, :new),
806
- name_start_pos, value_end_pos)
807
- node.name_source_range = range(name_start_pos, name_end_pos)
808
- node.value_source_range = range(value_start_pos, value_end_pos)
809
-
810
- return node unless require_block
811
- nested_properties! node
812
- end
813
-
814
- # This production is similar to the CSS [`<any-value>`][any-value]
815
- # production, but as the name implies, not quite the same. It's meant to
816
- # consume values that could be a selector, an expression, or a combination
817
- # of both. It respects strings and comments and supports interpolation. It
818
- # will consume up to "{", "}", ";", or "!".
819
- #
820
- # [any-value]: http://dev.w3.org/csswg/css-variables/#typedef-any-value
821
- #
822
- # Values consumed by this production will usually be parsed more
823
- # thoroughly once interpolation has been resolved.
824
- def almost_any_value
825
- return unless (tok = almost_any_value_token)
826
- sel = [tok]
827
- while (tok = almost_any_value_token)
828
- sel << tok
829
- end
830
- merge(sel)
831
- end
832
-
833
- def almost_any_value_token
834
- tok(%r{
835
- (
836
- \\.
837
- |
838
- (?!url\()
839
- [^"'/\#!;\{\}] # "
840
- |
841
- # interp_uri will handle most url() calls, but not ones that take strings
842
- url\(#{W}(?=")
843
- |
844
- /(?![/*])
845
- |
846
- \#(?!\{)
847
- |
848
- !(?![a-z]) # TODO: never consume "!" when issue 1126 is fixed.
849
- )+
850
- }xi) || tok(COMMENT) || tok(SINGLE_LINE_COMMENT) || interp_string || interp_uri ||
851
- interpolation(:warn_for_color)
852
- end
853
-
854
- def declaration
855
- # This allows the "*prop: val", ":prop: val", "#prop: val", and ".prop:
856
- # val" hacks.
857
- name_start_pos = source_position
858
- if (s = tok(/[:\*\.]|\#(?!\{)/))
859
- name = [s, str {ss}, *expr!(:interp_ident)]
860
- else
861
- return unless (name = interp_ident)
862
- name = Array(name)
863
- end
864
-
865
- if (comment = tok(COMMENT))
866
- name << comment
867
- end
868
- name_end_pos = source_position
869
- ss
870
-
871
- tok!(/:/)
872
- ss
873
- value_start_pos = source_position
874
- value = value!(name.first.is_a?(String) && name.first.start_with?("--"))
875
- value_end_pos = source_position
876
- ss
877
- require_block = tok?(/\{/)
878
-
879
- node = node(Sass::Tree::PropNode.new(name.flatten.compact, value, :new),
880
- name_start_pos, value_end_pos)
881
- node.name_source_range = range(name_start_pos, name_end_pos)
882
- node.value_source_range = range(value_start_pos, value_end_pos)
883
-
884
- return node unless require_block
885
- nested_properties! node
886
- end
887
-
888
- def value!(css_variable = false)
889
- if tok?(/\{/)
890
- str = Sass::Script::Tree::Literal.new(Sass::Script::Value::String.new(""))
891
- str.line = source_position.line
892
- str.source_range = range(source_position)
893
- return str
894
- end
895
-
896
- start_pos = source_position
897
- # This is a bit of a dirty trick:
898
- # if the value is completely static,
899
- # we don't parse it at all, and instead return a plain old string
900
- # containing the value.
901
- # This results in a dramatic speed increase.
902
- if (val = tok(STATIC_VALUE, true))
903
- str = Sass::Script::Tree::Literal.new(Sass::Script::Value::String.new(val.strip))
904
- str.line = start_pos.line
905
- str.source_range = range(start_pos)
906
- return str
907
- end
908
-
909
- sass_script(:parse, css_variable)
910
- end
911
-
912
- def nested_properties!(node)
913
- if node.name.first.is_a?(String) && node.name.first.start_with?("--")
914
- Sass::Util.sass_warn(<<WARNING)
915
- DEPRECATION WARNING on line #{@line}#{" of #{@filename}" if @filename}:
916
- Sass 3.6 will change the way CSS variables are parsed. Instead of being parsed as
917
- normal properties, they will not allow any Sass-specific behavior other than \#{}.
918
- WARNING
919
- end
920
-
921
- @expected = 'expression (e.g. 1px, bold) or "{"'
922
- block(node, :property)
923
- end
924
-
925
- def expr(allow_var = true)
926
- t = term(allow_var)
927
- return unless t
928
- res = [t, str {ss}]
929
-
930
- while (o = operator) && (t = term(allow_var))
931
- res << o << t << str {ss}
932
- end
933
-
934
- res.flatten
935
- end
936
-
937
- def term(allow_var)
938
- e = tok(NUMBER) ||
939
- interp_uri ||
940
- function(allow_var) ||
941
- interp_string ||
942
- tok(UNICODERANGE) ||
943
- interp_ident ||
944
- tok(HEXCOLOR) ||
945
- (allow_var && var_expr)
946
- return e if e
947
-
948
- op = tok(/[+-]/)
949
- return unless op
950
- @expected = "number or function"
951
- [op,
952
- tok(NUMBER) || function(allow_var) || (allow_var && var_expr) || expr!(:interpolation)]
953
- end
954
-
955
- def function(allow_var)
956
- name = tok(FUNCTION)
957
- return unless name
958
- if name == "expression(" || name == "calc("
959
- str, _ = Sass::Shared.balance(@scanner, ?(, ?), 1)
960
- [name, str]
961
- else
962
- [name, str {ss}, expr(allow_var), tok!(/\)/)]
963
- end
964
- end
965
-
966
- def var_expr
967
- return unless tok(/\$/)
968
- line = @line
969
- var = Sass::Script::Tree::Variable.new(tok!(IDENT))
970
- var.line = line
971
- var
972
- end
973
-
974
- def interpolation(warn_for_color = false)
975
- return unless tok(INTERP_START)
976
- sass_script(:parse_interpolated, warn_for_color)
977
- end
978
-
979
- def string
980
- return unless tok(STRING)
981
- Sass::Script::Value::String.value(@scanner[1] || @scanner[2])
982
- end
983
-
984
- def interp_string
985
- _interp_string(:double) || _interp_string(:single)
986
- end
987
-
988
- def interp_uri
989
- _interp_string(:uri)
990
- end
991
-
992
- def _interp_string(type)
993
- start = tok(Sass::Script::Lexer::STRING_REGULAR_EXPRESSIONS[type][false])
994
- return unless start
995
- res = [start]
996
-
997
- mid_re = Sass::Script::Lexer::STRING_REGULAR_EXPRESSIONS[type][true]
998
- # @scanner[2].empty? means we've started an interpolated section
999
- while @scanner[2] == '#{'
1000
- @scanner.pos -= 2 # Don't consume the #{
1001
- res.last.slice!(-2..-1)
1002
- res << expr!(:interpolation) << tok(mid_re)
1003
- end
1004
- res
1005
- end
1006
-
1007
- def interp_ident(start = IDENT)
1008
- val = tok(start) || interpolation(:warn_for_color) || tok(IDENT_HYPHEN_INTERP, true)
1009
- return unless val
1010
- res = [val]
1011
- while (val = tok(NAME) || interpolation(:warn_for_color))
1012
- res << val
1013
- end
1014
- res
1015
- end
1016
-
1017
- def interp_ident_or_var
1018
- id = interp_ident
1019
- return id if id
1020
- var = var_expr
1021
- return [var] if var
1022
- end
1023
-
1024
- def str
1025
- @strs.push String.new("")
1026
- yield
1027
- @strs.last
1028
- ensure
1029
- @strs.pop
1030
- end
1031
-
1032
- def str?
1033
- pos = @scanner.pos
1034
- line = @line
1035
- offset = @offset
1036
- @strs.push ""
1037
- throw_error {yield} && @strs.last
1038
- rescue Sass::SyntaxError
1039
- @scanner.pos = pos
1040
- @line = line
1041
- @offset = offset
1042
- nil
1043
- ensure
1044
- @strs.pop
1045
- end
1046
-
1047
- def node(node, start_pos, end_pos = source_position)
1048
- node.line = start_pos.line
1049
- node.source_range = range(start_pos, end_pos)
1050
- node
1051
- end
1052
-
1053
- @sass_script_parser = Sass::Script::Parser
1054
-
1055
- class << self
1056
- # @private
1057
- attr_accessor :sass_script_parser
1058
- end
1059
-
1060
- def sass_script(*args)
1061
- parser = self.class.sass_script_parser.new(@scanner, @line, @offset,
1062
- :filename => @filename, :importer => @importer, :allow_extra_text => true)
1063
- result = parser.send(*args)
1064
- unless @strs.empty?
1065
- # Convert to CSS manually so that comments are ignored.
1066
- src = result.to_sass
1067
- @strs.each {|s| s << src}
1068
- end
1069
- @line = parser.line
1070
- @offset = parser.offset
1071
- result
1072
- rescue Sass::SyntaxError => e
1073
- throw(:_sass_parser_error, true) if @throw_error
1074
- raise e
1075
- end
1076
-
1077
- def merge(arr)
1078
- arr && Sass::Util.merge_adjacent_strings([arr].flatten)
1079
- end
1080
-
1081
- EXPR_NAMES = {
1082
- :media_query => "media query (e.g. print, screen, print and screen)",
1083
- :media_query_list => "media query (e.g. print, screen, print and screen)",
1084
- :media_expr => "media expression (e.g. (min-device-width: 800px))",
1085
- :at_root_query => "@at-root query (e.g. (without: media))",
1086
- :at_root_directive_list => '* or identifier',
1087
- :pseudo_args => "expression (e.g. fr, 2n+1)",
1088
- :interp_ident => "identifier",
1089
- :qualified_name => "identifier",
1090
- :expr => "expression (e.g. 1px, bold)",
1091
- :selector_comma_sequence => "selector",
1092
- :string => "string",
1093
- :import_arg => "file to import (string or url())",
1094
- :moz_document_function => "matching function (e.g. url-prefix(), domain())",
1095
- :supports_condition => "@supports condition (e.g. (display: flexbox))",
1096
- :supports_condition_in_parens => "@supports condition (e.g. (display: flexbox))",
1097
- :a_n_plus_b => "An+B expression",
1098
- :keyframes_selector_component => "from, to, or a percentage",
1099
- :keyframes_selector => "keyframes selector (e.g. 10%)"
1100
- }
1101
-
1102
- TOK_NAMES = Sass::Util.to_hash(Sass::SCSS::RX.constants.map do |c|
1103
- [Sass::SCSS::RX.const_get(c), c.downcase]
1104
- end).merge(
1105
- IDENT => "identifier",
1106
- /[;{}]/ => '";"',
1107
- /\b(without|with)\b/ => '"with" or "without"'
1108
- )
1109
-
1110
- def tok?(rx)
1111
- @scanner.match?(rx)
1112
- end
1113
-
1114
- def expr!(name)
1115
- e = send(name)
1116
- return e if e
1117
- expected(EXPR_NAMES[name] || name.to_s)
1118
- end
1119
-
1120
- def tok!(rx)
1121
- t = tok(rx)
1122
- return t if t
1123
- name = TOK_NAMES[rx]
1124
-
1125
- unless name
1126
- # Display basic regexps as plain old strings
1127
- source = rx.source.gsub(%r{\\/}, '/')
1128
- string = rx.source.gsub(/\\(.)/, '\1')
1129
- name = source == Regexp.escape(string) ? string.inspect : rx.inspect
1130
- end
1131
-
1132
- expected(name)
1133
- end
1134
-
1135
- def expected(name)
1136
- throw(:_sass_parser_error, true) if @throw_error
1137
- self.class.expected(@scanner, @expected || name, @line)
1138
- end
1139
-
1140
- def err(msg)
1141
- throw(:_sass_parser_error, true) if @throw_error
1142
- raise Sass::SyntaxError.new(msg, :line => @line)
1143
- end
1144
-
1145
- def throw_error
1146
- old_throw_error, @throw_error = @throw_error, false
1147
- yield
1148
- ensure
1149
- @throw_error = old_throw_error
1150
- end
1151
-
1152
- def catch_error(&block)
1153
- old_throw_error, @throw_error = @throw_error, true
1154
- pos = @scanner.pos
1155
- line = @line
1156
- offset = @offset
1157
- expected = @expected
1158
-
1159
- logger = Sass::Logger::Delayed.install!
1160
- if catch(:_sass_parser_error) {yield; false}
1161
- @scanner.pos = pos
1162
- @line = line
1163
- @offset = offset
1164
- @expected = expected
1165
- {:pos => pos, :line => line, :expected => @expected, :block => block}
1166
- else
1167
- logger.flush
1168
- nil
1169
- end
1170
- ensure
1171
- logger.uninstall! if logger
1172
- @throw_error = old_throw_error
1173
- end
1174
-
1175
- def rethrow(err)
1176
- if @throw_error
1177
- throw :_sass_parser_error, err
1178
- else
1179
- @scanner = Sass::Util::MultibyteStringScanner.new(@scanner.string)
1180
- @scanner.pos = err[:pos]
1181
- @line = err[:line]
1182
- @expected = err[:expected]
1183
- err[:block].call
1184
- end
1185
- end
1186
-
1187
- # @private
1188
- def self.expected(scanner, expected, line)
1189
- pos = scanner.pos
1190
-
1191
- after = scanner.string[0...pos]
1192
- # Get rid of whitespace between pos and the last token,
1193
- # but only if there's a newline in there
1194
- after.gsub!(/\s*\n\s*$/, '')
1195
- # Also get rid of stuff before the last newline
1196
- after.gsub!(/.*\n/, '')
1197
- after = "..." + after[-15..-1] if after.size > 18
1198
-
1199
- was = scanner.rest.dup
1200
- # Get rid of whitespace between pos and the next token,
1201
- # but only if there's a newline in there
1202
- was.gsub!(/^\s*\n\s*/, '')
1203
- # Also get rid of stuff after the next newline
1204
- was.gsub!(/\n.*/, '')
1205
- was = was[0...15] + "..." if was.size > 18
1206
-
1207
- raise Sass::SyntaxError.new(
1208
- "Invalid CSS after \"#{after}\": expected #{expected}, was \"#{was}\"",
1209
- :line => line)
1210
- end
1211
-
1212
- # Avoid allocating lots of new strings for `#tok`.
1213
- # This is important because `#tok` is called all the time.
1214
- NEWLINE = "\n"
1215
-
1216
- def tok(rx, last_group_lookahead = false)
1217
- res = @scanner.scan(rx)
1218
-
1219
- return unless res
1220
-
1221
- # This fixes https://github.com/nex3/sass/issues/104, which affects
1222
- # Ruby 1.8.7 and REE. This fix is to replace the ?= zero-width
1223
- # positive lookahead operator in the Regexp (which matches without
1224
- # consuming the matched group), with a match that does consume the
1225
- # group, but then rewinds the scanner and removes the group from the
1226
- # end of the matched string. This fix makes the assumption that the
1227
- # matched group will always occur at the end of the match.
1228
- if last_group_lookahead && @scanner[-1]
1229
- @scanner.pos -= @scanner[-1].length
1230
- res.slice!(-@scanner[-1].length..-1)
1231
- end
1232
-
1233
- newline_count = res.count(NEWLINE)
1234
- if newline_count > 0
1235
- @line += newline_count
1236
- @offset = res[res.rindex(NEWLINE)..-1].size
1237
- else
1238
- @offset += res.size
1239
- end
1240
-
1241
- @expected = nil
1242
- if !@strs.empty? && rx != COMMENT && rx != SINGLE_LINE_COMMENT
1243
- @strs.each {|s| s << res}
1244
- end
1245
- res
1246
- end
1247
-
1248
- # Remove a vendor prefix from `str`.
1249
- def deprefix(str)
1250
- str.gsub(/^-[a-zA-Z0-9]+-/, '')
1251
- end
1252
- end
1253
- end
1254
- end