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
  tRATIONAL tIMAGINARY
23
23
 
24
24
  preclow
@@ -31,7 +31,7 @@ preclow
31
31
  right tEQL tOP_ASGN
32
32
  left kRESCUE_MOD
33
33
  right tEH tCOLON
34
- nonassoc tDOT2 tDOT3
34
+ nonassoc tDOT2 tDOT3 tBDOT2 tBDOT3
35
35
  left tOROP
36
36
  left tANDOP
37
37
  nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
@@ -54,6 +54,9 @@ rule
54
54
  top_compstmt
55
55
  {
56
56
  result = new_compstmt val
57
+
58
+ lexer.cond.pop # local_pop
59
+ lexer.cmdarg.pop
57
60
  }
58
61
 
59
62
  top_compstmt: top_stmts opt_terms
@@ -74,7 +77,7 @@ rule
74
77
  | klBEGIN
75
78
  {
76
79
  if (self.in_def || self.in_single > 0) then
77
- debug20 1
80
+ debug 11
78
81
  yyerror "BEGIN in method"
79
82
  end
80
83
  self.env.extend
@@ -99,7 +102,9 @@ rule
99
102
  bodystmt: compstmt opt_rescue k_else
100
103
  {
101
104
  res = _values[-2]
102
- yyerror "else without rescue is useless" unless res
105
+ # TODO: move down to main match so I can just use val
106
+
107
+ warn "else without rescue is useless" unless res
103
108
  }
104
109
  compstmt
105
110
  opt_ensure
@@ -129,7 +134,7 @@ rule
129
134
  | error stmt
130
135
  {
131
136
  result = val[1]
132
- debug20 2, val, result
137
+ debug 12
133
138
  }
134
139
 
135
140
  stmt_or_begin: stmt
@@ -137,6 +142,10 @@ rule
137
142
  {
138
143
  yyerror "BEGIN is permitted only at toplevel"
139
144
  }
145
+ begin_block
146
+ {
147
+ result = val[2] # wtf?
148
+ }
140
149
 
141
150
  stmt: kALIAS fitem
142
151
  {
@@ -149,12 +158,12 @@ rule
149
158
  }
150
159
  | kALIAS tGVAR tGVAR
151
160
  {
152
- (_, line), lhs, rhs = val
161
+ (_, line), (lhs, _), (rhs, _) = val
153
162
  result = s(:valias, lhs.to_sym, rhs.to_sym).line line
154
163
  }
155
164
  | kALIAS tGVAR tBACK_REF
156
165
  {
157
- (_, line), lhs, rhs = val
166
+ (_, line), (lhs, _), (rhs, _) = val
158
167
  result = s(:valias, lhs.to_sym, :"$#{rhs}").line line
159
168
  }
160
169
  | kALIAS tGVAR tNTH_REF
@@ -197,7 +206,7 @@ rule
197
206
  (_, line), _, stmt, _ = val
198
207
 
199
208
  if (self.in_def || self.in_single > 0) then
200
- debug20 3
209
+ debug 13
201
210
  yyerror "END in method; use at_exit"
202
211
  end
203
212
 
@@ -237,30 +246,31 @@ rule
237
246
  }
238
247
  | primary_value call_op tIDENTIFIER tOP_ASGN command_rhs
239
248
  {
240
- prim, _, id, opasgn, rhs = val
241
- result = s(:op_asgn, prim, rhs, id.to_sym, opasgn.to_sym)
242
- if val[1] == '&.'
243
- result.sexp_type = :safe_op_asgn
244
- end
245
- result.line = val[0].line
249
+ prim, (call_op, _), (id, _), (op_asgn, _), rhs = val
250
+
251
+ result = s(:op_asgn, prim, rhs, id.to_sym, op_asgn.to_sym)
252
+ result.sexp_type = :safe_op_asgn if call_op == '&.'
253
+ result.line prim.line
246
254
  }
247
255
  | primary_value call_op tCONSTANT tOP_ASGN command_rhs
248
256
  {
249
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
250
- if val[1] == '&.'
251
- result.sexp_type = :safe_op_asgn
252
- end
253
- result.line = val[0].line
257
+ prim, (call_op, _), (id, _), (op_asgn, _), rhs = val
258
+
259
+ result = s(:op_asgn, prim, rhs, id.to_sym, op_asgn.to_sym)
260
+ result.sexp_type = :safe_op_asgn if call_op == '&.'
261
+ result.line prim.line
254
262
  }
255
263
  | primary_value tCOLON2 tCONSTANT tOP_ASGN command_rhs
256
264
  {
257
- result = s(:op_asgn, val[0], val[4], val[2], val[3])
258
- debug20 4, val, result
265
+ lhs1, _, (lhs2, line), (id, _), rhs = val
266
+
267
+ result = s(:op_asgn, lhs1, rhs, lhs2.to_sym, id.to_sym).line line
259
268
  }
260
269
  | primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs
261
270
  {
262
- result = s(:op_asgn, val[0], val[4], val[2], val[3])
263
- debug20 5, val, result
271
+ lhs1, _, (lhs2, line), (id, _), rhs = val
272
+
273
+ result = s(:op_asgn, lhs1, rhs, lhs2.to_sym, id.to_sym).line line
264
274
  }
265
275
  | backref tOP_ASGN command_rhs
266
276
  {
@@ -298,7 +308,7 @@ rule
298
308
  # TODO: fix line number to tBANG... but causes BAD shift/reduce conflict
299
309
  # REFACTOR: call_uni_op -- see parse26.y
300
310
  }
301
- | arg
311
+ | arg =tLBRACE_ARG
302
312
 
303
313
  expr_value: expr
304
314
  {
@@ -323,7 +333,7 @@ rule
323
333
  block_command: block_call
324
334
  | block_call call_op2 operation2 command_args
325
335
  {
326
- blk, _, msg, args = val
336
+ blk, _, (msg, _line), args = val
327
337
  result = new_call(blk, msg.to_sym, args).line blk.line
328
338
  }
329
339
 
@@ -337,15 +347,15 @@ rule
337
347
  _, line, body, _ = val
338
348
 
339
349
  result = body
340
- result.line = line
350
+ result.line line
341
351
 
342
352
  # self.env.unextend
343
353
  }
344
354
 
345
355
  fcall: operation
346
356
  {
347
- msg, = val
348
- result = new_call(nil, msg.to_sym).line lexer.lineno
357
+ (msg, line), = val
358
+ result = new_call(nil, msg.to_sym).line line
349
359
  }
350
360
 
351
361
  command: fcall command_args =tLOWEST
@@ -368,12 +378,14 @@ rule
368
378
  }
369
379
  | primary_value call_op operation2 command_args =tLOWEST
370
380
  {
371
- lhs, callop, op, args = val
381
+ lhs, callop, (op, _), args = val
382
+
372
383
  result = new_call lhs, op.to_sym, args, callop
384
+ result.line lhs.line
373
385
  }
374
386
  | primary_value call_op operation2 command_args cmd_brace_block
375
387
  {
376
- recv, _, msg, args, block = val
388
+ recv, _, (msg, _line), args, block = val
377
389
  call = new_call recv, msg.to_sym, args, val[1]
378
390
 
379
391
  block_dup_check call, block
@@ -383,11 +395,14 @@ rule
383
395
  }
384
396
  | primary_value tCOLON2 operation2 command_args =tLOWEST
