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
@@ -274,28 +276,37 @@ rule
274
276
  }
275
277
  | command_call kRESCUE_MOD stmt
276
278
  {
277
- expr, _, resbody = val
279
+ expr, (_, line), resbody = val
280
+
278
281
  expr = value_expr expr
279
- result = new_rescue(expr, new_resbody(s(:array), resbody))
282
+ ary = s(:array).line line
283
+ result = new_rescue(expr, new_resbody(ary, resbody))
280
284
  }
281
285
  | command_asgn
282
286
 
283
287
  expr: command_call
284
288
  | expr kAND expr
285
289
  {
286
- result = logical_op :and, val[0], val[2]
290
+ lhs, _, rhs = val
291
+ result = logical_op :and, lhs, rhs
287
292
  }
288
293
  | expr kOR expr
289
294
  {
290
- result = logical_op :or, val[0], val[2]
295
+ lhs, _, rhs = val
296
+ result = logical_op :or, lhs, rhs
291
297
  }
292
298
  | kNOT opt_nl expr
293
299
  {
294
- result = s(:call, val[2], :"!")
300
+ (_, line), _, expr = val
301
+ result = new_call(expr, :"!").line line
302
+ # REFACTOR: call_uni_op
295
303
  }
296
304
  | tBANG command_call
297
305
  {
298
- result = s(:call, val[1], :"!")
306
+ _, cmd = val
307
+ result = new_call(cmd, :"!").line cmd.line
308
+ # TODO: fix line number to tBANG... but causes BAD shift/reduce conflict
309
+ # REFACTOR: call_uni_op -- see parse26.y
299
310
  }
300
311
  | arg
301
312
 
@@ -322,7 +333,8 @@ rule
322
333
  block_command: block_call
323
334
  | block_call call_op2 operation2 command_args
324
335
  {
325
- result = new_call val[0], val[2].to_sym, val[3]
336
+ blk, _, msg, args = val
337
+ result = new_call(blk, msg.to_sym, args).line blk.line
326
338
  }
327
339
 
328
340
  cmd_brace_block: tLBRACE_ARG
@@ -342,26 +354,32 @@ rule
342
354
 
343
355
  fcall: operation
344
356
  {
345
- result = new_call nil, val[0].to_sym
357
+ msg, = val
358
+ result = new_call(nil, msg.to_sym).line lexer.lineno
346
359
  }
347
360
 
348
361
  command: fcall command_args =tLOWEST
349
362
  {
350
- result = val[0].concat val[1].sexp_body # REFACTOR pattern
363
+ call, args = val
364
+ result = call.concat args.sexp_body
351
365
  }
352
366
  | fcall command_args cmd_brace_block
353
367
  {
354
- result = val[0].concat val[1].sexp_body
355
- if val[2] then
356
- block_dup_check result, val[2]
368
+ call, args, block = val
369
+
370
+ result = call.concat args.sexp_body
357
371
 
358
- result, operation = val[2], result
372
+ if block then
373
+ block_dup_check result, block
374
+
375
+ result, operation = block, result
359
376
  result.insert 1, operation
360
377
  end
361
378
  }
362
379
  | primary_value call_op operation2 command_args =tLOWEST
363
380
  {
364
- result = new_call val[0], val[2].to_sym, val[3], val[1]
381
+ lhs, callop, op, args = val
382
+ result = new_call lhs, op.to_sym, args, callop
365
383
  }
366
384
  | primary_value call_op operation2 command_args cmd_brace_block
367
385
  {
@@ -393,7 +411,9 @@ rule
393
411
  }
394
412
  | kYIELD command_args
395
413
  {
396
- result = new_yield val[1]
414
+ (_, line), args = val
415
+ result = new_yield args
416
+ result.line line # TODO: push to new_yield
397
417
  }
398
418
  | k_return call_args
399
419
  {
@@ -402,8 +422,8 @@ rule
402
422
  }
403
423
  | kBREAK call_args
404
424
  {
405
- line = val[0].last
406
- result = s(:break, ret_args(val[1])).line(line)
425
+ (_, line), args = val
426
+ result = s(:break, ret_args(args)).line line
407
427
  }
408
428
  | kNEXT call_args
