brakeman 4.8.0 → 5.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (273) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +144 -2
  3. data/README.md +23 -6
  4. data/bundle/load.rb +7 -5
  5. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/CHANGELOG.md +24 -0
  6. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/FAQ.md +0 -0
  7. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/Gemfile +1 -4
  8. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/MIT-LICENSE +0 -0
  9. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/README.md +21 -16
  10. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/REFERENCE.md +39 -10
  11. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/TODO +0 -0
  12. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/haml.gemspec +2 -1
  13. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/attribute_builder.rb +58 -3
  14. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/attribute_compiler.rb +45 -32
  15. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/attribute_parser.rb +0 -0
  16. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/buffer.rb +0 -56
  17. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/compiler.rb +0 -0
  18. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/engine.rb +0 -0
  19. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/error.rb +0 -0
  20. data/bundle/ruby/2.7.0/gems/haml-5.2.2/lib/haml/escapable.rb +77 -0
  21. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/exec.rb +0 -0
  22. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/filters.rb +0 -0
  23. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/generator.rb +0 -0
  24. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/action_view_extensions.rb +0 -0
  25. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/action_view_mods.rb +0 -0
  26. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/action_view_xss_mods.rb +0 -0
  27. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/safe_erubi_template.rb +0 -0
  28. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/safe_erubis_template.rb +0 -0
  29. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/xss_mods.rb +6 -3
  30. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers.rb +7 -1
  31. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/options.rb +0 -0
  32. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/parser.rb +32 -4
  33. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/plugin.rb +18 -1
  34. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/railtie.rb +5 -0
  35. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/sass_rails_filter.rb +0 -0
  36. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/template/options.rb +0 -0
  37. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/template.rb +0 -0
  38. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/temple_engine.rb +2 -1
  39. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/temple_line_counter.rb +0 -0
  40. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/util.rb +1 -1
  41. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/version.rb +1 -1
  42. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml.rb +0 -0
  43. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/yard/default/fulldoc/html/css/common.sass +0 -0
  44. data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/yard/default/layout/html/footer.erb +0 -0
  45. data/bundle/ruby/2.7.0/gems/parallel-1.21.0/MIT-LICENSE.txt +20 -0
  46. data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel/processor_count.rb +45 -0
  47. data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel/version.rb +4 -0
  48. data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel.rb +532 -0
  49. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/LICENSE.txt +22 -0
  50. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/NEWS.md +178 -0
  51. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/README.md +48 -0
  52. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb +63 -0
  53. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/attribute.rb +205 -0
  54. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/cdata.rb +68 -0
  55. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/child.rb +97 -0
  56. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/comment.rb +80 -0
  57. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/doctype.rb +311 -0
  58. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/document.rb +451 -0
  59. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/dtd/attlistdecl.rb +11 -0
  60. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/dtd/dtd.rb +47 -0
  61. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/dtd/elementdecl.rb +18 -0
  62. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/dtd/entitydecl.rb +57 -0
  63. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb +40 -0
  64. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/element.rb +2599 -0
  65. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/encoding.rb +51 -0
  66. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/entity.rb +171 -0
  67. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/formatters/default.rb +116 -0
  68. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/formatters/pretty.rb +142 -0
  69. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/formatters/transitive.rb +58 -0
  70. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/functions.rb +447 -0
  71. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/instruction.rb +79 -0
  72. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/light/node.rb +188 -0
  73. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/namespace.rb +59 -0
  74. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/node.rb +76 -0
  75. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/output.rb +30 -0
  76. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parent.rb +166 -0
  77. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parseexception.rb +52 -0
  78. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb +694 -0
  79. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/lightparser.rb +59 -0
  80. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/pullparser.rb +197 -0
  81. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/sax2parser.rb +273 -0
  82. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/streamparser.rb +61 -0
  83. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb +101 -0
  84. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/ultralightparser.rb +57 -0
  85. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/xpathparser.rb +689 -0
  86. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/quickpath.rb +266 -0
  87. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/rexml.rb +37 -0
  88. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/sax2listener.rb +98 -0
  89. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/security.rb +28 -0
  90. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/source.rb +298 -0
  91. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/streamlistener.rb +93 -0
  92. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/text.rb +424 -0
  93. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/undefinednamespaceexception.rb +9 -0
  94. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/validation/relaxng.rb +539 -0
  95. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/validation/validation.rb +144 -0
  96. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/validation/validationexception.rb +10 -0
  97. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/xmldecl.rb +130 -0
  98. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/xmltokens.rb +85 -0
  99. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/xpath.rb +81 -0
  100. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/xpath_parser.rb +974 -0
  101. data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml.rb +3 -0
  102. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/History.rdoc +148 -0
  103. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/Manifest.txt +7 -0
  104. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/README.rdoc +1 -0
  105. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/compare/normalize.rb +51 -6
  106. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/debugging.md +190 -0
  107. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/gauntlet.md +106 -0
  108. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/rp_extensions.rb +15 -36
  109. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/rp_stringscanner.rb +33 -0
  110. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby20_parser.rb +7128 -0
  111. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby20_parser.y +420 -296
  112. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby21_parser.rb +7182 -0
  113. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby21_parser.y +415 -293
  114. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby22_parser.rb +7228 -0
  115. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby22_parser.y +419 -295
  116. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby23_parser.rb +7237 -0
  117. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby23_parser.y +419 -295
  118. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby24_parser.rb +7268 -0
  119. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby24_parser.y +419 -295
  120. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby25_parser.rb +7268 -0
  121. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2/lib/ruby26_parser.y → ruby_parser-3.18.1/lib/ruby25_parser.y} +418 -308
  122. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby26_parser.rb +7287 -0
  123. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2/lib/ruby_parser.yy → ruby_parser-3.18.1/lib/ruby26_parser.y} +419 -399
  124. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby27_parser.rb +8517 -0
  125. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2/lib/ruby25_parser.y → ruby_parser-3.18.1/lib/ruby27_parser.y} +1030 -294
  126. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby30_parser.rb +8751 -0
  127. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby30_parser.y +3472 -0
  128. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby3_parser.yy +3476 -0
  129. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_lexer.rb +308 -605
  130. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_lexer.rex +33 -27
  131. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_lexer.rex.rb +65 -31
  132. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby_lexer_strings.rb +638 -0
  133. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_parser.rb +4 -0
  134. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby_parser.yy +3487 -0
  135. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_parser_extras.rb +341 -127
  136. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/tools/munge.rb +43 -10
  137. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/tools/ripper.rb +15 -10
  138. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/History.rdoc +39 -0
  139. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/Manifest.txt +0 -0
  140. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/README.rdoc +0 -0
  141. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/composite_sexp_processor.rb +0 -0
  142. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/pt_testcase.rb +9 -4
  143. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/sexp.rb +19 -9
  144. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/sexp_matcher.rb +4 -7
  145. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/sexp_processor.rb +1 -1
  146. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/strict_sexp.rb +25 -3
  147. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/unique.rb +0 -0
  148. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/CHANGES +4 -0
  149. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/Gemfile +12 -13
  150. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/LICENSE +0 -0
  151. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/README.jp.md +0 -0
  152. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/README.md +0 -0
  153. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/code_attributes.rb +0 -0
  154. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/command.rb +13 -13
  155. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/controls.rb +0 -0
  156. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/do_inserter.rb +0 -0
  157. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/embedded.rb +0 -0
  158. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/end_inserter.rb +0 -0
  159. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/engine.rb +0 -0
  160. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/erb_converter.rb +0 -0
  161. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/filter.rb +0 -0
  162. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/grammar.rb +0 -0
  163. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/include.rb +0 -0
  164. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/interpolation.rb +0 -0
  165. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/logic_less/context.rb +0 -0
  166. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/logic_less/filter.rb +0 -0
  167. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/logic_less.rb +0 -0
  168. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/parser.rb +1 -1
  169. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/smart/escaper.rb +0 -0
  170. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/smart/filter.rb +0 -0
  171. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/smart/parser.rb +0 -0
  172. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/smart.rb +0 -0
  173. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/splat/builder.rb +0 -0
  174. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/splat/filter.rb +0 -0
  175. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/template.rb +0 -0
  176. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/translator.rb +0 -0
  177. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/version.rb +1 -1
  178. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim.rb +0 -0
  179. data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/slim.gemspec +0 -0
  180. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/CHANGELOG.md +8 -0
  181. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/MIT-LICENSE.txt +0 -0
  182. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/README.md +1 -1
  183. data/bundle/ruby/2.7.0/gems/unicode-display_width-1.8.0/data/display_width.marshal.gz +0 -0
  184. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/lib/unicode/display_width/constants.rb +2 -2
  185. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/lib/unicode/display_width/index.rb +0 -0
  186. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/lib/unicode/display_width/no_string_ext.rb +0 -0
  187. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/lib/unicode/display_width/string_ext.rb +0 -0
  188. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/lib/unicode/display_width.rb +0 -0
  189. data/lib/brakeman/app_tree.rb +37 -4
  190. data/lib/brakeman/checks/base_check.rb +18 -2
  191. data/lib/brakeman/checks/check_basic_auth.rb +2 -0
  192. data/lib/brakeman/checks/check_csrf_token_forgery_cve.rb +28 -0
  193. data/lib/brakeman/checks/check_deserialize.rb +21 -1
  194. data/lib/brakeman/checks/check_detailed_exceptions.rb +1 -1
  195. data/lib/brakeman/checks/check_eol_rails.rb +23 -0
  196. data/lib/brakeman/checks/check_eol_ruby.rb +26 -0
  197. data/lib/brakeman/checks/check_evaluation.rb +1 -1
  198. data/lib/brakeman/checks/check_execute.rb +12 -1
  199. data/lib/brakeman/checks/check_json_entity_escape.rb +38 -0
  200. data/lib/brakeman/checks/check_json_parsing.rb +1 -1
  201. data/lib/brakeman/checks/check_mass_assignment.rb +37 -9
  202. data/lib/brakeman/checks/check_model_attr_accessible.rb +1 -1
  203. data/lib/brakeman/checks/check_model_attributes.rb +1 -1
  204. data/lib/brakeman/checks/check_page_caching_cve.rb +37 -0
  205. data/lib/brakeman/checks/check_permit_attributes.rb +1 -1
  206. data/lib/brakeman/checks/check_regex_dos.rb +1 -1
  207. data/lib/brakeman/checks/check_render.rb +15 -1
  208. data/lib/brakeman/checks/check_sanitize_methods.rb +2 -1
  209. data/lib/brakeman/checks/check_skip_before_filter.rb +4 -4
  210. data/lib/brakeman/checks/check_sql.rb +60 -9
  211. data/lib/brakeman/checks/check_symbol_dos.rb +1 -1
  212. data/lib/brakeman/checks/check_template_injection.rb +32 -0
  213. data/lib/brakeman/checks/check_unsafe_reflection_methods.rb +68 -0
  214. data/lib/brakeman/checks/check_verb_confusion.rb +75 -0
  215. data/lib/brakeman/checks/eol_check.rb +47 -0
  216. data/lib/brakeman/commandline.rb +25 -1
  217. data/lib/brakeman/file_parser.rb +58 -22
  218. data/lib/brakeman/options.rb +39 -2
  219. data/lib/brakeman/parsers/template_parser.rb +26 -3
  220. data/lib/brakeman/processors/alias_processor.rb +132 -24
  221. data/lib/brakeman/processors/base_processor.rb +4 -4
  222. data/lib/brakeman/processors/controller_alias_processor.rb +6 -43
  223. data/lib/brakeman/processors/controller_processor.rb +1 -1
  224. data/lib/brakeman/processors/gem_processor.rb +3 -0
  225. data/lib/brakeman/processors/haml_template_processor.rb +17 -1
  226. data/lib/brakeman/processors/lib/call_conversion_helper.rb +13 -7
  227. data/lib/brakeman/processors/lib/file_type_detector.rb +64 -0
  228. data/lib/brakeman/processors/lib/find_all_calls.rb +28 -13
  229. data/lib/brakeman/processors/lib/rails3_config_processor.rb +16 -16
  230. data/lib/brakeman/processors/lib/rails3_route_processor.rb +2 -0
  231. data/lib/brakeman/processors/lib/rails4_config_processor.rb +2 -1
  232. data/lib/brakeman/processors/lib/render_helper.rb +3 -1
  233. data/lib/brakeman/processors/library_processor.rb +9 -0
  234. data/lib/brakeman/processors/model_processor.rb +32 -0
  235. data/lib/brakeman/processors/output_processor.rb +1 -1
  236. data/lib/brakeman/processors/template_alias_processor.rb +5 -0
  237. data/lib/brakeman/report/ignore/config.rb +5 -1
  238. data/lib/brakeman/report/ignore/interactive.rb +1 -1
  239. data/lib/brakeman/report/report_base.rb +0 -2
  240. data/lib/brakeman/report/report_csv.rb +37 -60
  241. data/lib/brakeman/report/report_github.rb +31 -0
  242. data/lib/brakeman/report/report_junit.rb +2 -2
  243. data/lib/brakeman/report/report_sarif.rb +133 -0
  244. data/lib/brakeman/report/report_sonar.rb +38 -0
  245. data/lib/brakeman/report/report_tabs.rb +1 -1
  246. data/lib/brakeman/report/report_text.rb +38 -17
  247. data/lib/brakeman/report.rb +19 -1
  248. data/lib/brakeman/rescanner.rb +7 -5
  249. data/lib/brakeman/scanner.rb +65 -31
  250. data/lib/brakeman/tracker/collection.rb +57 -7
  251. data/lib/brakeman/tracker/config.rb +87 -5
  252. data/lib/brakeman/tracker/constants.rb +8 -7
  253. data/lib/brakeman/tracker/controller.rb +1 -1
  254. data/lib/brakeman/tracker/method_info.rb +70 -0
  255. data/lib/brakeman/tracker.rb +42 -5
  256. data/lib/brakeman/util.rb +58 -21
  257. data/lib/brakeman/version.rb +1 -1
  258. data/lib/brakeman/warning.rb +10 -2
  259. data/lib/brakeman/warning_codes.rb +13 -0
  260. data/lib/brakeman.rb +45 -6
  261. data/lib/ruby_parser/bm_sexp.rb +33 -9
  262. metadata +201 -123
  263. data/bundle/ruby/2.7.0/gems/haml-5.1.2/lib/haml/escapable.rb +0 -50
  264. data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/debugging.md +0 -18
  265. data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/rp_stringscanner.rb +0 -64
  266. data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby20_parser.rb +0 -7042
  267. data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby21_parser.rb +0 -7113
  268. data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby22_parser.rb +0 -7146
  269. data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby23_parser.rb +0 -7163
  270. data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby24_parser.rb +0 -7175
  271. data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby25_parser.rb +0 -7175
  272. data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby26_parser.rb +0 -7195
  273. data/bundle/ruby/2.7.0/gems/unicode-display_width-1.6.1/data/display_width.marshal.gz +0 -0
