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