brakeman 4.5.1 → 4.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (503) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +216 -109
  3. data/README.md +13 -6
  4. data/bundle/load.rb +14 -13
  5. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/CHANGES.txt +0 -0
  6. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/MIT-LICENSE +0 -0
  7. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/README.txt +0 -0
  8. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/contrib/erubis +0 -0
  9. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/contrib/erubis-run.rb +0 -0
  10. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/contrib/inline-require +0 -0
  11. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis.rb +0 -0
  12. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/context.rb +0 -0
  13. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/converter.rb +0 -0
  14. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine.rb +0 -0
  15. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ec.rb +0 -0
  16. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ecpp.rb +0 -0
  17. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ejava.rb +0 -0
  18. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ejavascript.rb +0 -0
  19. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/enhanced.rb +0 -0
  20. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/eperl.rb +0 -0
  21. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb +0 -0
  22. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/eruby.rb +0 -0
  23. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/escheme.rb +0 -0
  24. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/optimized.rb +0 -0
  25. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/enhancer.rb +0 -0
  26. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/error.rb +0 -0
  27. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/evaluator.rb +0 -0
  28. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/generator.rb +0 -0
  29. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/helper.rb +0 -0
  30. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/helpers/rails_form_helper.rb +0 -0
  31. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/helpers/rails_helper.rb +0 -0
  32. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/local-setting.rb +0 -0
  33. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/main.rb +0 -0
  34. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/preprocessing.rb +0 -0
  35. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/tiny.rb +0 -0
  36. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/util.rb +0 -0
  37. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/erubis-2.7.0/setup.rb +0 -0
  38. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/CHANGELOG.md +138 -4
  39. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/FAQ.md +4 -14
  40. data/bundle/ruby/2.7.0/gems/haml-5.2.1/Gemfile +16 -0
  41. data/bundle/ruby/2.7.0/gems/haml-5.2.1/MIT-LICENSE +20 -0
  42. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/README.md +79 -42
  43. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/REFERENCE.md +150 -71
  44. data/bundle/ruby/2.7.0/gems/haml-5.2.1/TODO +24 -0
  45. data/bundle/ruby/2.7.0/gems/haml-5.2.1/haml.gemspec +45 -0
  46. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml.rb +2 -0
  47. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/attribute_builder.rb +164 -0
  48. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/attribute_compiler.rb +235 -0
  49. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/attribute_parser.rb +150 -0
  50. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/buffer.rb +25 -132
  51. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/compiler.rb +330 -0
  52. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/engine.rb +34 -41
  53. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/error.rb +65 -0
  54. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/escapable.rb +77 -0
  55. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/exec.rb +38 -20
  56. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/filters.rb +22 -27
  57. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/generator.rb +42 -0
  58. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers.rb +134 -89
  59. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers/action_view_extensions.rb +4 -2
  60. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers/action_view_mods.rb +45 -60
  61. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers/action_view_xss_mods.rb +2 -0
  62. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/helpers/safe_erubi_template.rb +20 -0
  63. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers/safe_erubis_template.rb +5 -1
  64. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/helpers/xss_mods.rb +23 -13
  65. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/options.rb +63 -69
  66. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/parser.rb +319 -227
  67. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/plugin.rb +37 -0
  68. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/railtie.rb +48 -0
  69. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/sass_rails_filter.rb +18 -4
  70. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/template.rb +13 -6
  71. data/bundle/ruby/{2.5.0/gems/haml-4.0.7 → 2.7.0/gems/haml-5.2.1}/lib/haml/template/options.rb +13 -2
  72. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/temple_engine.rb +123 -0
  73. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/temple_line_counter.rb +30 -0
  74. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/util.rb +258 -0
  75. data/bundle/ruby/2.7.0/gems/haml-5.2.1/lib/haml/version.rb +5 -0
  76. data/bundle/ruby/2.7.0/gems/haml-5.2.1/yard/default/fulldoc/html/css/common.sass +15 -0
  77. data/bundle/ruby/2.7.0/gems/haml-5.2.1/yard/default/layout/html/footer.erb +12 -0
  78. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/AUTHORS +0 -0
  79. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/COPYING +0 -0
  80. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/Changelog.md +3 -0
  81. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/Gemfile +0 -0
  82. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/LICENSE +0 -0
  83. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/README.md +0 -0
  84. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/TODO +0 -0
  85. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/appveyor.yml +0 -0
  86. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/highline.gemspec +0 -0
  87. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline.rb +0 -0
  88. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/builtin_styles.rb +0 -0
  89. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/color_scheme.rb +0 -0
  90. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/compatibility.rb +0 -0
  91. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/custom_errors.rb +0 -0
  92. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/import.rb +0 -0
  93. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/io_console_compatible.rb +0 -0
  94. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/list.rb +0 -0
  95. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/list_renderer.rb +0 -0
  96. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/menu.rb +0 -0
  97. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/menu/item.rb +0 -0
  98. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/paginator.rb +0 -0
  99. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/question.rb +0 -0
  100. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/question/answer_converter.rb +0 -0
  101. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/question_asker.rb +0 -0
  102. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/simulate.rb +0 -0
  103. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/statement.rb +0 -0
  104. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/string.rb +0 -0
  105. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/string_extensions.rb +0 -0
  106. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/style.rb +0 -0
  107. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/template_renderer.rb +0 -0
  108. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/terminal.rb +0 -0
  109. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/terminal/io_console.rb +0 -0
  110. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/terminal/ncurses.rb +0 -0
  111. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/terminal/unix_stty.rb +0 -0
  112. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/version.rb +1 -1
  113. data/bundle/ruby/{2.5.0/gems/highline-2.0.2 → 2.7.0/gems/highline-2.0.3}/lib/highline/wrapper.rb +0 -0
  114. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/Gemfile +6 -0
  115. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/LICENSE.txt +22 -0
  116. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/NEWS.md +141 -0
  117. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/README.md +60 -0
  118. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/attlistdecl.rb +63 -0
  119. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/attribute.rb +205 -0
  120. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/cdata.rb +68 -0
  121. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/child.rb +97 -0
  122. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/comment.rb +80 -0
  123. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/doctype.rb +287 -0
  124. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/document.rb +291 -0
  125. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/dtd/attlistdecl.rb +11 -0
  126. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/dtd/dtd.rb +47 -0
  127. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/dtd/elementdecl.rb +18 -0
  128. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/dtd/entitydecl.rb +57 -0
  129. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/dtd/notationdecl.rb +40 -0
  130. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/element.rb +1269 -0
  131. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/encoding.rb +51 -0
  132. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/entity.rb +171 -0
  133. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/formatters/default.rb +116 -0
  134. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/formatters/pretty.rb +142 -0
  135. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/formatters/transitive.rb +58 -0
  136. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/functions.rb +447 -0
  137. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/instruction.rb +79 -0
  138. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/light/node.rb +196 -0
  139. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/namespace.rb +59 -0
  140. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/node.rb +76 -0
  141. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/output.rb +30 -0
  142. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parent.rb +166 -0
  143. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parseexception.rb +52 -0
  144. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/baseparser.rb +594 -0
  145. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/lightparser.rb +59 -0
  146. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/pullparser.rb +197 -0
  147. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/sax2parser.rb +273 -0
  148. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/streamparser.rb +61 -0
  149. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/treeparser.rb +101 -0
  150. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/ultralightparser.rb +57 -0
  151. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/parsers/xpathparser.rb +675 -0
  152. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/quickpath.rb +266 -0
  153. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/rexml.rb +32 -0
  154. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/sax2listener.rb +98 -0
  155. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/security.rb +28 -0
  156. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/source.rb +298 -0
  157. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/streamlistener.rb +93 -0
  158. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/text.rb +424 -0
  159. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/undefinednamespaceexception.rb +9 -0
  160. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/validation/relaxng.rb +539 -0
  161. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/validation/validation.rb +144 -0
  162. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/validation/validationexception.rb +10 -0
  163. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/xmldecl.rb +130 -0
  164. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/xmltokens.rb +85 -0
  165. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/xpath.rb +81 -0
  166. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/xpath_parser.rb +968 -0
  167. data/bundle/ruby/2.7.0/gems/rexml-3.2.4/rexml.gemspec +84 -0
  168. data/bundle/ruby/{2.5.0/gems/ruby2ruby-2.4.2 → 2.7.0/gems/ruby2ruby-2.4.4}/History.rdoc +19 -5
  169. data/bundle/ruby/{2.5.0/gems/ruby2ruby-2.4.2 → 2.7.0/gems/ruby2ruby-2.4.4}/Manifest.txt +0 -0
  170. data/bundle/ruby/{2.5.0/gems/ruby2ruby-2.4.2 → 2.7.0/gems/ruby2ruby-2.4.4}/README.rdoc +0 -0
  171. data/bundle/ruby/{2.5.0/gems/ruby2ruby-2.4.2 → 2.7.0/gems/ruby2ruby-2.4.4}/lib/ruby2ruby.rb +122 -112
  172. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/History.rdoc +91 -0
  173. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/Manifest.txt +2 -0
  174. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/README.rdoc +3 -3
  175. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/compare/normalize.rb +43 -3
  176. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/debugging.md +57 -0
  177. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/rp_extensions.rb +0 -0
  178. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/rp_stringscanner.rb +0 -0
  179. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby20_parser.rb +7062 -0
  180. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1/lib/ruby_parser.yy → 2.7.0/gems/ruby_parser-3.15.0/lib/ruby20_parser.y} +473 -450
  181. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby21_parser.rb +7140 -0
  182. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby21_parser.y +482 -307
  183. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby22_parser.rb +7160 -0
  184. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby22_parser.y +483 -308
  185. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby23_parser.rb +7175 -0
  186. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby23_parser.y +483 -308
  187. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby24_parser.rb +7204 -0
  188. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby24_parser.y +487 -310
  189. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby25_parser.rb +7204 -0
  190. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby25_parser.y +487 -310
  191. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby26_parser.rb +7224 -0
  192. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby26_parser.y +493 -314
  193. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby27_parser.rb +7224 -0
  194. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby27_parser.y +2657 -0
  195. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby_lexer.rb +483 -459
  196. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby_lexer.rex +5 -6
  197. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby_lexer.rex.rb +6 -8
  198. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby_parser.rb +29 -27
  199. data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby_parser.yy +2764 -0
  200. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/lib/ruby_parser_extras.rb +670 -420
  201. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/tools/munge.rb +10 -5
  202. data/bundle/ruby/{2.5.0/gems/ruby_parser-3.13.1 → 2.7.0/gems/ruby_parser-3.15.0}/tools/ripper.rb +13 -2
  203. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/History.rdoc +0 -0
  204. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/Manifest.txt +0 -0
  205. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/README.rdoc +0 -0
  206. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy.rb +0 -0
  207. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby18_parser.rb +0 -0
  208. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby18_parser.y +0 -0
  209. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby19_parser.rb +0 -0
  210. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby19_parser.y +0 -0
  211. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rb +0 -0
  212. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rex +0 -0
  213. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rex.rb +0 -0
  214. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_parser.rb +0 -0
  215. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_parser_extras.rb +0 -0
  216. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/CHANGES.md +0 -0
  217. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/Gemfile +0 -0
  218. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/LICENSE.txt +0 -0
  219. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/README.md +0 -0
  220. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/bundle_install_all_ruby_versions.sh +0 -0
  221. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml.rb +0 -0
  222. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/deep.rb +0 -0
  223. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/libyaml_checker.rb +0 -0
  224. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb +0 -0
  225. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/parse/date.rb +0 -0
  226. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/parse/hexadecimal.rb +0 -0
  227. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/parse/sexagesimal.rb +0 -0
  228. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_handler.rb +0 -0
  229. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb +0 -0
  230. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/resolver.rb +0 -0
  231. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/safe_to_ruby_visitor.rb +0 -0
  232. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb +0 -0
  233. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/syck_hack.rb +0 -0
  234. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/syck_node_monkeypatch.rb +0 -0
  235. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/syck_resolver.rb +0 -0
  236. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform.rb +0 -0
  237. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_boolean.rb +0 -0
  238. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_date.rb +0 -0
  239. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_float.rb +0 -0
  240. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_integer.rb +0 -0
  241. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_nil.rb +0 -0
  242. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_symbol.rb +0 -0
  243. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/transformation_map.rb +0 -0
  244. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/version.rb +0 -0
  245. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/run_specs_all_ruby_versions.sh +0 -0
  246. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/safe_yaml-1.0.5/safe_yaml.gemspec +0 -0
  247. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.12.0 → 2.7.0/gems/sexp_processor-4.15.1}/History.rdoc +53 -0
  248. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.12.0 → 2.7.0/gems/sexp_processor-4.15.1}/Manifest.txt +1 -0
  249. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.12.0 → 2.7.0/gems/sexp_processor-4.15.1}/README.rdoc +0 -0
  250. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.12.0 → 2.7.0/gems/sexp_processor-4.15.1}/lib/composite_sexp_processor.rb +0 -0
  251. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.12.0 → 2.7.0/gems/sexp_processor-4.15.1}/lib/pt_testcase.rb +15 -17
  252. data/bundle/ruby/2.7.0/gems/sexp_processor-4.15.1/lib/sexp.rb +381 -0
  253. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.12.0/lib/sexp.rb → 2.7.0/gems/sexp_processor-4.15.1/lib/sexp_matcher.rb} +67 -387
  254. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.12.0 → 2.7.0/gems/sexp_processor-4.15.1}/lib/sexp_processor.rb +2 -2
  255. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.12.0 → 2.7.0/gems/sexp_processor-4.15.1}/lib/strict_sexp.rb +0 -0
  256. data/bundle/ruby/{2.5.0/gems/sexp_processor-4.12.0 → 2.7.0/gems/sexp_processor-4.15.1}/lib/unique.rb +0 -0
  257. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/CHANGES +4 -0
  258. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/Gemfile +12 -13
  259. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/LICENSE +0 -0
  260. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/README.jp.md +0 -0
  261. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/README.md +0 -0
  262. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim.rb +0 -0
  263. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/code_attributes.rb +0 -0
  264. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/command.rb +13 -13
  265. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/controls.rb +0 -0
  266. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/do_inserter.rb +0 -0
  267. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/embedded.rb +0 -0
  268. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/end_inserter.rb +0 -0
  269. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/engine.rb +0 -0
  270. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/erb_converter.rb +0 -0
  271. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/filter.rb +0 -0
  272. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/grammar.rb +0 -0
  273. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/include.rb +0 -0
  274. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/interpolation.rb +0 -0
  275. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/logic_less.rb +0 -0
  276. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/logic_less/context.rb +0 -0
  277. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/logic_less/filter.rb +0 -0
  278. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/parser.rb +1 -1
  279. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart.rb +0 -0
  280. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart/escaper.rb +0 -0
  281. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart/filter.rb +0 -0
  282. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart/parser.rb +0 -0
  283. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/splat/builder.rb +0 -0
  284. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/splat/filter.rb +0 -0
  285. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/template.rb +0 -0
  286. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/translator.rb +0 -0
  287. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/version.rb +1 -1
  288. data/bundle/ruby/{2.5.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/slim.gemspec +0 -0
  289. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/CHANGES +5 -0
  290. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/EXPRESSIONS.md +0 -0
  291. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/Gemfile +0 -0
  292. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/LICENSE +0 -0
  293. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/README.md +1 -1
  294. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple.rb +0 -0
  295. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/engine.rb +0 -0
  296. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/erb/engine.rb +0 -0
  297. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/erb/parser.rb +0 -0
  298. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/erb/template.rb +0 -0
  299. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/erb/trimming.rb +0 -0
  300. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/exceptions.rb +0 -0
  301. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filter.rb +0 -0
  302. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/code_merger.rb +0 -0
  303. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/control_flow.rb +0 -0
  304. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/dynamic_inliner.rb +0 -0
  305. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/encoding.rb +0 -0
  306. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/eraser.rb +0 -0
  307. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/escapable.rb +0 -0
  308. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/multi_flattener.rb +0 -0
  309. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/remove_bom.rb +0 -0
  310. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/static_analyzer.rb +0 -0
  311. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/static_merger.rb +0 -0
  312. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/string_splitter.rb +1 -1
  313. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/filters/validator.rb +0 -0
  314. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/generator.rb +0 -0
  315. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/generators/array.rb +0 -0
  316. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/generators/array_buffer.rb +0 -0
  317. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/generators/erb.rb +0 -0
  318. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/generators/rails_output_buffer.rb +0 -0
  319. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/generators/string_buffer.rb +0 -0
  320. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/grammar.rb +0 -0
  321. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/attribute_merger.rb +0 -0
  322. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/attribute_remover.rb +0 -0
  323. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/attribute_sorter.rb +0 -0
  324. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/dispatcher.rb +0 -0
  325. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/fast.rb +0 -0
  326. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/filter.rb +0 -0
  327. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/pretty.rb +0 -0
  328. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/html/safe.rb +0 -0
  329. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/map.rb +0 -0
  330. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/mixins/dispatcher.rb +0 -0
  331. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/mixins/engine_dsl.rb +0 -0
  332. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/mixins/grammar_dsl.rb +0 -0
  333. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/mixins/options.rb +0 -0
  334. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/mixins/template.rb +0 -0
  335. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/parser.rb +0 -0
  336. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/static_analyzer.rb +1 -1
  337. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/templates.rb +0 -0
  338. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/templates/rails.rb +0 -0
  339. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/templates/tilt.rb +0 -0
  340. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/lib/temple/utils.rb +0 -0
  341. data/bundle/ruby/2.7.0/gems/temple-0.8.2/lib/temple/version.rb +3 -0
  342. data/bundle/ruby/{2.5.0/gems/temple-0.8.1 → 2.7.0/gems/temple-0.8.2}/temple.gemspec +0 -0
  343. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/Gemfile +0 -0
  344. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/History.rdoc +0 -0
  345. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/LICENSE.txt +0 -0
  346. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/Manifest +0 -0
  347. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/README.rdoc +0 -0
  348. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/Todo.rdoc +0 -0
  349. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table.rb +0 -0
  350. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/cell.rb +0 -0
  351. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/import.rb +0 -0
  352. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/row.rb +0 -0
  353. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/separator.rb +0 -0
  354. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/style.rb +0 -0
  355. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/table.rb +0 -0
  356. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/table_helper.rb +0 -0
  357. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/version.rb +0 -0
  358. data/bundle/ruby/{2.5.0 → 2.7.0}/gems/terminal-table-1.8.0/terminal-table.gemspec +0 -0
  359. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/COPYING +0 -0
  360. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt.rb +1 -1
  361. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/asciidoc.rb +0 -0
  362. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/babel.rb +0 -0
  363. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/bluecloth.rb +0 -0
  364. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/builder.rb +0 -0
  365. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/coffee.rb +0 -0
  366. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/commonmarker.rb +0 -0
  367. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/creole.rb +0 -0
  368. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/csv.rb +0 -0
  369. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/dummy.rb +0 -0
  370. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/erb.rb +0 -0
  371. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/erubi.rb +0 -0
  372. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/erubis.rb +0 -0
  373. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/etanni.rb +0 -0
  374. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/haml.rb +0 -0
  375. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/kramdown.rb +0 -0
  376. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/less.rb +0 -0
  377. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/liquid.rb +0 -0
  378. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/livescript.rb +0 -0
  379. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/mapping.rb +0 -0
  380. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/markaby.rb +0 -0
  381. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/maruku.rb +0 -0
  382. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/nokogiri.rb +0 -0
  383. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/pandoc.rb +0 -0
  384. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/plain.rb +0 -0
  385. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/prawn.rb +0 -0
  386. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/radius.rb +0 -0
  387. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/rdiscount.rb +0 -0
  388. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/rdoc.rb +0 -0
  389. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/redcarpet.rb +0 -0
  390. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/redcloth.rb +0 -0
  391. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/rst-pandoc.rb +0 -0
  392. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/sass.rb +0 -0
  393. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/sigil.rb +0 -0
  394. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/string.rb +0 -0
  395. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/template.rb +7 -12
  396. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/typescript.rb +0 -0
  397. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/wikicloth.rb +0 -0
  398. data/bundle/ruby/{2.5.0/gems/tilt-2.0.9 → 2.7.0/gems/tilt-2.0.10}/lib/tilt/yajl.rb +0 -0
  399. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.7.0}/CHANGELOG.md +8 -0
  400. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.7.0}/MIT-LICENSE.txt +1 -1
  401. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.7.0}/README.md +3 -3
  402. data/bundle/ruby/2.7.0/gems/unicode-display_width-1.7.0/data/display_width.marshal.gz +0 -0
  403. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.7.0}/lib/unicode/display_width.rb +1 -1
  404. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.7.0}/lib/unicode/display_width/constants.rb +2 -2
  405. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.7.0}/lib/unicode/display_width/index.rb +0 -0
  406. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.7.0}/lib/unicode/display_width/no_string_ext.rb +0 -0
  407. data/bundle/ruby/{2.5.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.7.0}/lib/unicode/display_width/string_ext.rb +0 -0
  408. data/lib/brakeman.rb +24 -0
  409. data/lib/brakeman/call_index.rb +54 -15
  410. data/lib/brakeman/checks/base_check.rb +62 -56
  411. data/lib/brakeman/checks/check_basic_auth.rb +2 -0
  412. data/lib/brakeman/checks/check_content_tag.rb +1 -2
  413. data/lib/brakeman/checks/check_cookie_serialization.rb +22 -0
  414. data/lib/brakeman/checks/check_cross_site_scripting.rb +4 -4
  415. data/lib/brakeman/checks/check_csrf_token_forgery_cve.rb +28 -0
  416. data/lib/brakeman/checks/check_deserialize.rb +24 -7
  417. data/lib/brakeman/checks/check_execute.rb +65 -5
  418. data/lib/brakeman/checks/check_file_access.rb +7 -1
  419. data/lib/brakeman/checks/check_header_dos.rb +2 -2
  420. data/lib/brakeman/checks/check_i18n_xss.rb +2 -2
  421. data/lib/brakeman/checks/check_jruby_xml.rb +2 -2
  422. data/lib/brakeman/checks/check_json_entity_escape.rb +38 -0
  423. data/lib/brakeman/checks/check_json_parsing.rb +2 -2
  424. data/lib/brakeman/checks/check_link_to.rb +1 -1
  425. data/lib/brakeman/checks/check_link_to_href.rb +1 -3
  426. data/lib/brakeman/checks/check_mass_assignment.rb +34 -4
  427. data/lib/brakeman/checks/check_mime_type_dos.rb +2 -2
  428. data/lib/brakeman/checks/check_model_attr_accessible.rb +1 -1
  429. data/lib/brakeman/checks/check_model_attributes.rb +1 -1
  430. data/lib/brakeman/checks/check_nested_attributes_bypass.rb +1 -1
  431. data/lib/brakeman/checks/check_page_caching_cve.rb +37 -0
  432. data/lib/brakeman/checks/check_permit_attributes.rb +1 -1
  433. data/lib/brakeman/checks/check_regex_dos.rb +1 -1
  434. data/lib/brakeman/checks/check_reverse_tabnabbing.rb +58 -0
  435. data/lib/brakeman/checks/check_sanitize_methods.rb +2 -2
  436. data/lib/brakeman/checks/check_session_settings.rb +5 -2
  437. data/lib/brakeman/checks/check_skip_before_filter.rb +4 -4
  438. data/lib/brakeman/checks/check_sql.rb +24 -33
  439. data/lib/brakeman/checks/check_template_injection.rb +32 -0
  440. data/lib/brakeman/checks/check_xml_dos.rb +2 -2
  441. data/lib/brakeman/checks/check_yaml_parsing.rb +10 -18
  442. data/lib/brakeman/commandline.rb +25 -1
  443. data/lib/brakeman/differ.rb +16 -33
  444. data/lib/brakeman/file_parser.rb +9 -8
  445. data/lib/brakeman/file_path.rb +14 -0
  446. data/lib/brakeman/options.rb +21 -1
  447. data/lib/brakeman/parsers/haml_embedded.rb +1 -1
  448. data/lib/brakeman/parsers/template_parser.rb +3 -1
  449. data/lib/brakeman/processor.rb +2 -2
  450. data/lib/brakeman/processors/alias_processor.rb +19 -6
  451. data/lib/brakeman/processors/base_processor.rb +2 -0
  452. data/lib/brakeman/processors/controller_processor.rb +5 -5
  453. data/lib/brakeman/processors/gem_processor.rb +10 -2
  454. data/lib/brakeman/processors/haml_template_processor.rb +94 -123
  455. data/lib/brakeman/processors/lib/call_conversion_helper.rb +6 -5
  456. data/lib/brakeman/processors/lib/find_all_calls.rb +57 -18
  457. data/lib/brakeman/processors/lib/find_call.rb +3 -64
  458. data/lib/brakeman/processors/lib/rails2_config_processor.rb +1 -1
  459. data/lib/brakeman/processors/lib/render_helper.rb +3 -1
  460. data/lib/brakeman/processors/output_processor.rb +1 -1
  461. data/lib/brakeman/processors/template_alias_processor.rb +33 -0
  462. data/lib/brakeman/processors/template_processor.rb +10 -6
  463. data/lib/brakeman/report.rb +11 -1
  464. data/lib/brakeman/report/ignore/config.rb +10 -2
  465. data/lib/brakeman/report/report_junit.rb +104 -0
  466. data/lib/brakeman/report/report_markdown.rb +0 -1
  467. data/lib/brakeman/report/report_sarif.rb +114 -0
  468. data/lib/brakeman/report/report_text.rb +41 -21
  469. data/lib/brakeman/rescanner.rb +4 -0
  470. data/lib/brakeman/scanner.rb +4 -1
  471. data/lib/brakeman/tracker.rb +29 -3
  472. data/lib/brakeman/tracker/config.rb +43 -75
  473. data/lib/brakeman/tracker/constants.rb +10 -8
  474. data/lib/brakeman/tracker/controller.rb +1 -1
  475. data/lib/brakeman/util.rb +23 -5
  476. data/lib/brakeman/version.rb +1 -1
  477. data/lib/brakeman/warning.rb +4 -0
  478. data/lib/brakeman/warning_codes.rb +10 -0
  479. data/lib/ruby_parser/bm_sexp.rb +16 -11
  480. metadata +422 -343
  481. data/bundle/ruby/2.5.0/gems/haml-4.0.7/MIT-LICENSE +0 -20
  482. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/compiler.rb +0 -540
  483. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/error.rb +0 -61
  484. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/railtie.rb +0 -22
  485. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/template/plugin.rb +0 -41
  486. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/util.rb +0 -377
  487. data/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/version.rb +0 -3
  488. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.1/debugging.md +0 -18
  489. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.1/lib/ruby20_parser.rb +0 -6869
  490. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.1/lib/ruby20_parser.y +0 -2431
  491. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.1/lib/ruby21_parser.rb +0 -6944
  492. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.1/lib/ruby22_parser.rb +0 -6968
  493. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.1/lib/ruby23_parser.rb +0 -6987
  494. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.1/lib/ruby24_parser.rb +0 -6994
  495. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.1/lib/ruby25_parser.rb +0 -6994
  496. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.1/lib/ruby26_parser.rb +0 -7012
  497. data/bundle/ruby/2.5.0/gems/temple-0.8.1/lib/temple/version.rb +0 -3
  498. data/bundle/ruby/2.5.0/gems/tilt-2.0.9/CHANGELOG.md +0 -132
  499. data/bundle/ruby/2.5.0/gems/tilt-2.0.9/Gemfile +0 -70
  500. data/bundle/ruby/2.5.0/gems/tilt-2.0.9/HACKING +0 -16
  501. data/bundle/ruby/2.5.0/gems/tilt-2.0.9/README.md +0 -233
  502. data/bundle/ruby/2.5.0/gems/tilt-2.0.9/tilt.gemspec +0 -130
  503. data/bundle/ruby/2.5.0/gems/unicode-display_width-1.6.0/data/display_width.marshal.gz +0 -0
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionView
2
4
  module Helpers