@@ -18,7 +18,7 @@ token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
18
18
  tBACK_REF2 tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG
19
19
  tWORDS_BEG tQWORDS_BEG tSTRING_DBEG tSTRING_DVAR tSTRING_END
20
20
  tSTRING tSYMBOL tNL tEH tCOLON tCOMMA tSPACE tSEMI tLAMBDA
21
- tLAMBEG tDSTAR tCHAR tSYMBOLS_BEG tQSYMBOLS_BEG tSTRING_DEND tUBANG
21
+ tLAMBEG tDSTAR tCHAR tSYMBOLS_BEG tQSYMBOLS_BEG tSTRING_DEND
22
22
 
23
23
  preclow
24
24
  nonassoc tLOWEST
@@ -30,7 +30,7 @@ preclow
30
30
  right tEQL tOP_ASGN
31
31
  left kRESCUE_MOD
32
32
  right tEH tCOLON
33
- nonassoc tDOT2 tDOT3
33
+ nonassoc tDOT2 tDOT3 tBDOT2 tBDOT3
34
34
  left tOROP
35
35
  left tANDOP
36
36
  nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
@@ -53,6 +53,9 @@ rule
53
53
  top_compstmt
54
54
  {
55
55
  result = new_compstmt val
56
+
57
+ lexer.cond.pop # local_pop
58
+ lexer.cmdarg.pop
56
59
  }
57
60
 
58
61
  top_compstmt: top_stmts opt_terms
@@ -73,7 +76,7 @@ rule
73
76
  | klBEGIN
74
77
  {
75
78
  if (self.in_def || self.in_single > 0) then
76
- debug20 1
79
+ debug 11
77
80
  yyerror "BEGIN in method"
78
81
  end
79
82
  self.env.extend
@@ -98,7 +101,9 @@ rule
98
101
  bodystmt: compstmt opt_rescue k_else
99
102
  {
100
103
  res = _values[-2]
101
- yyerror "else without rescue is useless" unless res
104
+ # TODO: move down to main match so I can just use val
105
+
106
+ warn "else without rescue is useless" unless res
102
107
  }
103
108
  compstmt
104
109
  opt_ensure
@@ -128,7 +133,7 @@ rule
128
133
  | error stmt
129
134
  {
130
135
  result = val[1]
131
- debug20 2, val, result
136
+ debug 12
132
137
  }
133
138
 
134
139
  stmt_or_begin: stmt
@@ -136,6 +141,10 @@ rule
136
141
  {
137
142
  yyerror "BEGIN is permitted only at toplevel"
138
143
  }
144
+ begin_block
145
+ {
146
+ result = val[2] # wtf?
147
+ }
139
148
 
140
149
  stmt: kALIAS fitem
141
150
  {
@@ -148,12 +157,12 @@ rule
148
157
  }
149
158
  | kALIAS tGVAR tGVAR
150
159
  {
151
- (_, line), lhs, rhs = val
160
+ (_, line), (lhs, _), (rhs, _) = val
152
161
  result = s(:valias, lhs.to_sym, rhs.to_sym).line line
153
162
  }
154
163
  | kALIAS tGVAR tBACK_REF
155
164
  {
156
- (_, line), lhs, rhs = val
165
+ (_, line), (lhs, _), (rhs, _) = val
157
166
  result = s(:valias, lhs.to_sym, :"$#{rhs}").line line
158
167
  }
159
168
  | kALIAS tGVAR tNTH_REF
@@ -196,7 +205,7 @@ rule
196
205
  (_, line), _, stmt, _ = val
197
206
 
198
207
  if (self.in_def || self.in_single > 0) then
199
- debug20 3
208
+ debug 13
200
209
  yyerror "END in method; use at_exit"
201
210
  end
202
211
 
@@ -240,30 +249,31 @@ rule
240
249
  }