385
397
  {
386
- result = new_call val[0], val[2].to_sym, val[3]
398
+ lhs, _, (id, line), args = val
399
+
400
+ result = new_call lhs, id.to_sym, args
401
+ result.line line
387
402
  }
388
403
  | primary_value tCOLON2 operation2 command_args cmd_brace_block
389
404
  {
390
- recv, _, msg, args, block = val
405
+ recv, _, (msg, _line), args, block = val
391
406
  call = new_call recv, msg.to_sym, args
392
407
 
393
408
  block_dup_check call, block
@@ -545,25 +560,29 @@ rule
545
560
  }
546
561
  | primary_value call_op tIDENTIFIER
547
562
  {
548
- result = new_attrasgn val[0], val[2], val[1]
563
+ lhs, call_op, (id, _line) = val
564
+
565
+ result = new_attrasgn lhs, id, call_op
549
566
  }
550
567
  | primary_value tCOLON2 tIDENTIFIER
551
568
  {
552
- recv, _, id = val
569
+ recv, _, (id, _line) = val
553
570
  result = new_attrasgn recv, id
554
571
  }
555
572
  | primary_value call_op tCONSTANT
556
573
  {
557
- result = new_attrasgn val[0], val[2], val[1]
574
+ lhs, call_op, (id, _line) = val
575
+
576
+ result = new_attrasgn lhs, id, call_op
558
577
  }
559
578
  | primary_value tCOLON2 tCONSTANT
