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