brakeman 4.6.1 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of brakeman might be problematic. Click here for more details.

Files changed (251) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +11 -0
  3. data/bundle/load.rb +7 -7
  4. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/CHANGELOG.md +122 -4
  5. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/FAQ.md +4 -14
  6. data/bundle/ruby/2.6.0/gems/haml-5.1.2/Gemfile +19 -0
  7. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/MIT-LICENSE +2 -2
  8. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/README.md +80 -42
  9. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/REFERENCE.md +121 -64
  10. data/bundle/ruby/2.6.0/gems/haml-5.1.2/TODO +24 -0
  11. data/bundle/ruby/2.6.0/gems/haml-5.1.2/haml.gemspec +44 -0
  12. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml.rb +2 -0
  13. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/attribute_builder.rb +164 -0
  14. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/attribute_compiler.rb +224 -0
  15. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/attribute_parser.rb +150 -0
  16. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/buffer.rb +25 -132
  17. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/compiler.rb +330 -0
  18. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/engine.rb +34 -41
  19. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/error.rb +65 -0
  20. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/escapable.rb +50 -0
  21. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/exec.rb +38 -20
  22. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/filters.rb +22 -27
  23. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/generator.rb +42 -0
  24. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers.rb +129 -90
  25. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers/action_view_extensions.rb +4 -2
  26. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers/action_view_mods.rb +45 -60
  27. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers/action_view_xss_mods.rb +2 -0
  28. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/helpers/safe_erubi_template.rb +20 -0
  29. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers/safe_erubis_template.rb +5 -1
  30. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers/xss_mods.rb +19 -12
  31. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/options.rb +63 -69
  32. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/parser.rb +292 -228
  33. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/plugin.rb +37 -0
  34. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/railtie.rb +48 -0
  35. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/sass_rails_filter.rb +18 -4
  36. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/template.rb +13 -6
  37. data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/template/options.rb +13 -2
  38. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/temple_engine.rb +123 -0
  39. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/temple_line_counter.rb +30 -0
  40. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/util.rb +258 -0
  41. data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/version.rb +5 -0
  42. data/bundle/ruby/2.6.0/gems/haml-5.1.2/yard/default/fulldoc/html/css/common.sass +15 -0
  43. data/bundle/ruby/2.6.0/gems/haml-5.1.2/yard/default/layout/html/footer.erb +12 -0
  44. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/AUTHORS +0 -0
  45. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/COPYING +0 -0
  46. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/Changelog.md +3 -0
  47. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/Gemfile +0 -0
  48. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/LICENSE +0 -0
  49. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/README.md +0 -0
  50. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/TODO +0 -0
  51. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/appveyor.yml +0 -0
  52. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/highline.gemspec +0 -0
  53. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline.rb +0 -0
  54. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/builtin_styles.rb +0 -0
  55. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/color_scheme.rb +0 -0
  56. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/compatibility.rb +0 -0
  57. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/custom_errors.rb +0 -0
  58. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/import.rb +0 -0
  59. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/io_console_compatible.rb +0 -0
  60. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/list.rb +0 -0
  61. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/list_renderer.rb +0 -0
  62. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/menu.rb +0 -0
  63. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/menu/item.rb +0 -0
  64. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/paginator.rb +0 -0
  65. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/question.rb +0 -0
  66. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/question/answer_converter.rb +0 -0
  67. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/question_asker.rb +0 -0
  68. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/simulate.rb +0 -0
  69. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/statement.rb +0 -0
  70. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/string.rb +0 -0
  71. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/string_extensions.rb +0 -0
  72. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/style.rb +0 -0
  73. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/template_renderer.rb +0 -0
  74. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/terminal.rb +0 -0
  75. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/terminal/io_console.rb +0 -0
  76. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/terminal/ncurses.rb +0 -0
  77. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/terminal/unix_stty.rb +0 -0
  78. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/version.rb +1 -1
  79. data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/wrapper.rb +0 -0
  80. data/bundle/ruby/2.6.0/gems/{ruby2ruby-2.4.3 → ruby2ruby-2.4.4}/History.rdoc +6 -0
  81. data/bundle/ruby/2.6.0/gems/{ruby2ruby-2.4.3 → ruby2ruby-2.4.4}/Manifest.txt +0 -0
  82. data/bundle/ruby/2.6.0/gems/{ruby2ruby-2.4.3 → ruby2ruby-2.4.4}/README.rdoc +0 -0
  83. data/bundle/ruby/2.6.0/gems/{ruby2ruby-2.4.3 → ruby2ruby-2.4.4}/lib/ruby2ruby.rb +3 -3
  84. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/History.rdoc +38 -0
  85. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/Manifest.txt +0 -0
  86. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/README.rdoc +3 -3
  87. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/compare/normalize.rb +0 -0
  88. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/debugging.md +0 -0
  89. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/rp_extensions.rb +0 -0
  90. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/rp_stringscanner.rb +0 -0
  91. data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby20_parser.rb +7045 -0
  92. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1/lib/ruby_parser.yy → ruby_parser-3.14.0/lib/ruby20_parser.y} +390 -397
  93. data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby21_parser.rb +7116 -0
  94. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby21_parser.y +399 -254
  95. data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby22_parser.rb +7149 -0
  96. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby22_parser.y +400 -255
  97. data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby23_parser.rb +7166 -0
  98. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby23_parser.y +400 -255
  99. data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby24_parser.rb +7178 -0
  100. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby24_parser.y +404 -257
  101. data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby25_parser.rb +7178 -0
  102. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby25_parser.y +404 -257
  103. data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby26_parser.rb +7198 -0
  104. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby26_parser.y +410 -261
  105. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby_lexer.rb +424 -432
  106. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby_lexer.rex +0 -0
  107. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby_lexer.rex.rb +1 -1
  108. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby_parser.rb +27 -27
  109. data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby_parser.yy +2732 -0
  110. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby_parser_extras.rb +627 -406
  111. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/tools/munge.rb +1 -1
  112. data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/tools/ripper.rb +13 -2
  113. data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/History.rdoc +13 -0
  114. data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/Manifest.txt +1 -0
  115. data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/README.rdoc +0 -0
  116. data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/lib/composite_sexp_processor.rb +0 -0
  117. data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/lib/pt_testcase.rb +0 -0
  118. data/bundle/ruby/2.6.0/gems/sexp_processor-4.13.0/lib/sexp.rb +381 -0
  119. data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1/lib/sexp.rb → sexp_processor-4.13.0/lib/sexp_matcher.rb} +25 -385
  120. data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/lib/sexp_processor.rb +1 -1
  121. data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/lib/strict_sexp.rb +0 -0
  122. data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/lib/unique.rb +0 -0
  123. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/CHANGES +5 -0
  124. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/EXPRESSIONS.md +0 -0
  125. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/Gemfile +0 -0
  126. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/LICENSE +0 -0
  127. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/README.md +1 -1
  128. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple.rb +0 -0
  129. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/engine.rb +0 -0
  130. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/erb/engine.rb +0 -0
  131. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/erb/parser.rb +0 -0
  132. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/erb/template.rb +0 -0
  133. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/erb/trimming.rb +0 -0
  134. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/exceptions.rb +0 -0
  135. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filter.rb +0 -0
  136. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/code_merger.rb +0 -0
  137. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/control_flow.rb +0 -0
  138. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/dynamic_inliner.rb +0 -0
  139. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/encoding.rb +0 -0
  140. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/eraser.rb +0 -0
  141. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/escapable.rb +0 -0
  142. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/multi_flattener.rb +0 -0
  143. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/remove_bom.rb +0 -0
  144. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/static_analyzer.rb +0 -0
  145. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/static_merger.rb +0 -0
  146. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/string_splitter.rb +1 -1
  147. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/validator.rb +0 -0
  148. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generator.rb +0 -0
  149. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generators/array.rb +0 -0
  150. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generators/array_buffer.rb +0 -0
  151. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generators/erb.rb +0 -0
  152. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generators/rails_output_buffer.rb +0 -0
  153. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generators/string_buffer.rb +0 -0
  154. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/grammar.rb +0 -0
  155. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/attribute_merger.rb +0 -0
  156. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/attribute_remover.rb +0 -0
  157. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/attribute_sorter.rb +0 -0
  158. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/dispatcher.rb +0 -0
  159. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/fast.rb +0 -0
  160. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/filter.rb +0 -0
  161. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/pretty.rb +0 -0
  162. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/safe.rb +0 -0
  163. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/map.rb +0 -0
  164. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/mixins/dispatcher.rb +0 -0
  165. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/mixins/engine_dsl.rb +0 -0
  166. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/mixins/grammar_dsl.rb +0 -0
  167. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/mixins/options.rb +0 -0
  168. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/mixins/template.rb +0 -0
  169. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/parser.rb +0 -0
  170. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/static_analyzer.rb +1 -1
  171. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/templates.rb +0 -0
  172. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/templates/rails.rb +0 -0
  173. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/templates/tilt.rb +0 -0
  174. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/utils.rb +0 -0
  175. data/bundle/ruby/2.6.0/gems/temple-0.8.2/lib/temple/version.rb +3 -0
  176. data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/temple.gemspec +0 -0
  177. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/COPYING +0 -0
  178. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt.rb +1 -1
  179. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/asciidoc.rb +0 -0
  180. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/babel.rb +0 -0
  181. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/bluecloth.rb +0 -0
  182. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/builder.rb +0 -0
  183. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/coffee.rb +0 -0
  184. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/commonmarker.rb +0 -0
  185. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/creole.rb +0 -0
  186. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/csv.rb +0 -0
  187. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/dummy.rb +0 -0
  188. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/erb.rb +0 -0
  189. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/erubi.rb +0 -0
  190. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/erubis.rb +0 -0
  191. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/etanni.rb +0 -0
  192. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/haml.rb +0 -0
  193. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/kramdown.rb +0 -0
  194. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/less.rb +0 -0
  195. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/liquid.rb +0 -0
  196. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/livescript.rb +0 -0
  197. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/mapping.rb +0 -0
  198. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/markaby.rb +0 -0
  199. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/maruku.rb +0 -0
  200. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/nokogiri.rb +0 -0
  201. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/pandoc.rb +0 -0
  202. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/plain.rb +0 -0
  203. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/prawn.rb +0 -0
  204. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/radius.rb +0 -0
  205. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/rdiscount.rb +0 -0
  206. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/rdoc.rb +0 -0
  207. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/redcarpet.rb +0 -0
  208. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/redcloth.rb +0 -0
  209. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/rst-pandoc.rb +0 -0
  210. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/sass.rb +0 -0
  211. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/sigil.rb +0 -0
  212. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/string.rb +0 -0
  213. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/template.rb +7 -12
  214. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/typescript.rb +0 -0
  215. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/wikicloth.rb +0 -0
  216. data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/yajl.rb +0 -0
  217. data/lib/brakeman/checks/base_check.rb +23 -1
  218. data/lib/brakeman/checks/check_cookie_serialization.rb +1 -1
  219. data/lib/brakeman/checks/check_cross_site_scripting.rb +1 -1
  220. data/lib/brakeman/checks/check_execute.rb +26 -1
  221. data/lib/brakeman/differ.rb +16 -28
  222. data/lib/brakeman/parsers/haml_embedded.rb +1 -1
  223. data/lib/brakeman/parsers/template_parser.rb +3 -1
  224. data/lib/brakeman/processors/alias_processor.rb +10 -0
  225. data/lib/brakeman/processors/base_processor.rb +2 -0
  226. data/lib/brakeman/processors/haml_template_processor.rb +86 -122
  227. data/lib/brakeman/processors/lib/rails2_config_processor.rb +1 -1
  228. data/lib/brakeman/processors/template_alias_processor.rb +28 -0
  229. data/lib/brakeman/tracker/config.rb +33 -92
  230. data/lib/brakeman/version.rb +1 -1
  231. metadata +215 -206
  232. data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/compiler.rb +0 -540
  233. data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/error.rb +0 -61
  234. data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/railtie.rb +0 -22
  235. data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/template/plugin.rb +0 -41
  236. data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/util.rb +0 -377
  237. data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/version.rb +0 -3
  238. data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby20_parser.rb +0 -6869
  239. data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby20_parser.y +0 -2431
  240. data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby21_parser.rb +0 -6944
  241. data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby22_parser.rb +0 -6968
  242. data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby23_parser.rb +0 -6987
  243. data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby24_parser.rb +0 -6994
  244. data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby25_parser.rb +0 -6994
  245. data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby26_parser.rb +0 -7012
  246. data/bundle/ruby/2.6.0/gems/temple-0.8.1/lib/temple/version.rb +0 -3
  247. data/bundle/ruby/2.6.0/gems/tilt-2.0.9/CHANGELOG.md +0 -132
  248. data/bundle/ruby/2.6.0/gems/tilt-2.0.9/Gemfile +0 -70
  249. data/bundle/ruby/2.6.0/gems/tilt-2.0.9/HACKING +0 -16
  250. data/bundle/ruby/2.6.0/gems/tilt-2.0.9/README.md +0 -233
  251. data/bundle/ruby/2.6.0/gems/tilt-2.0.9/tilt.gemspec +0 -130