3
5
  module CaptureHelper
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'action_view'
4
+
5
+ module Haml
6
+ class ErubiTemplateHandler < ActionView::Template::Handlers::ERB::Erubi
7
+
8
+ def initialize(*args, &blk)
9
+ @newline_pending = 0
10
+ super
11
+ end
12
+ end
13
+
14
+ class SafeErubiTemplate < Tilt::ErubiTemplate
15
+ def prepare
16
+ @options.merge! engine_class: Haml::ErubiTemplateHandler
17
+ super
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'action_view'
4
+
1
5
  module Haml
2
6
 
3
7
  class ErubisTemplateHandler < ActionView::Template::Handlers::Erubis
@@ -26,4 +30,4 @@ module Haml
26
30
  [super, '@output_buffer.to_s'].join("\n")
27
31
  end
28
32
  end
29
- end
33
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Haml
2
4
  module Helpers
3
5
  # This module overrides Haml helpers to work properly
@@ -6,12 +8,15 @@ module Haml
6
8
  # to work with Rails' XSS protection methods.
7
9
  module XssMods
8
10
  def self.included(base)
9
- %w[html_escape find_and_preserve preserve list_of surround
10
- precede succeed capture_haml haml_concat haml_indent
11
- haml_tag escape_once].each do |name|
11
+ %w[find_and_preserve preserve list_of surround
12
+ precede succeed capture_haml haml_concat haml_internal_concat haml_indent].each do |name|
12
13
  base.send(:alias_method, "#{name}_without_haml_xss", name)