241
250
  | primary_value call_op tIDENTIFIER tOP_ASGN command_rhs
242
251
  {
243
- prim, _, id, opasgn, rhs = val
244
- result = s(:op_asgn, prim, rhs, id.to_sym, opasgn.to_sym)
245
- if val[1] == '&.'
246
- result.sexp_type = :safe_op_asgn
247
- end
248
- result.line = val[0].line
252
+ prim, (call_op, _), (id, _), (op_asgn, _), rhs = val
253
+
254
+ result = s(:op_asgn, prim, rhs, id.to_sym, op_asgn.to_sym)
255
+ result.sexp_type = :safe_op_asgn if call_op == '&.'
256
+ result.line prim.line
249
257
  }
250
258
  | primary_value call_op tCONSTANT tOP_ASGN command_rhs
251
259
  {
252
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
253
- if val[1] == '&.'
254
- result.sexp_type = :safe_op_asgn
255
- end
256
- result.line = val[0].line
260
+ prim, (call_op, _), (id, _), (op_asgn, _), rhs = val
261
+
262
+ result = s(:op_asgn, prim, rhs, id.to_sym, op_asgn.to_sym)
263
+ result.sexp_type = :safe_op_asgn if call_op == '&.'
264
+ result.line prim.line
257
265
  }
258
266
  | primary_value tCOLON2 tCONSTANT tOP_ASGN command_rhs
259
267
  {
260
- result = s(:op_asgn, val[0], val[4], val[2], val[3])
261
- debug20 4, val, result
268
+ lhs1, _, (lhs2, line), (id, _), rhs = val
269
+
270
+ result = s(:op_asgn, lhs1, rhs, lhs2.to_sym, id.to_sym).line line
262
271
  }
263
272
  | primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs
264
273
  {
265
- result = s(:op_asgn, val[0], val[4], val[2], val[3])
266
- debug20 5, val, result
274
+ lhs1, _, (lhs2, line), (id, _), rhs = val
275
+
276
+ result = s(:op_asgn, lhs1, rhs, lhs2.to_sym, id.to_sym).line line
267
277
  }
268
278
  | backref tOP_ASGN command_rhs
269
279
  {
@@ -301,7 +311,7 @@ rule
301
311
  # TODO: fix line number to tBANG... but causes BAD shift/reduce conflict
302
312
  # REFACTOR: call_uni_op -- see parse26.y
303
313
  }
304
- | arg
314
+ | arg =tLBRACE_ARG
305
315
 
306
316
  expr_value: expr
307
317
  {
@@ -326,7 +336,7 @@ rule
326
336
  block_command: block_call
327
337
  | block_call call_op2 operation2 command_args
328
338
  {
329
- blk, _, msg, args = val
339
+ blk, _, (msg, _line), args = val
330
340
  result = new_call(blk, msg.to_sym, args).line blk.line
331
341
  }
332
342
 
@@ -340,15 +350,15 @@ rule
340
350
  _, line, body, _ = val
341
351
 
342
352
  result = body
343
- result.line = line
353
+ result.line line
344
354
 
345
355
  # self.env.unextend
346
356
  }
347
357
 
348
358
  fcall: operation
349
359
  {
350
- msg, = val
351
- result = new_call(nil, msg.to_sym).line lexer.lineno
360
+ (msg, line), = val
361
+ result = new_call(nil, msg.to_sym).line line
352
362
  }
353
363
 
354
364
  command: fcall command_args =tLOWEST
@@ -371,12 +381,14 @@ rule
371
381
  }
372
382
  | primary_value call_op operation2 command_args =tLOWEST
373
383
  {
374
- lhs, callop, op, args = val
384
+ lhs, callop, (op, _), args = val
385
+
375
386
  result = new_call lhs, op.to_sym, args, callop
387
+ result.line lhs.line
376
388
  }
377
389
  | primary_value call_op operation2 command_args cmd_brace_block
378
390
  {
379
- recv, _, msg, args, block = val
391
+ recv, _, (msg, _line), args, block = val
380
392
  call = new_call recv, msg.to_sym, args, val[1]
381
393
 
382
394
  block_dup_check call, block
@@ -386,11 +398,14 @@ rule
386
398
  }
387
399
  | primary_value tCOLON2 operation2 command_args =tLOWEST
388
400
  {
389
- result = new_call val[0], val[2].to_sym, val[3]
401
+ lhs, _, (id, line), args = val
402
+
403
+ result = new_call lhs, id.to_sym, args
404
+ result.line line
390
405
  }
391
406
  | primary_value tCOLON2 operation2 command_args cmd_brace_block
392
407
  {
393
- recv, _, msg, args, block = val
408
+ recv, _, (msg, _line), args, block = val
394
409
  call = new_call recv, msg.to_sym, args
395
410
 
396
411
  block_dup_check call, block
@@ -548,25 +563,29 @@ rule
548
563
  }
549
564
  | primary_value call_op tIDENTIFIER
550
565
  {
551
- result = new_attrasgn val[0], val[2], val[1]
566
+ lhs, call_op, (id, _line) = val
567
+
568
+ result = new_attrasgn lhs, id, call_op
552
569
  }
553
570
  | primary_value tCOLON2 tIDENTIFIER
554
571
  {
555
- recv, _, id = val
572
+ recv, _, (id, _line) = val
556
573
  result = new_attrasgn recv, id
557
574
  }
558
575
  | primary_value call_op tCONSTANT
559
576
  {
560
- result = new_attrasgn val[0], val[2], val[1]
577
+ lhs, call_op, (id, _line) = val
578
+
579
+ result = new_attrasgn lhs, id, call_op
561
580
  }
562
581
  | primary_value tCOLON2 tCONSTANT