@@ -22,30 +22,30 @@ token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
22
22
  tRATIONAL tIMAGINARY
23
23
  tLABEL_END
24
24
 
25
- prechigh
26
- right tBANG tTILDE tUPLUS
27
- right tPOW
28
- right tUMINUS_NUM tUMINUS
29
- left tSTAR2 tDIVIDE tPERCENT
30
- left tPLUS tMINUS
31
- left tLSHFT tRSHFT
32
- left tAMPER2
33
- left tPIPE tCARET
34
- left tGT tGEQ tLT tLEQ
35
- nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
36
- left tANDOP
37
- left tOROP
38
- nonassoc tDOT2 tDOT3
39
- right tEH tCOLON
40
- left kRESCUE_MOD
41
- right tEQL tOP_ASGN
42
- nonassoc kDEFINED
43
- right kNOT
44
- left kOR kAND
45
- nonassoc kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
46
- nonassoc tLBRACE_ARG
47
- nonassoc tLOWEST
48
25
  preclow
26
+ nonassoc tLOWEST
27
+ nonassoc tLBRACE_ARG
28
+ nonassoc kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
29
+ left kOR kAND
30
+ right kNOT
31
+ nonassoc kDEFINED
32
+ right tEQL tOP_ASGN
33
+ left kRESCUE_MOD
34
+ right tEH tCOLON
35
+ nonassoc tDOT2 tDOT3
36
+ left tOROP
37
+ left tANDOP
38
+ nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
39
+ left tGT tGEQ tLT tLEQ
40
+ left tPIPE tCARET
41
+ left tAMPER2
42
+ left tLSHFT tRSHFT
43
+ left tPLUS tMINUS
44
+ left tSTAR2 tDIVIDE tPERCENT # TODO: tSTAR2 -> tMULT
45
+ right tUMINUS_NUM tUMINUS
46
+ right tPOW
47
+ right tBANG tTILDE tUPLUS
48
+ prechigh
49
49
 
50
50
  rule
51
51
 
@@ -59,7 +59,8 @@ rule
59
59
 
60
60
  top_compstmt: top_stmts opt_terms
61
61
  {
62
- result = val[0]
62
+ stmt, _ = val
63
+ result = stmt
63
64
  }
64
65
 
65
66
  top_stmts: none
@@ -71,14 +72,6 @@ rule
71
72
  | error top_stmt
72
73
 
73
74
  top_stmt: stmt
74
- {
75
- result = val[0]
76
-
77
- # TODO: remove once I have more confidence this is fixed
78
- # result.each_of_type :call_args do |s|
79
- # debug20 666, s, result
80
- # end
81
- }
82
75
  | klBEGIN
83
76
  {
84
77
  if (self.in_def || self.in_single > 0) then
@@ -89,14 +82,19 @@ rule
89
82
  }
90
83
  begin_block
91
84
  {
92
- _, _, block = val
93
- result = block
85
+ (_, lineno), _, iter = val
86
+ iter.line lineno
87
+
88
+ (_, preexe,) = iter
89
+ preexe.line lineno
90
+
91
+ result = iter
94
92
  }
95
93
 
96
- begin_block: tLCURLY top_compstmt tRCURLY
94
+ begin_block: tLCURLY { result = lexer.lineno } top_compstmt tRCURLY
97
95
  {
98
- _, stmt, _ = val
99
- result = new_iter s(:preexe), 0, stmt
96
+ _, line, stmt, _ = val
97
+ result = new_iter s(:preexe).line(line), 0, stmt
100
98
  }
101
99
 
102
100
  bodystmt: compstmt opt_rescue k_else
@@ -138,34 +136,27 @@ rule
138
136
  stmt_or_begin: stmt
139
137
  | klBEGIN
140
138
  {
141
- if (self.in_def || self.in_single > 0) then
142
- debug20 1
143
- yyerror "BEGIN in method"
144
- end
145
- self.env.extend
146
- }
147
- begin_block
148
- {
149
- _, _, stmt = val
150
- result = stmt
139
+ yyerror "BEGIN is permitted only at toplevel"
151
140
  }
152
141
 
153
142
  stmt: kALIAS fitem
154
143
  {
155
144
  lexer.lex_state = EXPR_FNAME
156
- result = self.lexer.lineno
157
145
  }
158
146
  fitem
159
147
  {
160
- result = s(:alias, val[1], val[3]).line(val[2])
148
+ (_, line), lhs, _, rhs = val
149
+ result = s(:alias, lhs, rhs).line(line).line line
161
150
  }
162
151
  | kALIAS tGVAR tGVAR