13
14
  base.send(:alias_method, name, "#{name}_with_haml_xss")
14
15
  end
16
+ # Those two always have _without_haml_xss
17
+ %w[html_escape escape_once].each do |name|
18
+ base.send(:alias_method, name, "#{name}_with_haml_xss")
19
+ end
15
20
  end
16
21
 
17
22
  # Don't escape text that's already safe,
@@ -61,24 +66,29 @@ module Haml
61
66
  Haml::Util.html_safe(capture_haml_without_haml_xss(*args, &block))
62
67
  end
63
68
 
64
- # Input is escaped
69
+ # Input will be escaped unless this is in a `with_raw_haml_concat`
70
+ # block. See #Haml::Helpers::ActionViewExtensions#with_raw_haml_concat.
65
71
  def haml_concat_with_haml_xss(text = "")
66
- raw = instance_variable_defined?('@_haml_concat_raw') ? @_haml_concat_raw : false
67
- haml_concat_without_haml_xss(raw ? text : haml_xss_html_escape(text))
72
+ raw = instance_variable_defined?(:@_haml_concat_raw) ? @_haml_concat_raw : false
73
+ if raw
74
+ haml_internal_concat_raw text
75
+ else
76
+ haml_internal_concat text
77
+ end
78
+ ErrorReturn.new("haml_concat")
68
79
  end
69
80
 