409
429
  {
@@ -420,56 +440,79 @@ rule
420
440
  mlhs_inner: mlhs_basic
421
441
  | tLPAREN mlhs_inner rparen
422
442
  {
423
- result = s(:masgn, s(:array, val[1]))
443
+ _, arg, _ = val
444
+ l = arg.line
445
+
446
+ result = s(:masgn, s(:array, arg).line(l)).line l
424
447
  }
425
448
 
426
449
  mlhs_basic: mlhs_head
427
450
  {
428
- result = s(:masgn, val[0])
451
+ head, = val
452
+ result = s(:masgn, head).line head.line
429
453
  }
430
454
  | mlhs_head mlhs_item
431
455
  {
432
- result = s(:masgn, val[0] << val[1].compact)
456
+ lhs, rhs = val
457
+ result = s(:masgn, lhs << rhs.compact).line lhs.line
433
458
  }
434
459
  | mlhs_head tSTAR mlhs_node
435
460
  {
436
- result = s(:masgn, val[0] << s(:splat, val[2]))
461
+ head, _, tail = val
462
+ head << s(:splat, tail).line(tail.line)
463
+ result = s(:masgn, head).line head.line
437
464
  }
438
465
  | mlhs_head tSTAR mlhs_node tCOMMA mlhs_post
439
466
  {
440
467
  ary1, _, splat, _, ary2 = val
441
468
 
442
- result = list_append ary1, s(:splat, splat)
469
+ result = list_append ary1, s(:splat, splat).line(splat.line)
443
470
  result.concat ary2.sexp_body
444
- result = s(:masgn, result)
471
+ result = s(:masgn, result).line result.line
445
472
  }
446
473
  | mlhs_head tSTAR
447
474
  {
448
- result = s(:masgn, val[0] << s(:splat))
475
+ head, _ = val
476
+ l = head.line
477
+ result = s(:masgn, head << s(:splat).line(l)).line l
449
478
  }
450
479
  | mlhs_head tSTAR tCOMMA mlhs_post
451
480
  {
452
- ary = list_append val[0], s(:splat)
453
- ary.concat val[3].sexp_body
454
- result = s(:masgn, ary)
481
+ head, _, _, post = val
482
+ ary = list_append head, s(:splat).line(head.line)
483
+ ary.concat post.sexp_body
484
+ result = s(:masgn, ary).line ary.line
455
485
  }
456
486
  | tSTAR mlhs_node
457
487
  {
458
- result = s(:masgn, s(:array, s(:splat, val[1])))
488
+ _, node = val
489
+ l = node.line
490
+ splat = s(:splat, node).line l
491
+ ary = s(:array, splat).line l
492
+ result = s(:masgn, ary).line l
459
493
  }
460
494
  | tSTAR mlhs_node tCOMMA mlhs_post
461
495
  {
462
- ary = s(:array, s(:splat, val[1]))
463
- ary.concat val[3].sexp_body
464
- result = s(:masgn, ary)
496
+ _, node, _, post = val
497
+
498
+ splat = s(:splat, node).line node.line
499
+ ary = s(:array, splat).line splat.line
500
+ ary.concat post.sexp_body
501
+ result = s(:masgn, ary).line ary.line
465
502
  }
466
503
  | tSTAR
467
504
  {
468
- result = s(:masgn, s(:array, s(:splat)))
505
+ l = lexer.lineno
506
+ result = s(:masgn, s(:array, s(:splat).line(l)).line(l)).line l
469
507
  }
470
508
  | tSTAR tCOMMA mlhs_post
471
509
  {
472
- result = s(:masgn, s(:array, s(:splat), *val[2].sexp_body))
510
+ _, _, post = val
511
+ l = post.line
512
+
513
+ splat = s(:splat).line l
514
+ ary = s(:array, splat, *post.sexp_body).line l
515
+ result = s(:masgn, ary).line l
473
516
  }
474
517
 
475
518
  mlhs_item: mlhs_node
@@ -480,7 +523,8 @@ rule
480
523
 
481
524
  mlhs_head: mlhs_item tCOMMA
482
525
  {
483
- result = s(:array, val[0])
526
+ lhs, _ = val
527
+ result = s(:array, lhs).line lhs.line
484
528
  }
485
529
  | mlhs_head mlhs_item tCOMMA
486
530
  {
@@ -489,7 +533,8 @@ rule
489
533
 
490
534
  mlhs_post: mlhs_item
491
535
  {
492
- result = s(:array, val[0])
536
+ item, = val
537
+ result = s(:array, item).line item.line
493
538
  }
494
539
  | mlhs_post tCOMMA mlhs_item
495
540
  {
@@ -514,7 +559,8 @@ rule
514
559
  }
515
560
  | primary_value tCOLON2 tIDENTIFIER
516
561
  {
517
- result = s(:attrasgn, val[0], :"#{val[2]}=")
562
+ recv, _, id = val
563
+ result = new_attrasgn recv, id
518
564
  }
519
565
  | primary_value call_op tCONSTANT
520
566
  {
@@ -527,7 +573,10 @@ rule
527
573
  yyerror "dynamic constant assignment"
528
574
  end
529
575
 
530
- result = s(:const, s(:colon2, val[0], val[2].to_sym), nil)
576
+ expr, _, id = val
577
+ l = expr.line
578
+
579
+ result = s(:const, s(:colon2, expr, id.to_sym).line(l), nil).line l
531
580
  }
532
581
  | tCOLON3 tCONSTANT
533
582
  {
@@ -536,7 +585,10 @@ rule
536
585
  yyerror "dynamic constant assignment"
537
586
  end
538
587
 
539
- result = s(:const, nil, s(:colon3, val[1].to_sym))
588
+ _, id = val
589
+ l = lexer.lineno
590
+
591
+ result = s(:const, nil, s(:colon3, id.to_sym).line(l)).line l
540
592
  }
541
593
  | backref
542
594
  {
@@ -545,24 +597,31 @@ rule
545
597
 
546
598
  lhs: user_variable
547
599
  {
600
+ line = lexer.lineno
548
601
  result = self.assignable val[0]
602
+ result.line = line
549
603
  }
550
604
  | keyword_variable
551
605
  {
606
+ line = lexer.lineno
552
607
  result = self.assignable val[0]
608
+ result.line = line
553
609
  debug20 9, val, result
554
610
  }
555
611
  | primary_value tLBRACK2 opt_call_args rbracket
556
612
  {
557
- result = self.aryset val[0], val[2]
613
+ lhs, _, args, _ = val
614
+ result = self.aryset lhs, args
558
615
  }
559
616
  | primary_value call_op tIDENTIFIER # REFACTOR
560
617
  {
561
- result = new_attrasgn val[0], val[2], val[1]
618
+ lhs, op, id = val
619
+ result = new_attrasgn lhs, id, op
562
620
  }
563
621
  | primary_value tCOLON2 tIDENTIFIER
564
622
  {
565
- result = s(:attrasgn, val[0], :"#{val[2]}=")
623
+ lhs, _, id = val
624
+ result = new_attrasgn lhs, id
566
625
  }
567
626
  | primary_value call_op tCONSTANT # REFACTOR?
568
627
  {
@@ -570,21 +629,27 @@ rule
570
629
  }
571
630
  | primary_value tCOLON2 tCONSTANT
572
631
  {
632
+ expr, _, id = val
633
+
573
634
  if (self.in_def || self.in_single > 0) then
574
635
  debug20 10
575
636
  yyerror "dynamic constant assignment"
576
637
  end
577
638
 
578
- result = s(:const, s(:colon2, val[0], val[2].to_sym))
639
+ l = expr.line
640
+ result = s(:const, s(:colon2, expr, id.to_sym).line(l)).line l
579
641
  }
580
642
  | tCOLON3 tCONSTANT
581
643
  {
644
+ _, id = val
645
+
582
646
  if (self.in_def || self.in_single > 0) then
583
647
  debug20 11
584
648
  yyerror "dynamic constant assignment"
585
649
  end
586
650
 
587
- result = s(:const, s(:colon3, val[1].to_sym))
651
+ l = lexer.lineno
652
+ result = s(:const, s(:colon3, id.to_sym).line(l)).line l
588
653
  }
589
654
  | backref
590
655
  {
@@ -599,7 +664,8 @@ rule
599
664
 
600
665
  cpath: tCOLON3 cname
601
666
  {
602
- result = s(:colon3, val[1].to_sym)
667
+ _, name = val
668
+ result = s(:colon3, name.to_sym).line lexer.lineno
603
669
  }
604
670
  | cname
605
671
  {
@@ -607,7 +673,10 @@ rule
607
673
  }
608
674
  | primary_value tCOLON2 cname
609
675
  {
610
- result = s(:colon2, val[0], val[2].to_sym)
676
+ pval, _, name = val
677
+
678
+ result = s(:colon2, pval, name.to_sym)
679
+ result.line pval.line
611
680
  }
612
681
 
613
682
  fname: tIDENTIFIER | tCONSTANT | tFID
@@ -628,7 +697,8 @@ rule
628
697
 
629
698
  fitem: fsym
630
699
  {
631
- result = s(:lit, val[0].to_sym)
700
+ id, = val
701
+ result = s(:lit, id.to_sym).line lexer.lineno
632
702
  }
633
703
  | dsym
634
704
 
@@ -651,6 +721,7 @@ rule
651
721
  | tNEQ | tLSHFT | tRSHFT | tPLUS | tMINUS | tSTAR2
652
722
  | tSTAR | tDIVIDE | tPERCENT | tPOW | tDSTAR | tBANG | tTILDE
653
723
  | tUPLUS | tUMINUS | tAREF | tASET | tBACK_REF2
724
+ # TODO: tUBANG dead?
654
725
  | tUBANG
655
726
 
656
727
  reswords: k__LINE__ | k__FILE__ | k__ENCODING__ | klBEGIN | klEND
@@ -673,8 +744,7 @@ rule
673
744
  }
674
745
  | primary_value tLBRACK2 opt_call_args rbracket tOP_ASGN arg_rhs
675
746
  {
676
- val[2].sexp_type = :arglist if val[2]
677
- result = s(:op_asgn1, val[0], val[2], val[4].to_sym, val[5])
747
+ result = new_op_asgn1 val
678
748
  }
679
749
  | primary_value call_op tIDENTIFIER tOP_ASGN arg_rhs
680
750
  {
@@ -686,7 +756,9 @@ rule
686
756
  }
687
757
  | primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
688
758
  {
689
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
759
+ lhs, _, id, op, rhs = val
760
+
761
+ result = s(:op_asgn, lhs, rhs, id.to_sym, op.to_sym).line lhs.line
690
762
  }
691
763
  | primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
692
764
  {
@@ -716,18 +788,18 @@ rule
716
788
  {
717
789
  v1, v2 = val[0], val[2]
718
790
  if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
719
- result = s(:lit, (v1.last)..(v2.last))
791
+ result = s(:lit, (v1.last)..(v2.last)).line v1.line
720
792
  else
721
- result = s(:dot2, v1, v2)
793
+ result = s(:dot2, v1, v2).line v1.line
722
794
  end
723
795
  }
724
796
  | arg tDOT3 arg
725
797
  {
726
798
  v1, v2 = val[0], val[2]
727
799
  if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
728
- result = s(:lit, (v1.last)...(v2.last))
800
+ result = s(:lit, (v1.last)...(v2.last)).line v1.line
729
801
  else
730
- result = s(:dot3, v1, v2)
802
+ result = s(:dot3, v1, v2).line v1.line
731
803
  end
732
804
  }
733
805
  | arg tPLUS arg
@@ -756,7 +828,9 @@ rule
756
828
  }
757
829
  | tUMINUS_NUM simple_numeric tPOW arg
758
830
  {
759
- result = new_call(new_call(s(:lit, val[1]), :"**", argl(val[3])), :"-@")
831
+ lit = s(:lit, val[1]).line lexer.lineno
832
+ result = new_call(new_call(lit, :"**", argl(val[3])), :"-@")
833
+
760
834
  }
761
835
  | tUPLUS arg
762
836
  {
@@ -797,15 +871,19 @@ rule
797
871
  }
798
872
  | arg tMATCH arg
799
873
  {
800
- result = new_match val[0], val[2]
874
+ lhs, _, rhs = val
875
+ result = new_match lhs, rhs
801
876
  }
802
877
  | arg tNMATCH arg
803
878
  {
804
- result = s(:not, new_match(val[0], val[2]))
879
+ lhs, _, rhs = val
880
+ result = s(:not, new_match(lhs, rhs)).line lhs.line
805
881
  }
806
882
  | tBANG arg
807
883
  {
808
- result = new_call val[1], :"!"
884
+ _, arg = val
885
+ result = new_call arg, :"!"
886
+ result.line arg.line
809
887
  }
810
888
  | tTILDE arg
811
889
  {
@@ -833,11 +911,13 @@ rule
833
911
  }
834
912
  | kDEFINED opt_nl arg
835
913
  {
836
- result = s(:defined, val[2])
914
+ (_, line), _, arg = val
915
+ result = s(:defined, arg).line line
837
916
  }
838
917
  | arg tEH arg opt_nl tCOLON arg
839
918
  {
840
- result = s(:if, val[0], val[2], val[5])
919
+ c, _, t, _, _, f = val
920
+ result = s(:if, c, t, f).line c.line
841
921
  }
842
922
  | primary
843
923
 
@@ -880,28 +960,25 @@ rule
880
960
  arg_rhs: arg =tOP_ASGN
881
961
  | arg kRESCUE_MOD arg
882
962
  {
883
- body, _, resbody = val
963
+ body, (_, line), resbody = val
884
964
  body = value_expr body
885
965
  resbody = remove_begin resbody
886
- result = new_rescue(body, new_resbody(s(:array), resbody))
966
+
967
+ ary = s(:array).line line
968
+ result = new_rescue(body, new_resbody(ary, resbody))
887
969
  }
888
970
 
889
971
  paren_args: tLPAREN2 opt_call_args rparen
890
972
  {
891
- result = val[1]
973
+ _, args, _ = val
974
+ result = args
892
975
  }
893
976
 
894
977
  opt_paren_args: none
895
978
  | paren_args
896
979
 
897
980
  opt_call_args: none
898
- {
899
- result = val[0]
900
- }
901
981
  | call_args
902
- {
903
- result = val[0]
904
- }
905
982
  | args tCOMMA
906
983
  {
907
984
  result = args val
@@ -951,7 +1028,8 @@ rule
951
1028
 
952
1029
  block_arg: tAMPER arg_value
953
1030
  {
954
- result = s(:block_pass, val[1])
1031
+ _, arg = val
1032
+ result = s(:block_pass, arg).line arg.line
955
1033
  }
956
1034
 
957
1035
  opt_block_arg: tCOMMA block_arg
@@ -962,19 +1040,24 @@ rule
962
1040
 
963
1041
  args: arg_value
964
1042
  {
965
- result = s(:array, val[0])
1043
+ arg, = val
1044
+
1045
+ result = s(:array, arg).line arg.line
966
1046
  }
967
1047
  | tSTAR arg_value
968
1048
  {
969
- result = s(:array, s(:splat, val[1]))
1049
+ _, arg = val
1050
+ result = s(:array, s(:splat, arg).line(arg.line)).line arg.line
970
1051
  }
971
1052
  | args tCOMMA arg_value
972
1053
  {
973
- result = self.list_append val[0], val[2]
1054
+ args, _, id = val
1055
+ result = self.list_append args, id
974
1056
  }
975
- | args tCOMMA tSTAR arg_value
1057
+ | args tCOMMA tSTAR { result = lexer.lineno } arg_value
976
1058
  {
977
- result = self.list_append val[0], s(:splat, val[3])
1059
+ args, _, _, line, id = val
1060
+ result = self.list_append args, s(:splat, id).line(line)
978
1061
  }
979
1062
 
980
1063
  mrhs_arg: mrhs
@@ -992,11 +1075,15 @@ rule
992
1075
  }
993
1076
  | args tCOMMA tSTAR arg_value
994
1077
  {
995
- result = self.arg_concat val[0], val[3]
1078
+ # FIX: bad shift/reduce conflict with rhs' comma star prod
1079
+ # TODO: make all tXXXX terminals include lexer.lineno
1080
+ arg, _, _, splat = val
1081
+ result = self.arg_concat arg, splat
996
1082
  }
997
1083
  | tSTAR arg_value
998
1084
  {
999
- result = s(:splat, val[1])
1085
+ _, arg = val
1086
+ result = s(:splat, arg).line arg.line
1000
1087
  }
1001
1088
 
1002
1089
  primary: literal
@@ -1011,7 +1098,8 @@ rule
1011
1098
  | backref
1012
1099
  | tFID
1013
1100
  {
1014
- result = new_call nil, val[0].to_sym
1101
+ msg, = val
1102
+ result = new_call nil, msg.to_sym
1015
1103
  }
1016
1104
  | k_begin
1017
1105
  {
@@ -1031,16 +1119,19 @@ rule
1031
1119
 
1032
1120
  result.line = val[1]
1033
1121
  }
1034
- | tLPAREN_ARG rparen
1122
+ | tLPAREN_ARG
1035
1123
  {
1036
- # TODO: lex_state = EXPR_ENDARG in between
1037
- debug20 13, val, result
1124
+ lexer.lex_state = EXPR_ENDARG
1125
+ result = lexer.lineno
1126
+ }
1127
+ rparen
1128
+ {
1129
+ _, line, _ = val
1130
+ result = s(:begin).line line
1038
1131
  }
1039
1132
  | tLPAREN_ARG
1040
1133
  {
1041
1134
  result = lexer.cmdarg.store false
1042
- # result = self.lexer.cmdarg.stack.dup
1043
- # lexer.cmdarg.stack.replace [false] # TODO add api for these
1044
1135
  }
1045
1136
  stmt
1046
1137
  {
@@ -1055,21 +1146,29 @@ rule
1055
1146
  }
1056
1147
  | tLPAREN compstmt tRPAREN
1057
1148
  {
1058
- result = val[1] || s(:nil)
1149
+ _, stmt, _ = val
1150
+ result = stmt
1151
+ result ||= s(:nil).line lexer.lineno
1059
1152
  result.paren = true
1060
1153
  }
1061
1154
  | primary_value tCOLON2 tCONSTANT
1062
1155
  {
1063
- result = s(:colon2, val[0], val[2].to_sym)
1156
+ expr, _, id = val
1157
+
1158
+ result = s(:colon2, expr, id.to_sym).line expr.line
1064
1159
  }
1065
1160
  | tCOLON3 tCONSTANT
1066
1161
  {
1067
- result = s(:colon3, val[1].to_sym)
1162
+ _, id = val
1163
+
1164
+ result = s(:colon3, id.to_sym).line lexer.lineno
1068
1165
  }
1069
- | tLBRACK aref_args tRBRACK
1166
+ | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1070
1167
  {
1071
- result = val[1] || s(:array)
1168
+ _, line, args, _ = val
1169
+ result = args || s(:array)
1072
1170
  result.sexp_type = :array # aref_args is :args
1171
+ result.line line
1073
1172
  }
1074
1173
  | tLBRACE
1075
1174
  {
@@ -1081,7 +1180,8 @@ rule
1081
1180
  }
1082
1181
  | k_return
1083
1182
  {
1084
- result = s(:return)
1183
+ (_, line), = val
1184
+ result = s(:return).line line
1085
1185
  }
1086
1186
  | kYIELD tLPAREN2 call_args rparen
1087
1187
  {
@@ -1097,11 +1197,14 @@ rule
1097
1197
  }
1098
1198
  | kDEFINED opt_nl tLPAREN2 expr rparen
1099
1199
  {
1100
- result = s(:defined, val[3])
1200
+ (_, line), _, _, arg, _ = val
1201
+
1202
+ result = s(:defined, arg).line line
1101
1203
  }
1102
1204
  | kNOT tLPAREN2 expr rparen
1103
1205
  {
1104
- result = s(:call, val[2], :"!")
1206
+ _, _, lhs, _ = val
1207
+ result = new_call lhs, :"!"
1105
1208
  }
1106
1209
  | kNOT tLPAREN2 rparen
1107
1210
  {
@@ -1109,11 +1212,11 @@ rule
1109
1212
  }
1110
1213
  | fcall brace_block
1111
1214
  {
1112
- oper, iter = val[0], val[1]
1113
- call = oper # FIX
1215
+ call, iter = val
1216
+
1114
1217
  iter.insert 1, call
1115
1218
  result = iter
1116
- call.line = iter.line
1219
+ # FIX: probably not: call.line = iter.line
1117
1220
  }
1118
1221
  | method_call
1119
1222
  | method_call brace_block
@@ -1230,7 +1333,7 @@ rule
1230
1333
  # TODO: port local_push_gen and local_pop_gen
1231
1334
  lexer.cmdarg.stack.replace [false]
1232
1335
  }
1233
- f_arglist bodystmt k_end
1336
+ f_arglist bodystmt { result = lexer.lineno } k_end
1234
1337
  {
1235
1338
  in_def, cmdarg = val[2]
1236
1339
 
@@ -1256,9 +1359,8 @@ rule
1256
1359
  }
1257
1360
  f_arglist bodystmt k_end
1258
1361
  {
1259
- line, cmdarg = val[5]
1362
+ _, cmdarg = val[5]
1260
1363
  result = new_defs val
1261
- result[3].line line
1262
1364
 
1263
1365
  lexer.cmdarg.stack.replace cmdarg
1264
1366
 
@@ -1268,19 +1370,23 @@ rule
1268
1370
  }
1269
1371
  | kBREAK
1270
1372
  {
1271
- result = s(:break)
1373
+ (_, line), = val
1374
+ result = s(:break).line line
1272
1375
  }
1273
1376
  | kNEXT
1274
1377
  {
1275
- result = s(:next)
1378
+ (_, line), = val
1379
+ result = s(:next).line line
1276
1380
  }
1277
1381
  | kREDO
1278
1382
  {
1279
- result = s(:redo)
1383
+ (_, line), = val
1384
+ result = s(:redo).line line
1280
1385
  }
1281
1386
  | kRETRY
1282
1387
  {
1283
- result = s(:retry)
1388
+ (_, line), = val
1389
+ result = s(:retry).line line
1284
1390
  }
1285
1391
 
1286
1392
  primary_value: primary
@@ -1319,7 +1425,9 @@ rule
1319
1425
  if_tail: opt_else
1320
1426
  | k_elsif expr_value then compstmt if_tail
1321
1427
  {
1322
- result = s(:if, val[1], val[3], val[4])
1428
+ (_, line), c, _, t, rest = val
1429
+
1430
+ result = s(:if, c, t, rest).line line
1323
1431
  }
1324
1432
 
1325
1433
  opt_else: none
@@ -1342,7 +1450,9 @@ rule
1342
1450
 
1343
1451
  f_marg_list: f_marg
1344
1452
  {
1345
- result = s(:array, val[0])
1453
+ sym, = val
1454
+
1455
+ result = s(:array, sym).line lexer.lineno
1346
1456
  }
1347
1457
  | f_marg_list tCOMMA f_marg
1348
1458
  {
@@ -1416,7 +1526,9 @@ rule
1416
1526
  }
1417
1527
  | f_block_arg
1418
1528
  {
1419
- result = call_args val
1529
+ line = lexer.lineno
1530
+ result = call_args val # TODO: push line down
1531
+ result.line line
1420
1532
  }
1421
1533
 
1422
1534
  opt_block_args_tail: tCOMMA block_args_tail
@@ -1447,7 +1559,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1447
1559
  }
1448
1560
  | f_arg tCOMMA
1449
1561
  {
1450
- result = args val
1562
+ result = args(val) << nil
1451
1563
  }
1452
1564
  | f_arg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
1453
1565
  {
@@ -1499,7 +1611,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1499
1611
  }
1500
1612
  | tOROP
1501
1613
  {
1502
- result = s(:args)
1614
+ result = s(:args).line lexer.lineno
1503
1615
  }
1504
1616
  | tPIPE block_param opt_bv_decl tPIPE
1505
1617
  {
@@ -1524,33 +1636,33 @@ opt_block_args_tail: tCOMMA block_args_tail
1524
1636
 
1525
1637
  bvar: tIDENTIFIER
1526
1638
  {
1527
- result = s(:shadow, val[0].to_sym)
1639
+ id, = val
1640
+ line = lexer.lineno
1641
+ result = s(:shadow, id.to_sym).line line
1528
1642
  }
1529
1643
  | f_bad_arg
1530
1644
 
1531
1645
  lambda: {
1532
1646
  self.env.extend :dynamic
1533
- result = self.lexer.lineno
1534
-
1535
- result = lexer.lpar_beg
1647
+ result = [lexer.lineno, lexer.lpar_beg]
1536
1648
  lexer.paren_nest += 1
1537
1649
  lexer.lpar_beg = lexer.paren_nest
1538
1650
  }
1539
1651
  f_larglist
1540
1652
  {
1541
- result = [lexer.cmdarg.store(false), self.lexer.lineno]
1653
+ result = lexer.cmdarg.store(false)
1542
1654
  }
1543
1655
  lambda_body
1544
1656
  {
1545
- lpar, args, (cmdarg, lineno), body = val
1657
+ (line, lpar), args, cmdarg, body = val
1546
1658
  lexer.lpar_beg = lpar
1547
1659
 
1548
1660
  lexer.cmdarg.restore cmdarg
1549
1661
  lexer.cmdarg.lexpop
1550
1662
 
1551
- call = new_call nil, :lambda
1663
+ call = s(:lambda).line line
1552
1664
  result = new_iter call, args, body
1553
- result.line = lineno
1665
+ result.line = line
1554
1666
  self.env.unextend
1555
1667
  }
1556
1668
 
@@ -1575,8 +1687,8 @@ opt_block_args_tail: tCOMMA block_args_tail
1575
1687
 
1576
1688
  do_block: k_do_block do_body kEND
1577
1689
  {
1578
- # TODO: maybe fix lineno to kDO's lineno?
1579
- result = val[1]
1690
+ (_, line), iter, _ = val
1691
+ result = iter.line line
1580
1692
  }
1581
1693
 
1582
1694
  block_call: command do_block
@@ -1590,8 +1702,10 @@ opt_block_args_tail: tCOMMA block_args_tail
1590
1702
 
1591
1703
  val = invert_block_call val if inverted? val
1592
1704
 
1593
- result = val[1]
1594
- result.insert 1, val[0]
1705
+ cmd, blk = val
1706
+
1707
+ result = blk
1708
+ result.insert 1, cmd
1595
1709
  }
1596
1710
  | block_call call_op2 operation2 opt_paren_args
1597
1711
  {
@@ -1622,8 +1736,10 @@ opt_block_args_tail: tCOMMA block_args_tail
1622
1736
  }
1623
1737
  paren_args
1624
1738
  {
1625
- args = self.call_args val[2..-1]
1626
- result = val[0].concat args.sexp_body
1739
+ call, lineno, args = val
1740
+
1741
+ result = call.concat args.sexp_body if args
1742
+ result.line lineno
1627
1743
  }
1628
1744
  | primary_value call_op operation2 opt_paren_args
1629
1745
  {
@@ -1651,7 +1767,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1651
1767
  }
1652
1768
  | kSUPER
1653
1769
  {
1654
- result = s(:zsuper)
1770
+ result = s(:zsuper).line lexer.lineno
1655
1771
  }
1656
1772
  | primary_value tLBRACK2 opt_call_args rbracket
1657
1773
  {
@@ -1729,7 +1845,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1729
1845
  (_, line), klasses, var, _, body, rest = val
1730
1846
 
1731
1847
  klasses ||= s(:array)
1732
- klasses << new_assign(var, s(:gvar, :"$!")) if var
1848
+ klasses << new_assign(var, s(:gvar, :"$!").line(var.line)) if var
1733
1849
  klasses.line line
1734
1850
 
1735
1851
  result = new_resbody(klasses, body)
@@ -1742,7 +1858,8 @@ opt_block_args_tail: tCOMMA block_args_tail
1742
1858
 
1743
1859
  exc_list: arg_value
1744
1860
  {
1745
- result = s(:array, val[0])
1861
+ arg, = val
1862
+ result = s(:array, arg).line arg.line
1746
1863
  }
1747
1864
  | mrhs
1748
1865
  | none
@@ -1755,26 +1872,31 @@ opt_block_args_tail: tCOMMA block_args_tail
1755
1872
 
1756
1873
  opt_ensure: k_ensure compstmt
1757
1874
  {
1758
- _, body = val
1875
+ (_, line), body = val
1759
1876
 
1760
- result = body || s(:nil)
1877
+ result = body || s(:nil).line(line)
1761
1878
  }
1762
1879
  | none
1763
1880
 
1764
1881
  literal: numeric
1765
1882
  {
1883
+ line = lexer.lineno
1766
1884
  result = s(:lit, val[0])
1885
+ result.line = line
1767
1886
  }
1768
1887
  | symbol
1769
1888
  {
1889
+ line = lexer.lineno
1770
1890
  result = s(:lit, val[0])
1891
+ result.line = line
1771
1892
  }
1772
1893
  | dsym
1773
1894
 
1774
1895
  strings: string
1775
1896
  {
1776
- val[0] = s(:dstr, val[0].value) if val[0].sexp_type == :evstr
1777
- result = val[0]
1897
+ str, = val
1898
+ str = s(:dstr, str.value) if str.sexp_type == :evstr
1899
+ result = str
1778
1900
  }
1779
1901
 
1780
1902
  string: tCHAR
@@ -1789,7 +1911,11 @@ opt_block_args_tail: tCOMMA block_args_tail
1789
1911
 
1790
1912
  string1: tSTRING_BEG string_contents tSTRING_END
1791
1913
  {
1792
- result = val[1]
1914
+ _, str, (_, func) = val
1915
+
1916
+ str = dedent str if func =~ RubyLexer::STR_FUNC_ICNTNT
1917
+
1918
+ result = str
1793
1919
  }
1794
1920
  | tSTRING
1795
1921
  {
@@ -1799,6 +1925,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1799
1925
  xstring: tXSTRING_BEG xstring_contents tSTRING_END
1800
1926
  {
1801
1927
  result = new_xstring val[1]
1928
+ # TODO: dedent?!?! SERIOUSLY?!?
1802
1929
  }
1803
1930
 
1804
1931
  regexp: tREGEXP_BEG regexp_contents tREGEXP_END
@@ -1808,7 +1935,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1808
1935
 
1809
1936
  words: tWORDS_BEG tSPACE tSTRING_END
1810
1937
  {
1811
- result = s(:array)
1938
+ result = s(:array).line lexer.lineno
1812
1939
  }
1813
1940
  | tWORDS_BEG word_list tSTRING_END
1814
1941
  {
@@ -1832,25 +1959,28 @@ opt_block_args_tail: tCOMMA block_args_tail
1832
1959
 
1833
1960
  symbols: tSYMBOLS_BEG tSPACE tSTRING_END
1834
1961
  {
1835
- result = s(:array)
1962
+ result = s(:array).line lexer.lineno
1836
1963
  }
1837
- | tSYMBOLS_BEG symbol_list tSTRING_END
1964
+ | tSYMBOLS_BEG { result = lexer.lineno } symbol_list tSTRING_END
1838
1965
  {
1839
- result = val[1]
1966
+ _, line, list, _, = val
1967
+ list.line = line
1968
+ result = list
1840
1969
  }
1841
1970
 
1842
1971
  symbol_list: none
1843
1972
  {
1844
- result = new_symbol_list
1973
+ result = new_symbol_list.line lexer.lineno
1845
1974
  }
1846
1975
  | symbol_list word tSPACE
1847
1976
  {
1848
- result = val[0].dup << new_symbol_list_entry(val)
1977
+ list, * = val
1978
+ result = list.dup << new_symbol_list_entry(val)
1849
1979
  }
1850
1980
 
1851
1981
  qwords: tQWORDS_BEG tSPACE tSTRING_END
1852
1982
  {
1853
- result = s(:array)
1983
+ result = s(:array).line lexer.lineno
1854
1984
  }
1855
1985
  | tQWORDS_BEG qword_list tSTRING_END
1856
1986
  {
@@ -1859,7 +1989,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1859
1989
 
1860
1990
  qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
1861
1991
  {
1862
- result = s(:array)
1992
+ result = s(:array).line lexer.lineno # FIX
1863
1993
  }
1864
1994
  | tQSYMBOLS_BEG qsym_list tSTRING_END
1865
1995
  {
@@ -1886,11 +2016,12 @@ opt_block_args_tail: tCOMMA block_args_tail
1886
2016
 
1887
2017
  string_contents: none
1888
2018
  {
1889
- result = s(:str, "")
2019
+ result = s(:str, "").line lexer.lineno
1890
2020
  }
1891
2021
  | string_contents string_content
1892
2022
  {
1893
- result = literal_concat(val[0], val[1])
2023
+ v1, v2 = val
2024
+ result = literal_concat v1, v2
1894
2025
  }
1895
2026
 
1896
2027
  xstring_contents: none
@@ -1899,7 +2030,8 @@ xstring_contents: none
1899
2030
  }
1900
2031
  | xstring_contents string_content
1901
2032
  {
1902
- result = literal_concat(val[0], val[1])
2033
+ v1, v2 = val
2034
+ result = literal_concat v1, v2
1903
2035
  }
1904
2036
 
1905
2037
  regexp_contents: none
@@ -1908,7 +2040,8 @@ regexp_contents: none
1908
2040
  }
1909
2041
  | regexp_contents string_content
1910
2042
  {
1911
- result = literal_concat(val[0], val[1])
2043
+ v1, v2 = val
2044
+ result = literal_concat v1, v2
1912
2045
  }
1913
2046
 
1914
2047
  string_content: tSTRING_CONTENT
@@ -1924,8 +2057,9 @@ regexp_contents: none
1924
2057
  }
1925
2058
  string_dvar
1926
2059
  {
1927
- lexer.lex_strterm = val[1]
1928
- result = s(:evstr, val[2])
2060
+ _, strterm, str = val
2061
+ lexer.lex_strterm = strterm
2062
+ result = s(:evstr, str).line str.line
1929
2063
  }
1930
2064
  | tSTRING_DBEG
1931
2065
  {
@@ -1935,6 +2069,7 @@ regexp_contents: none
1935
2069
  lexer.cond.store,
1936
2070
  lexer.cmdarg.store,
1937
2071
  lexer.lex_state,
2072
+ lexer.lineno,
1938
2073
  ]
1939
2074
 
1940
2075
  lexer.lex_strterm = nil
@@ -1948,7 +2083,7 @@ regexp_contents: none
1948
2083
  {
1949
2084
  _, memo, stmt, _ = val
1950
2085
 
1951
- lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state = memo
2086
+ lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state, line = memo
1952
2087
 
1953
2088
  lexer.lex_strterm = lex_strterm
1954
2089
  lexer.brace_nest = brace_nest
@@ -1965,19 +2100,19 @@ regexp_contents: none
1965
2100
  when :str, :dstr, :evstr then
1966
2101
  result = stmt
1967
2102
  else
1968
- result = s(:evstr, stmt)
2103
+ result = s(:evstr, stmt).line line
1969
2104
  end
1970
2105
  when nil then
1971
- result = s(:evstr)
2106
+ result = s(:evstr).line line
1972
2107
  else
1973
2108
  debug20 25
1974
2109
  raise "unknown string body: #{stmt.inspect}"
1975
2110
  end
1976
2111
  }
1977
2112
 
1978
- string_dvar: tGVAR { result = s(:gvar, val[0].to_sym) }
1979
- | tIVAR { result = s(:ivar, val[0].to_sym) }
1980
- | tCVAR { result = s(:cvar, val[0].to_sym) }
2113
+ string_dvar: tGVAR { result = s(:gvar, val[0].to_sym).line lexer.lineno }
2114
+ | tIVAR { result = s(:ivar, val[0].to_sym).line lexer.lineno }
2115
+ | tCVAR { result = s(:cvar, val[0].to_sym).line lexer.lineno }
1981
2116
  | backref
1982
2117
 
1983
2118
  symbol: tSYMBEG sym
@@ -1994,18 +2129,19 @@ regexp_contents: none
1994
2129
 
1995
2130
  dsym: tSYMBEG xstring_contents tSTRING_END
1996
2131
  {
2132
+ _, result, _ = val
2133
+
1997
2134
  lexer.lex_state = EXPR_END
1998
- result = val[1]
1999
2135
 
2000
- result ||= s(:str, "")
2136
+ result ||= s(:str, "").line lexer.lineno
2001
2137
 
2002
2138
  case result.sexp_type
2003
2139
  when :dstr then
2004
2140
  result.sexp_type = :dsym
2005
2141
  when :str then
2006
- result = s(:lit, result.last.to_sym)
2142
+ result = s(:lit, result.last.to_sym).line result.line
2007
2143
  when :evstr then
2008
- result = s(:dsym, "", result)
2144
+ result = s(:dsym, "", result).line result.line
2009
2145
  else
2010
2146
  debug20 26, val, result
2011
2147
  end
@@ -2028,19 +2164,20 @@ regexp_contents: none
2028
2164
  | tCONSTANT
2029
2165
  | tCVAR
2030
2166
 
2031
- keyword_variable: kNIL { result = s(:nil) }
2032
- | kSELF { result = s(:self) }
2033
- | kTRUE { result = s(:true) }
2034
- | kFALSE { result = s(:false) }
2035
- | k__FILE__ { result = s(:str, self.file) }
2036
- | k__LINE__ { result = s(:lit, lexer.lineno) }
2167
+ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2168
+ | kSELF { result = s(:self).line lexer.lineno }
2169
+ | kTRUE { result = s(:true).line lexer.lineno }
2170
+ | kFALSE { result = s(:false).line lexer.lineno }
2171
+ | k__FILE__ { result = s(:str, self.file).line lexer.lineno }
2172
+ | k__LINE__ { result = s(:lit, lexer.lineno).line lexer.lineno }
2037
2173
  | k__ENCODING__
2038
2174
  {
2175
+ l = lexer.lineno
2039
2176
  result =
2040
2177
  if defined? Encoding then
2041
- s(:colon2, s(:const, :Encoding), :UTF_8)
2178
+ s(:colon2, s(:const, :Encoding).line(l), :UTF_8).line l
2042
2179
  else
2043
- s(:str, "Unsupported!")
2180
+ s(:str, "Unsupported!").line l
2044
2181
  end
2045
2182
  }
2046
2183
 
@@ -2065,8 +2202,8 @@ keyword_variable: kNIL { result = s(:nil) }
2065
2202
  debug20 29, val, result
2066
2203
  }
2067
2204
 
2068
- backref: tNTH_REF { result = s(:nth_ref, val[0]) }
2069
- | tBACK_REF { result = s(:back_ref, val[0]) }
2205
+ backref: tNTH_REF { result = s(:nth_ref, val[0]).line lexer.lineno }
2206
+ | tBACK_REF { result = s(:back_ref, val[0]).line lexer.lineno }
2070
2207
 
2071
2208
  superclass: tLT
2072
2209
  {
@@ -2223,12 +2360,13 @@ keyword_variable: kNIL { result = s(:nil) }
2223
2360
 
2224
2361
  f_arg: f_arg_item
2225
2362
  {
2226
- case val[0]
2363
+ arg, = val
2364
+
2365
+ case arg
2227
2366
  when Symbol then
2228
- result = s(:args)
2229
- result << val[0]
2367
+ result = s(:args, arg).line lexer.lineno
2230
2368
  when Sexp then
2231
- result = val[0]
2369
+ result = arg
2232
2370
  else
2233
2371
  debug20 32
2234
2372
  raise "Unknown f_arg type: #{val.inspect}"
@@ -2241,7 +2379,7 @@ keyword_variable: kNIL { result = s(:nil) }
2241
2379
  if list.sexp_type == :args then
2242
2380
  result = list
2243
2381
  else
2244
- result = s(:args, list)
2382
+ result = s(:args, list).line list.line
2245
2383
  end
2246
2384
 
2247
2385
  result << item
@@ -2251,38 +2389,42 @@ keyword_variable: kNIL { result = s(:nil) }
2251
2389
 
2252
2390
  f_kw: f_label arg_value
2253
2391
  {
2254
- # TODO: call_args
2255
- label, _ = val[0] # TODO: fix lineno?
2392
+ # TODO: new_kw_arg
2393
+ (label, line), arg = val
2394
+
2256
2395
  identifier = label.to_sym
2257
2396
  self.env[identifier] = :lvar
2258
2397
 
2259
- result = s(:array, s(:kwarg, identifier, val[1]))
2398
+ kwarg = s(:kwarg, identifier, arg).line line
2399
+ result = s(:array, kwarg).line line
2260
2400
  }
2261
2401
  | f_label
2262
2402
  {
2263
- label, _ = val[0] # TODO: fix lineno?
2264
- identifier = label.to_sym
2265
- self.env[identifier] = :lvar
2403
+ (label, line), = val
2266
2404
 
2267
- result = s(:array, s(:kwarg, identifier))
2405
+ id = label.to_sym
2406
+ self.env[id] = :lvar
2407
+
2408
+ result = s(:array, s(:kwarg, id).line(line)).line line
2268
2409
  }
2269
2410
 
2270
2411
  f_block_kw: f_label primary_value
2271
2412
  {
2272
- # TODO: call_args
2273
- label, _ = val[0] # TODO: fix lineno?
2274
- identifier = label.to_sym
2275
- self.env[identifier] = :lvar
2413
+ # TODO: new_kw_arg
2414
+ (label, line), expr = val
2415
+ id = label.to_sym
2416
+ self.env[id] = :lvar
2276
2417
 
2277
- result = s(:array, s(:kwarg, identifier, val[1]))
2418
+ result = s(:array, s(:kwarg, id, expr).line(line)).line line
2278
2419
  }
2279
2420
  | f_label
2280
2421
  {
2281
- label, _ = val[0] # TODO: fix lineno?
2282
- identifier = label.to_sym
2283
- self.env[identifier] = :lvar
2422
+ # TODO: new_kw_arg
2423
+ (label, line), = val
2424
+ id = label.to_sym
2425
+ self.env[id] = :lvar
2284
2426
 
2285
- result = s(:array, s(:kwarg, identifier))
2427
+ result = s(:array, s(:kwarg, id).line(line)).line line
2286
2428
  }
2287
2429
 
2288
2430
  f_block_kwarg: f_block_kw
@@ -2325,17 +2467,20 @@ keyword_variable: kNIL { result = s(:nil) }
2325
2467
 
2326
2468
  f_block_optarg: f_block_opt
2327
2469
  {
2328
- result = s(:block, val[0])
2470
+ optblk, = val
2471
+ result = s(:block, optblk).line optblk.line
2329
2472
  }
2330
2473
  | f_block_optarg tCOMMA f_block_opt
2331
2474
  {
2332
- result = val[0]
2333
- result << val[2]
2475
+ optarg, _, optblk = val
2476
+ result = optarg
2477
+ result << optblk
2334
2478
  }
2335
2479
 
2336
2480
  f_optarg: f_opt
2337
2481
  {
2338
- result = s(:block, val[0])
2482
+ opt, = val
2483
+ result = s(:block, opt).line opt.line
2339
2484
  }
2340
2485
  | f_optarg tCOMMA f_opt
2341
2486
  {
@@ -2389,14 +2534,11 @@ keyword_variable: kNIL { result = s(:nil) }
2389
2534
  result.sexp_type == :lit
2390
2535
  }
2391
2536
 
2392
- assoc_list: none # [!nil]
2537
+ assoc_list: none
2393
2538
  {
2394
- result = s(:array)
2395
- }
2396
- | assocs trailer # [!nil]
2397
- {
2398
- result = val[0]
2539
+ result = s(:array).line lexer.lineno
2399
2540
  }
2541
+ | assocs trailer
2400
2542
 
2401
2543
  assocs: assoc
2402
2544
  | assocs tCOMMA assoc
@@ -2410,22 +2552,27 @@ keyword_variable: kNIL { result = s(:nil) }
2410
2552
 
2411
2553
  assoc: arg_value tASSOC arg_value
2412
2554
  {
2413
- result = s(:array, val[0], val[2])
2555
+ v1, _, v2 = val
2556
+ result = s(:array, v1, v2).line v1.line
2414
2557
  }
2415
2558
  | tLABEL arg_value
2416
2559
  {
2417
- (label, _), arg = val
2418
- result = s(:array, s(:lit, label.to_sym), arg)
2560
+ (label, line), arg = val
2561
+
2562
+ lit = s(:lit, label.to_sym).line line
2563
+ result = s(:array, lit, arg).line line
2419
2564
  }
2420
2565
  | tSTRING_BEG string_contents tLABEL_END arg_value
2421
2566
  {
2422
2567
  _, sym, _, value = val
2423
2568
  sym.sexp_type = :dsym
2424
- result = s(:array, sym, value)
2569
+ result = s(:array, sym, value).line sym.line
2425
2570
  }
2426
2571
  | tDSTAR arg_value
2427
2572
  {
2428
- result = s(:array, s(:kwsplat, val[1]))
2573
+ _, arg = val
2574
+ line = arg.line
2575
+ result = s(:array, s(:kwsplat, arg).line(line)).line line
2429
2576
  }
2430
2577
 
2431
2578
  operation: tIDENTIFIER | tCONSTANT | tFID