563
582
  {
564
583
  if (self.in_def || self.in_single > 0) then
565
- debug20 7
584
+ debug 14
566
585
  yyerror "dynamic constant assignment"
567
586
  end
568
587
 
569
- expr, _, id = val
588
+ expr, _, (id, _line) = val
570
589
  l = expr.line
571
590
 
572
591
  result = s(:const, s(:colon2, expr, id.to_sym).line(l), nil).line l
@@ -574,58 +593,65 @@ rule
574
593
  | tCOLON3 tCONSTANT
575
594
  {
576
595
  if (self.in_def || self.in_single > 0) then
577
- debug20 8
596
+ debug 15
578
597
  yyerror "dynamic constant assignment"
579
598
  end
580
599
 
581
- _, id = val
582
- l = lexer.lineno
600
+ _, (id, l) = val
583
601
 
584
602
  result = s(:const, nil, s(:colon3, id.to_sym).line(l)).line l
585
603
  }
586
604
  | backref
587
605
  {
588
- self.backref_assign_error val[0]
606
+ ref, = val
607
+
608
+ self.backref_assign_error ref
589
609
  }
590
610
 
591
611
  lhs: user_variable
592
612
  {
593
- line = lexer.lineno
594
- result = self.assignable val[0]
595
- result.line = line
613
+ var, = val
614
+
615
+ result = self.assignable var
596
616
  }
597
617
  | keyword_variable
598
618
  {
599
- line = lexer.lineno
600
- result = self.assignable val[0]
601
- result.line = line
602
- debug20 9, val, result
619
+ var, = val
620
+
621
+ result = self.assignable var
622
+
623
+ debug 16
603
624
  }
604
625
  | primary_value tLBRACK2 opt_call_args rbracket
605
626
  {
606
627
  lhs, _, args, _ = val
628
+
607
629
  result = self.aryset lhs, args
608
630
  }
609
631
  | primary_value call_op tIDENTIFIER # REFACTOR
610
632
  {
611
- lhs, op, id = val
633
+ lhs, op, (id, _line) = val
634
+
612
635
  result = new_attrasgn lhs, id, op
613
636
  }
614
637
  | primary_value tCOLON2 tIDENTIFIER
615
638
  {
616
- lhs, _, id = val
639
+ lhs, _, (id, _line) = val
640
+
617
641
  result = new_attrasgn lhs, id
618
642
  }
619
643
  | primary_value call_op tCONSTANT # REFACTOR?
620
644
  {
621
- result = new_attrasgn val[0], val[2], val[1]
645
+ lhs, call_op, (id, _line) = val
646
+
647
+ result = new_attrasgn lhs, id, call_op
622
648
  }
623
649
  | primary_value tCOLON2 tCONSTANT
624
650
  {
625
- expr, _, id = val
651
+ expr, _, (id, _line) = val
626
652
 
627
653
  if (self.in_def || self.in_single > 0) then
628
- debug20 10
654
+ debug 17
629
655
  yyerror "dynamic constant assignment"
630
656
  end
631
657
 
@@ -634,14 +660,13 @@ rule
634
660
  }
635
661
  | tCOLON3 tCONSTANT
636
662
  {
637
- _, id = val
663
+ _, (id, l) = val
638
664
 
639
665
  if (self.in_def || self.in_single > 0) then
640
- debug20 11
666
+ debug 18
641
667
  yyerror "dynamic constant assignment"
642
668
  end
643
669
 
644
- l = lexer.lineno
645
670
  result = s(:const, s(:colon3, id.to_sym).line(l)).line l
646
671
  }
647
672
  | backref
@@ -657,16 +682,17 @@ rule
657
682
 
658
683
  cpath: tCOLON3 cname
659
684
  {
660
- _, name = val
661
- result = s(:colon3, name.to_sym).line lexer.lineno
685
+ _, (name, line) = val
686
+ result = s(:colon3, name.to_sym).line line
662
687
  }
663
688
  | cname
664
689
  {
665
- result = val[0].to_sym
690
+ (id, line), = val
691
+ result = [id.to_sym, line] # TODO: sexp?
666
692
  }
667
693
  | primary_value tCOLON2 cname
668
694
  {
669
- pval, _, name = val
695
+ pval, _, (name, _line) = val
670
696
 
671
697
  result = s(:colon2, pval, name.to_sym)
672
698
  result.line pval.line
@@ -676,24 +702,17 @@ rule
676
702
  | op
677
703
  {
678
704
  lexer.lex_state = EXPR_END
679
- result = val[0]
680
705
  }
681
706
 
682
707
  | reswords
683
- {
684
- (sym, _line), = val
685
- lexer.lex_state = EXPR_END
686
- result = sym
687
- }
688
-
689
- fsym: fname | symbol
690
708
 
691
- fitem: fsym
709
+ fitem: fname
692
710
  {
693
- id, = val
694
- result = s(:lit, id.to_sym).line lexer.lineno
711
+ (id, line), = val
712
+
713
+ result = s(:lit, id.to_sym).line line
695
714
  }
696
- | dsym
715
+ | symbol
697
716
 
698
717
  undef_list: fitem
699
718
  {
@@ -714,8 +733,6 @@ rule
714
733
  | tNEQ | tLSHFT | tRSHFT | tPLUS | tMINUS | tSTAR2
715
734
  | tSTAR | tDIVIDE | tPERCENT | tPOW | tDSTAR | tBANG | tTILDE
716
735
  | tUPLUS | tUMINUS | tAREF | tASET | tBACK_REF2
717
- # TODO: tUBANG dead?
718
- | tUBANG
719
736
 
720
737
  reswords: k__LINE__ | k__FILE__ | k__ENCODING__ | klBEGIN | klEND
721
738
  | kALIAS | kAND | kBEGIN | kBREAK | kCASE
@@ -749,24 +766,20 @@ rule
749
766
  }
750
767
  | primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
751
768
  {
752
- lhs, _, id, op, rhs = val
769
+ lhs, _, (id, _line), (op, _), rhs = val
753
770
 
754
771
  result = s(:op_asgn, lhs, rhs, id.to_sym, op.to_sym).line lhs.line
755
772
  }
756
773
  | primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
757
774
  {
758
- lhs1, _, lhs2, op, rhs = val
775
+ lhs1, _, (lhs2, _line), op, rhs = val
759
776
 
760
777
  lhs = s(:colon2, lhs1, lhs2.to_sym).line lhs1.line
761
778
  result = new_const_op_asgn [lhs, op, rhs]
762
779
  }
763
- | tCOLON3 tCONSTANT
764
- {
765
- result = self.lexer.lineno
766
- }
767
- tOP_ASGN arg_rhs
780
+ | tCOLON3 tCONSTANT tOP_ASGN arg_rhs
768
781
  {
769
- _, lhs, line, op, rhs = val
782
+ _, (lhs, line), op, rhs = val
770
783
 
771
784
  lhs = s(:colon3, lhs.to_sym).line line
772
785
  result = new_const_op_asgn [lhs, op, rhs]
@@ -780,7 +793,7 @@ rule
780
793
  | arg tDOT2 arg
781
794
  {
782
795
  v1, v2 = val[0], val[2]
783
- if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
796
+ if v1.sexp_type == :lit and v2.sexp_type == :lit and Integer === v1.last and Integer === v2.last then
784
797
  result = s(:lit, (v1.last)..(v2.last)).line v1.line
785
798
  else
786
799
  result = s(:dot2, v1, v2).line v1.line
@@ -789,12 +802,14 @@ rule
789
802
  | arg tDOT3 arg
790
803
  {
791
804
  v1, v2 = val[0], val[2]
792
- if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
805
+ if v1.sexp_type == :lit and v2.sexp_type == :lit and Integer === v1.last and Integer === v2.last then
793
806
  result = s(:lit, (v1.last)...(v2.last)).line v1.line
794
807
  else
795
808
  result = s(:dot3, v1, v2).line v1.line
796
809
  end
797
810
  }
811
+
812
+
798
813
  | arg tPLUS arg
799
814
  {
800
815
  result = new_call val[0], :+, argl(val[2])
@@ -821,16 +836,18 @@ rule
821
836
  }
822
837
  | tUMINUS_NUM tINTEGER tPOW arg
823
838
  {
824
- lit = s(:lit, val[1]).line lexer.lineno
825
- result = new_call(new_call(lit, :"**", argl(val[3])), :"-@")
839
+ _, (num, line), _, arg = val
840
+ lit = s(:lit, num).line line
841
+ result = new_call(new_call(lit, :"**", argl(arg)), :"-@")
826
842
  }
827
843
  | tUMINUS_NUM tFLOAT tPOW arg
828
844
  {
829
- lit = s(:lit, val[1]).line lexer.lineno
830
- result = new_call(new_call(lit, :"**", argl(val[3])), :"-@")
845
+ _, (num, line), _, arg = val
846
+ lit = s(:lit, num).line line
847
+ result = new_call(new_call(lit, :"**", argl(arg)), :"-@")
831
848
 
832
849
  ## TODO: why is this 2.0 only?
833
- debug20 12, val, result
850
+ debug 19
834
851
  }
835
852
  | tUPLUS arg
836
853
  {
@@ -928,12 +945,12 @@ rule
928
945
 
929
946
  rel_expr: arg relop arg =tGT
930
947
  {
931
- lhs, op, rhs = val
948
+ lhs, (op, _), rhs = val
932
949
  result = new_call lhs, op.to_sym, argl(rhs)
933
950
  }
934
951
  | rel_expr relop arg =tGT
935
952
  {
936
- lhs, op, rhs = val
953
+ lhs, (op, _), rhs = val
937
954
  warn "comparison '%s' after comparison", op
938
955
  result = new_call lhs, op.to_sym, argl(rhs)
939
956
  }
@@ -1015,12 +1032,39 @@ rule
1015
1032
  }
1016
1033
 
1017
1034
  command_args: {
1018
- result = lexer.cmdarg.store true
1035
+ # parse26.y line 2200
1036
+
1037
+ # If call_args starts with a open paren '(' or
1038
+ # '[', look-ahead reading of the letters calls
1039
+ # CMDARG_PUSH(0), but the push must be done
1040
+ # after CMDARG_PUSH(1). So this code makes them
1041
+ # consistent by first cancelling the premature
1042
+ # CMDARG_PUSH(0), doing CMDARG_PUSH(1), and
1043
+ # finally redoing CMDARG_PUSH(0).
1044
+
1045
+ result = yychar = self.last_token_type.first
1046
+ lookahead = [:tLPAREN, :tLPAREN_ARG, :tLPAREN2, :tLBRACK, :tLBRACK2].include?(yychar)
1047
+ lexer.cmdarg.pop if lookahead
1048
+ lexer.cmdarg.push true
1049
+ lexer.cmdarg.push false if lookahead
1019
1050
  }
1020
1051
  call_args
1021
1052
  {
1022
- lexer.cmdarg.restore val[0]
1023
- result = val[1]
1053
+ yychar, args = val
1054
+
1055
+ # call_args can be followed by tLBRACE_ARG (that
1056
+ # does CMDARG_PUSH(0) in the lexer) but the push
1057
+ # must be done after CMDARG_POP() in the parser.
1058
+ # So this code does CMDARG_POP() to pop 0 pushed
1059
+ # by tLBRACE_ARG, CMDARG_POP() to pop 1 pushed
1060
+ # by command_args, and CMDARG_PUSH(0) to restore
1061
+ # back the flag set by tLBRACE_ARG.
1062
+
1063
+ lookahead = [:tLBRACE_ARG].include?(yychar)
1064
+ lexer.cmdarg.pop if lookahead
1065
+ lexer.cmdarg.pop
1066
+ lexer.cmdarg.push false if lookahead
1067
+ result = args
1024
1068
  }
1025
1069
 
1026
1070
  block_arg: tAMPER arg_value
@@ -1038,8 +1082,9 @@ rule
1038
1082
  args: arg_value
1039
1083
  {
1040
1084
  arg, = val
1085
+ lineno = arg.line || lexer.lineno # HACK
1041
1086
 
1042
- result = s(:array, arg).line arg.line
1087
+ result = s(:array, arg).line lineno
1043
1088
  }
1044
1089
  | tSTAR arg_value
1045
1090
  {
@@ -1051,9 +1096,11 @@ rule
1051
1096
  args, _, id = val
1052
1097
  result = self.list_append args, id
1053
1098
  }
1054
- | args tCOMMA tSTAR { result = lexer.lineno } arg_value
1099
+ | args tCOMMA tSTAR arg_value
1055
1100
  {
1056
- args, _, _, line, id = val
1101
+ # TODO: the line number from tSTAR has been dropped
1102
+ args, _, _, id = val
1103
+ line = lexer.lineno
1057
1104
  result = self.list_append args, s(:splat, id).line(line)
1058
1105
  }
1059
1106
 
@@ -1063,7 +1110,6 @@ rule
1063
1110
  }
1064
1111
  | args tCOMMA tSTAR arg_value
1065
1112
  {
1066
- # FIX: bad shift/reduce conflict with rhs' comma star prod
1067
1113
  # TODO: make all tXXXX terminals include lexer.lineno
1068
1114
  arg, _, _, splat = val
1069
1115
  result = self.arg_concat arg, splat
@@ -1086,26 +1132,19 @@ rule
1086
1132
  | backref
1087
1133
  | tFID
1088
1134
  {
1089
- msg, = val
1135
+ (msg, line), = val
1090
1136
  result = new_call nil, msg.to_sym
1137
+ result.line line
1091
1138
  }
1092
1139
  | k_begin
1093
1140
  {
1141
+ lexer.cmdarg.push false
1094
1142
  result = self.lexer.lineno
1095
- # TODO:
1096
- # $<val>1 = cmdarg_stack;
1097
- # CMDARG_SET(0);
1098
1143
  }
1099
1144
  bodystmt k_end
1100
1145
  {
1101
- # TODO: CMDARG_SET($<val>1);
1102
- unless val[2] then
1103
- result = s(:nil)
1104
- else
1105
- result = s(:begin, val[2])
1106
- end
1107
-
1108
- result.line = val[1]
1146
+ lexer.cmdarg.pop
1147
+ result = new_begin val
1109
1148
  }
1110
1149
  | tLPAREN_ARG
1111
1150
  {
@@ -1118,18 +1157,14 @@ rule
1118
1157
  result = s(:begin).line line
1119
1158
  }
1120
1159
  | tLPAREN_ARG
1121
- {
1122
- result = lexer.cmdarg.store false
1123
- }
1124
1160
  stmt
1125
1161
  {
1126
1162
  lexer.lex_state = EXPR_ENDARG
1127
1163
  }
1128
1164
  rparen
1129
1165
  {
1130
- _, cmdarg, stmt, _, _, = val
1131
- warning "(...) interpreted as grouped expression"
1132
- lexer.cmdarg.restore cmdarg
1166
+ _, stmt, _, _, = val
1167
+ # warning "(...) interpreted as grouped expression"
1133
1168
  result = stmt
1134
1169
  }
1135
1170
  | tLPAREN compstmt tRPAREN
@@ -1141,15 +1176,15 @@ rule
1141
1176
  }
1142
1177
  | primary_value tCOLON2 tCONSTANT
1143
1178
  {
1144
- expr, _, id = val
1179
+ expr, _, (id, _line) = val
1145
1180
 
1146
1181
  result = s(:colon2, expr, id.to_sym).line expr.line
1147
1182
  }
1148
1183
  | tCOLON3 tCONSTANT
1149
1184
  {
1150
- _, id = val
1185
+ _, (id, line) = val
1151
1186
 
1152
- result = s(:colon3, id.to_sym).line lexer.lineno
1187
+ result = s(:colon3, id.to_sym).line line
1153
1188
  }
1154
1189
  | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1155
1190
  {
@@ -1173,15 +1208,21 @@ rule
1173
1208
  }
1174
1209
  | kYIELD tLPAREN2 call_args rparen
1175
1210
  {
1176
- result = new_yield val[2]
1211
+ (_, line), _, args, _ = val
1212
+
1213
+ result = new_yield(args).line line
1177
1214
  }
1178
1215
  | kYIELD tLPAREN2 rparen
1179
1216
  {
1180
- result = new_yield
1217
+ (_, line), _, _ = val
1218
+
1219
+ result = new_yield.line line
1181
1220
  }
1182
1221
  | kYIELD
1183
1222
  {
1184
- result = new_yield
1223
+ (_, line), = val
1224
+
1225
+ result = new_yield.line line
1185
1226
  }
1186
1227
  | kDEFINED opt_nl tLPAREN2 expr rparen
1187
1228
  {
@@ -1196,7 +1237,7 @@ rule
1196
1237
  }
1197
1238
  | kNOT tLPAREN2 rparen
1198
1239
  {
1199
- debug20 14, val, result
1240
+ debug 20
1200
1241
  }
1201
1242
  | fcall brace_block
1202
1243
  {
@@ -1214,9 +1255,10 @@ rule
1214
1255
  iter.insert 1, call # FIX
1215
1256
  result = iter
1216
1257
  }
1217
- | tLAMBDA lambda
1258
+ | lambda
1218
1259
  {
1219
- result = val[1] # TODO: fix lineno
1260
+ expr, = val
1261
+ result = expr
1220
1262
  }
1221
1263
  | k_if expr_value then compstmt if_tail k_end
1222
1264
  {
@@ -1259,7 +1301,6 @@ rule
1259
1301
  }
1260
1302
  cpath superclass
1261
1303
  {
1262
- self.comments.push self.lexer.comments
1263
1304
  if (self.in_def || self.in_single > 0) then
1264
1305
  yyerror "class definition in method body"
1265
1306
  end
@@ -1269,7 +1310,7 @@ rule
1269
1310
  {
1270
1311
  result = new_class val
1271
1312
  self.env.unextend
1272
- self.lexer.comments # we don't care about comments in the body
1313
+ self.lexer.ignore_body_comments
1273
1314
  }
1274
1315
  | k_class tLSHFT
1275
1316
  {
@@ -1290,7 +1331,7 @@ rule
1290
1331
  {
1291
1332
  result = new_sclass val
1292
1333
  self.env.unextend
1293
- self.lexer.comments # we don't care about comments in the body
1334
+ self.lexer.ignore_body_comments
1294
1335
  }
1295
1336
  | k_module
1296
1337
  {
@@ -1298,7 +1339,6 @@ rule
1298
1339
  }
1299
1340
  cpath
1300
1341
  {
1301
- self.comments.push self.lexer.comments
1302
1342
  yyerror "module definition in method body" if
1303
1343
  self.in_def or self.in_single > 0
1304
1344
 
@@ -1308,53 +1348,67 @@ rule
1308
1348
  {
1309
1349
  result = new_module val
1310
1350
  self.env.unextend
1311
- self.lexer.comments # we don't care about comments in the body
1351
+ self.lexer.ignore_body_comments
1312
1352
  }
1313
1353
  | k_def fname
1314
1354
  {
1315
- result = [self.in_def, self.lexer.cmdarg.stack.dup]
1355
+ result = self.in_def
1316
1356
 
1317
- self.comments.push self.lexer.comments
1318
- self.in_def = true
1357
+ self.in_def = true # group = local_push
1319
1358
  self.env.extend
1320
- # TODO: local->cmdargs = cmdarg_stack;
1321
- # TODO: port local_push_gen and local_pop_gen
1322
- lexer.cmdarg.stack.replace [false]
1359
+ lexer.cmdarg.push false
1360
+ lexer.cond.push false
1323
1361
  }
1324
- f_arglist bodystmt { result = lexer.lineno } k_end
1362
+ f_arglist bodystmt k_end
1325
1363
  {
1326
- in_def, cmdarg = val[2]
1364
+ result, in_def = new_defn val
1327
1365
 
1328
- result = new_defn val
1329
-
1330
- lexer.cmdarg.stack.replace cmdarg
1366
+ lexer.cond.pop # group = local_pop
1367
+ lexer.cmdarg.pop
1331
1368
  self.env.unextend
1332
1369
  self.in_def = in_def
1333
- self.lexer.comments # we don't care about comments in the body
1370
+
1371
+ self.lexer.ignore_body_comments
1334
1372
  }
1335
1373
  | k_def singleton dot_or_colon
1336
1374
  {
1337
- self.comments.push self.lexer.comments
1338
1375
  lexer.lex_state = EXPR_FNAME
1339
1376
  }
1340
1377
  fname
1341
1378
  {
1342
- self.in_single += 1
1379
+ result = self.in_def
1380
+
1381
+ self.in_single += 1 # TODO: remove?
1382
+
1383
+ self.in_def = true # local_push
1343
1384
  self.env.extend
1344
- lexer.lex_state = EXPR_ENDFN # force for args
1345
- result = [lexer.lineno, self.lexer.cmdarg.stack.dup]
1346
- lexer.cmdarg.stack.replace [false]
1385
+ lexer.cmdarg.push false
1386
+ lexer.cond.push false
1387
+
1388
+ lexer.lex_state = EXPR_ENDFN|EXPR_LABEL
1347
1389
  }
1348
1390
  f_arglist bodystmt k_end
1349
1391
  {
1350
- _, cmdarg = val[5]
1351
- result = new_defs val
1352
1392
 
1353
- lexer.cmdarg.stack.replace cmdarg
1393
+ # [kdef, recv, _, _, (name, line), in_def, args, body, kend]
1394
+ # =>
1395
+ # [kdef, recv, (name, line), in_def, args, body, kend]
1396
+
1397
+ val.delete_at 3
1398
+ val.delete_at 2
1354
1399
 
1400
+ result, in_def = new_defs val
1401
+
1402
+ lexer.cond.pop # group = local_pop
1403
+ lexer.cmdarg.pop
1355
1404
  self.env.unextend
1405
+ self.in_def = in_def
1406
+
1356
1407
  self.in_single -= 1
1357
- self.lexer.comments # we don't care about comments in the body
1408
+
1409
+ # TODO: restore cur_arg ? what's cur_arg?
1410
+
1411
+ self.lexer.ignore_body_comments
1358
1412
  }
1359
1413
  | kBREAK
1360
1414
  {
@@ -1391,8 +1445,17 @@ rule
1391
1445
  k_case: kCASE
1392
1446
  k_for: kFOR
1393
1447
  k_class: kCLASS
1448
+ {
1449
+ self.comments.push self.lexer.comments
1450
+ }
1394
1451
  k_module: kMODULE
1452
+ {
1453
+ self.comments.push self.lexer.comments
1454
+ }
1395
1455
  k_def: kDEF
1456
+ {
1457
+ self.comments.push self.lexer.comments
1458
+ }
1396
1459
  k_do: kDO
1397
1460
  k_do_block: kDO_BLOCK
1398
1461
  k_rescue: kRESCUE
@@ -1453,51 +1516,42 @@ rule
1453
1516
 
1454
1517
  result = block_var args
1455
1518
  }
1456
- | f_marg_list tCOMMA tSTAR f_norm_arg
1519
+ | f_marg_list tCOMMA f_rest_marg
1457
1520
  {
1458
- args, _, _, splat = val
1521
+ args, _, rest = val
1459
1522
 
1460
- result = block_var args, "*#{splat}".to_sym
1523
+ result = block_var args, rest
1461
1524
  }
1462
- | f_marg_list tCOMMA tSTAR f_norm_arg tCOMMA f_marg_list
1525
+ | f_marg_list tCOMMA f_rest_marg tCOMMA f_marg_list
1463
1526
  {
1464
- args, _, _, splat, _, args2 = val
1527
+ lhs, _, splat, _, rhs = val
1465
1528
 
1466
- result = block_var args, "*#{splat}".to_sym, args2
1529
+ result = block_var lhs, splat, rhs
1467
1530
  }
1468
- | f_marg_list tCOMMA tSTAR
1531
+ | f_rest_marg
1469
1532
  {
1470
- args, _, _ = val
1533
+ rest, = val
1471
1534
 
1472
- result = block_var args, :*
1535
+ result = block_var rest
1473
1536
  }
1474
- | f_marg_list tCOMMA tSTAR tCOMMA f_marg_list
1537
+ | f_rest_marg tCOMMA f_marg_list
1475
1538
  {
1476
- args, _, _, _, args2 = val
1539
+ splat, _, rest = val
1477
1540
 
1478
- result = block_var args, :*, args2
1541
+ result = block_var splat, rest
1479
1542
  }
1480
- | tSTAR f_norm_arg
1481
- {
1482
- _, splat = val
1483
1543
 
1484
- result = block_var :"*#{splat}"
1485
- }
1486
- | tSTAR f_norm_arg tCOMMA f_marg_list
1544
+ f_rest_marg: tSTAR f_norm_arg
1487
1545
  {
1488
- _, splat, _, args = val
1546
+ _, (id, line) = val
1489
1547
 
1490
- result = block_var :"*#{splat}", args
1548
+ result = args ["*#{id}".to_sym]
1549
+ result.line line
1491
1550
  }
1492
1551
  | tSTAR
1493
1552
  {
1494
- result = block_var :*
1495
- }
1496
- | tSTAR tCOMMA f_marg_list
1497
- {
1498
- _, _, args = val
1499
-
1500
- result = block_var :*, args
1553
+ result = args [:*]
1554
+ result.line lexer.lineno # FIX: tSTAR -> line
1501
1555
  }
1502
1556
 
1503
1557
  block_args_tail: f_block_kwarg tCOMMA f_kwrest opt_f_block_arg
@@ -1514,8 +1568,8 @@ rule
1514
1568
  }
1515
1569
  | f_block_arg
1516
1570
  {
1517
- line = lexer.lineno
1518
- result = call_args val # TODO: push line down
1571
+ (id, line), = val
1572
+ result = call_args [id]
1519
1573
  result.line line
1520
1574
  }
1521
1575
 
@@ -1624,13 +1678,13 @@ opt_block_args_tail: tCOMMA block_args_tail
1624
1678
 
1625
1679
  bvar: tIDENTIFIER
1626
1680
  {
1627
- id, = val
1628
- line = lexer.lineno
1681
+ (id, line), = val
1629
1682
  result = s(:shadow, id.to_sym).line line
1630
1683
  }
1631
1684
  | f_bad_arg
1632
1685
 
1633
- lambda: {
1686
+ lambda: tLAMBDA
1687
+ {
1634
1688
  self.env.extend :dynamic
1635
1689
  result = [lexer.lineno, lexer.lpar_beg]
1636
1690
  lexer.paren_nest += 1
@@ -1638,20 +1692,19 @@ opt_block_args_tail: tCOMMA block_args_tail
1638
1692
  }
1639
1693
  f_larglist
1640
1694
  {
1641
- result = lexer.cmdarg.store(false)
1695
+ lexer.cmdarg.push false
1642
1696
  }
1643
1697
  lambda_body
1644
1698
  {
1645
- (line, lpar), args, cmdarg, body = val
1699
+ _, (line, lpar), args, _cmdarg, body = val
1646
1700
  lexer.lpar_beg = lpar
1647
1701
 
1648
- lexer.cmdarg.restore cmdarg
1649
- lexer.cmdarg.lexpop
1702
+ lexer.cmdarg.pop
1650
1703
 
1651
1704
  call = s(:lambda).line line
1652
1705
  result = new_iter call, args, body
1653
- result.line = line
1654
- self.env.unextend
1706
+ result.line line
1707
+ self.env.unextend # TODO: dynapush & dynapop
1655
1708
  }
1656
1709
 
1657
1710
  f_larglist: tLPAREN2 f_args opt_bv_decl rparen
@@ -1685,23 +1738,28 @@ opt_block_args_tail: tCOMMA block_args_tail
1685
1738
  ## if (nd_type($1) == NODE_YIELD) {
1686
1739
  ## compile_error(PARSER_ARG "block given to yield");
1687
1740
 
1688
- syntax_error "Both block arg and actual block given." if
1689
- val[0].block_pass?
1741
+ cmd, blk = val
1690
1742
 
1691
- val = invert_block_call val if inverted? val
1743
+ syntax_error "Both block arg and actual block given." if
1744
+ cmd.block_pass?
1692
1745
 
1693
- cmd, blk = val
1746
+ if inverted? val then
1747
+ val = invert_block_call val
1748
+ cmd, blk = val
1749
+ end
1694
1750
 
1695
1751
  result = blk
1696
1752
  result.insert 1, cmd
1697
1753
  }
1698
1754
  | block_call call_op2 operation2 opt_paren_args
1699
1755
  {
1700
- result = new_call val[0], val[2].to_sym, val[3]
1756
+ lhs, _, (id, _line), args = val
1757
+
1758
+ result = new_call lhs, id.to_sym, args
1701
1759
  }
1702
1760
  | block_call call_op2 operation2 opt_paren_args brace_block
1703
1761
  {
1704
- iter1, _, name, args, iter2 = val
1762
+ iter1, _, (name, _line), args, iter2 = val
1705
1763
 
1706
1764
  call = new_call iter1, name.to_sym, args
1707
1765
  iter2.insert 1, call
@@ -1710,7 +1768,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1710
1768
  }
1711
1769
  | block_call call_op2 operation2 command_args do_block
1712
1770
  {
1713
- iter1, _, name, args, iter2 = val
1771
+ iter1, _, (name, _line), args, iter2 = val
1714
1772
 
1715
1773
  call = new_call iter1, name.to_sym, args
1716
1774
  iter2.insert 1, call
@@ -1718,28 +1776,29 @@ opt_block_args_tail: tCOMMA block_args_tail
1718
1776
  result = iter2
1719
1777
  }
1720
1778
 
1721
- method_call: fcall
1722
- {
1723
- result = self.lexer.lineno
1724
- }
1725
- paren_args
1779
+ method_call: fcall paren_args
1726
1780
  {
1727
- call, lineno, args = val
1781
+ call, args = val
1728
1782
 
1729
1783
  result = call.concat args.sexp_body if args
1730
- result.line lineno
1731
1784
  }
1732
1785
  | primary_value call_op operation2 opt_paren_args
1733
1786
  {
1734
- result = new_call val[0], val[2].to_sym, val[3], val[1]
1787
+ recv, call_op, (op, _line), args = val
1788
+
1789
+ result = new_call recv, op.to_sym, args, call_op
1735
1790
  }
1736
1791
  | primary_value tCOLON2 operation2 paren_args
1737
1792
  {
1738
- result = new_call val[0], val[2].to_sym, val[3]
1793
+ recv, _, (op, _line), args = val
1794
+
1795
+ result = new_call recv, op.to_sym, args
1739
1796
  }
1740
1797
  | primary_value tCOLON2 operation3
1741
1798
  {
1742
- result = new_call val[0], val[2].to_sym
1799
+ lhs, _, (id, _line) = val
1800
+
1801
+ result = new_call lhs, id.to_sym
1743
1802
  }
1744
1803
  | primary_value call_op paren_args
1745
1804
  {
@@ -1772,7 +1831,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1772
1831
  _, line, body, _ = val
1773
1832
 
1774
1833
  result = body
1775
- result.line = line
1834
+ result.line line
1776
1835
 
1777
1836
  self.env.unextend
1778
1837
  }
@@ -1786,7 +1845,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1786
1845
  _, line, body, _ = val
1787
1846
 
1788
1847
  result = body
1789
- result.line = line
1848
+ result.line line
1790
1849
 
1791
1850
  self.env.unextend
1792
1851
  }
@@ -1804,25 +1863,50 @@ opt_block_args_tail: tCOMMA block_args_tail
1804
1863
  }
1805
1864
 
1806
1865
  do_body: { self.env.extend :dynamic; result = self.lexer.lineno }
1807
- { result = lexer.cmdarg.store(false) }
1866
+ { lexer.cmdarg.push false }
1808
1867
  opt_block_param
1809
1868
  compstmt
1810
1869
  {
1811
- line, cmdarg, param, cmpstmt = val
1870
+ line, _cmdarg, param, cmpstmt = val
1812
1871
 
1813
1872
  result = new_do_body param, cmpstmt, line
1873
+ lexer.cmdarg.pop
1814
1874
  self.env.unextend
1815
- lexer.cmdarg.restore cmdarg
1875
+ }
1876
+
1877
+ case_args: arg_value
1878
+ {
1879
+ arg, = val
1880
+
1881
+ result = s(:array, arg).line arg.line
1882
+ }
1883
+ | tSTAR arg_value
1884
+ {
1885
+ _, arg = val
1886
+
1887
+ result = s(:array, s(:splat, arg).line(arg.line)).line arg.line
1888
+ }
1889
+ | case_args tCOMMA arg_value
1890
+ {
1891
+ args, _, id = val
1892
+
1893
+ result = self.list_append args, id
1894
+ }
1895
+ | case_args tCOMMA tSTAR arg_value
1896
+ {
1897
+ args, _, _, id = val
1898
+
1899
+ result = self.list_append args, s(:splat, id).line(id.line)
1816
1900
  }
1817
1901
 
1818
1902
  case_body: k_when
1819
1903
  {
1820
1904
  result = self.lexer.lineno
1821
1905
  }
1822
- args then compstmt cases
1906
+ case_args then compstmt cases
1823
1907
  {
1824
1908
  result = new_when(val[2], val[4])
1825
- result.line = val[1]
1909
+ result.line val[1]
1826
1910
  result << val[5] if val[5]
1827
1911
  }
1828
1912
 
@@ -1868,17 +1952,10 @@ opt_block_args_tail: tCOMMA block_args_tail
1868
1952
 
1869
1953
  literal: numeric
1870
1954
  {
1871
- line = lexer.lineno
1872
- result = s(:lit, val[0])
1873
- result.line = line
1955
+ (lit, line), = val
1956
+ result = s(:lit, lit).line line
1874
1957
  }
1875
1958
  | symbol
1876
- {
1877
- line = lexer.lineno
1878
- result = s(:lit, val[0])
1879
- result.line = line
1880
- }
1881
- | dsym
1882
1959
 
1883
1960
  strings: string
1884
1961
  {
@@ -1889,7 +1966,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1889
1966
 
1890
1967
  string: tCHAR
1891
1968
  {
1892
- debug20 23, val, result
1969
+ debug 37
1893
1970
  }
1894
1971
  | string1
1895
1972
  | string string1
@@ -1899,11 +1976,11 @@ opt_block_args_tail: tCOMMA block_args_tail
1899
1976
 
1900
1977
  string1: tSTRING_BEG string_contents tSTRING_END
1901
1978
  {
1902
- _, str, (_, func) = val
1979
+ (_, line), str, (_, func) = val
1903
1980
 
1904
- str = dedent str if func =~ RubyLexer::STR_FUNC_ICNTNT
1981
+ str = dedent str if func =~ RubyLexer::STR_FUNC_DEDENT
1905
1982
 
1906
- result = str
1983
+ result = str.line line
1907
1984
  }
1908
1985
  | tSTRING
1909
1986
  {
@@ -1912,7 +1989,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1912
1989
 
1913
1990
  xstring: tXSTRING_BEG xstring_contents tSTRING_END
1914
1991
  {
1915
- result = new_xstring val[1]
1992
+ result = new_xstring val
1916
1993
  # TODO: dedent?!?! SERIOUSLY?!?
1917
1994
  }
1918
1995
 
@@ -1923,11 +2000,15 @@ opt_block_args_tail: tCOMMA block_args_tail
1923
2000
 
1924
2001
  words: tWORDS_BEG tSPACE tSTRING_END
1925
2002
  {
1926
- result = s(:array).line lexer.lineno
2003
+ (_, line), _, _ = val
2004
+
2005
+ result = s(:array).line line
1927
2006
  }
1928
2007
  | tWORDS_BEG word_list tSTRING_END
1929
2008
  {
1930
- result = val[1]
2009
+ (_, line), list, _ = val
2010
+
2011
+ result = list.line line
1931
2012
  }
1932
2013
 
1933
2014
  word_list: none
@@ -1947,18 +2028,20 @@ opt_block_args_tail: tCOMMA block_args_tail
1947
2028
 
1948
2029
  symbols: tSYMBOLS_BEG tSPACE tSTRING_END
1949
2030
  {
1950
- result = s(:array).line lexer.lineno
2031
+ (_, line), _, _ = val
2032
+
2033
+ result = s(:array).line line
1951
2034
  }
1952
- | tSYMBOLS_BEG { result = lexer.lineno } symbol_list tSTRING_END
2035
+ | tSYMBOLS_BEG symbol_list tSTRING_END
1953
2036
  {
1954
- _, line, list, _, = val
1955
- list.line = line
2037
+ (_, line), list, _, = val
2038
+ list.line line
1956
2039
  result = list
1957
2040
  }
1958
2041
 
1959
2042
  symbol_list: none
1960
2043
  {
1961
- result = new_symbol_list.line lexer.lineno
2044
+ result = new_symbol_list
1962
2045
  }
1963
2046
  | symbol_list word tSPACE
1964
2047
  {
@@ -1968,20 +2051,28 @@ opt_block_args_tail: tCOMMA block_args_tail
1968
2051
 
1969
2052
  qwords: tQWORDS_BEG tSPACE tSTRING_END
1970
2053
  {
1971
- result = s(:array).line lexer.lineno
2054
+ (_, line), _, _ = val
2055
+
2056
+ result = s(:array).line line
1972
2057
  }
1973
2058
  | tQWORDS_BEG qword_list tSTRING_END
1974
2059
  {
1975
- result = val[1]
2060
+ (_, line), list, _ = val
2061
+
2062
+ result = list.line line
1976
2063
  }
1977
2064
 
1978
2065
  qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
1979
2066
  {
1980
- result = s(:array).line lexer.lineno # FIX
2067
+ (_, line), _, _ = val
2068
+
2069
+ result = s(:array).line line
1981
2070
  }
1982
2071
  | tQSYMBOLS_BEG qsym_list tSTRING_END
1983
2072
  {
1984
- result = val[1]
2073
+ (_, line), list, _ = val
2074
+
2075
+ result = list.line line
1985
2076
  }
1986
2077
 
1987
2078
  qword_list: none
@@ -2004,7 +2095,8 @@ opt_block_args_tail: tCOMMA block_args_tail
2004
2095
 
2005
2096
  string_contents: none
2006
2097
  {
2007
- result = s(:str, "").line lexer.lineno
2098
+ line = prev_value_to_lineno _values.last
2099
+ result = s(:str, +"").line line
2008
2100
  }
2009
2101
  | string_contents string_content
2010
2102
  {
@@ -2054,12 +2146,13 @@ regexp_contents: none
2054
2146
  result = [lexer.lex_strterm,
2055
2147
  lexer.brace_nest,
2056
2148
  lexer.string_nest, # TODO: remove
2057
- lexer.cond.store,
2058
- lexer.cmdarg.store,
2059
2149
  lexer.lex_state,
2060
2150
  lexer.lineno,
2061
2151
  ]
2062
2152
 
2153
+ lexer.cmdarg.push false
2154
+ lexer.cond.push false
2155
+
2063
2156
  lexer.lex_strterm = nil
2064
2157
  lexer.brace_nest = 0
2065
2158
  lexer.string_nest = 0
@@ -2071,14 +2164,15 @@ regexp_contents: none
2071
2164
  {
2072
2165
  _, memo, stmt, _ = val
2073
2166
 
2074
- lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state, line = memo
2167
+ lex_strterm, brace_nest, string_nest, oldlex_state, line = memo
2168
+ # TODO: heredoc_indent
2075
2169
 
2076
2170
  lexer.lex_strterm = lex_strterm
2077
2171
  lexer.brace_nest = brace_nest
2078
2172
  lexer.string_nest = string_nest
2079
2173
 
2080
- lexer.cond.restore oldcond
2081
- lexer.cmdarg.restore oldcmdarg
2174
+ lexer.cond.pop
2175
+ lexer.cmdarg.pop
2082
2176
 
2083
2177
  lexer.lex_state = oldlex_state
2084
2178
 
@@ -2093,29 +2187,49 @@ regexp_contents: none
2093
2187
  when nil then
2094
2188
  result = s(:evstr).line line
2095
2189
  else
2096
- debug20 25
2190
+ debug 38
2097
2191
  raise "unknown string body: #{stmt.inspect}"
2098
2192
  end
2099
2193
  }
2100
2194
 
2101
- string_dvar: tGVAR { result = s(:gvar, val[0].to_sym).line lexer.lineno }
2102
- | tIVAR { result = s(:ivar, val[0].to_sym).line lexer.lineno }
2103
- | tCVAR { result = s(:cvar, val[0].to_sym).line lexer.lineno }
2195
+ string_dvar: tGVAR
2196
+ {
2197
+ (id, line), = val
2198
+ result = s(:gvar, id.to_sym).line line
2199
+ }
2200
+ | tIVAR
2201
+ {
2202
+ (id, line), = val
2203
+ result = s(:ivar, id.to_sym).line line
2204
+ }
2205
+ | tCVAR
2206
+ {
2207
+ (id, line), = val
2208
+ result = s(:cvar, id.to_sym).line line
2209
+ }
2104
2210
  | backref
2105
2211
 
2106
- symbol: tSYMBEG sym
2212
+ symbol: ssym
2213
+ | dsym
2214
+
2215
+ ssym: tSYMBEG sym
2107
2216
  {
2217
+ _, (id, line) = val
2218
+
2108
2219
  lexer.lex_state = EXPR_END
2109
- result = val[1].to_sym
2220
+ result = s(:lit, id.to_sym).line line
2110
2221
  }
2111
2222
  | tSYMBOL
2112
2223
  {
2113
- result = val[0].to_sym
2224
+ (id, line), = val
2225
+
2226
+ lexer.lex_state = EXPR_END
2227
+ result = s(:lit, id.to_sym).line line
2114
2228
  }
2115
2229
 
2116
2230
  sym: fname | tIVAR | tGVAR | tCVAR
2117
2231
 
2118
- dsym: tSYMBEG xstring_contents tSTRING_END
2232
+ dsym: tSYMBEG string_contents tSTRING_END
2119
2233
  {
2120
2234
  _, result, _ = val
2121
2235
 
@@ -2131,7 +2245,7 @@ regexp_contents: none
2131
2245
  when :evstr then
2132
2246
  result = s(:dsym, "", result).line result.line
2133
2247
  else
2134
- debug20 26, val, result
2248
+ debug 39
2135
2249
  end
2136
2250
  }
2137
2251
 
@@ -2139,11 +2253,13 @@ regexp_contents: none
2139
2253
  | tFLOAT
2140
2254
  | tUMINUS_NUM tINTEGER =tLOWEST
2141
2255
  {
2142
- result = -val[1] # TODO: pt_testcase
2256
+ _, (num, line) = val
2257
+ result = [-num, line]
2143
2258
  }
2144
2259
  | tUMINUS_NUM tFLOAT =tLOWEST
2145
2260
  {
2146
- result = -val[1] # TODO: pt_testcase
2261
+ _, (num, line) = val
2262
+ result = [-num, line]
2147
2263
  }
2148
2264
 
2149
2265
  user_variable: tIDENTIFIER
@@ -2171,8 +2287,10 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2171
2287
 
2172
2288
  var_ref: user_variable
2173
2289
  {
2174
- var = val[0]
2290
+ raise "NO: #{val.inspect}" if Sexp === val.first
2291
+ (var, line), = val
2175
2292
  result = Sexp === var ? var : self.gettable(var)
2293
+ result.line line
2176
2294
  }
2177
2295
  | keyword_variable
2178
2296
  {
@@ -2187,11 +2305,19 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2187
2305
  | keyword_variable
2188
2306
  {
2189
2307
  result = self.assignable val[0]
2190
- debug20 29, val, result
2308
+ debug 40
2191
2309
  }
2192
2310
 
2193
- backref: tNTH_REF { result = s(:nth_ref, val[0]).line lexer.lineno }
2194
- | tBACK_REF { result = s(:back_ref, val[0]).line lexer.lineno }
2311
+ backref: tNTH_REF
2312
+ {
2313
+ (ref, line), = val
2314
+ result = s(:nth_ref, ref).line line
2315
+ }
2316
+ | tBACK_REF
2317
+ {
2318
+ (ref, line), = val
2319
+ result = s(:back_ref, ref).line line
2320
+ }
2195
2321
 
2196
2322
  superclass: tLT
2197
2323
  {
@@ -2209,9 +2335,7 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2209
2335
 
2210
2336
  f_arglist: tLPAREN2 f_args rparen
2211
2337
  {
2212
- result = val[1]
2213
- self.lexer.lex_state = EXPR_BEG
2214
- self.lexer.command_start = true
2338
+ result = end_args val
2215
2339
  }
2216
2340
  | {
2217
2341
  result = self.in_kwarg
@@ -2220,12 +2344,7 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2220
2344
  }
2221
2345
  f_args term
2222
2346
  {
2223
- kwarg, args, _ = val
2224
-
2225
- self.in_kwarg = kwarg
2226
- result = args
2227
- lexer.lex_state = EXPR_BEG
2228
- lexer.command_start = true
2347
+ result = end_args val
2229
2348
  }
2230
2349
 
2231
2350
  args_tail: f_kwarg tCOMMA f_kwrest opt_f_block_arg
@@ -2310,8 +2429,10 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2310
2429
  |
2311
2430
  {
2312
2431
  result = args val
2432
+ # result.line lexer.lineno
2313
2433
  }
2314
2434
 
2435
+
2315
2436
  f_bad_arg: tCONSTANT
2316
2437
  {
2317
2438
  yyerror "formal argument cannot be a constant"
@@ -2332,31 +2453,24 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2332
2453
  f_norm_arg: f_bad_arg
2333
2454
  | tIDENTIFIER
2334
2455
  {
2335
- identifier = val[0].to_sym
2456
+ (id, line), = val
2457
+ identifier = id.to_sym
2336
2458
  self.env[identifier] = :lvar
2337
2459
 
2338
- result = identifier
2460
+ result = [identifier, line]
2339
2461
  }
2340
2462
 
2341
2463
  f_arg_item: f_norm_arg
2342
2464
  | tLPAREN f_margs rparen
2343
2465
  {
2344
- result = val[1]
2466
+ _, margs, _ = val
2467
+
2468
+ result = margs
2345
2469
  }
2346
2470
 
2347
2471
  f_arg: f_arg_item
2348
2472
  {
2349
- arg, = val
2350
-
2351
- case arg
2352
- when Symbol then
2353
- result = s(:args, arg).line lexer.lineno
2354
- when Sexp then
2355
- result = arg
2356
- else
2357
- debug20 32
2358
- raise "Unknown f_arg type: #{val.inspect}"
2359
- end
2473
+ result = new_arg val
2360
2474
  }
2361
2475
  | f_arg tCOMMA f_arg_item
2362
2476
  {
@@ -2368,7 +2482,7 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2368
2482
  result = s(:args, list).line list.line
2369
2483
  end
2370
2484
 
2371
- result << item
2485
+ result << (Sexp === item ? item : item.first)
2372
2486
  }
2373
2487
 
2374
2488
  f_kw: tLABEL arg_value
@@ -2409,26 +2523,33 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2409
2523
  kwrest_mark: tPOW
2410
2524
  | tDSTAR
2411
2525
 
2526
+
2412
2527
  f_kwrest: kwrest_mark tIDENTIFIER
2413
2528
  {
2414
- name = val[1].to_sym
2415
- self.assignable name
2416
- result = :"**#{name}"
2529
+ _, (id, line) = val
2530
+
2531
+ name = id.to_sym
2532
+ self.assignable [name, line]
2533
+ result = [:"**#{name}", line]
2417
2534
  }
2418
2535
  | kwrest_mark
2419
2536
  {
2420
- result = :"**"
2537
+ id = :"**"
2538
+ self.env[id] = :lvar # TODO: needed?!?
2539
+ result = [id, lexer.lineno] # TODO: tPOW/tDSTAR include lineno
2421
2540
  }
2422
2541
 
2423
2542
  f_opt: tIDENTIFIER tEQL arg_value
2424
2543
  {
2425
- result = self.assignable val[0], val[2]
2544
+ lhs, _, rhs = val
2545
+ result = self.assignable lhs, rhs
2426
2546
  # TODO: detect duplicate names
2427
2547
  }
2428
2548
 
2429
2549
  f_block_opt: tIDENTIFIER tEQL primary_value
2430
2550
  {
2431
- result = self.assignable val[0], val[2]
2551
+ lhs, _, rhs = val
2552
+ result = self.assignable lhs, rhs
2432
2553
  }
2433
2554
 
2434
2555
  f_block_optarg: f_block_opt
@@ -2458,30 +2579,33 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2458
2579
  f_rest_arg: restarg_mark tIDENTIFIER
2459
2580
  {
2460
2581
  # TODO: differs from parse.y - needs tests
2461
- name = val[1].to_sym
2462
- self.assignable name
2463
- result = :"*#{name}"
2582
+ _, (id, line) = val
2583
+ name = id.to_sym
2584
+ self.assignable [name, line]
2585
+ result = [:"*#{name}", line]
2464
2586
  }
2465
2587
  | restarg_mark
2466
2588
  {
2467
2589
  name = :"*"
2468
2590
  self.env[name] = :lvar
2469
- result = name
2591
+ result = [name, lexer.lineno] # FIX: tSTAR to include lineno
2470
2592
  }
2471
2593
 
2472
2594
  blkarg_mark: tAMPER2 | tAMPER
2473
2595
 
2474
2596
  f_block_arg: blkarg_mark tIDENTIFIER
2475
2597
  {
2476
- identifier = val[1].to_sym
2598
+ _, (id, line) = val
2599
+ identifier = id.to_sym
2477
2600
 
2478
2601
  self.env[identifier] = :lvar
2479
- result = "&#{identifier}".to_sym
2602
+ result = ["&#{identifier}".to_sym, line]
2480
2603
  }
2481
2604
 
2482
2605
  opt_f_block_arg: tCOMMA f_block_arg
2483
2606
  {
2484
- result = val[1]
2607
+ _, arg = val
2608
+ result = arg
2485
2609
  }
2486
2610
  |
2487
2611
  {