163
152
  {
164
- result = s(:valias, val[1].to_sym, val[2].to_sym)
153
+ (_, line), lhs, rhs = val
154
+ result = s(:valias, lhs.to_sym, rhs.to_sym).line line
165
155
  }
166
156
  | kALIAS tGVAR tBACK_REF
167
157
  {
168
- result = s(:valias, val[1].to_sym, :"$#{val[2]}")
158
+ (_, line), lhs, rhs = val
159
+ result = s(:valias, lhs.to_sym, :"$#{rhs}").line line
169
160
  }
170
161
  | kALIAS tGVAR tNTH_REF
171
162
  {
@@ -177,32 +168,41 @@ rule
177
168
  }
178
169
  | stmt kIF_MOD expr_value
179
170
  {
180
- result = new_if val[2], val[0], nil
171
+ t, _, c = val
172
+ result = new_if c, t, nil
181
173
  }
182
174
  | stmt kUNLESS_MOD expr_value
183
175
  {
184
- result = new_if val[2], nil, val[0]
176
+ f, _, c = val
177
+ result = new_if c, nil, f
185
178
  }
186
179
  | stmt kWHILE_MOD expr_value
187
180
  {
188
- result = new_while val[0], val[2], true
181
+ e, _, c = val
182
+ result = new_while e, c, true
189
183
  }
190
184
  | stmt kUNTIL_MOD expr_value
191
185
  {
192
- result = new_until val[0], val[2], true
186
+ e, _, c = val
187
+ result = new_until e, c, true
193
188
  }
194
189
  | stmt kRESCUE_MOD stmt
195
190
  {
196
191
  body, _, resbody = val
197
- result = new_rescue body, new_resbody(s(:array), resbody)
192
+
193
+ resbody = new_resbody s(:array).line(resbody.line), resbody
194
+ result = new_rescue body, resbody
198
195
  }
199
196
  | klEND tLCURLY compstmt tRCURLY
200
197
  {
198
+ (_, line), _, stmt, _ = val
199
+
201
200
  if (self.in_def || self.in_single > 0) then
202
201
  debug20 3
203
202
  yyerror "END in method; use at_exit"
204
203
  end
205
- result = new_iter s(:postexe), 0, val[2]
204
+
205
+ result = new_iter s(:postexe).line(line), 0, stmt
206
206
  }
207
207
  | command_asgn
208
208
  | mlhs tEQL command_call
@@ -211,7 +211,8 @@ rule
211
211
  }
212
212
  | lhs tEQL mrhs
213
213
  {
214
- result = new_assign val[0], s(:svalue, val[2])
214
+ lhs, _, rhs = val
215
+ result = new_assign lhs, s(:svalue, rhs).line(rhs.line)
215
216
  }
216
217
  | mlhs tEQL mrhs_arg
217
218
  {
@@ -233,11 +234,12 @@ rule
233
234
  }
234
235
  | primary_value tLBRACK2 opt_call_args rbracket tOP_ASGN command_rhs
235
236
  {
236
- result = s(:op_asgn1, val[0], val[2], val[4].to_sym, val[5])
237
+ result = new_op_asgn1 val
237
238
  }
238
239
  | primary_value call_op tIDENTIFIER tOP_ASGN command_rhs