81
+ # Input is escaped
82
+ def haml_internal_concat_with_haml_xss(text="", newline=true, indent=true)
83
+ haml_internal_concat_without_haml_xss(haml_xss_html_escape(text), newline, indent)
84
+ end
85
+ private :haml_internal_concat_with_haml_xss
86
+
70
87
  # Output is always HTML safe
71
88
  def haml_indent_with_haml_xss
72
89
  Haml::Util.html_safe(haml_indent_without_haml_xss)
73
90
  end
74
91
 
75
- # Input is escaped, haml_concat'ed output is always HTML safe
76
- def haml_tag_with_haml_xss(name, *rest, &block)
77
- name = haml_xss_html_escape(name.to_s)
78
- rest.unshift(haml_xss_html_escape(rest.shift.to_s)) unless [Symbol, Hash, NilClass].any? {|t| rest.first.is_a? t}
79
- with_raw_haml_concat {haml_tag_without_haml_xss(name, *rest, &block)}
80
- end
81
-
82
92
  # Output is always HTML safe
83
93
  def escape_once_with_haml_xss(*args)
84
94
  Haml::Util.html_safe(escape_once_without_haml_xss(*args))
@@ -1,53 +1,45 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Haml
2
4
  # This class encapsulates all of the configuration options that Haml
3
5
  # understands. Please see the {file:REFERENCE.md#options Haml Reference} to
4
6
  # learn how to set the options.
5
7
  class Options
6
-
7
- @defaults = {
8
- :attr_wrapper => "'",
9
- :autoclose => %w(area base basefont br col command embed frame
10
- hr img input isindex keygen link menuitem meta
11
- param source track wbr),
12
- :encoding => "UTF-8",
13
- :escape_attrs => true,
14
- :escape_html => false,
15
- :filename => '(haml)',
16
- :format => :html5,
17
- :hyphenate_data_attrs => true,
18
- :line => 1,
19
- :mime_type => 'text/html',
20
- :preserve => %w(textarea pre code),
21
- :remove_whitespace => false,
22
- :suppress_eval => false,
23
- :ugly => false,
24
- :cdata => false,
25
- :parser_class => ::Haml::Parser,
26
- :compiler_class => ::Haml::Compiler
27
- }
28
-
29
8
  @valid_formats = [:html4, :html5, :xhtml]
9
+ @buffer_option_keys = [:autoclose, :preserve, :attr_wrapper, :format,
10
+ :encoding, :escape_html, :escape_filter_interpolations, :escape_attrs, :hyphenate_data_attrs, :cdata]
11
+
12
+ class << self
13
+ # The default option values.
14
+ # @return Hash
15
+ def defaults
16
+ @defaults ||= Haml::TempleEngine.options.to_hash.merge(encoding: 'UTF-8')
17
+ end
30
18
 
31
- @buffer_option_keys = [:autoclose, :preserve, :attr_wrapper, :ugly, :format,
32
- :encoding, :escape_html, :escape_attrs, :hyphenate_data_attrs, :cdata]
19
+ # An array of valid values for the `:format` option.
20
+ # @return Array
21
+ attr_reader :valid_formats
33
22
 
34
- # The default option values.
35
- # @return Hash
36
- def self.defaults
37
- @defaults
38
- end
23
+ # An array of keys that will be used to provide a hash of options to
24
+ # {Haml::Buffer}.
25
+ # @return Hash
26
+ attr_reader :buffer_option_keys
39
27
 
40
- # An array of valid values for the `:format` option.
41
- # @return Array
42
- def self.valid_formats
43
- @valid_formats
44
- end
28
+ # Returns a subset of defaults: those that {Haml::Buffer} cares about.
29
+ # @return [{Symbol => Object}] The options hash
30
+ def buffer_defaults
31
+ @buffer_defaults ||= buffer_option_keys.inject({}) do |hash, key|
32
+ hash.merge(key => defaults[key])
33
+ end
34
+ end
45
35
 
46
- # An array of keys that will be used to provide a hash of options to
47
- # {Haml::Buffer}.
48
- # @return Hash
49
- def self.buffer_option_keys
50
- @buffer_option_keys
36
+ def wrap(options)
37
+ if options.is_a?(Options)
38
+ options
39
+ else
40
+ Options.new(options)
41
+ end
42
+ end
51
43
  end
52
44
 
53
45
  # The character that should wrap element attributes. This defaults to `'`
@@ -63,7 +55,6 @@ module Haml
63
55
  attr_accessor :autoclose
64
56
 
65
57
  # The encoding to use for the HTML output.
66
- # Only available on Ruby 1.9 or higher.
67
58
  # This can be a string or an `Encoding` Object. Note that Haml **does not**
68
59
  # automatically re-encode Ruby values; any strings coming from outside the
69
60
  # application should be converted before being passed into the Haml
@@ -91,6 +82,13 @@ module Haml
91
82
  # Defaults to false.
92
83
  attr_accessor :escape_html
93
84
 
85
+ # Sets whether or not to escape HTML-sensitive characters in interpolated strings.
86
+ # See also {file:REFERENCE.md#escaping_html Escaping HTML} and
87
+ # {file:REFERENCE.md#unescaping_html Unescaping HTML}.
88
+ #
89
+ # Defaults to the current value of `escape_html`.
90
+ attr_accessor :escape_filter_interpolations
91
+
94
92
  # The name of the Haml file being parsed.
95
93
  # This is only used as information when exceptions are raised. This is
96
94
  # automatically assigned when working through ActionView, so it's really
@@ -137,7 +135,7 @@ module Haml
137
135
  # formatting errors.
138
136
  #
139
137
  # Defaults to `false`.
140
- attr_reader :remove_whitespace
138
+ attr_accessor :remove_whitespace
141
139
 
142
140
  # Whether or not attribute hashes and Ruby scripts designated by `=` or `~`
143
141
  # should be evaluated. If this is `true`, said scripts are rendered as empty
@@ -146,13 +144,6 @@ module Haml
146
144
  # Defaults to `false`.
147
145
  attr_accessor :suppress_eval
148
146
 
149
- # If set to `true`, Haml makes no attempt to properly indent or format the
150
- # HTML output. This significantly improves rendering performance but makes
151
- # viewing the source unpleasant.
152
- #
153
- # Defaults to `true` in Rails production mode, and `false` everywhere else.
154
- attr_accessor :ugly
155
-
156
147
  # Whether to include CDATA sections around javascript and css blocks when
157
148
  # using the `:javascript` or `:css` filters.
158
149
  #
@@ -169,9 +160,20 @@ module Haml
169
160
  # The compiler class to use. Defaults to Haml::Compiler.
170
161
  attr_accessor :compiler_class
171
162
 
172
- def initialize(values = {}, &block)
163
+ # Enable template tracing. If true, it will add a 'data-trace' attribute to
164
+ # each tag generated by Haml. The value of the attribute will be the
165
+ # source template name and the line number from which the tag was generated,
166
+ # separated by a colon. On Rails applications, the path given will be a
167
+ # relative path as from the views directory. On non-Rails applications,
168
+ # the path will be the full path.
169
+ attr_accessor :trace
170
+
171
+ # Key is filter name in String and value is Class to use. Defaults to {}.
172
+ attr_accessor :filters
173
+
174
+ def initialize(values = {})
173
175
  defaults.each {|k, v| instance_variable_set :"@#{k}", v}
174
- values.reject {|k, v| !defaults.has_key?(k) || v.nil?}.each {|k, v| send("#{k}=", v)}
176
+ values.each {|k, v| send("#{k}=", v) if defaults.has_key?(k) && !v.nil?}
175
177
  yield if block_given?
176
178
  end
177
179
 
@@ -188,8 +190,7 @@ module Haml
188
190
  send "#{key}=", value
189
191
  end
190
192
 
191
- [:escape_attrs, :hyphenate_data_attrs, :remove_whitespace, :suppress_eval,
192
- :ugly].each do |method|
193
+ [:escape_attrs, :hyphenate_data_attrs, :remove_whitespace, :suppress_eval].each do |method|
193
194
  class_eval(<<-END)
194
195
  def #{method}?
195
196
  !! @#{method}
@@ -240,22 +241,13 @@ module Haml
240
241
  xhtml? || @cdata
241
242
  end
242
243
 
243
- def remove_whitespace=(value)
244
- @ugly = true if value
245
- @remove_whitespace = value
244
+ def encoding=(value)
245
+ return unless value
246
+ @encoding = value.is_a?(Encoding) ? value.name : value.to_s
247
+ @encoding = "UTF-8" if @encoding.upcase == "US-ASCII"
246
248
  end
247
249
 
248
- if RUBY_VERSION < "1.9"
249
- attr_writer :encoding
250
- else
251
- def encoding=(value)
252
- return unless value
253
- @encoding = value.is_a?(Encoding) ? value.name : value.to_s
254
- @encoding = "UTF-8" if @encoding.upcase == "US-ASCII"
255
- end
256
- end
257
-
258
- # Returns a subset of options: those that {Haml::Buffer} cares about.
250
+ # Returns a non-default subset of options: those that {Haml::Buffer} cares about.
259
251
  # All of the values here are such that when `#inspect` is called on the hash,
260
252
  # it can be `Kernel#eval`ed to get the same result back.
261
253
  #
@@ -264,7 +256,10 @@ module Haml
264
256
  # @return [{Symbol => Object}] The options hash
265
257
  def for_buffer
266
258
  self.class.buffer_option_keys.inject({}) do |hash, key|
267
- hash[key] = send(key)
259
+ value = public_send(key)
260
+ if self.class.buffer_defaults[key] != value
261
+ hash[key] = value
262
+ end
268
263
  hash
269
264
  end
270
265
  end
@@ -274,6 +269,5 @@ module Haml
274
269
  def defaults
275
270
  self.class.defaults
276
271
  end
277
-
278
272
  end
279
273
  end
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ripper'
1
4
  require 'strscan'
2
5
 
3
6
  module Haml
@@ -59,7 +62,7 @@ module Haml
59
62
  SILENT_SCRIPT,
60
63
  ESCAPE,
61
64
  FILTER
62
- ]
65
+ ].freeze
63
66
 
64
67
  # The value of the character that designates that a line is part
65
68
  # of a multiline string.
@@ -71,26 +74,28 @@ module Haml
71
74
  # foo.each do | bar |
72
75
  # = bar
73
76
  #
74
- BLOCK_WITH_SPACES = /do[\s]*\|[\s]*[^\|]*[\s]+\|\z/
77
+ BLOCK_WITH_SPACES = /do\s*\|\s*[^\|]*\s+\|\z/
75
78
 