560
579
  {
561
580
  if (self.in_def || self.in_single > 0) then
562
- debug20 7
581
+ debug 14
563
582
  yyerror "dynamic constant assignment"
564
583
  end
565
584
 
566
- expr, _, id = val
585
+ expr, _, (id, _line) = val
567
586
  l = expr.line
568
587
 
569
588
  result = s(:const, s(:colon2, expr, id.to_sym).line(l), nil).line l
@@ -571,58 +590,65 @@ rule
571
590
  | tCOLON3 tCONSTANT
572
591
  {
573
592
  if (self.in_def || self.in_single > 0) then
574
- debug20 8
593
+ debug 15
575
594
  yyerror "dynamic constant assignment"
576
595
  end
577
596
 
578
- _, id = val
579
- l = lexer.lineno
597
+ _, (id, l) = val
580
598
 
581
599
  result = s(:const, nil, s(:colon3, id.to_sym).line(l)).line l
582
600
  }
583
601
  | backref
584
602
  {
585
- self.backref_assign_error val[0]
603
+ ref, = val
604
+
605
+ self.backref_assign_error ref
586
606
  }
587
607
 
588
608
  lhs: user_variable
589
609
  {
590
- line = lexer.lineno
591
- result = self.assignable val[0]
592
- result.line = line
610
+ var, = val
611
+
612
+ result = self.assignable var
593
613
  }
594
614
  | keyword_variable
595
615
  {
596
- line = lexer.lineno
597
- result = self.assignable val[0]
598
- result.line = line
599
- debug20 9, val, result
616
+ var, = val
617
+
618
+ result = self.assignable var
619
+
620
+ debug 16
600
621
  }
601
622
  | primary_value tLBRACK2 opt_call_args rbracket
602
623
  {
603
624
  lhs, _, args, _ = val
625
+
604
626
  result = self.aryset lhs, args
605
627
  }
606
628
  | primary_value call_op tIDENTIFIER # REFACTOR
607
629
  {
608
- lhs, op, id = val
630
+ lhs, op, (id, _line) = val
631
+
609
632
  result = new_attrasgn lhs, id, op
610
633
  }
611
634
  | primary_value tCOLON2 tIDENTIFIER
612
635
  {
613
- lhs, _, id = val
636
+ lhs, _, (id, _line) = val
637
+
614
638
  result = new_attrasgn lhs, id
615
639
  }
616
640
  | primary_value call_op tCONSTANT # REFACTOR?
617
641
  {
618
- result = new_attrasgn val[0], val[2], val[1]
642
+ lhs, call_op, (id, _line) = val
643
+
644
+ result = new_attrasgn lhs, id, call_op
619
645
  }
620
646
  | primary_value tCOLON2 tCONSTANT
621
647
  {
622
- expr, _, id = val
648
+ expr, _, (id, _line) = val
623
649
 
624
650
  if (self.in_def || self.in_single > 0) then
625
- debug20 10
651
+ debug 17
626
652
  yyerror "dynamic constant assignment"
627
653
  end
628
654
 
@@ -631,14 +657,13 @@ rule
631
657
  }
632
658
  | tCOLON3 tCONSTANT
633
659
  {
634
- _, id = val
660
+ _, (id, l) = val
635
661
 
636
662
  if (self.in_def || self.in_single > 0) then
637
- debug20 11
663
+ debug 18
638
664
  yyerror "dynamic constant assignment"
639
665
  end
640
666
 
641
- l = lexer.lineno
642
667
  result = s(:const, s(:colon3, id.to_sym).line(l)).line l
643
668
  }
644
669
  | backref
@@ -654,16 +679,17 @@ rule
654
679
 
655
680
  cpath: tCOLON3 cname
656
681
  {
657
- _, name = val
658
- result = s(:colon3, name.to_sym).line lexer.lineno
682
+ _, (name, line) = val
683
+ result = s(:colon3, name.to_sym).line line
659
684
  }
660
685
  | cname
661
686
  {
662
- result = val[0].to_sym
687
+ (id, line), = val
688
+ result = [id.to_sym, line] # TODO: sexp?
663
689
  }
664
690
  | primary_value tCOLON2 cname
665
691
  {
666
- pval, _, name = val
692
+ pval, _, (name, _line) = val
667
693
 
668
694
  result = s(:colon2, pval, name.to_sym)
669
695
  result.line pval.line
@@ -673,24 +699,17 @@ rule
673
699
  | op
674
700
  {
675
701
  lexer.lex_state = EXPR_END
676
- result = val[0]
677
702
  }
678
703
 
679
704
  | reswords
680
- {
681
- (sym, _line), = val
682
- lexer.lex_state = EXPR_END
683
- result = sym
684
- }
685
-
686
- fsym: fname | symbol
687
705
 
688
- fitem: fsym
706
+ fitem: fname
689
707
  {
690
- id, = val
691
- result = s(:lit, id.to_sym).line lexer.lineno
708
+ (id, line), = val
709
+
710
+ result = s(:lit, id.to_sym).line line
692
711
  }
693
- | dsym
712
+ | symbol
694
713
 
695
714
  undef_list: fitem
696
715
  {
@@ -711,8 +730,6 @@ rule
711
730
  | tNEQ | tLSHFT | tRSHFT | tPLUS | tMINUS | tSTAR2
712
731
  | tSTAR | tDIVIDE | tPERCENT | tPOW | tDSTAR | tBANG | tTILDE
713
732
  | tUPLUS | tUMINUS | tAREF | tASET | tBACK_REF2
714
- # TODO: tUBANG dead?
715
- | tUBANG
716
733
 
717
734
  reswords: k__LINE__ | k__FILE__ | k__ENCODING__ | klBEGIN | klEND
718
735
  | kALIAS | kAND | kBEGIN | kBREAK | kCASE
@@ -746,24 +763,20 @@ rule
746
763
  }
747
764
  | primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
748
765
  {
749
- lhs, _, id, op, rhs = val
766
+ lhs, _, (id, _line), (op, _), rhs = val
750
767
 
751
768
  result = s(:op_asgn, lhs, rhs, id.to_sym, op.to_sym).line lhs.line
752
769
  }
753
770
  | primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
754
771
  {
755
- lhs1, _, lhs2, op, rhs = val
772
+ lhs1, _, (lhs2, _line), op, rhs = val
756
773
 
757
774
  lhs = s(:colon2, lhs1, lhs2.to_sym).line lhs1.line
758
775
  result = new_const_op_asgn [lhs, op, rhs]
759
776
  }
760
- | tCOLON3 tCONSTANT
761
- {
762
- result = self.lexer.lineno
763
- }
764
- tOP_ASGN arg_rhs
777
+ | tCOLON3 tCONSTANT tOP_ASGN arg_rhs
765
778
  {
766
- _, lhs, line, op, rhs = val
779
+ _, (lhs, line), op, rhs = val
767
780
 
768
781
  lhs = s(:colon3, lhs.to_sym).line line
769
782
  result = new_const_op_asgn [lhs, op, rhs]
@@ -777,7 +790,7 @@ rule
777
790
  | arg tDOT2 arg
778
791
  {
779
792
  v1, v2 = val[0], val[2]
780
- if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
793
+ if v1.sexp_type == :lit and v2.sexp_type == :lit and Integer === v1.last and Integer === v2.last then
781
794
  result = s(:lit, (v1.last)..(v2.last)).line v1.line
782
795
  else
783
796
  result = s(:dot2, v1, v2).line v1.line
@@ -786,12 +799,14 @@ rule
786
799
  | arg tDOT3 arg
787
800
  {
788
801
  v1, v2 = val[0], val[2]
789
- if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
802
+ if v1.sexp_type == :lit and v2.sexp_type == :lit and Integer === v1.last and Integer === v2.last then
790
803
  result = s(:lit, (v1.last)...(v2.last)).line v1.line
791
804
  else
792
805
  result = s(:dot3, v1, v2).line v1.line
793
806
  end
794
807
  }
808
+
809
+
795
810
  | arg tPLUS arg
796
811
  {
797
812
  result = new_call val[0], :+, argl(val[2])
@@ -818,8 +833,9 @@ rule
818
833
  }
819
834
  | tUMINUS_NUM simple_numeric tPOW arg
820
835
  {
821
- lit = s(:lit, val[1]).line lexer.lineno
822
- result = new_call(new_call(lit, :"**", argl(val[3])), :"-@")
836
+ _, (num, line), _, arg = val
837
+ lit = s(:lit, num).line line
838
+ result = new_call(new_call(lit, :"**", argl(arg)), :"-@")
823
839
 
824
840
  }
825
841
  | tUPLUS arg
@@ -918,12 +934,12 @@ rule
918
934
 
919
935
  rel_expr: arg relop arg =tGT
920
936
  {
921
- lhs, op, rhs = val
937
+ lhs, (op, _), rhs = val
922
938
  result = new_call lhs, op.to_sym, argl(rhs)
923
939
  }
924
940
  | rel_expr relop arg =tGT
925
941
  {
926
- lhs, op, rhs = val
942
+ lhs, (op, _), rhs = val
927
943
  warn "comparison '%s' after comparison", op
928
944
  result = new_call lhs, op.to_sym, argl(rhs)
929
945
  }
@@ -1005,12 +1021,39 @@ rule
1005
1021
  }
1006
1022
 
1007
1023
  command_args: {
1008
- result = lexer.cmdarg.store true
1024
+ # parse26.y line 2200
1025
+
1026
+ # If call_args starts with a open paren '(' or
1027
+ # '[', look-ahead reading of the letters calls
1028
+ # CMDARG_PUSH(0), but the push must be done
1029
+ # after CMDARG_PUSH(1). So this code makes them
1030
+ # consistent by first cancelling the premature
1031
+ # CMDARG_PUSH(0), doing CMDARG_PUSH(1), and
1032
+ # finally redoing CMDARG_PUSH(0).
1033
+
1034
+ result = yychar = self.last_token_type.first
1035
+ lookahead = [:tLPAREN, :tLPAREN_ARG, :tLPAREN2, :tLBRACK, :tLBRACK2].include?(yychar)
1036
+ lexer.cmdarg.pop if lookahead
1037
+ lexer.cmdarg.push true
1038
+ lexer.cmdarg.push false if lookahead
1009
1039
  }
1010
1040
  call_args
1011
1041
  {
1012
- lexer.cmdarg.restore val[0]
1013
- result = val[1]
1042
+ yychar, args = val
1043
+
1044
+ # call_args can be followed by tLBRACE_ARG (that
1045
+ # does CMDARG_PUSH(0) in the lexer) but the push
1046
+ # must be done after CMDARG_POP() in the parser.
1047
+ # So this code does CMDARG_POP() to pop 0 pushed
1048
+ # by tLBRACE_ARG, CMDARG_POP() to pop 1 pushed
1049
+ # by command_args, and CMDARG_PUSH(0) to restore
1050
+ # back the flag set by tLBRACE_ARG.
1051
+
1052
+ lookahead = [:tLBRACE_ARG].include?(yychar)
1053
+ lexer.cmdarg.pop if lookahead
1054
+ lexer.cmdarg.pop
1055
+ lexer.cmdarg.push false if lookahead
1056
+ result = args
1014
1057
  }
1015
1058
 
1016
1059
  block_arg: tAMPER arg_value
@@ -1028,8 +1071,9 @@ rule
1028
1071
  args: arg_value
1029
1072
  {
1030
1073
  arg, = val
1074
+ lineno = arg.line || lexer.lineno # HACK
1031
1075
 
1032
- result = s(:array, arg).line arg.line
1076
+ result = s(:array, arg).line lineno
1033
1077
  }
1034
1078
  | tSTAR arg_value
1035
1079
  {
@@ -1041,9 +1085,11 @@ rule
1041
1085
  args, _, id = val
1042
1086
  result = self.list_append args, id
1043
1087
  }
1044
- | args tCOMMA tSTAR { result = lexer.lineno } arg_value
1088
+ | args tCOMMA tSTAR arg_value
1045
1089
  {
1046
- args, _, _, line, id = val
1090
+ # TODO: the line number from tSTAR has been dropped
1091
+ args, _, _, id = val
1092
+ line = lexer.lineno
1047
1093
  result = self.list_append args, s(:splat, id).line(line)
1048
1094
  }
1049
1095
 
@@ -1062,7 +1108,6 @@ rule
1062
1108
  }
1063
1109
  | args tCOMMA tSTAR arg_value
1064
1110
  {
1065
- # FIX: bad shift/reduce conflict with rhs' comma star prod
1066
1111
  # TODO: make all tXXXX terminals include lexer.lineno
1067
1112
  arg, _, _, splat = val
1068
1113
  result = self.arg_concat arg, splat
@@ -1085,26 +1130,19 @@ rule
1085
1130
  | backref
1086
1131
  | tFID
1087
1132
  {
1088
- msg, = val
1133
+ (msg, line), = val
1089
1134
  result = new_call nil, msg.to_sym
1135
+ result.line line
1090
1136
  }
1091
1137
  | k_begin
1092
1138
  {
1139
+ lexer.cmdarg.push false
1093
1140
  result = self.lexer.lineno
1094
- # TODO:
1095
- # $<val>1 = cmdarg_stack;
1096
- # CMDARG_SET(0);
1097
1141
  }
1098
1142
  bodystmt k_end
1099
1143
  {
1100
- # TODO: CMDARG_SET($<val>1);
1101
- unless val[2] then
1102
- result = s(:nil)
1103
- else
1104
- result = s(:begin, val[2])
1105
- end
1106
-
1107
- result.line = val[1]
1144
+ lexer.cmdarg.pop
1145
+ result = new_begin val
1108
1146
  }
1109
1147
  | tLPAREN_ARG
1110
1148
  {
@@ -1117,18 +1155,14 @@ rule
1117
1155
  result = s(:begin).line line
1118
1156
  }
1119
1157
  | tLPAREN_ARG
1120
- {
1121
- result = lexer.cmdarg.store false
1122
- }
1123
1158
  stmt
1124
1159
  {
1125
1160
  lexer.lex_state = EXPR_ENDARG
1126
1161
  }
1127
1162
  rparen
1128
1163
  {
1129
- _, cmdarg, stmt, _, _, = val
1130
- warning "(...) interpreted as grouped expression"
1131
- lexer.cmdarg.restore cmdarg
1164
+ _, stmt, _, _, = val
1165
+ # warning "(...) interpreted as grouped expression"
1132
1166
  result = stmt
1133
1167
  }
1134
1168
  | tLPAREN compstmt tRPAREN
@@ -1140,15 +1174,15 @@ rule
1140
1174
  }
1141
1175
  | primary_value tCOLON2 tCONSTANT
1142
1176
  {
1143
- expr, _, id = val
1177
+ expr, _, (id, _line) = val
1144
1178
 
1145
1179
  result = s(:colon2, expr, id.to_sym).line expr.line
1146
1180
  }
1147
1181
  | tCOLON3 tCONSTANT
1148
1182
  {
1149
- _, id = val
1183
+ _, (id, line) = val
1150
1184
 
1151
- result = s(:colon3, id.to_sym).line lexer.lineno
1185
+ result = s(:colon3, id.to_sym).line line
1152
1186
  }
1153
1187
  | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1154
1188
  {
@@ -1172,15 +1206,21 @@ rule
1172
1206
  }
1173
1207
  | kYIELD tLPAREN2 call_args rparen
1174
1208
  {
1175
- result = new_yield val[2]
1209
+ (_, line), _, args, _ = val
1210
+
1211
+ result = new_yield(args).line line
1176
1212
  }
1177
1213
  | kYIELD tLPAREN2 rparen
1178
1214
  {
1179
- result = new_yield
1215
+ (_, line), _, _ = val
1216
+
1217
+ result = new_yield.line line
1180
1218
  }
1181
1219
  | kYIELD
1182
1220
  {
1183
- result = new_yield
1221
+ (_, line), = val
1222
+
1223
+ result = new_yield.line line
1184
1224
  }
1185
1225
  | kDEFINED opt_nl tLPAREN2 expr rparen
1186
1226
  {
@@ -1195,7 +1235,7 @@ rule
1195
1235
  }
1196
1236
  | kNOT tLPAREN2 rparen
1197
1237
  {
1198
- debug20 14, val, result
1238
+ debug 20
1199
1239
  }
1200
1240
  | fcall brace_block
1201
1241
  {
@@ -1213,9 +1253,10 @@ rule
1213
1253
  iter.insert 1, call # FIX
1214
1254
  result = iter
1215
1255
  }
1216
- | tLAMBDA lambda
1256
+ | lambda
1217
1257
  {
1218
- result = val[1] # TODO: fix lineno
1258
+ expr, = val
1259
+ result = expr
1219
1260
  }
1220
1261
  | k_if expr_value then compstmt if_tail k_end
1221
1262
  {
@@ -1258,7 +1299,6 @@ rule
1258
1299
  }
1259
1300
  cpath superclass
1260
1301
  {
1261
- self.comments.push self.lexer.comments
1262
1302
  if (self.in_def || self.in_single > 0) then
1263
1303
  yyerror "class definition in method body"
1264
1304
  end
@@ -1268,7 +1308,7 @@ rule
1268
1308
  {
1269
1309
  result = new_class val
1270
1310
  self.env.unextend
1271
- self.lexer.comments # we don't care about comments in the body
1311
+ self.lexer.ignore_body_comments
1272
1312
  }
1273
1313
  | k_class tLSHFT
1274
1314
  {
@@ -1289,7 +1329,7 @@ rule
1289
1329
  {
1290
1330
  result = new_sclass val
1291
1331
  self.env.unextend
1292
- self.lexer.comments # we don't care about comments in the body
1332
+ self.lexer.ignore_body_comments
1293
1333
  }
1294
1334
  | k_module
1295
1335
  {
@@ -1297,7 +1337,6 @@ rule
1297
1337
  }
1298
1338
  cpath
1299
1339
  {
1300
- self.comments.push self.lexer.comments
1301
1340
  yyerror "module definition in method body" if
1302
1341
  self.in_def or self.in_single > 0
1303
1342
 
@@ -1307,53 +1346,67 @@ rule
1307
1346
  {
1308
1347
  result = new_module val
1309
1348
  self.env.unextend
1310
- self.lexer.comments # we don't care about comments in the body
1349
+ self.lexer.ignore_body_comments
1311
1350
  }
1312
1351
  | k_def fname
1313
1352
  {
1314
- result = [self.in_def, self.lexer.cmdarg.stack.dup]
1353
+ result = self.in_def
1315
1354
 
1316
- self.comments.push self.lexer.comments
1317
- self.in_def = true
1355
+ self.in_def = true # group = local_push
1318
1356
  self.env.extend
1319
- # TODO: local->cmdargs = cmdarg_stack;
1320
- # TODO: port local_push_gen and local_pop_gen
1321
- lexer.cmdarg.stack.replace [false]
1357
+ lexer.cmdarg.push false
1358
+ lexer.cond.push false
1322
1359
  }
1323
- f_arglist bodystmt { result = lexer.lineno } k_end
1360
+ f_arglist bodystmt k_end
1324
1361
  {
1325
- in_def, cmdarg = val[2]
1362
+ result, in_def = new_defn val
1326
1363
 
1327
- result = new_defn val
1328
-
1329
- lexer.cmdarg.stack.replace cmdarg
1364
+ lexer.cond.pop # group = local_pop
1365
+ lexer.cmdarg.pop
1330
1366
  self.env.unextend
1331
1367
  self.in_def = in_def
1332
- self.lexer.comments # we don't care about comments in the body
1368
+
1369
+ self.lexer.ignore_body_comments
1333
1370
  }
1334
1371
  | k_def singleton dot_or_colon
1335
1372
  {
1336
- self.comments.push self.lexer.comments
1337
1373
  lexer.lex_state = EXPR_FNAME
1338
1374
  }
1339
1375
  fname
1340
1376
  {
1341
- self.in_single += 1
1377
+ result = self.in_def
1378
+
1379
+ self.in_single += 1 # TODO: remove?
1380
+
1381
+ self.in_def = true # local_push
1342
1382
  self.env.extend
1343
- lexer.lex_state = EXPR_ENDFN # force for args
1344
- result = [lexer.lineno, self.lexer.cmdarg.stack.dup]
1345
- lexer.cmdarg.stack.replace [false]
1383
+ lexer.cmdarg.push false
1384
+ lexer.cond.push false
1385
+
1386
+ lexer.lex_state = EXPR_ENDFN|EXPR_LABEL
1346
1387
  }
1347
1388
  f_arglist bodystmt k_end
1348
1389
  {
1349
- _, cmdarg = val[5]
1350
- result = new_defs val
1351
1390
 
1352
- lexer.cmdarg.stack.replace cmdarg
1391
+ # [kdef, recv, _, _, (name, line), in_def, args, body, kend]
1392
+ # =>
1393
+ # [kdef, recv, (name, line), in_def, args, body, kend]
1394
+
1395
+ val.delete_at 3
1396
+ val.delete_at 2
1353
1397
 
1398
+ result, in_def = new_defs val
1399
+
1400
+ lexer.cond.pop # group = local_pop
1401
+ lexer.cmdarg.pop
1354
1402
  self.env.unextend
1403
+ self.in_def = in_def
1404
+
1355
1405
  self.in_single -= 1
1356
- self.lexer.comments # we don't care about comments in the body
1406
+
1407
+ # TODO: restore cur_arg ? what's cur_arg?
1408
+
1409
+ self.lexer.ignore_body_comments
1357
1410
  }
1358
1411
  | kBREAK
1359
1412
  {
@@ -1390,8 +1443,17 @@ rule
1390
1443
  k_case: kCASE
1391
1444
  k_for: kFOR
1392
1445
  k_class: kCLASS
1446
+ {
1447
+ self.comments.push self.lexer.comments
1448
+ }
1393
1449
  k_module: kMODULE
1450
+ {
1451
+ self.comments.push self.lexer.comments
1452
+ }
1394
1453
  k_def: kDEF
1454
+ {
1455
+ self.comments.push self.lexer.comments
1456
+ }
1395
1457
  k_do: kDO
1396
1458
  k_do_block: kDO_BLOCK
1397
1459
  k_rescue: kRESCUE
@@ -1452,51 +1514,42 @@ rule
1452
1514
 
1453
1515
  result = block_var args
1454
1516
  }
1455
- | f_marg_list tCOMMA tSTAR f_norm_arg
1517
+ | f_marg_list tCOMMA f_rest_marg
1456
1518
  {
1457
- args, _, _, splat = val
1519
+ args, _, rest = val
1458
1520
 
1459
- result = block_var args, "*#{splat}".to_sym
1521
+ result = block_var args, rest
1460
1522
  }
1461
- | f_marg_list tCOMMA tSTAR f_norm_arg tCOMMA f_marg_list
1523
+ | f_marg_list tCOMMA f_rest_marg tCOMMA f_marg_list
1462
1524
  {
1463
- args, _, _, splat, _, args2 = val
1525
+ lhs, _, splat, _, rhs = val
1464
1526
 
1465
- result = block_var args, "*#{splat}".to_sym, args2
1527
+ result = block_var lhs, splat, rhs
1466
1528
  }
1467
- | f_marg_list tCOMMA tSTAR
1529
+ | f_rest_marg
1468
1530
  {
1469
- args, _, _ = val
1531
+ rest, = val
1470
1532
 
1471
- result = block_var args, :*
1533
+ result = block_var rest
1472
1534
  }
1473
- | f_marg_list tCOMMA tSTAR tCOMMA f_marg_list
1535
+ | f_rest_marg tCOMMA f_marg_list
1474
1536
  {
1475
- args, _, _, _, args2 = val
1537
+ splat, _, rest = val
1476
1538
 
1477
- result = block_var args, :*, args2
1539
+ result = block_var splat, rest
1478
1540
  }
1479
- | tSTAR f_norm_arg
1480
- {
1481
- _, splat = val
1482
1541
 
1483
- result = block_var :"*#{splat}"
1484
- }
1485
- | tSTAR f_norm_arg tCOMMA f_marg_list
1542
+ f_rest_marg: tSTAR f_norm_arg
1486
1543
  {
1487
- _, splat, _, args = val
1544
+ _, (id, line) = val
1488
1545
 
1489
- result = block_var :"*#{splat}", args
1546
+ result = args ["*#{id}".to_sym]
1547
+ result.line line
1490
1548
  }
1491
1549
  | tSTAR
1492
1550
  {
1493
- result = block_var :*
1494
- }
1495
- | tSTAR tCOMMA f_marg_list
1496
- {
1497
- _, _, args = val
1498
-
1499
- result = block_var :*, args
1551
+ result = args [:*]
1552
+ result.line lexer.lineno # FIX: tSTAR -> line
1500
1553
  }
1501
1554
 
1502
1555
  block_args_tail: f_block_kwarg tCOMMA f_kwrest opt_f_block_arg
@@ -1513,8 +1566,8 @@ rule
1513
1566
  }
1514
1567
  | f_block_arg
1515
1568
  {
1516
- line = lexer.lineno
1517
- result = call_args val # TODO: push line down
1569
+ (id, line), = val
1570
+ result = call_args [id]
1518
1571
  result.line line
1519
1572
  }
1520
1573
 
@@ -1623,13 +1676,13 @@ opt_block_args_tail: tCOMMA block_args_tail
1623
1676
 
1624
1677
  bvar: tIDENTIFIER
1625
1678
  {
1626
- id, = val
1627
- line = lexer.lineno
1679
+ (id, line), = val
1628
1680
  result = s(:shadow, id.to_sym).line line
1629
1681
  }
1630
1682
  | f_bad_arg
1631
1683
 
1632
- lambda: {
1684
+ lambda: tLAMBDA
1685
+ {
1633
1686
  self.env.extend :dynamic
1634
1687
  result = [lexer.lineno, lexer.lpar_beg]
1635
1688
  lexer.paren_nest += 1
@@ -1637,20 +1690,19 @@ opt_block_args_tail: tCOMMA block_args_tail
1637
1690
  }
1638
1691
  f_larglist
1639
1692
  {
1640
- result = lexer.cmdarg.store(false)
1693
+ lexer.cmdarg.push false
1641
1694
  }
1642
1695
  lambda_body
1643
1696
  {
1644
- (line, lpar), args, cmdarg, body = val
1697
+ _, (line, lpar), args, _cmdarg, body = val
1645
1698
  lexer.lpar_beg = lpar
1646
1699
 
1647
- lexer.cmdarg.restore cmdarg
1648
- lexer.cmdarg.lexpop
1700
+ lexer.cmdarg.pop
1649
1701
 
1650
1702
  call = s(:lambda).line line
1651
1703
  result = new_iter call, args, body
1652
- result.line = line
1653
- self.env.unextend
1704
+ result.line line
1705
+ self.env.unextend # TODO: dynapush & dynapop
1654
1706
  }
1655
1707
 
1656
1708
  f_larglist: tLPAREN2 f_args opt_bv_decl rparen
@@ -1684,23 +1736,28 @@ opt_block_args_tail: tCOMMA block_args_tail
1684
1736
  ## if (nd_type($1) == NODE_YIELD) {
1685
1737
  ## compile_error(PARSER_ARG "block given to yield");
1686
1738
 
1687
- syntax_error "Both block arg and actual block given." if
1688
- val[0].block_pass?
1739
+ cmd, blk = val
1689
1740
 
1690
- val = invert_block_call val if inverted? val
1741
+ syntax_error "Both block arg and actual block given." if
1742
+ cmd.block_pass?
1691
1743
 
1692
- cmd, blk = val
1744
+ if inverted? val then
1745
+ val = invert_block_call val
1746
+ cmd, blk = val
1747
+ end
1693
1748
 
1694
1749
  result = blk
1695
1750
  result.insert 1, cmd
1696
1751
  }
1697
1752
  | block_call call_op2 operation2 opt_paren_args
1698
1753
  {
1699
- result = new_call val[0], val[2].to_sym, val[3]
1754
+ lhs, _, (id, _line), args = val
1755
+
1756
+ result = new_call lhs, id.to_sym, args
1700
1757
  }
1701
1758
  | block_call call_op2 operation2 opt_paren_args brace_block
1702
1759
  {
1703
- iter1, _, name, args, iter2 = val
1760
+ iter1, _, (name, _line), args, iter2 = val
1704
1761
 
1705
1762
  call = new_call iter1, name.to_sym, args
1706
1763
  iter2.insert 1, call
@@ -1709,7 +1766,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1709
1766
  }
1710
1767
  | block_call call_op2 operation2 command_args do_block
1711
1768
  {
1712
- iter1, _, name, args, iter2 = val
1769
+ iter1, _, (name, _line), args, iter2 = val
1713
1770
 
1714
1771
  call = new_call iter1, name.to_sym, args
1715
1772
  iter2.insert 1, call
@@ -1717,28 +1774,29 @@ opt_block_args_tail: tCOMMA block_args_tail
1717
1774
  result = iter2
1718
1775
  }
1719
1776
 
1720
- method_call: fcall
1721
- {
1722
- result = self.lexer.lineno
1723
- }
1724
- paren_args
1777
+ method_call: fcall paren_args
1725
1778
  {
1726
- call, lineno, args = val
1779
+ call, args = val
1727
1780
 
1728
1781
  result = call.concat args.sexp_body if args
1729
- result.line lineno
1730
1782
  }
1731
1783
  | primary_value call_op operation2 opt_paren_args
1732
1784
  {
1733
- result = new_call val[0], val[2].to_sym, val[3], val[1]
1785
+ recv, call_op, (op, _line), args = val
1786
+
1787
+ result = new_call recv, op.to_sym, args, call_op
1734
1788
  }
1735
1789
  | primary_value tCOLON2 operation2 paren_args
1736
1790
  {
1737
- result = new_call val[0], val[2].to_sym, val[3]
1791
+ recv, _, (op, _line), args = val
1792
+
1793
+ result = new_call recv, op.to_sym, args
1738
1794
  }
1739
1795
  | primary_value tCOLON2 operation3
1740
1796
  {
1741
- result = new_call val[0], val[2].to_sym
1797
+ lhs, _, (id, _line) = val
1798
+
1799
+ result = new_call lhs, id.to_sym
1742
1800
  }
1743
1801
  | primary_value call_op paren_args
1744
1802
  {
@@ -1771,7 +1829,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1771
1829
  _, line, body, _ = val
1772
1830
 
1773
1831
  result = body
1774
- result.line = line
1832
+ result.line line
1775
1833
 
1776
1834
  self.env.unextend
1777
1835
  }
@@ -1785,7 +1843,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1785
1843
  _, line, body, _ = val
1786
1844
 
1787
1845
  result = body
1788
- result.line = line
1846
+ result.line line
1789
1847
 
1790
1848
  self.env.unextend
1791
1849
  }
@@ -1803,25 +1861,50 @@ opt_block_args_tail: tCOMMA block_args_tail
1803
1861
  }
1804
1862
 
1805
1863
  do_body: { self.env.extend :dynamic; result = self.lexer.lineno }
1806
- { result = lexer.cmdarg.store(false) }
1864
+ { lexer.cmdarg.push false }
1807
1865
  opt_block_param
1808
1866
  compstmt
1809
1867
  {
1810
- line, cmdarg, param, cmpstmt = val
1868
+ line, _cmdarg, param, cmpstmt = val
1811
1869
 
1812
1870
  result = new_do_body param, cmpstmt, line
1871
+ lexer.cmdarg.pop
1813
1872
  self.env.unextend
1814
- lexer.cmdarg.restore cmdarg
1873
+ }
1874
+
1875
+ case_args: arg_value
1876
+ {
1877
+ arg, = val
1878
+
1879
+ result = s(:array, arg).line arg.line
1880
+ }
1881
+ | tSTAR arg_value
1882
+ {
1883
+ _, arg = val
1884
+
1885
+ result = s(:array, s(:splat, arg).line(arg.line)).line arg.line
1886
+ }
1887
+ | case_args tCOMMA arg_value
1888
+ {
1889
+ args, _, id = val
1890
+
1891
+ result = self.list_append args, id
1892
+ }
1893
+ | case_args tCOMMA tSTAR arg_value
1894
+ {
1895
+ args, _, _, id = val
1896
+
1897
+ result = self.list_append args, s(:splat, id).line(id.line)
1815
1898
  }
1816
1899
 
1817
1900
  case_body: k_when
1818
1901
  {
1819
1902
  result = self.lexer.lineno
1820
1903
  }
1821
- args then compstmt cases
1904
+ case_args then compstmt cases
1822
1905
  {
1823
1906
  result = new_when(val[2], val[4])
1824
- result.line = val[1]
1907
+ result.line val[1]
1825
1908
  result << val[5] if val[5]
1826
1909
  }
1827
1910
 
@@ -1867,17 +1950,10 @@ opt_block_args_tail: tCOMMA block_args_tail
1867
1950
 
1868
1951
  literal: numeric
1869
1952
  {
1870
- line = lexer.lineno
1871
- result = s(:lit, val[0])
1872
- result.line = line
1953
+ (lit, line), = val
1954
+ result = s(:lit, lit).line line
1873
1955
  }
1874
1956
  | symbol
1875
- {
1876
- line = lexer.lineno
1877
- result = s(:lit, val[0])
1878
- result.line = line
1879
- }
1880
- | dsym
1881
1957
 
1882
1958
  strings: string
1883
1959
  {
@@ -1888,7 +1964,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1888
1964
 
1889
1965
  string: tCHAR
1890
1966
  {
1891
- debug20 23, val, result
1967
+ debug 37
1892
1968
  }
1893
1969
  | string1
1894
1970
  | string string1
@@ -1898,11 +1974,11 @@ opt_block_args_tail: tCOMMA block_args_tail
1898
1974
 
1899
1975
  string1: tSTRING_BEG string_contents tSTRING_END
1900
1976
  {
1901
- _, str, (_, func) = val
1977
+ (_, line), str, (_, func) = val
1902
1978
 
1903
- str = dedent str if func =~ RubyLexer::STR_FUNC_ICNTNT
1979
+ str = dedent str if func =~ RubyLexer::STR_FUNC_DEDENT
1904
1980
 
1905
- result = str
1981
+ result = str.line line
1906
1982
  }
1907
1983
  | tSTRING
1908
1984
  {
@@ -1911,7 +1987,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1911
1987
 
1912
1988
  xstring: tXSTRING_BEG xstring_contents tSTRING_END
1913
1989
  {
1914
- result = new_xstring val[1]
1990
+ result = new_xstring val
1915
1991
  # TODO: dedent?!?! SERIOUSLY?!?
1916
1992
  }
1917
1993
 
@@ -1922,11 +1998,15 @@ opt_block_args_tail: tCOMMA block_args_tail
1922
1998
 
1923
1999
  words: tWORDS_BEG tSPACE tSTRING_END
1924
2000
  {
1925
- result = s(:array).line lexer.lineno
2001
+ (_, line), _, _ = val
2002
+
2003
+ result = s(:array).line line
1926
2004
  }
1927
2005
  | tWORDS_BEG word_list tSTRING_END
1928
2006
  {
1929
- result = val[1]
2007
+ (_, line), list, _ = val
2008
+
2009
+ result = list.line line
1930
2010
  }
1931
2011
 
1932
2012
  word_list: none
@@ -1946,18 +2026,20 @@ opt_block_args_tail: tCOMMA block_args_tail
1946
2026
 
1947
2027
  symbols: tSYMBOLS_BEG tSPACE tSTRING_END
1948
2028
  {
1949
- result = s(:array).line lexer.lineno
2029
+ (_, line), _, _ = val
2030
+
2031
+ result = s(:array).line line
1950
2032
  }
1951
- | tSYMBOLS_BEG { result = lexer.lineno } symbol_list tSTRING_END
2033
+ | tSYMBOLS_BEG symbol_list tSTRING_END
1952
2034
  {
1953
- _, line, list, _, = val
1954
- list.line = line
2035
+ (_, line), list, _, = val
2036
+ list.line line
1955
2037
  result = list
1956
2038
  }
1957
2039
 
1958
2040
  symbol_list: none
1959
2041
  {
1960
- result = new_symbol_list.line lexer.lineno
2042
+ result = new_symbol_list
1961
2043
  }
1962
2044
  | symbol_list word tSPACE
1963
2045
  {
@@ -1967,20 +2049,28 @@ opt_block_args_tail: tCOMMA block_args_tail
1967
2049
 
1968
2050
  qwords: tQWORDS_BEG tSPACE tSTRING_END
1969
2051
  {
1970
- result = s(:array).line lexer.lineno
2052
+ (_, line), _, _ = val
2053
+
2054
+ result = s(:array).line line
1971
2055
  }
1972
2056
  | tQWORDS_BEG qword_list tSTRING_END
1973
2057
  {
1974
- result = val[1]
2058
+ (_, line), list, _ = val
2059
+
2060
+ result = list.line line
1975
2061
  }
1976
2062
 
1977
2063
  qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
1978
2064
  {
1979
- result = s(:array).line lexer.lineno # FIX
2065
+ (_, line), _, _ = val
2066
+
2067
+ result = s(:array).line line
1980
2068
  }
1981
2069
  | tQSYMBOLS_BEG qsym_list tSTRING_END
1982
2070
  {
1983
- result = val[1]
2071
+ (_, line), list, _ = val
2072
+
2073
+ result = list.line line
1984
2074
  }
1985
2075
 
1986
2076
  qword_list: none
@@ -2003,7 +2093,8 @@ opt_block_args_tail: tCOMMA block_args_tail
2003
2093
 
2004
2094
  string_contents: none
2005
2095
  {
2006
- result = s(:str, "").line lexer.lineno
2096
+ line = prev_value_to_lineno _values.last
2097
+ result = s(:str, +"").line line
2007
2098
  }
2008
2099
  | string_contents string_content
2009
2100
  {
@@ -2053,12 +2144,13 @@ regexp_contents: none
2053
2144
  result = [lexer.lex_strterm,
2054
2145
  lexer.brace_nest,
2055
2146
  lexer.string_nest, # TODO: remove
2056
- lexer.cond.store,
2057
- lexer.cmdarg.store,
2058
2147
  lexer.lex_state,
2059
2148
  lexer.lineno,
2060
2149
  ]
2061
2150
 
2151
+ lexer.cmdarg.push false
2152
+ lexer.cond.push false
2153
+
2062
2154
  lexer.lex_strterm = nil
2063
2155
  lexer.brace_nest = 0
2064
2156
  lexer.string_nest = 0
@@ -2070,14 +2162,15 @@ regexp_contents: none
2070
2162
  {
2071
2163
  _, memo, stmt, _ = val
2072
2164
 
2073
- lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state, line = memo
2165
+ lex_strterm, brace_nest, string_nest, oldlex_state, line = memo
2166
+ # TODO: heredoc_indent
2074
2167
 
2075
2168
  lexer.lex_strterm = lex_strterm
2076
2169
  lexer.brace_nest = brace_nest
2077
2170
  lexer.string_nest = string_nest
2078
2171
 
2079
- lexer.cond.restore oldcond
2080
- lexer.cmdarg.restore oldcmdarg
2172
+ lexer.cond.pop
2173
+ lexer.cmdarg.pop
2081
2174
 
2082
2175
  lexer.lex_state = oldlex_state
2083
2176
 
@@ -2092,29 +2185,49 @@ regexp_contents: none
2092
2185
  when nil then
2093
2186
  result = s(:evstr).line line
2094
2187
  else
2095
- debug20 25
2188
+ debug 38
2096
2189
  raise "unknown string body: #{stmt.inspect}"
2097
2190
  end
2098
2191
  }
2099
2192
 
2100
- string_dvar: tGVAR { result = s(:gvar, val[0].to_sym).line lexer.lineno }
2101
- | tIVAR { result = s(:ivar, val[0].to_sym).line lexer.lineno }
2102
- | tCVAR { result = s(:cvar, val[0].to_sym).line lexer.lineno }
2193
+ string_dvar: tGVAR
2194
+ {
2195
+ (id, line), = val
2196
+ result = s(:gvar, id.to_sym).line line
2197
+ }
2198
+ | tIVAR
2199
+ {
2200
+ (id, line), = val
2201
+ result = s(:ivar, id.to_sym).line line
2202
+ }
2203
+ | tCVAR
2204
+ {
2205
+ (id, line), = val
2206
+ result = s(:cvar, id.to_sym).line line
2207
+ }
2103
2208
  | backref
2104
2209
 
2105
- symbol: tSYMBEG sym
2210
+ symbol: ssym
2211
+ | dsym
2212
+
2213
+ ssym: tSYMBEG sym
2106
2214
  {
2215
+ _, (id, line) = val
2216
+
2107
2217
  lexer.lex_state = EXPR_END
2108
- result = val[1].to_sym
2218
+ result = s(:lit, id.to_sym).line line
2109
2219
  }
2110
2220
  | tSYMBOL
2111
2221
  {
2112
- result = val[0].to_sym
2222
+ (id, line), = val
2223
+
2224
+ lexer.lex_state = EXPR_END
2225
+ result = s(:lit, id.to_sym).line line
2113
2226
  }
2114
2227
 
2115
2228
  sym: fname | tIVAR | tGVAR | tCVAR
2116
2229
 
2117
- dsym: tSYMBEG xstring_contents tSTRING_END
2230
+ dsym: tSYMBEG string_contents tSTRING_END
2118
2231
  {
2119
2232
  _, result, _ = val
2120
2233
 
@@ -2130,14 +2243,15 @@ regexp_contents: none
2130
2243
  when :evstr then
2131
2244
  result = s(:dsym, "", result).line result.line
2132
2245
  else
2133
- debug20 26, val, result
2246
+ debug 39
2134
2247
  end
2135
2248
  }
2136
2249
 
2137
2250
  numeric: simple_numeric
2138
- | tUMINUS_NUM simple_numeric
2251
+ | tUMINUS_NUM simple_numeric =tLOWEST
2139
2252
  {
2140
- result = -val[1] # TODO: pt_testcase
2253
+ _, (num, line) = val
2254
+ result = [-num, line]
2141
2255
  }
2142
2256
 
2143
2257
  simple_numeric: tINTEGER
@@ -2170,8 +2284,10 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2170
2284
 
2171
2285
  var_ref: user_variable
2172
2286
  {
2173
- var = val[0]
2287
+ raise "NO: #{val.inspect}" if Sexp === val.first
2288
+ (var, line), = val
2174
2289
  result = Sexp === var ? var : self.gettable(var)
2290
+ result.line line
2175
2291
  }
2176
2292
  | keyword_variable
2177
2293
  {
@@ -2186,11 +2302,19 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2186
2302
  | keyword_variable
2187
2303
  {
2188
2304
  result = self.assignable val[0]
2189
- debug20 29, val, result
2305
+ debug 40
2190
2306
  }
2191
2307
 
2192
- backref: tNTH_REF { result = s(:nth_ref, val[0]).line lexer.lineno }
2193
- | tBACK_REF { result = s(:back_ref, val[0]).line lexer.lineno }
2308
+ backref: tNTH_REF
2309
+ {
2310
+ (ref, line), = val
2311
+ result = s(:nth_ref, ref).line line
2312
+ }
2313
+ | tBACK_REF
2314
+ {
2315
+ (ref, line), = val
2316
+ result = s(:back_ref, ref).line line
2317
+ }
2194
2318
 
2195
2319
  superclass: tLT
2196
2320
  {
@@ -2208,9 +2332,7 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2208
2332
 
2209
2333
  f_arglist: tLPAREN2 f_args rparen
2210
2334
  {
2211
- result = val[1]
2212
- self.lexer.lex_state = EXPR_BEG
2213
- self.lexer.command_start = true
2335
+ result = end_args val
2214
2336
  }
2215
2337
  | {
2216
2338
  result = self.in_kwarg
@@ -2219,12 +2341,7 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2219
2341
  }
2220
2342
  f_args term
2221
2343
  {
2222
- kwarg, args, _ = val
2223
-
2224
- self.in_kwarg = kwarg
2225
- result = args
2226
- lexer.lex_state = EXPR_BEG
2227
- lexer.command_start = true
2344
+ result = end_args val
2228
2345
  }
2229
2346
 
2230
2347
  args_tail: f_kwarg tCOMMA f_kwrest opt_f_block_arg
@@ -2309,8 +2426,10 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2309
2426
  |
2310
2427
  {
2311
2428
  result = args val
2429
+ # result.line lexer.lineno
2312
2430
  }
2313
2431
 
2432
+
2314
2433
  f_bad_arg: tCONSTANT
2315
2434
  {
2316
2435
  yyerror "formal argument cannot be a constant"
@@ -2331,31 +2450,24 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2331
2450
  f_norm_arg: f_bad_arg
2332
2451
  | tIDENTIFIER
2333
2452
  {
2334
- identifier = val[0].to_sym
2453
+ (id, line), = val
2454
+ identifier = id.to_sym
2335
2455
  self.env[identifier] = :lvar
2336
2456
 
2337
- result = identifier
2457
+ result = [identifier, line]
2338
2458
  }
2339
2459
 
2340
2460
  f_arg_item: f_norm_arg
2341
2461
  | tLPAREN f_margs rparen
2342
2462
  {
2343
- result = val[1]
2463
+ _, margs, _ = val
2464
+
2465
+ result = margs
2344
2466
  }
2345
2467
 
2346
2468
  f_arg: f_arg_item
2347
2469
  {
2348
- arg, = val
2349
-
2350
- case arg
2351
- when Symbol then
2352
- result = s(:args, arg).line lexer.lineno
2353
- when Sexp then
2354
- result = arg
2355
- else
2356
- debug20 32
2357
- raise "Unknown f_arg type: #{val.inspect}"
2358
- end
2470
+ result = new_arg val
2359
2471
  }
2360
2472
  | f_arg tCOMMA f_arg_item
2361
2473
  {
@@ -2367,7 +2479,7 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2367
2479
  result = s(:args, list).line list.line
2368
2480
  end
2369
2481
 
2370
- result << item
2482
+ result << (Sexp === item ? item : item.first)
2371
2483
  }
2372
2484
 
2373
2485
  f_label: tLABEL
@@ -2428,26 +2540,33 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2428
2540
  kwrest_mark: tPOW
2429
2541
  | tDSTAR
2430
2542
 
2543
+
2431
2544
  f_kwrest: kwrest_mark tIDENTIFIER
2432
2545
  {
2433
- name = val[1].to_sym
2434
- self.assignable name
2435
- result = :"**#{name}"
2546
+ _, (id, line) = val
2547
+
2548
+ name = id.to_sym
2549
+ self.assignable [name, line]
2550
+ result = [:"**#{name}", line]
2436
2551
  }
2437
2552
  | kwrest_mark
2438
2553
  {
2439
- result = :"**"
2554
+ id = :"**"
2555
+ self.env[id] = :lvar # TODO: needed?!?
2556
+ result = [id, lexer.lineno] # TODO: tPOW/tDSTAR include lineno
2440
2557
  }
2441
2558
 
2442
2559
  f_opt: f_norm_arg tEQL arg_value
2443
2560
  {
2444
- result = self.assignable val[0], val[2]
2561
+ lhs, _, rhs = val
2562
+ result = self.assignable lhs, rhs
2445
2563
  # TODO: detect duplicate names
2446
2564
  }
2447
2565
 
2448
2566
  f_block_opt: f_norm_arg tEQL primary_value
2449
2567
  {
2450
- result = self.assignable val[0], val[2]
2568
+ lhs, _, rhs = val
2569
+ result = self.assignable lhs, rhs
2451
2570
  }
2452
2571
 
2453
2572
  f_block_optarg: f_block_opt
@@ -2477,30 +2596,33 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2477
2596
  f_rest_arg: restarg_mark tIDENTIFIER
2478
2597
  {
2479
2598
  # TODO: differs from parse.y - needs tests
2480
- name = val[1].to_sym
2481
- self.assignable name
2482
- result = :"*#{name}"
2599
+ _, (id, line) = val
2600
+ name = id.to_sym
2601
+ self.assignable [name, line]
2602
+ result = [:"*#{name}", line]
2483
2603
  }
2484
2604
  | restarg_mark
2485
2605
  {
2486
2606
  name = :"*"
2487
2607
  self.env[name] = :lvar
2488
- result = name
2608
+ result = [name, lexer.lineno] # FIX: tSTAR to include lineno
2489
2609
  }
2490
2610
 
2491
2611
  blkarg_mark: tAMPER2 | tAMPER
2492
2612
 
2493
2613
  f_block_arg: blkarg_mark tIDENTIFIER
2494
2614
  {
2495
- identifier = val[1].to_sym
2615
+ _, (id, line) = val
2616
+ identifier = id.to_sym
2496
2617
 
2497
2618
  self.env[identifier] = :lvar
2498
- result = "&#{identifier}".to_sym
2619
+ result = ["&#{identifier}".to_sym, line]
2499
2620
  }
2500
2621
 
2501
2622
  opt_f_block_arg: tCOMMA f_block_arg
2502
2623
  {
2503
- result = val[1]
2624
+ _, arg = val
2625
+ result = arg
2504
2626
  }
2505
2627
  |
2506
2628
  {