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