239
240
  {
240
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
241
+ prim, _, id, opasgn, rhs = val
242
+ result = s(:op_asgn, prim, rhs, id.to_sym, opasgn.to_sym)
241
243
  if val[1] == '&.'
242
244
  result.sexp_type = :safe_op_asgn
243
245
  end
@@ -276,19 +278,26 @@ rule
276
278
  expr: command_call
277
279
  | expr kAND expr
278
280
  {
279
- result = logical_op :and, val[0], val[2]
281
+ lhs, _, rhs = val
282
+ result = logical_op :and, lhs, rhs
280
283
  }
281
284
  | expr kOR expr
282
285
  {
283
- result = logical_op :or, val[0], val[2]
286
+ lhs, _, rhs = val
287
+ result = logical_op :or, lhs, rhs
284
288
  }
285
289
  | kNOT opt_nl expr
286
290
  {
287
- result = s(:call, val[2], :"!")
291
+ (_, line), _, expr = val
292
+ result = new_call(expr, :"!").line line
293
+ # REFACTOR: call_uni_op
288
294
  }
289
295
  | tBANG command_call
290
296
  {
291
- result = s(:call, val[1], :"!")
297
+ _, cmd = val
298
+ result = new_call(cmd, :"!").line cmd.line
299
+ # TODO: fix line number to tBANG... but causes BAD shift/reduce conflict
300
+ # REFACTOR: call_uni_op -- see parse26.y
292
301
  }
293
302
  | arg
294
303
 
@@ -315,7 +324,8 @@ rule
315
324
  block_command: block_call
316
325
  | block_call call_op2 operation2 command_args
317
326
  {
318
- result = new_call val[0], val[2].to_sym, val[3]
327
+ blk, _, msg, args = val
328
+ result = new_call(blk, msg.to_sym, args).line blk.line
319
329
  }
320
330
 
321
331
  cmd_brace_block: tLBRACE_ARG
@@ -335,26 +345,32 @@ rule
335
345
 
336
346
  fcall: operation
337
347
  {
338
- result = new_call nil, val[0].to_sym
348
+ msg, = val
349
+ result = new_call(nil, msg.to_sym).line lexer.lineno
339
350
  }
340
351
 
341
352
  command: fcall command_args =tLOWEST
342
353
  {
343
- result = val[0].concat val[1].sexp_body # REFACTOR pattern
354
+ call, args = val
355
+ result = call.concat args.sexp_body
344
356
  }
345
357
  | fcall command_args cmd_brace_block
346
358
  {
347
- result = val[0].concat val[1].sexp_body
348
- if val[2] then
349
- block_dup_check result, val[2]
359
+ call, args, block = val
350
360
 
351
- result, operation = val[2], result
361
+ result = call.concat args.sexp_body
362
+
363
+ if block then
364
+ block_dup_check result, block
365
+
366
+ result, operation = block, result
352
367
  result.insert 1, operation
353
368
  end
354
369
  }
355
370
  | primary_value call_op operation2 command_args =tLOWEST
356
371
  {
357
- result = new_call val[0], val[2].to_sym, val[3], val[1]
372
+ lhs, callop, op, args = val
373
+ result = new_call lhs, op.to_sym, args, callop
358
374
  }
359
375
  | primary_value call_op operation2 command_args cmd_brace_block
360
376
  {
@@ -386,7 +402,9 @@ rule
386
402
  }
387
403
  | kYIELD command_args
388
404
  {
389
- result = new_yield val[1]
405
+ (_, line), args = val
406
+ result = new_yield args
407
+ result.line line # TODO: push to new_yield
390
408
  }
391
409
  | k_return call_args
392
410
  {
@@ -395,8 +413,8 @@ rule
395
413
  }
396
414
  | kBREAK call_args
397
415
  {
398
- line = val[0].last
399
- result = s(:break, ret_args(val[1])).line(line)
416
+ (_, line), args = val
417
+ result = s(:break, ret_args(args)).line line
400
418
  }
401
419
  | kNEXT call_args
402
420
  {
@@ -413,56 +431,79 @@ rule
413
431
  mlhs_inner: mlhs_basic
414
432
  | tLPAREN mlhs_inner rparen
415
433
  {
416
- result = s(:masgn, s(:array, val[1]))
434
+ _, arg, _ = val
435
+ l = arg.line
436
+
437
+ result = s(:masgn, s(:array, arg).line(l)).line l
417
438
  }
418
439
 
419
440
  mlhs_basic: mlhs_head
420
441
  {
421
- result = s(:masgn, val[0])
442
+ head, = val
443
+ result = s(:masgn, head).line head.line
422
444
  }
423
445
  | mlhs_head mlhs_item
424
446
  {
425
- result = s(:masgn, val[0] << val[1].compact)
447
+ lhs, rhs = val
448
+ result = s(:masgn, lhs << rhs.compact).line lhs.line
426
449
  }
427
450
  | mlhs_head tSTAR mlhs_node
428
451
  {
429
- result = s(:masgn, val[0] << s(:splat, val[2]))
452
+ head, _, tail = val
453
+ head << s(:splat, tail).line(tail.line)
454
+ result = s(:masgn, head).line head.line
430
455
  }
431
456
  | mlhs_head tSTAR mlhs_node tCOMMA mlhs_post
432
457
  {
433
458
  ary1, _, splat, _, ary2 = val
434
459
 
435
- result = list_append ary1, s(:splat, splat)
460
+ result = list_append ary1, s(:splat, splat).line(splat.line)
436
461
  result.concat ary2.sexp_body
437
- result = s(:masgn, result)
462
+ result = s(:masgn, result).line result.line
438
463
  }
439
464
  | mlhs_head tSTAR
440
465
  {
441
- result = s(:masgn, val[0] << s(:splat))
466
+ head, _ = val
467
+ l = head.line
468
+ result = s(:masgn, head << s(:splat).line(l)).line l
442
469
  }
443
470
  | mlhs_head tSTAR tCOMMA mlhs_post
444
471
  {
445
- ary = list_append val[0], s(:splat)
446
- ary.concat val[3].sexp_body
447
- result = s(:masgn, ary)
472
+ head, _, _, post = val
473
+ ary = list_append head, s(:splat).line(head.line)
474
+ ary.concat post.sexp_body
475
+ result = s(:masgn, ary).line ary.line
448
476
  }
449
477
  | tSTAR mlhs_node
450
478
  {
451
- result = s(:masgn, s(:array, s(:splat, val[1])))
479
+ _, node = val
480
+ l = node.line
481
+ splat = s(:splat, node).line l
482
+ ary = s(:array, splat).line l
483
+ result = s(:masgn, ary).line l
452
484
  }
453
485
  | tSTAR mlhs_node tCOMMA mlhs_post
454
486
  {
455
- ary = s(:array, s(:splat, val[1]))
456
- ary.concat val[3].sexp_body
457
- result = s(:masgn, ary)
487
+ _, node, _, post = val
488
+
489
+ splat = s(:splat, node).line node.line
490
+ ary = s(:array, splat).line splat.line
491
+ ary.concat post.sexp_body
492
+ result = s(:masgn, ary).line ary.line
458
493
  }
459
494
  | tSTAR
460
495
  {
461
- result = s(:masgn, s(:array, s(:splat)))
496
+ l = lexer.lineno
497
+ result = s(:masgn, s(:array, s(:splat).line(l)).line(l)).line l
462
498
  }
463
499
  | tSTAR tCOMMA mlhs_post
464
500
  {
465
- result = s(:masgn, s(:array, s(:splat), *val[2].sexp_body))
501
+ _, _, post = val
502
+ l = post.line
503
+
504
+ splat = s(:splat).line l
505
+ ary = s(:array, splat, *post.sexp_body).line l
506
+ result = s(:masgn, ary).line l
466
507
  }
467
508
 
468
509
  mlhs_item: mlhs_node
@@ -473,7 +514,8 @@ rule
473
514
 
474
515
  mlhs_head: mlhs_item tCOMMA
475
516
  {
476
- result = s(:array, val[0])
517
+ lhs, _ = val
518
+ result = s(:array, lhs).line lhs.line
477
519
  }
478
520
  | mlhs_head mlhs_item tCOMMA
479
521
  {
@@ -482,7 +524,8 @@ rule
482
524
 
483
525
  mlhs_post: mlhs_item
484
526
  {
485
- result = s(:array, val[0])
527
+ item, = val
528
+ result = s(:array, item).line item.line
486
529
  }
487
530
  | mlhs_post tCOMMA mlhs_item
488
531
  {
@@ -507,7 +550,8 @@ rule
507
550
  }
508
551
  | primary_value tCOLON2 tIDENTIFIER
509
552
  {
510
- result = s(:attrasgn, val[0], :"#{val[2]}=")
553
+ recv, _, id = val
554
+ result = new_attrasgn recv, id
511
555
  }
512
556
  | primary_value call_op tCONSTANT
513
557
  {
@@ -520,7 +564,10 @@ rule
520
564
  yyerror "dynamic constant assignment"
521
565
  end
522
566
 
523
- result = s(:const, s(:colon2, val[0], val[2].to_sym), nil)
567
+ expr, _, id = val
568
+ l = expr.line
569
+
570
+ result = s(:const, s(:colon2, expr, id.to_sym).line(l), nil).line l
524
571
  }
525
572
  | tCOLON3 tCONSTANT
526
573
  {
@@ -529,7 +576,10 @@ rule
529
576
  yyerror "dynamic constant assignment"
530
577
  end
531
578
 
532
- result = s(:const, nil, s(:colon3, val[1].to_sym))
579
+ _, id = val
580
+ l = lexer.lineno
581
+
582
+ result = s(:const, nil, s(:colon3, id.to_sym).line(l)).line l
533
583
  }
534
584
  | backref
535
585
  {
@@ -538,24 +588,31 @@ rule
538
588
 
539
589
  lhs: user_variable
540
590
  {
591
+ line = lexer.lineno
541
592
  result = self.assignable val[0]
593
+ result.line = line
542
594
  }
543
595
  | keyword_variable
544
596
  {
597
+ line = lexer.lineno
545
598
  result = self.assignable val[0]
599
+ result.line = line
546
600
  debug20 9, val, result
547
601
  }
548
602
  | primary_value tLBRACK2 opt_call_args rbracket
549
603
  {
550
- result = self.aryset val[0], val[2]
604
+ lhs, _, args, _ = val
605
+ result = self.aryset lhs, args
551
606
  }
552
607
  | primary_value call_op tIDENTIFIER # REFACTOR
553
608
  {
554
- result = new_attrasgn val[0], val[2], val[1]
609
+ lhs, op, id = val
610
+ result = new_attrasgn lhs, id, op
555
611
  }
556
612
  | primary_value tCOLON2 tIDENTIFIER
557
613
  {
558
- result = s(:attrasgn, val[0], :"#{val[2]}=")
614
+ lhs, _, id = val
615
+ result = new_attrasgn lhs, id
559
616
  }
560
617
  | primary_value call_op tCONSTANT # REFACTOR?
561
618
  {
@@ -563,21 +620,27 @@ rule
563
620
  }
564
621
  | primary_value tCOLON2 tCONSTANT
565
622
  {
623
+ expr, _, id = val
624
+
566
625
  if (self.in_def || self.in_single > 0) then
567
626
  debug20 10
568
627
  yyerror "dynamic constant assignment"
569
628
  end
570
629
 
571
- result = s(:const, s(:colon2, val[0], val[2].to_sym))
630
+ l = expr.line
631
+ result = s(:const, s(:colon2, expr, id.to_sym).line(l)).line l
572
632
  }
573
633
  | tCOLON3 tCONSTANT
574
634
  {
635
+ _, id = val
636
+
575
637
  if (self.in_def || self.in_single > 0) then
576
638
  debug20 11
577
639
  yyerror "dynamic constant assignment"
578
640
  end
579
641
 
580
- result = s(:const, s(:colon3, val[1].to_sym))
642
+ l = lexer.lineno
643
+ result = s(:const, s(:colon3, id.to_sym).line(l)).line l
581
644
  }
582
645
  | backref
583
646
  {
@@ -592,7 +655,8 @@ rule
592
655
 
593
656
  cpath: tCOLON3 cname
594
657
  {
595
- result = s(:colon3, val[1].to_sym)
658
+ _, name = val
659
+ result = s(:colon3, name.to_sym).line lexer.lineno
596
660
  }
597
661
  | cname
598
662
  {
@@ -600,7 +664,10 @@ rule
600
664
  }
601
665
  | primary_value tCOLON2 cname
602
666
  {
603
- result = s(:colon2, val[0], val[2].to_sym)
667
+ pval, _, name = val
668
+
669
+ result = s(:colon2, pval, name.to_sym)
670
+ result.line pval.line
604
671
  }
605
672
 
606
673
  fname: tIDENTIFIER | tCONSTANT | tFID
@@ -621,7 +688,8 @@ rule
621
688
 
622
689
  fitem: fsym
623
690
  {
624
- result = s(:lit, val[0].to_sym)
691
+ id, = val
692
+ result = s(:lit, id.to_sym).line lexer.lineno
625
693
  }
626
694
  | dsym
627
695
 
@@ -644,6 +712,7 @@ rule
644
712
  | tNEQ | tLSHFT | tRSHFT | tPLUS | tMINUS | tSTAR2
645
713
  | tSTAR | tDIVIDE | tPERCENT | tPOW | tDSTAR | tBANG | tTILDE
646
714
  | tUPLUS | tUMINUS | tAREF | tASET | tBACK_REF2
715
+ # TODO: tUBANG dead?
647
716
  | tUBANG
648
717
 
649
718
  reswords: k__LINE__ | k__FILE__ | k__ENCODING__ | klBEGIN | klEND
@@ -666,8 +735,7 @@ rule
666
735
  }
667
736
  | primary_value tLBRACK2 opt_call_args rbracket tOP_ASGN arg_rhs
668
737
  {
669
- val[2].sexp_type = :arglist if val[2]
670
- result = s(:op_asgn1, val[0], val[2], val[4].to_sym, val[5])
738
+ result = new_op_asgn1 val
671
739
  }
672
740
  | primary_value call_op tIDENTIFIER tOP_ASGN arg_rhs
673
741
  {
@@ -679,7 +747,9 @@ rule
679
747
  }
680
748
  | primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
681
749
  {
682
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
750
+ lhs, _, id, op, rhs = val
751
+
752
+ result = s(:op_asgn, lhs, rhs, id.to_sym, op.to_sym).line lhs.line
683
753
  }
684
754
  | primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
685
755
  {
@@ -709,18 +779,18 @@ rule
709
779
  {
710
780
  v1, v2 = val[0], val[2]
711
781
  if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
712
- result = s(:lit, (v1.last)..(v2.last))
782
+ result = s(:lit, (v1.last)..(v2.last)).line v1.line
713
783
  else
714
- result = s(:dot2, v1, v2)
784
+ result = s(:dot2, v1, v2).line v1.line
715
785
  end
716
786
  }
717
787
  | arg tDOT3 arg
718
788
  {
719
789
  v1, v2 = val[0], val[2]
720
790
  if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
721
- result = s(:lit, (v1.last)...(v2.last))
791
+ result = s(:lit, (v1.last)...(v2.last)).line v1.line
722
792
  else
723
- result = s(:dot3, v1, v2)
793
+ result = s(:dot3, v1, v2).line v1.line
724
794
  end
725
795
  }
726
796
  | arg tPLUS arg
@@ -749,7 +819,9 @@ rule
749
819
  }
750
820
  | tUMINUS_NUM simple_numeric tPOW arg
751
821
  {
752
- result = new_call(new_call(s(:lit, val[1]), :"**", argl(val[3])), :"-@")
822
+ lit = s(:lit, val[1]).line lexer.lineno
823
+ result = new_call(new_call(lit, :"**", argl(val[3])), :"-@")
824
+
753
825
  }
754
826
  | tUPLUS arg
755
827
  {
@@ -790,15 +862,19 @@ rule
790
862
  }
791
863
  | arg tMATCH arg
792
864
  {
793
- result = new_match val[0], val[2]
865
+ lhs, _, rhs = val
866
+ result = new_match lhs, rhs
794
867
  }
795
868
  | arg tNMATCH arg
796
869
  {
797
- result = s(:not, new_match(val[0], val[2]))
870
+ lhs, _, rhs = val
871
+ result = s(:not, new_match(lhs, rhs)).line lhs.line
798
872
  }
799
873
  | tBANG arg
800
874
  {
801
- result = new_call val[1], :"!"
875
+ _, arg = val
876
+ result = new_call arg, :"!"
877
+ result.line arg.line
802
878
  }
803
879
  | tTILDE arg
804
880
  {
@@ -826,11 +902,13 @@ rule
826
902
  }
827
903
  | kDEFINED opt_nl arg
828
904
  {
829
- result = s(:defined, val[2])
905
+ (_, line), _, arg = val
906
+ result = s(:defined, arg).line line
830
907
  }
831
908
  | arg tEH arg opt_nl tCOLON arg
832
909
  {
833
- result = s(:if, val[0], val[2], val[5])
910
+ c, _, t, _, _, f = val
911
+ result = s(:if, c, t, f).line c.line
834
912
  }
835
913
  | primary
836
914
 
@@ -873,28 +951,25 @@ rule
873
951
  arg_rhs: arg =tOP_ASGN
874
952
  | arg kRESCUE_MOD arg
875
953
  {
876
- body, _, resbody = val
954
+ body, (_, line), resbody = val
877
955
  body = value_expr body
878
956
  resbody = remove_begin resbody
879
- result = new_rescue(body, new_resbody(s(:array), resbody))
957
+
958
+ ary = s(:array).line line
959
+ result = new_rescue(body, new_resbody(ary, resbody))
880
960
  }
881
961
 
882
962
  paren_args: tLPAREN2 opt_call_args rparen
883
963
  {
884
- result = val[1]
964
+ _, args, _ = val
965
+ result = args
885
966
  }
886
967
 
887
968
  opt_paren_args: none
888
969
  | paren_args
889
970
 
890
971
  opt_call_args: none
891
- {
892
- result = val[0]
893
- }
894
972
  | call_args
895
- {
896
- result = val[0]
897
- }
898
973
  | args tCOMMA
899
974
  {
900
975
  result = args val
@@ -944,7 +1019,8 @@ rule
944
1019
 
945
1020
  block_arg: tAMPER arg_value
946
1021
  {
947
- result = s(:block_pass, val[1])
1022
+ _, arg = val
1023
+ result = s(:block_pass, arg).line arg.line
948
1024
  }
949
1025
 
950
1026
  opt_block_arg: tCOMMA block_arg
@@ -955,19 +1031,24 @@ rule
955
1031
 
956
1032
  args: arg_value
957
1033
  {
958
- result = s(:array, val[0])
1034
+ arg, = val
1035
+
1036
+ result = s(:array, arg).line arg.line
959
1037
  }
960
1038
  | tSTAR arg_value
961
1039
  {
962
- result = s(:array, s(:splat, val[1]))
1040
+ _, arg = val
1041
+ result = s(:array, s(:splat, arg).line(arg.line)).line arg.line
963
1042
  }
964
1043
  | args tCOMMA arg_value
965
1044
  {
966
- result = self.list_append val[0], val[2]
1045
+ args, _, id = val
1046
+ result = self.list_append args, id
967
1047
  }
968
- | args tCOMMA tSTAR arg_value
1048
+ | args tCOMMA tSTAR { result = lexer.lineno } arg_value
969
1049
  {
970
- result = self.list_append val[0], s(:splat, val[3])
1050
+ args, _, _, line, id = val
1051
+ result = self.list_append args, s(:splat, id).line(line)
971
1052
  }
972
1053
 
973
1054
  mrhs_arg: mrhs
@@ -985,11 +1066,15 @@ rule
985
1066
  }
986
1067
  | args tCOMMA tSTAR arg_value
987
1068
  {
988
- result = self.arg_concat val[0], val[3]
1069
+ # FIX: bad shift/reduce conflict with rhs' comma star prod
1070
+ # TODO: make all tXXXX terminals include lexer.lineno
1071
+ arg, _, _, splat = val
1072
+ result = self.arg_concat arg, splat
989
1073
  }
990
1074
  | tSTAR arg_value
991
1075
  {
992
- result = s(:splat, val[1])
1076
+ _, arg = val
1077
+ result = s(:splat, arg).line arg.line
993
1078
  }
994
1079
 
995
1080
  primary: literal
@@ -1004,7 +1089,8 @@ rule
1004
1089
  | backref
1005
1090
  | tFID
1006
1091
  {
1007
- result = new_call nil, val[0].to_sym
1092
+ msg, = val
1093
+ result = new_call nil, msg.to_sym
1008
1094
  }
1009
1095
  | k_begin
1010
1096
  {
@@ -1024,16 +1110,19 @@ rule
1024
1110
 
1025
1111
  result.line = val[1]
1026
1112
  }
1027
- | tLPAREN_ARG rparen
1113
+ | tLPAREN_ARG
1028
1114
  {
1029
- # TODO: lex_state = EXPR_ENDARG in between
1030
- debug20 13, val, result
1115
+ lexer.lex_state = EXPR_ENDARG
1116
+ result = lexer.lineno
1117
+ }
1118
+ rparen
1119
+ {
1120
+ _, line, _ = val
1121
+ result = s(:begin).line line
1031
1122
  }
1032
1123
  | tLPAREN_ARG
1033
1124
  {
1034
1125
  result = lexer.cmdarg.store false
1035
- # result = self.lexer.cmdarg.stack.dup
1036
- # lexer.cmdarg.stack.replace [false] # TODO add api for these
1037
1126
  }
1038
1127
  stmt
1039
1128
  {
@@ -1048,21 +1137,29 @@ rule
1048
1137
  }
1049
1138
  | tLPAREN compstmt tRPAREN
1050
1139
  {
1051
- result = val[1] || s(:nil)
1140
+ _, stmt, _ = val
1141
+ result = stmt
1142
+ result ||= s(:nil).line lexer.lineno
1052
1143
  result.paren = true
1053
1144
  }
1054
1145
  | primary_value tCOLON2 tCONSTANT
1055
1146
  {
1056
- result = s(:colon2, val[0], val[2].to_sym)
1147
+ expr, _, id = val
1148
+
1149
+ result = s(:colon2, expr, id.to_sym).line expr.line
1057
1150
  }
1058
1151
  | tCOLON3 tCONSTANT
1059
1152
  {
1060
- result = s(:colon3, val[1].to_sym)
1153
+ _, id = val
1154
+
1155
+ result = s(:colon3, id.to_sym).line lexer.lineno
1061
1156
  }
1062
- | tLBRACK aref_args tRBRACK
1157
+ | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1063
1158
  {
1064
- result = val[1] || s(:array)
1159
+ _, line, args, _ = val
1160
+ result = args || s(:array)
1065
1161
  result.sexp_type = :array # aref_args is :args
1162
+ result.line line
1066
1163
  }
1067
1164
  | tLBRACE
1068
1165
  {
@@ -1074,7 +1171,8 @@ rule
1074
1171
  }
1075
1172
  | k_return
1076
1173
  {
1077
- result = s(:return)
1174
+ (_, line), = val
1175
+ result = s(:return).line line
1078
1176
  }
1079
1177
  | kYIELD tLPAREN2 call_args rparen
1080
1178
  {
@@ -1090,11 +1188,14 @@ rule
1090
1188
  }
1091
1189
  | kDEFINED opt_nl tLPAREN2 expr rparen
1092
1190
  {
1093
- result = s(:defined, val[3])
1191
+ (_, line), _, _, arg, _ = val
1192
+
1193
+ result = s(:defined, arg).line line
1094
1194
  }
1095
1195
  | kNOT tLPAREN2 expr rparen
1096
1196
  {
1097
- result = s(:call, val[2], :"!")
1197
+ _, _, lhs, _ = val
1198
+ result = new_call lhs, :"!"
1098
1199
  }
1099
1200
  | kNOT tLPAREN2 rparen
1100
1201
  {
@@ -1102,11 +1203,11 @@ rule
1102
1203
  }
1103
1204
  | fcall brace_block
1104
1205
  {
1105
- oper, iter = val[0], val[1]
1106
- call = oper # FIX
1206
+ call, iter = val
1207
+
1107
1208
  iter.insert 1, call
1108
1209
  result = iter
1109
- call.line = iter.line
1210
+ # FIX: probably not: call.line = iter.line
1110
1211
  }
1111
1212
  | method_call
1112
1213
  | method_call brace_block
@@ -1223,7 +1324,7 @@ rule
1223
1324
  # TODO: port local_push_gen and local_pop_gen
1224
1325
  lexer.cmdarg.stack.replace [false]
1225
1326
  }
1226
- f_arglist bodystmt k_end
1327
+ f_arglist bodystmt { result = lexer.lineno } k_end
1227
1328
  {
1228
1329
  in_def, cmdarg = val[2]
1229
1330
 
@@ -1249,9 +1350,8 @@ rule
1249
1350
  }
1250
1351
  f_arglist bodystmt k_end
1251
1352
  {
1252
- line, cmdarg = val[5]
1353
+ _, cmdarg = val[5]
1253
1354
  result = new_defs val
1254
- result[3].line line
1255
1355
 
1256
1356
  lexer.cmdarg.stack.replace cmdarg
1257
1357
 
@@ -1261,19 +1361,23 @@ rule
1261
1361
  }
1262
1362
  | kBREAK
1263
1363
  {
1264
- result = s(:break)
1364
+ (_, line), = val
1365
+ result = s(:break).line line
1265
1366
  }
1266
1367
  | kNEXT
1267
1368
  {
1268
- result = s(:next)
1369
+ (_, line), = val
1370
+ result = s(:next).line line
1269
1371
  }
1270
1372
  | kREDO
1271
1373
  {
1272
- result = s(:redo)
1374
+ (_, line), = val
1375
+ result = s(:redo).line line
1273
1376
  }
1274
1377
  | kRETRY
1275
1378
  {
1276
- result = s(:retry)
1379
+ (_, line), = val
1380
+ result = s(:retry).line line
1277
1381
  }
1278
1382
 
1279
1383
  primary_value: primary
@@ -1312,7 +1416,9 @@ rule
1312
1416
  if_tail: opt_else
1313
1417
  | k_elsif expr_value then compstmt if_tail
1314
1418
  {
1315
- result = s(:if, val[1], val[3], val[4])
1419
+ (_, line), c, _, t, rest = val
1420
+
1421
+ result = s(:if, c, t, rest).line line
1316
1422
  }
1317
1423
 
1318
1424
  opt_else: none
@@ -1335,7 +1441,9 @@ rule
1335
1441
 
1336
1442
  f_marg_list: f_marg
1337
1443
  {
1338
- result = s(:array, val[0])
1444
+ sym, = val
1445
+
1446
+ result = s(:array, sym).line lexer.lineno
1339
1447
  }
1340
1448
  | f_marg_list tCOMMA f_marg
1341
1449
  {
@@ -1409,7 +1517,9 @@ rule
1409
1517
  }
1410
1518
  | f_block_arg
1411
1519
  {
1412
- result = call_args val
1520
+ line = lexer.lineno
1521
+ result = call_args val # TODO: push line down
1522
+ result.line line
1413
1523
  }
1414
1524
 
1415
1525
  opt_block_args_tail: tCOMMA block_args_tail
@@ -1440,7 +1550,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1440
1550
  }
1441
1551
  | f_arg tCOMMA
1442
1552
  {
1443
- result = args val
1553
+ result = args(val) << nil
1444
1554
  }
1445
1555
  | f_arg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
1446
1556
  {
@@ -1492,7 +1602,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1492
1602
  }
1493
1603
  | tOROP
1494
1604
  {
1495
- result = s(:args)
1605
+ result = s(:args).line lexer.lineno
1496
1606
  }
1497
1607
  | tPIPE block_param opt_bv_decl tPIPE
1498
1608
  {
@@ -1517,33 +1627,33 @@ opt_block_args_tail: tCOMMA block_args_tail
1517
1627
 
1518
1628
  bvar: tIDENTIFIER
1519
1629
  {
1520
- result = s(:shadow, val[0].to_sym)
1630
+ id, = val
1631
+ line = lexer.lineno
1632
+ result = s(:shadow, id.to_sym).line line
1521
1633
  }
1522
1634
  | f_bad_arg
1523
1635
 
1524
1636
  lambda: {
1525
1637
  self.env.extend :dynamic
1526
- result = self.lexer.lineno
1527
-
1528
- result = lexer.lpar_beg
1638
+ result = [lexer.lineno, lexer.lpar_beg]
1529
1639
  lexer.paren_nest += 1
1530
1640
  lexer.lpar_beg = lexer.paren_nest
1531
1641
  }
1532
1642
  f_larglist
1533
1643
  {
1534
- result = [lexer.cmdarg.store(false), self.lexer.lineno]
1644
+ result = lexer.cmdarg.store(false)
1535
1645
  }
1536
1646
  lambda_body
1537
1647
  {
1538
- lpar, args, (cmdarg, lineno), body = val
1648
+ (line, lpar), args, cmdarg, body = val
1539
1649
  lexer.lpar_beg = lpar
1540
1650
 
1541
1651
  lexer.cmdarg.restore cmdarg
1542
1652
  lexer.cmdarg.lexpop
1543
1653
 
1544
- call = new_call nil, :lambda
1654
+ call = s(:lambda).line line
1545
1655
  result = new_iter call, args, body
1546
- result.line = lineno
1656
+ result.line = line
1547
1657
  self.env.unextend
1548
1658
  }
1549
1659
 
@@ -1568,8 +1678,8 @@ opt_block_args_tail: tCOMMA block_args_tail
1568
1678
 
1569
1679
  do_block: k_do_block do_body kEND
1570
1680
  {
1571
- # TODO: maybe fix lineno to kDO's lineno?
1572
- result = val[1]
1681
+ (_, line), iter, _ = val
1682
+ result = iter.line line
1573
1683
  }
1574
1684
 
1575
1685
  block_call: command do_block
@@ -1583,8 +1693,10 @@ opt_block_args_tail: tCOMMA block_args_tail
1583
1693
 
1584
1694
  val = invert_block_call val if inverted? val
1585
1695
 
1586
- result = val[1]
1587
- result.insert 1, val[0]
1696
+ cmd, blk = val
1697
+
1698
+ result = blk
1699
+ result.insert 1, cmd
1588
1700
  }
1589
1701
  | block_call call_op2 operation2 opt_paren_args
1590
1702
  {
@@ -1615,8 +1727,10 @@ opt_block_args_tail: tCOMMA block_args_tail
1615
1727
  }
1616
1728
  paren_args
1617
1729
  {
1618
- args = self.call_args val[2..-1]
1619
- result = val[0].concat args.sexp_body
1730
+ call, lineno, args = val
1731
+
1732
+ result = call.concat args.sexp_body if args
1733
+ result.line lineno
1620
1734
  }
1621
1735
  | primary_value call_op operation2 opt_paren_args
1622
1736
  {
@@ -1644,7 +1758,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1644
1758
  }
1645
1759
  | kSUPER
1646
1760
  {
1647
- result = s(:zsuper)
1761
+ result = s(:zsuper).line lexer.lineno
1648
1762
  }
1649
1763
  | primary_value tLBRACK2 opt_call_args rbracket
1650
1764
  {
@@ -1722,7 +1836,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1722
1836
  (_, line), klasses, var, _, body, rest = val
1723
1837
 
1724
1838
  klasses ||= s(:array)
1725
- klasses << new_assign(var, s(:gvar, :"$!")) if var
1839
+ klasses << new_assign(var, s(:gvar, :"$!").line(var.line)) if var
1726
1840
  klasses.line line
1727
1841
 
1728
1842
  result = new_resbody(klasses, body)
@@ -1735,7 +1849,8 @@ opt_block_args_tail: tCOMMA block_args_tail
1735
1849
 
1736
1850
  exc_list: arg_value
1737
1851
  {
1738
- result = s(:array, val[0])
1852
+ arg, = val
1853
+ result = s(:array, arg).line arg.line
1739
1854
  }
1740
1855
  | mrhs
1741
1856
  | none
@@ -1748,26 +1863,31 @@ opt_block_args_tail: tCOMMA block_args_tail
1748
1863
 
1749
1864
  opt_ensure: k_ensure compstmt
1750
1865
  {
1751
- _, body = val
1866
+ (_, line), body = val
1752
1867
 
1753
- result = body || s(:nil)
1868
+ result = body || s(:nil).line(line)
1754
1869
  }
1755
1870
  | none
1756
1871
 
1757
1872
  literal: numeric
1758
1873
  {
1874
+ line = lexer.lineno
1759
1875
  result = s(:lit, val[0])
1876
+ result.line = line
1760
1877
  }
1761
1878
  | symbol
1762
1879
  {
1880
+ line = lexer.lineno
1763
1881
  result = s(:lit, val[0])
1882
+ result.line = line
1764
1883
  }
1765
1884
  | dsym
1766
1885
 
1767
1886
  strings: string
1768
1887
  {
1769
- val[0] = s(:dstr, val[0].value) if val[0].sexp_type == :evstr
1770
- result = val[0]
1888
+ str, = val
1889
+ str = s(:dstr, str.value) if str.sexp_type == :evstr
1890
+ result = str
1771
1891
  }
1772
1892
 
1773
1893
  string: tCHAR
@@ -1782,7 +1902,11 @@ opt_block_args_tail: tCOMMA block_args_tail
1782
1902
 
1783
1903
  string1: tSTRING_BEG string_contents tSTRING_END
1784
1904
  {
1785
- result = val[1]
1905
+ _, str, (_, func) = val
1906
+
1907
+ str = dedent str if func =~ RubyLexer::STR_FUNC_ICNTNT
1908
+
1909
+ result = str
1786
1910
  }
1787
1911
  | tSTRING
1788
1912
  {
@@ -1792,6 +1916,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1792
1916
  xstring: tXSTRING_BEG xstring_contents tSTRING_END
1793
1917
  {
1794
1918
  result = new_xstring val[1]
1919
+ # TODO: dedent?!?! SERIOUSLY?!?
1795
1920
  }
1796
1921
 
1797
1922
  regexp: tREGEXP_BEG regexp_contents tREGEXP_END
@@ -1801,7 +1926,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1801
1926
 
1802
1927
  words: tWORDS_BEG tSPACE tSTRING_END
1803
1928
  {
1804
- result = s(:array)
1929
+ result = s(:array).line lexer.lineno
1805
1930
  }
1806
1931
  | tWORDS_BEG word_list tSTRING_END
1807
1932
  {
@@ -1825,25 +1950,28 @@ opt_block_args_tail: tCOMMA block_args_tail
1825
1950
 
1826
1951
  symbols: tSYMBOLS_BEG tSPACE tSTRING_END
1827
1952
  {
1828
- result = s(:array)
1953
+ result = s(:array).line lexer.lineno
1829
1954
  }
1830
- | tSYMBOLS_BEG symbol_list tSTRING_END
1955
+ | tSYMBOLS_BEG { result = lexer.lineno } symbol_list tSTRING_END
1831
1956
  {
1832
- result = val[1]
1957
+ _, line, list, _, = val
1958
+ list.line = line
1959
+ result = list
1833
1960
  }
1834
1961
 
1835
1962
  symbol_list: none
1836
1963
  {
1837
- result = new_symbol_list
1964
+ result = new_symbol_list.line lexer.lineno
1838
1965
  }
1839
1966
  | symbol_list word tSPACE
1840
1967
  {
1841
- result = val[0].dup << new_symbol_list_entry(val)
1968
+ list, * = val
1969
+ result = list.dup << new_symbol_list_entry(val)
1842
1970
  }
1843
1971
 
1844
1972
  qwords: tQWORDS_BEG tSPACE tSTRING_END
1845
1973
  {
1846
- result = s(:array)
1974
+ result = s(:array).line lexer.lineno
1847
1975
  }
1848
1976
  | tQWORDS_BEG qword_list tSTRING_END
1849
1977
  {
@@ -1852,7 +1980,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1852
1980
 
1853
1981
  qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
1854
1982
  {
1855
- result = s(:array)
1983
+ result = s(:array).line lexer.lineno # FIX
1856
1984
  }
1857
1985
  | tQSYMBOLS_BEG qsym_list tSTRING_END
1858
1986
  {
@@ -1879,11 +2007,12 @@ opt_block_args_tail: tCOMMA block_args_tail
1879
2007
 
1880
2008
  string_contents: none
1881
2009
  {
1882
- result = s(:str, "")
2010
+ result = s(:str, "").line lexer.lineno
1883
2011
  }
1884
2012
  | string_contents string_content
1885
2013
  {
1886
- result = literal_concat(val[0], val[1])
2014
+ v1, v2 = val
2015
+ result = literal_concat v1, v2
1887
2016
  }
1888
2017
 
1889
2018
  xstring_contents: none
@@ -1892,7 +2021,8 @@ xstring_contents: none
1892
2021
  }
1893
2022
  | xstring_contents string_content
1894
2023
  {
1895
- result = literal_concat(val[0], val[1])
2024
+ v1, v2 = val
2025
+ result = literal_concat v1, v2
1896
2026
  }
1897
2027
 
1898
2028
  regexp_contents: none
@@ -1901,7 +2031,8 @@ regexp_contents: none
1901
2031
  }
1902
2032
  | regexp_contents string_content
1903
2033
  {
1904
- result = literal_concat(val[0], val[1])
2034
+ v1, v2 = val
2035
+ result = literal_concat v1, v2
1905
2036
  }
1906
2037
 
1907
2038
  string_content: tSTRING_CONTENT
@@ -1917,8 +2048,9 @@ regexp_contents: none
1917
2048
  }
1918
2049
  string_dvar
1919
2050
  {
1920
- lexer.lex_strterm = val[1]
1921
- result = s(:evstr, val[2])
2051
+ _, strterm, str = val
2052
+ lexer.lex_strterm = strterm
2053
+ result = s(:evstr, str).line str.line
1922
2054
  }
1923
2055
  | tSTRING_DBEG
1924
2056
  {
@@ -1928,6 +2060,7 @@ regexp_contents: none
1928
2060
  lexer.cond.store,
1929
2061
  lexer.cmdarg.store,
1930
2062
  lexer.lex_state,
2063
+ lexer.lineno,
1931
2064
  ]
1932
2065
 
1933
2066
  lexer.lex_strterm = nil
@@ -1941,7 +2074,7 @@ regexp_contents: none
1941
2074
  {
1942
2075
  _, memo, stmt, _ = val
1943
2076
 
1944
- lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state = memo
2077
+ lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state, line = memo
1945
2078
 
1946
2079
  lexer.lex_strterm = lex_strterm
1947
2080
  lexer.brace_nest = brace_nest
@@ -1958,19 +2091,19 @@ regexp_contents: none
1958
2091
  when :str, :dstr, :evstr then
1959
2092
  result = stmt
1960
2093
  else
1961
- result = s(:evstr, stmt)
2094
+ result = s(:evstr, stmt).line line
1962
2095
  end
1963
2096
  when nil then
1964
- result = s(:evstr)
2097
+ result = s(:evstr).line line
1965
2098
  else
1966
2099
  debug20 25
1967
2100
  raise "unknown string body: #{stmt.inspect}"
1968
2101
  end
1969
2102
  }
1970
2103
 
1971
- string_dvar: tGVAR { result = s(:gvar, val[0].to_sym) }
1972
- | tIVAR { result = s(:ivar, val[0].to_sym) }
1973
- | tCVAR { result = s(:cvar, val[0].to_sym) }
2104
+ string_dvar: tGVAR { result = s(:gvar, val[0].to_sym).line lexer.lineno }
2105
+ | tIVAR { result = s(:ivar, val[0].to_sym).line lexer.lineno }
2106
+ | tCVAR { result = s(:cvar, val[0].to_sym).line lexer.lineno }
1974
2107
  | backref
1975
2108
 
1976
2109
  symbol: tSYMBEG sym
@@ -1987,18 +2120,19 @@ regexp_contents: none
1987
2120
 
1988
2121
  dsym: tSYMBEG xstring_contents tSTRING_END
1989
2122
  {
2123
+ _, result, _ = val
2124
+
1990
2125
  lexer.lex_state = EXPR_END
1991
- result = val[1]
1992
2126
 
1993
- result ||= s(:str, "")
2127
+ result ||= s(:str, "").line lexer.lineno
1994
2128
 
1995
2129
  case result.sexp_type
1996
2130
  when :dstr then
1997
2131
  result.sexp_type = :dsym
1998
2132
  when :str then
1999
- result = s(:lit, result.last.to_sym)
2133
+ result = s(:lit, result.last.to_sym).line result.line
2000
2134
  when :evstr then
2001
- result = s(:dsym, "", result)
2135
+ result = s(:dsym, "", result).line result.line
2002
2136
  else
2003
2137
  debug20 26, val, result
2004
2138
  end
@@ -2021,19 +2155,20 @@ regexp_contents: none
2021
2155
  | tCONSTANT
2022
2156
  | tCVAR
2023
2157
 
2024
- keyword_variable: kNIL { result = s(:nil) }
2025
- | kSELF { result = s(:self) }
2026
- | kTRUE { result = s(:true) }
2027
- | kFALSE { result = s(:false) }
2028
- | k__FILE__ { result = s(:str, self.file) }
2029
- | k__LINE__ { result = s(:lit, lexer.lineno) }
2158
+ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2159
+ | kSELF { result = s(:self).line lexer.lineno }
2160
+ | kTRUE { result = s(:true).line lexer.lineno }
2161
+ | kFALSE { result = s(:false).line lexer.lineno }
2162
+ | k__FILE__ { result = s(:str, self.file).line lexer.lineno }
2163
+ | k__LINE__ { result = s(:lit, lexer.lineno).line lexer.lineno }
2030
2164
  | k__ENCODING__
2031
2165
  {
2166
+ l = lexer.lineno
2032
2167
  result =
2033
2168
  if defined? Encoding then
2034
- s(:colon2, s(:const, :Encoding), :UTF_8)
2169
+ s(:colon2, s(:const, :Encoding).line(l), :UTF_8).line l
2035
2170
  else
2036
- s(:str, "Unsupported!")
2171
+ s(:str, "Unsupported!").line l
2037
2172
  end
2038
2173
  }
2039
2174
 
@@ -2058,8 +2193,8 @@ keyword_variable: kNIL { result = s(:nil) }
2058
2193
  debug20 29, val, result
2059
2194
  }
2060
2195
 
2061
- backref: tNTH_REF { result = s(:nth_ref, val[0]) }
2062
- | tBACK_REF { result = s(:back_ref, val[0]) }
2196
+ backref: tNTH_REF { result = s(:nth_ref, val[0]).line lexer.lineno }
2197
+ | tBACK_REF { result = s(:back_ref, val[0]).line lexer.lineno }
2063
2198
 
2064
2199
  superclass: tLT
2065
2200
  {
@@ -2216,12 +2351,13 @@ keyword_variable: kNIL { result = s(:nil) }
2216
2351
 
2217
2352
  f_arg: f_arg_item
2218
2353
  {
2219
- case val[0]
2354
+ arg, = val
2355
+
2356
+ case arg
2220
2357
  when Symbol then
2221
- result = s(:args)
2222
- result << val[0]
2358
+ result = s(:args, arg).line lexer.lineno
2223
2359
  when Sexp then
2224
- result = val[0]
2360
+ result = arg
2225
2361
  else
2226
2362
  debug20 32
2227
2363
  raise "Unknown f_arg type: #{val.inspect}"
@@ -2234,7 +2370,7 @@ keyword_variable: kNIL { result = s(:nil) }
2234
2370
  if list.sexp_type == :args then
2235
2371
  result = list
2236
2372
  else
2237
- result = s(:args, list)
2373
+ result = s(:args, list).line list.line
2238
2374
  end
2239
2375
 
2240
2376
  result << item
@@ -2244,38 +2380,42 @@ keyword_variable: kNIL { result = s(:nil) }
2244
2380
 
2245
2381
  f_kw: f_label arg_value
2246
2382
  {
2247
- # TODO: call_args
2248
- label, _ = val[0] # TODO: fix lineno?
2383
+ # TODO: new_kw_arg
2384
+ (label, line), arg = val
2385
+
2249
2386
  identifier = label.to_sym
2250
2387
  self.env[identifier] = :lvar
2251
2388
 
2252
- result = s(:array, s(:kwarg, identifier, val[1]))
2389
+ kwarg = s(:kwarg, identifier, arg).line line
2390
+ result = s(:array, kwarg).line line
2253
2391
  }
2254
2392
  | f_label
2255
2393
  {
2256
- label, _ = val[0] # TODO: fix lineno?
2257
- identifier = label.to_sym
2258
- self.env[identifier] = :lvar
2394
+ (label, line), = val
2259
2395
 
2260
- result = s(:array, s(:kwarg, identifier))
2396
+ id = label.to_sym
2397
+ self.env[id] = :lvar
2398
+
2399
+ result = s(:array, s(:kwarg, id).line(line)).line line
2261
2400
  }
2262
2401
 
2263
2402
  f_block_kw: f_label primary_value
2264
2403
  {
2265
- # TODO: call_args
2266
- label, _ = val[0] # TODO: fix lineno?
2267
- identifier = label.to_sym
2268
- self.env[identifier] = :lvar
2404
+ # TODO: new_kw_arg
2405
+ (label, line), expr = val
2406
+ id = label.to_sym
2407
+ self.env[id] = :lvar
2269
2408
 
2270
- result = s(:array, s(:kwarg, identifier, val[1]))
2409
+ result = s(:array, s(:kwarg, id, expr).line(line)).line line
2271
2410
  }
2272
2411
  | f_label
2273
2412
  {
2274
- label, _ = val[0] # TODO: fix lineno?
2275
- identifier = label.to_sym
2276
- self.env[identifier] = :lvar
2413
+ # TODO: new_kw_arg
2414
+ (label, line), = val
2415
+ id = label.to_sym
2416
+ self.env[id] = :lvar
2277
2417
 
2278
- result = s(:array, s(:kwarg, identifier))
2418
+ result = s(:array, s(:kwarg, id).line(line)).line line
2279
2419
  }
2280
2420
 
2281
2421
  f_block_kwarg: f_block_kw
@@ -2318,17 +2458,20 @@ keyword_variable: kNIL { result = s(:nil) }
2318
2458
 
2319
2459
  f_block_optarg: f_block_opt
2320
2460
  {
2321
- result = s(:block, val[0])
2461
+ optblk, = val
2462
+ result = s(:block, optblk).line optblk.line
2322
2463
  }
2323
2464
  | f_block_optarg tCOMMA f_block_opt
2324
2465
  {
2325
- result = val[0]
2326
- result << val[2]
2466
+ optarg, _, optblk = val
2467
+ result = optarg
2468
+ result << optblk
2327
2469
  }
2328
2470
 
2329
2471
  f_optarg: f_opt
2330
2472
  {
2331
- result = s(:block, val[0])
2473
+ opt, = val
2474
+ result = s(:block, opt).line opt.line
2332
2475
  }
2333
2476
  | f_optarg tCOMMA f_opt
2334
2477
  {
@@ -2382,14 +2525,11 @@ keyword_variable: kNIL { result = s(:nil) }
2382
2525
  result.sexp_type == :lit
2383
2526
  }
2384
2527
 
2385
- assoc_list: none # [!nil]
2528
+ assoc_list: none
2386
2529
  {
2387
- result = s(:array)
2388
- }
2389
- | assocs trailer # [!nil]
2390
- {
2391
- result = val[0]
2530
+ result = s(:array).line lexer.lineno
2392
2531
  }
2532
+ | assocs trailer
2393
2533
 
2394
2534
  assocs: assoc
2395
2535
  | assocs tCOMMA assoc
@@ -2403,22 +2543,27 @@ keyword_variable: kNIL { result = s(:nil) }
2403
2543
 
2404
2544
  assoc: arg_value tASSOC arg_value
2405
2545
  {
2406
- result = s(:array, val[0], val[2])
2546
+ v1, _, v2 = val
2547
+ result = s(:array, v1, v2).line v1.line
2407
2548
  }
2408
2549
  | tLABEL arg_value
2409
2550
  {
2410
- (label, _), arg = val
2411
- result = s(:array, s(:lit, label.to_sym), arg)
2551
+ (label, line), arg = val
2552
+
2553
+ lit = s(:lit, label.to_sym).line line
2554
+ result = s(:array, lit, arg).line line
2412
2555
  }
2413
2556
  | tSTRING_BEG string_contents tLABEL_END arg_value
2414
2557
  {
2415
2558
  _, sym, _, value = val
2416
2559
  sym.sexp_type = :dsym
2417
- result = s(:array, sym, value)
2560
+ result = s(:array, sym, value).line sym.line
2418
2561
  }
2419
2562
  | tDSTAR arg_value
2420
2563
  {
2421
- result = s(:array, s(:kwsplat, val[1]))
2564
+ _, arg = val
2565
+ line = arg.line
2566
+ result = s(:array, s(:kwsplat, arg).line(line)).line line
2422
2567
  }
2423
2568
 
2424
2569
  operation: tIDENTIFIER | tCONSTANT | tFID