76
- MID_BLOCK_KEYWORDS = %w[else elsif rescue ensure end when]
77
- START_BLOCK_KEYWORDS = %w[if begin case unless]
79
+ MID_BLOCK_KEYWORDS = %w[else elsif rescue ensure end when].freeze
80
+ START_BLOCK_KEYWORDS = %w[if begin case unless].freeze
78
81
  # Try to parse assignments to block starters as best as possible
79
82
  START_BLOCK_KEYWORD_REGEX = /(?:\w+(?:,\s*\w+)*\s*=\s*)?(#{START_BLOCK_KEYWORDS.join('|')})/
80
83
  BLOCK_KEYWORD_REGEX = /^-?\s*(?:(#{MID_BLOCK_KEYWORDS.join('|')})|#{START_BLOCK_KEYWORD_REGEX.source})\b/
81
84
 
82
85
  # The Regex that matches a Doctype command.
83
- DOCTYPE_REGEX = /(\d(?:\.\d)?)?[\s]*([a-z]*)\s*([^ ]+)?/i
86
+ DOCTYPE_REGEX = /(\d(?:\.\d)?)?\s*([a-z]*)\s*([^ ]+)?/i
84
87
 
85
88
  # The Regex that matches a literal string or symbol value
86
89
  LITERAL_VALUE_REGEX = /:(\w*)|(["'])((?!\\|\#\{|\#@|\#\$|\2).|\\.)*\2/
87
90
 
88
- def initialize(template, options)
89
- # :eod is a special end-of-document marker
90
- @template = (template.rstrip).split(/\r\n|\r|\n/) + [:eod, :eod]
91
- @options = options
92
- @flat = false
93
- @index = 0
91
+ ID_KEY = 'id'.freeze
92
+ CLASS_KEY = 'class'.freeze
93
+
94
+ # Used for scanning old attributes, substituting the first '{'
95
+ METHOD_CALL_PREFIX = 'a('
96
+
97
+ def initialize(options)
98
+ @options = Options.wrap(options)
94
99
  # Record the indent levels of "if" statements to validate the subsequent
95
100
  # elsif and else statements are indented at the appropriate level.
96
101
  @script_level_stack = []
@@ -98,15 +103,27 @@ module Haml
98
103
  @template_tabs = 0
99
104
  end
100
105
 
101
- def parse
106
+ def call(template)
107
+ match = template.rstrip.scan(/(([ \t]+)?(.*?))(?:\Z|\r\n|\r|\n)/m)
108
+ # discard the last match which is always blank
109
+ match.pop
110
+ @template = match.each_with_index.map do |(full, whitespace, text), index|
111
+ Line.new(whitespace, text.rstrip, full, index, self, false)
112
+ end
113
+ # Append special end-of-document marker
114
+ @template << Line.new(nil, '-#', '-#', @template.size, self, true)
115
+
102
116
  @root = @parent = ParseNode.new(:root)
103
- @haml_comment = false
117
+ @flat = false
118
+ @filter_buffer = nil
104
119
  @indentation = nil
105
120
  @line = next_line
106
121
 
107
122
  raise SyntaxError.new(Error.message(:indenting_at_start), @line.index) if @line.tabs != 0
108
123
 
109
- while next_line
124
+ loop do
125
+ next_line
126
+
110
127
  process_indent(@line) unless @line.text.empty?
111
128
 
112
129
  if flat?
@@ -118,75 +135,103 @@ module Haml
118
135
  end
119
136
 
120
137
  @tab_up = nil
121
- process_line(@line.text, @line.index) unless @line.text.empty? || @haml_comment
122
- if @parent.type != :haml_comment && (block_opened? || @tab_up)
138
+ process_line(@line) unless @line.text.empty?
139
+ if block_opened? || @tab_up
123
140
  @template_tabs += 1
124
141
  @parent = @parent.children.last
125
142
  end
126
143
 
127
- if !@haml_comment && !flat? && @next_line.tabs - @line.tabs > 1
144
+ if !flat? && @next_line.tabs - @line.tabs > 1
128
145
  raise SyntaxError.new(Error.message(:deeper_indenting, @next_line.tabs - @line.tabs), @next_line.index)
129
146
  end
130
147
 
131
148
  @line = @next_line
132
149
  end
133
-
134
150
  # Close all the open tags
135
151
  close until @parent.type == :root
136
152
  @root
137
153
  rescue Haml::Error => e
138
- e.backtrace.unshift "#{@options[:filename]}:#{(e.line ? e.line + 1 : @index) + @options[:line] - 1}"
154
+ e.backtrace.unshift "#{@options.filename}:#{(e.line ? e.line + 1 : @line.index + 1) + @options.line - 1}"
139
155
  raise
140
156
  end
141
157
 
158
+ def compute_tabs(line)
159
+ return 0 if line.text.empty? || !line.whitespace
160
+
161
+ if @indentation.nil?
162
+ @indentation = line.whitespace
163
+
164
+ if @indentation.include?(?\s) && @indentation.include?(?\t)
165
+ raise SyntaxError.new(Error.message(:cant_use_tabs_and_spaces), line.index)
166
+ end
167
+
168
+ @flat_spaces = @indentation * (@template_tabs+1) if flat?
169
+ return 1
170
+ end
171
+
172
+ tabs = line.whitespace.length / @indentation.length
173
+ return tabs if line.whitespace == @indentation * tabs
174
+ return @template_tabs + 1 if flat? && line.whitespace =~ /^#{@flat_spaces}/
175
+
176
+ message = Error.message(:inconsistent_indentation,
177
+ human_indentation(line.whitespace),
178
+ human_indentation(@indentation)
179
+ )
180
+ raise SyntaxError.new(message, line.index)
181
+ end
142
182
 
143
183
  private
144
184
 
145
185
  # @private
146
- class Line < Struct.new(:text, :unstripped, :full, :index, :compiler, :eod)
186
+ Line = Struct.new(:whitespace, :text, :full, :index, :parser, :eod) do
147
187
  alias_method :eod?, :eod
148
188
 
149
189
  # @private
150
190
  def tabs
151
- line = self
152
- @tabs ||= compiler.instance_eval do
153
- break 0 if line.text.empty? || !(whitespace = line.full[/^\s+/])
154
-
155
- if @indentation.nil?
156
- @indentation = whitespace
157
-
158
- if @indentation.include?(?\s) && @indentation.include?(?\t)
159
- raise SyntaxError.new(Error.message(:cant_use_tabs_and_spaces), line.index)
160
- end
161
-
162
- @flat_spaces = @indentation * (@template_tabs+1) if flat?
163
- break 1
164
- end
165
-
166
- tabs = whitespace.length / @indentation.length
167
- break tabs if whitespace == @indentation * tabs
168
- break @template_tabs + 1 if flat? && whitespace =~ /^#{@flat_spaces}/
191
+ @tabs ||= parser.compute_tabs(self)
192
+ end
169
193
 
170
- message = Error.message(:inconsistent_indentation,
171
- Haml::Util.human_indentation(whitespace),
172
- Haml::Util.human_indentation(@indentation)
173
- )
174
- raise SyntaxError.new(message, line.index)
175
- end
194
+ def strip!(from)
195
+ self.text = text[from..-1]
196
+ self.text.lstrip!
197
+ self
176
198
  end
177
199
  end
178
200
 
179
201
  # @private
180
- class ParseNode < Struct.new(:type, :line, :value, :parent, :children)
202
+ ParseNode = Struct.new(:type, :line, :value, :parent, :children) do
181
203
  def initialize(*args)
182
204
  super
183
205
  self.children ||= []
184
206
  end
185
207
 
186
208
  def inspect
187
- text = "(#{type} #{value.inspect}"
188
- children.each {|c| text << "\n" << c.inspect.gsub(/^/, " ")}
189
- text + ")"
209
+ %Q[(#{type} #{value.inspect}#{children.each_with_object(''.dup) {|c, s| s << "\n#{c.inspect.gsub!(/^/, ' ')}"}})].dup
210
+ end
211
+ end
212
+
213
+ # @param [String] new - Hash literal including dynamic values.
214
+ # @param [String] old - Hash literal including dynamic values or Ruby literal of multiple Hashes which MUST be interpreted as method's last arguments.
215
+ DynamicAttributes = Struct.new(:new, :old) do
216
+ undef :old=
217
+ def old=(value)
218
+ unless value =~ /\A{.*}\z/m
219
+ raise ArgumentError.new('Old attributes must start with "{" and end with "}"')
220
+ end
221
+ self[:old] = value
222
+ end
223
+
224
+ # This will be a literal for Haml::Buffer#attributes's last argument, `attributes_hashes`.
225
+ def to_literal
226
+ [new, stripped_old].compact.join(', ')
227
+ end
228
+
229
+ private
230
+
231
+ # For `%foo{ { foo: 1 }, bar: 2 }`, :old is "{ { foo: 1 }, bar: 2 }" and this method returns " { foo: 1 }, bar: 2 " for last argument.
232
+ def stripped_old
233
+ return nil if old.nil?
234
+ old.sub!(/\A{/, '').sub!(/}\z/m, '')
190
235
  end
191
236
  end
192
237
 
@@ -195,98 +240,104 @@ module Haml
195
240
  return unless line.tabs <= @template_tabs && @template_tabs > 0
196
241
 
197
242
  to_close = @template_tabs - line.tabs
198
- to_close.times {|i| close unless to_close - 1 - i == 0 && mid_block_keyword?(line.text)}
243
+ to_close.times {|i| close unless to_close - 1 - i == 0 && continuation_script?(line.text)}
244
+ end
245
+
246
+ def continuation_script?(text)
247
+ text[0] == SILENT_SCRIPT && mid_block_keyword?(text)
248
+ end
249
+
250
+ def mid_block_keyword?(text)
251
+ MID_BLOCK_KEYWORDS.include?(block_keyword(text))
199
252
  end
200
253
 
201
254
  # Processes a single line of Haml.
202
255
  #
203
256
  # This method doesn't return anything; it simply processes the line and
204
257
  # adds the appropriate code to `@precompiled`.
205
- def process_line(text, index)
206
- @index = index + 1
207
-
208
- case text[0]
209
- when DIV_CLASS; push div(text)
258
+ def process_line(line)
259
+ case line.text[0]
260
+ when DIV_CLASS; push div(line)
210
261
  when DIV_ID
211
- return push plain(text) if text[1] == ?{
212
- push div(text)
213
- when ELEMENT; push tag(text)
214
- when COMMENT; push comment(text[1..-1].strip)
262
+ return push plain(line) if %w[{ @ $].include?(line.text[1])
263
+ push div(line)
264
+ when ELEMENT; push tag(line)
265
+ when COMMENT; push comment(line.text[1..-1].lstrip)
215
266
  when SANITIZE
216
- return push plain(text[3..-1].strip, :escape_html) if text[1..2] == "=="
217
- return push script(text[2..-1].strip, :escape_html) if text[1] == SCRIPT
218
- return push flat_script(text[2..-1].strip, :escape_html) if text[1] == FLAT_SCRIPT
219
- return push plain(text[1..-1].strip, :escape_html) if text[1] == ?\s
220
- push plain(text)
267
+ return push plain(line.strip!(3), :escape_html) if line.text[1, 2] == '=='
268
+ return push script(line.strip!(2), :escape_html) if line.text[1] == SCRIPT
269
+ return push flat_script(line.strip!(2), :escape_html) if line.text[1] == FLAT_SCRIPT
270
+ return push plain(line.strip!(1), :escape_html) if line.text[1] == ?\s || line.text[1..2] == '#{'
271
+ push plain(line)
221
272
  when SCRIPT
222
- return push plain(text[2..-1].strip) if text[1] == SCRIPT
223
- push script(text[1..-1])
224
- when FLAT_SCRIPT; push flat_script(text[1..-1])
225
- when SILENT_SCRIPT; push silent_script(text)
226
- when FILTER; push filter(text[1..-1].downcase)
273
+ return push plain(line.strip!(2)) if line.text[1] == SCRIPT
274
+ line.text = line.text[1..-1]
275
+ push script(line)
276
+ when FLAT_SCRIPT; push flat_script(line.strip!(1))
277
+ when SILENT_SCRIPT
278
+ return push haml_comment(line.text[2..-1]) if line.text[1] == SILENT_COMMENT
279
+ push silent_script(line)
280
+ when FILTER; push filter(line.text[1..-1].downcase)
227
281
  when DOCTYPE
228
- return push doctype(text) if text[0...3] == '!!!'
229
- return push plain(text[3..-1].strip, false) if text[1..2] == "=="
230
- return push script(text[2..-1].strip, false) if text[1] == SCRIPT
231
- return push flat_script(text[2..-1].strip, false) if text[1] == FLAT_SCRIPT
232
- return push plain(text[1..-1].strip, false) if text[1] == ?\s
233
- push plain(text)
234
- when ESCAPE; push plain(text[1..-1])
235
- else; push plain(text)
282
+ return push doctype(line.text) if line.text[0, 3] == '!!!'
283
+ return push plain(line.strip!(3), false) if line.text[1, 2] == '=='
284
+ return push script(line.strip!(2), false) if line.text[1] == SCRIPT
285
+ return push flat_script(line.strip!(2), false) if line.text[1] == FLAT_SCRIPT
286
+ return push plain(line.strip!(1), false) if line.text[1] == ?\s || line.text[1..2] == '#{'
287
+ push plain(line)
288
+ when ESCAPE
289
+ line.text = line.text[1..-1]
290
+ push plain(line)
291
+ else; push plain(line)
236
292
  end
237
293
  end
238
294
 
239
295
  def block_keyword(text)
240
- return unless keyword = text.scan(BLOCK_KEYWORD_REGEX)[0]
296
+ return unless (keyword = text.scan(BLOCK_KEYWORD_REGEX)[0])
241
297
  keyword[0] || keyword[1]
242
298
  end
243
299
 
244
- def mid_block_keyword?(text)
245
- MID_BLOCK_KEYWORDS.include?(block_keyword(text))
246
- end
247
-
248
300
  def push(node)
249
301
  @parent.children << node
250
302
  node.parent = @parent
251
303
  end
252
304
 
253
- def plain(text, escape_html = nil)
305
+ def plain(line, escape_html = nil)
254
306
  if block_opened?
255
307
  raise SyntaxError.new(Error.message(:illegal_nesting_plain), @next_line.index)
256
308
  end
257
309
 
258
- unless contains_interpolation?(text)
259
- return ParseNode.new(:plain, @index, :text => text)
310
+ unless contains_interpolation?(line.text)
311
+ return ParseNode.new(:plain, line.index + 1, :text => line.text)
260
312
  end
261
313
 
262
- escape_html = @options[:escape_html] if escape_html.nil?
263
- script(unescape_interpolation(text, escape_html), false)
314
+ escape_html = @options.escape_html && @options.mime_type != 'text/plain' if escape_html.nil?
315
+ line.text = unescape_interpolation(line.text, escape_html)
316
+ script(line, false)
264
317
  end
265
318
 
266
- def script(text, escape_html = nil, preserve = false)
267
- raise SyntaxError.new(Error.message(:no_ruby_code, '=')) if text.empty?
268
- text = handle_ruby_multiline(text)
269
- escape_html = @options[:escape_html] if escape_html.nil?
319
+ def script(line, escape_html = nil, preserve = false)
320
+ raise SyntaxError.new(Error.message(:no_ruby_code, '=')) if line.text.empty?
321
+ line = handle_ruby_multiline(line)
322
+ escape_html = @options.escape_html if escape_html.nil?
270
323
 
271
- keyword = block_keyword(text)
324
+ keyword = block_keyword(line.text)
272
325
  check_push_script_stack(keyword)
273
326
 
274
- ParseNode.new(:script, @index, :text => text, :escape_html => escape_html,
327
+ ParseNode.new(:script, line.index + 1, :text => line.text, :escape_html => escape_html,
275
328
  :preserve => preserve, :keyword => keyword)
276
329
  end
277
330
 
278
- def flat_script(text, escape_html = nil)
279
- raise SyntaxError.new(Error.message(:no_ruby_code, '~')) if text.empty?
280
- script(text, escape_html, :preserve)
331
+ def flat_script(line, escape_html = nil)
332
+ raise SyntaxError.new(Error.message(:no_ruby_code, '~')) if line.text.empty?
333
+ script(line, escape_html, :preserve)
281
334
  end
282
335
 
283
- def silent_script(text)
284
- return haml_comment(text[2..-1]) if text[1] == SILENT_COMMENT
285
-
286
- raise SyntaxError.new(Error.message(:no_end), @index - 1) if text[1..-1].strip == "end"
336
+ def silent_script(line)
337
+ raise SyntaxError.new(Error.message(:no_end), line.index) if line.text[1..-1].strip == 'end'
287
338
 
288
- text = handle_ruby_multiline(text)
289
- keyword = block_keyword(text)
339
+ line = handle_ruby_multiline(line)
340
+ keyword = block_keyword(line.text)
290
341
 
291
342
  check_push_script_stack(keyword)
292
343
 
@@ -308,8 +359,8 @@ module Haml
308
359
  end
309
360
  end
310
361
 
311
- ParseNode.new(:silent_script, @index,
312
- :text => text[1..-1], :keyword => keyword)
362
+ ParseNode.new(:silent_script, @line.index + 1,
363
+ :text => line.text[1..-1], :keyword => keyword)
313
364
  end
314
365
 
315
366
  def check_push_script_stack(keyword)
@@ -323,18 +374,25 @@ module Haml
323
374
  end
324
375
 
325
376
  def haml_comment(text)
326
- @haml_comment = block_opened?
327
- ParseNode.new(:haml_comment, @index, :text => text)
377
+ if filter_opened?
378
+ @flat = true
379
+ @filter_buffer = String.new
380
+ @filter_buffer << "#{text}\n" unless text.empty?
381
+ text = @filter_buffer
382
+ # If we don't know the indentation by now, it'll be set in Line#tabs
383
+ @flat_spaces = @indentation * (@template_tabs+1) if @indentation
384
+ end
385
+
386
+ ParseNode.new(:haml_comment, @line.index + 1, :text => text)
328
387
  end
329
388
 
330
389
  def tag(line)
331
390
  tag_name, attributes, attributes_hashes, object_ref, nuke_outer_whitespace,
332
- nuke_inner_whitespace, action, value, last_line = parse_tag(line)
391
+ nuke_inner_whitespace, action, value, last_line = parse_tag(line.text)
333
392
 
334
- preserve_tag = @options[:preserve].include?(tag_name)
393
+ preserve_tag = @options.preserve.include?(tag_name)
335
394
  nuke_inner_whitespace ||= preserve_tag
336
- preserve_tag = false if @options[:ugly]
337
- escape_html = (action == '&' || (action != '!' && @options[:escape_html]))
395
+ escape_html = (action == '&' || (action != '!' && @options.escape_html))
338
396
 
339
397
  case action
340
398
  when '/'; self_closing = true
@@ -369,22 +427,20 @@ module Haml
369
427
  end
370
428
 
371
429
  attributes = Parser.parse_class_and_id(attributes)
372
- attributes_list = []
430
+ dynamic_attributes = DynamicAttributes.new
373
431
 
374
432
  if attributes_hashes[:new]
375
433
  static_attributes, attributes_hash = attributes_hashes[:new]
376
- Buffer.merge_attrs(attributes, static_attributes) if static_attributes
377
- attributes_list << attributes_hash
434
+ AttributeBuilder.merge_attributes!(attributes, static_attributes) if static_attributes
435
+ dynamic_attributes.new = attributes_hash
378
436
  end
379
437
 
380
438
  if attributes_hashes[:old]
381
439
  static_attributes = parse_static_hash(attributes_hashes[:old])
382
- Buffer.merge_attrs(attributes, static_attributes) if static_attributes
383
- attributes_list << attributes_hashes[:old] unless static_attributes || @options[:suppress_eval]
440
+ AttributeBuilder.merge_attributes!(attributes, static_attributes) if static_attributes
441
+ dynamic_attributes.old = attributes_hashes[:old] unless static_attributes || @options.suppress_eval
384
442
  end
385
443
 
386
- attributes_list.compact!
387
-
388
444
  raise SyntaxError.new(Error.message(:illegal_nesting_self_closing), @next_line.index) if block_opened? && self_closing
389
445
  raise SyntaxError.new(Error.message(:no_ruby_code, action), last_line - 1) if parse && value.empty?
390
446
  raise SyntaxError.new(Error.message(:self_closing_content), last_line - 1) if self_closing && !value.empty?
@@ -393,56 +449,70 @@ module Haml
393
449
  raise SyntaxError.new(Error.message(:illegal_nesting_line, tag_name), @next_line.index)
394
450
  end
395
451
 
396
- self_closing ||= !!(!block_opened? && value.empty? && @options[:autoclose].any? {|t| t === tag_name})
452
+ self_closing ||= !!(!block_opened? && value.empty? && @options.autoclose.any? {|t| t === tag_name})
397
453
  value = nil if value.empty? && (block_opened? || self_closing)
398
- value = handle_ruby_multiline(value) if parse
454
+ line.text = value
455
+ line = handle_ruby_multiline(line) if parse
399
456
 
400
- ParseNode.new(:tag, @index, :name => tag_name, :attributes => attributes,
401
- :attributes_hashes => attributes_list, :self_closing => self_closing,
457
+ ParseNode.new(:tag, line.index + 1, :name => tag_name, :attributes => attributes,
458
+ :dynamic_attributes => dynamic_attributes, :self_closing => self_closing,
402
459
  :nuke_inner_whitespace => nuke_inner_whitespace,
403
460
  :nuke_outer_whitespace => nuke_outer_whitespace, :object_ref => object_ref,
404
461
  :escape_html => escape_html, :preserve_tag => preserve_tag,
405
- :preserve_script => preserve_script, :parse => parse, :value => value)
462
+ :preserve_script => preserve_script, :parse => parse, :value => line.text)
406
463
  end
407
464
 
408
465
  # Renders a line that creates an XHTML tag and has an implicit div because of
409
466
  # `.` or `#`.
410
467
  def div(line)
411
- tag('%div' + line)
468
+ line.text = "%div#{line.text}"
469
+ tag(line)
412
470
  end
413
471
 
414
472
  # Renders an XHTML comment.
415
- def comment(line)
416
- conditional, line = balance(line, ?[, ?]) if line[0] == ?[
417
- line.strip!
418
- conditional << ">" if conditional
473
+ def comment(text)
474
+ if text[0..1] == '!['
475
+ revealed = true
476
+ text = text[1..-1]
477
+ else
478
+ revealed = false
479
+ end
419
480
 
420
- if block_opened? && !line.empty?
481
+ conditional, text = balance(text, ?[, ?]) if text[0] == ?[
482
+ text.strip!
483
+
484
+ if contains_interpolation?(text)
485
+ parse = true
486
+ text = unescape_interpolation(text)
487
+ else
488
+ parse = false
489
+ end
490
+
491
+ if block_opened? && !text.empty?
421
492
  raise SyntaxError.new(Haml::Error.message(:illegal_nesting_content), @next_line.index)
422
493
  end
423
494
 
424
- ParseNode.new(:comment, @index, :conditional => conditional, :text => line)
495
+ ParseNode.new(:comment, @line.index + 1, :conditional => conditional, :text => text, :revealed => revealed, :parse => parse)
425
496
  end
426
497
 
427
498
  # Renders an XHTML doctype or XML shebang.
428
- def doctype(line)
499
+ def doctype(text)
429
500
  raise SyntaxError.new(Error.message(:illegal_nesting_header), @next_line.index) if block_opened?
430
- version, type, encoding = line[3..-1].strip.downcase.scan(DOCTYPE_REGEX)[0]
431
- ParseNode.new(:doctype, @index, :version => version, :type => type, :encoding => encoding)
501
+ version, type, encoding = text[3..-1].strip.downcase.scan(DOCTYPE_REGEX)[0]
502
+ ParseNode.new(:doctype, @line.index + 1, :version => version, :type => type, :encoding => encoding)
432
503
  end
433
504
 
434
505
  def filter(name)
435
506
  raise Error.new(Error.message(:invalid_filter_name, name)) unless name =~ /^\w+$/
436
507
 
437
- @filter_buffer = String.new
438
-
439
508
  if filter_opened?
440
509
  @flat = true
510
+ @filter_buffer = String.new
441
511
  # If we don't know the indentation by now, it'll be set in Line#tabs
442
512
  @flat_spaces = @indentation * (@template_tabs+1) if @indentation
443
513
  end
444
514
 
445
- ParseNode.new(:filter, @index, :name => name, :text => @filter_buffer)
515
+ ParseNode.new(:filter, @line.index + 1, :name => name, :text => @filter_buffer)
446
516
  end
447
517
 
448
518
  def close
@@ -452,13 +522,17 @@ module Haml
452
522
  end
453
523
 
454
524
  def close_filter(_)
455
- @flat = false
456
- @flat_spaces = nil
457
- @filter_buffer = nil
525
+ close_flat_section
458
526
  end
459
527
 
460
528
  def close_haml_comment(_)
461
- @haml_comment = false
529
+ close_flat_section
530
+ end
531
+
532
+ def close_flat_section
533
+ @flat = false
534
+ @flat_spaces = nil
535
+ @filter_buffer = nil
462
536
  end
463
537
 
464
538
  def close_silent_script(node)
@@ -466,7 +540,7 @@ module Haml
466
540
 
467
541
  # Post-process case statements to normalize the nesting of "when" clauses
468
542
  return unless node.value[:keyword] == "case"
469
- return unless first = node.children.first
543
+ return unless (first = node.children.first)
470
544
  return unless first.type == :silent_script && first.value[:keyword] == "when"
471
545
  return if first.children.empty?
472
546
  # If the case node has a "when" child with children, it's the
@@ -485,29 +559,39 @@ module Haml
485
559
  # that can then be merged with another attributes hash.
486
560
  def self.parse_class_and_id(list)
487
561
  attributes = {}
488
- list.scan(/([#.])([-:_a-zA-Z0-9]+)/) do |type, property|
562
+ return attributes if list.empty?
563
+
564
+ list.scan(/([#.])([-:_a-zA-Z0-9\@]+)/) do |type, property|
489
565
  case type
490
566
  when '.'
491
- if attributes['class']
492
- attributes['class'] += " "
567
+ if attributes[CLASS_KEY]
568
+ attributes[CLASS_KEY] += " "
493
569
  else
494
- attributes['class'] = ""
570
+ attributes[CLASS_KEY] = ""
495
571
  end
496
- attributes['class'] += property
497
- when '#'; attributes['id'] = property
572
+ attributes[CLASS_KEY] += property
573
+ when '#'; attributes[ID_KEY] = property
498
574
  end
499
575
  end
500
576
  attributes
501
577
  end
502
578
 
579
+ # This method doesn't use Haml::AttributeParser because currently it depends on Ripper and Rubinius doesn't provide it.
580
+ # Ideally this logic should be placed in Haml::AttributeParser instead of here and this method should use it.
581
+ #
582
+ # @param [String] text - Hash literal or text inside old attributes
583
+ # @return [Hash,nil] - Return nil if text is not static Hash literal
503
584
  def parse_static_hash(text)
504
585
  attributes = {}
586
+ return attributes if text.empty?
587
+
588
+ text = text[1...-1] # strip brackets
505
589
  scanner = StringScanner.new(text)
506
590
  scanner.scan(/\s+/)
507
591
  until scanner.eos?
508
- return unless key = scanner.scan(LITERAL_VALUE_REGEX)
592
+ return unless (key = scanner.scan(LITERAL_VALUE_REGEX))
509
593
  return unless scanner.scan(/\s*=>\s*/)
510
- return unless value = scanner.scan(LITERAL_VALUE_REGEX)
594
+ return unless (value = scanner.scan(LITERAL_VALUE_REGEX))
511
595
  return unless scanner.scan(/\s*(?:,|$)\s*/)
512
596
  attributes[eval(key).to_s] = eval(value).to_s
513
597
  end
@@ -515,20 +599,20 @@ module Haml
515
599
  end
516
600
 
517
601
  # Parses a line into tag_name, attributes, attributes_hash, object_ref, action, value
518
- def parse_tag(line)
519
- match = line.scan(/%([-:\w]+)([-:\w\.\#]*)(.*)/)[0]
520
- raise SyntaxError.new(Error.message(:invalid_tag, line)) unless match
602
+ def parse_tag(text)
603
+ match = text.scan(/%([-:\w]+)([-:\w.#\@]*)(.+)?/)[0]
604
+ raise SyntaxError.new(Error.message(:invalid_tag, text)) unless match
521
605
 
522
606
  tag_name, attributes, rest = match
523
607
 
524
- if attributes =~ /[\.#](\.|#|\z)/
608
+ if !attributes.empty? && (attributes =~ /[.#](\.|#|\z)/)
525
609
  raise SyntaxError.new(Error.message(:illegal_element))
526
610
  end
527
611
 
528
612
  new_attributes_hash = old_attributes_hash = last_line = nil
529
- object_ref = "nil"
613
+ object_ref = :nil
530
614
  attributes_hashes = {}
531
- while rest
615
+ while rest && !rest.empty?
532
616
  case rest[0]
533
617
  when ?{
534
618
  break if old_attributes_hash
@@ -539,38 +623,51 @@ module Haml
539
623
  new_attributes_hash, rest, last_line = parse_new_attributes(rest)
540
624
  attributes_hashes[:new] = new_attributes_hash
541
625
  when ?[
542
- break unless object_ref == "nil"
626
+ break unless object_ref == :nil
543
627
  object_ref, rest = balance(rest, ?[, ?])
544
628
  else; break
545
629
  end
546
630
  end
547
631
 
548
- if rest
632
+ if rest && !rest.empty?
549
633
  nuke_whitespace, action, value = rest.scan(/(<>|><|[><])?([=\/\~&!])?(.*)?/)[0]
550
- nuke_whitespace ||= ''
551
- nuke_outer_whitespace = nuke_whitespace.include? '>'
552
- nuke_inner_whitespace = nuke_whitespace.include? '<'
634
+ if nuke_whitespace
635
+ nuke_outer_whitespace = nuke_whitespace.include? '>'
636
+ nuke_inner_whitespace = nuke_whitespace.include? '<'
637
+ end
553
638
  end
554
639
 
555
- if @options[:remove_whitespace]
640
+ if @options.remove_whitespace
556
641
  nuke_outer_whitespace = true
557
642
  nuke_inner_whitespace = true
558
643
  end
559
644
 
560
- value = value.to_s.strip
645
+ if value.nil?
646
+ value = ''
647
+ else
648
+ value.strip!
649
+ end
561
650
  [tag_name, attributes, attributes_hashes, object_ref, nuke_outer_whitespace,
562
- nuke_inner_whitespace, action, value, last_line || @index]
651
+ nuke_inner_whitespace, action, value, last_line || @line.index + 1]
563
652
  end
564
653
 
565
- def parse_old_attributes(line)
566
- line = line.dup
567
- last_line = @index
654
+ # @return [String] attributes_hash - Hash literal starting with `{` and ending with `}`
655
+ # @return [String] rest
656
+ # @return [Integer] last_line
657
+ def parse_old_attributes(text)
658
+ last_line = @line.index + 1
568
659
 
569
660
  begin
570
- attributes_hash, rest = balance(line, ?{, ?})
661
+ # Old attributes often look like a valid Hash literal, but it sometimes allow code like
662
+ # `{ hash, foo: bar }`, which is compiled to `_hamlout.attributes({}, nil, hash, foo: bar)`.
663
+ #
664
+ # To scan such code correctly, this scans `a( hash, foo: bar }` instead, stops when there is
665
+ # 1 more :on_embexpr_end (the last '}') than :on_embexpr_beg, and resurrects '{' afterwards.
666
+ balanced, rest = balance_tokens(text.sub(?{, METHOD_CALL_PREFIX), :on_embexpr_beg, :on_embexpr_end, count: 1)
667
+ attributes_hash = balanced.sub(METHOD_CALL_PREFIX, ?{)
571
668
  rescue SyntaxError => e
572
- if line.strip[-1] == ?, && e.message == Error.message(:unbalanced_brackets)
573
- line << "\n" << @next_line.text
669
+ if e.message == Error.message(:unbalanced_brackets) && !@template.empty?
670
+ text << "\n#{@next_line.text}"
574
671
  last_line += 1
575
672
  next_line
576
673
  retry
@@ -579,14 +676,15 @@ module Haml
579
676
  raise e
580
677
  end
581
678
 
582
- attributes_hash = attributes_hash[1...-1] if attributes_hash
583
679
  return attributes_hash, rest, last_line
584
680
  end
585
681
 
586
- def parse_new_attributes(line)
587
- line = line.dup
588
- scanner = StringScanner.new(line)
589
- last_line = @index
682
+ # @return [Array<Hash,String,nil>] - [static_attributes (Hash), dynamic_attributes (nil or String starting with `{` and ending with `}`)]
683
+ # @return [String] rest
684
+ # @return [Integer] last_line
685
+ def parse_new_attributes(text)
686
+ scanner = StringScanner.new(text)
687
+ last_line = @line.index + 1
590
688
  attributes = {}
591
689
 
592
690
  scanner.scan(/\(\s*/)
@@ -595,14 +693,15 @@ module Haml
595
693
  break if name.nil?
596
694
 
597
695
  if name == false
598
- text = (Haml::Util.balance(line, ?(, ?)) || [line]).first
696
+ scanned = Haml::Util.balance(text, ?(, ?))
697
+ text = scanned ? scanned.first : text
599
698
  raise Haml::SyntaxError.new(Error.message(:invalid_attribute_list, text.inspect), last_line - 1)
600
699
  end
601
700
  attributes[name] = value
602
701
  scanner.scan(/\s*/)
603
702
 
604
703
  if scanner.eos?
605
- line << " " << @next_line.text
704
+ text << " #{@next_line.text}"
606
705
  last_line += 1
607
706
  next_line
608
707
  scanner.scan(/\s*/)
@@ -610,12 +709,12 @@ module Haml
610
709
  end
611
710
 
612
711
  static_attributes = {}
613
- dynamic_attributes = "{"
712
+ dynamic_attributes = "{".dup
614
713
  attributes.each do |name, (type, val)|
615
714
  if type == :static
616
715
  static_attributes[name] = val
617
716
  else
618
- dynamic_attributes << inspect_obj(name) << " => " << val << ","
717
+ dynamic_attributes << "#{inspect_obj(name)} => #{val},"
619
718
  end
620
719
  end
621
720
  dynamic_attributes << "}"
@@ -625,7 +724,7 @@ module Haml
625
724
  end
626
725
 
627
726
  def parse_new_attribute(scanner)
628
- unless name = scanner.scan(/[-:\w]+/)
727
+ unless (name = scanner.scan(/[-:\w]+/))
629
728
  return if scanner.scan(/\)/)
630
729
  return false
631
730
  end
@@ -634,8 +733,8 @@ module Haml
634
733
  return name, [:static, true] unless scanner.scan(/=/) #/end
635
734
 
636
735
  scanner.scan(/\s*/)
637
- unless quote = scanner.scan(/["']/)
638
- return false unless var = scanner.scan(/(@@?|\$)?\w+/)
736
+ unless (quote = scanner.scan(/["']/))
737
+ return false unless (var = scanner.scan(/(@@?|\$)?\w+/))
639
738
  return name, [:dynamic, var]
640
739
  end
641
740
 
@@ -650,35 +749,16 @@ module Haml
650
749
 
651
750
  return name, [:static, content.first[1]] if content.size == 1
652
751
  return name, [:dynamic,
653
- '"' + content.map {|(t, v)| t == :str ? inspect_obj(v)[1...-1] : "\#{#{v}}"}.join + '"']
654
- end
655
-
656
- def raw_next_line
657
- text = @template.shift
658
- return unless text
659
-
660
- index = @template_index
661
- @template_index += 1
662
-
663
- return text, index
752
+ %!"#{content.each_with_object(''.dup) {|(t, v), s| s << (t == :str ? inspect_obj(v)[1...-1] : "\#{#{v}}")}}"!]
664
753
  end
665
754
 
666
755
  def next_line
667
- text, index = raw_next_line
668
- return unless text
669
-
670
- # :eod is a special end-of-document marker
671
- line =
672
- if text == :eod
673
- Line.new '-#', '-#', '-#', index, self, true
674
- else
675
- Line.new text.strip, text.lstrip.chomp, text, index, self, false
676
- end
756
+ line = @template.shift || raise(StopIteration)
677
757
 
678
758
  # `flat?' here is a little outdated,
679
759
  # so we have to manually check if either the previous or current line
680
760
  # closes the flat block, as well as whether a new block is opened.
681
- line_defined = instance_variable_defined?('@line')
761
+ line_defined = instance_variable_defined?(:@line)
682
762
  @line.tabs if line_defined
683
763
  unless (flat? && !closes_flat?(line) && !closes_flat?(@line)) ||
684
764
  (line_defined && @line.text[0] == ?: && line.full =~ %r[^#{@line.full[/^\s+/]}\s])
@@ -694,21 +774,17 @@ module Haml
694
774
  line && !line.text.empty? && line.full !~ /^#{@flat_spaces}/
695
775
  end
696
776
 
697
- def un_next_line(line)
698
- @template.unshift line
699
- @template_index -= 1
700
- end
701
-
702
777
  def handle_multiline(line)
703
778
  return unless is_multiline?(line.text)
704
779
  line.text.slice!(-1)
705
- while new_line = raw_next_line.first
706
- break if new_line == :eod
707
- next if new_line.strip.empty?
708
- break unless is_multiline?(new_line.strip)
709
- line.text << new_line.strip[0...-1]
780
+ loop do
781
+ new_line = @template.first
782
+ break if new_line.eod?
783
+ next @template.shift if new_line.text.strip.empty?
784
+ break unless is_multiline?(new_line.text.strip)
785
+ line.text << new_line.text.strip[0...-1]
786
+ @template.shift
710
787
  end
711
- un_next_line new_line
712
788
  end
713
789
 
714
790
  # Checks whether or not `line` is in a multiline sequence.
@@ -716,18 +792,18 @@ module Haml
716
792
  text && text.length > 1 && text[-1] == MULTILINE_CHAR_VALUE && text[-2] == ?\s && text !~ BLOCK_WITH_SPACES
717
793
  end
718
794
 
719
- def handle_ruby_multiline(text)
720
- text = text.rstrip
721
- return text unless is_ruby_multiline?(text)
722
- un_next_line @next_line.full
795
+ def handle_ruby_multiline(line)
796
+ line.text.rstrip!
797
+ return line unless is_ruby_multiline?(line.text)
723
798
  begin
724
- new_line = raw_next_line.first
725
- break if new_line == :eod
726
- next if new_line.strip.empty?
727
- text << " " << new_line.strip
728
- end while is_ruby_multiline?(new_line.strip)
799
+ # Use already fetched @next_line in the first loop. Otherwise, fetch next
800
+ new_line = new_line.nil? ? @next_line : @template.shift
801
+ break if new_line.eod?
802
+ next if new_line.text.empty?
803
+ line.text << " #{new_line.text.rstrip}"
804
+ end while is_ruby_multiline?(new_line.text)
729
805
  next_line
730
- text
806
+ line
731
807
  end
732
808
 
733
809
  # `text' is a Ruby multiline block if it:
@@ -735,15 +811,31 @@ module Haml
735
811
  # - but not "?," which is a character literal
736
812
  # (however, "x?," is a method call and not a literal)
737
813
  # - and not "?\," which is a character literal
738
- #
739
814
  def is_ruby_multiline?(text)
740
815
  text && text.length > 1 && text[-1] == ?, &&
741
- !((text[-3..-2] =~ /\W\?/) || text[-3..-2] == "?\\")
816
+ !((text[-3, 2] =~ /\W\?/) || text[-3, 2] == "?\\")
742
817
  end
743
818
 
744
819
  def balance(*args)
745
- res = Haml::Util.balance(*args)
746
- return res if res
820
+ Haml::Util.balance(*args) or raise(SyntaxError.new(Error.message(:unbalanced_brackets)))
821
+ end
822
+
823
+ # Unlike #balance, this balances Ripper tokens to balance something like `{ a: "}" }` correctly.
824
+ def balance_tokens(buf, start, finish, count: 0)
825
+ text = ''.dup
826
+ Ripper.lex(buf).each do |_, token, str|
827
+ text << str
828
+ case token
829
+ when start
830
+ count += 1
831
+ when finish
832
+ count -= 1
833
+ end
834
+
835
+ if count == 0
836
+ return text, buf.sub(text, '')
837
+ end
838
+ end
747
839
  raise SyntaxError.new(Error.message(:unbalanced_brackets))
748
840
  end
749
841
 
@@ -754,7 +846,7 @@ module Haml
754
846
  # Same semantics as block_opened?, except that block_opened? uses Line#tabs,
755
847
  # which doesn't interact well with filter lines
756
848
  def filter_opened?
757
- @next_line.full =~ (@indentation ? /^#{@indentation * @template_tabs}/ : /^\s/)
849
+ @next_line.full =~ (@indentation ? /^#{@indentation * (@template_tabs + 1)}/ : /^\s/)
758
850
  end
759
851
 
760
852
  def flat?