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
@@ -1,22 +1,6 @@
1
1
  # -*- racc -*-
2
2
 
3
- #if V==20
4
3
  class Ruby20Parser
5
- #elif V==21
6
- class Ruby21Parser
7
- #elif V == 22
8
- class Ruby22Parser
9
- #elif V == 23
10
- class Ruby23Parser
11
- #elif V == 24
12
- class Ruby24Parser
13
- #elif V == 25
14
- class Ruby25Parser
15
- #elif V == 26
16
- class Ruby26Parser
17
- #else
18
- fail "version not specified or supported on code generation"
19
- #endif
20
4
 
21
5
  token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
22
6
  kTHEN kELSIF kELSE kCASE kWHEN kWHILE kUNTIL kFOR kBREAK kNEXT
@@ -35,40 +19,31 @@ token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
35
19
  tWORDS_BEG tQWORDS_BEG tSTRING_DBEG tSTRING_DVAR tSTRING_END
36
20
  tSTRING tSYMBOL tNL tEH tCOLON tCOMMA tSPACE tSEMI tLAMBDA
37
21
  tLAMBEG tDSTAR tCHAR tSYMBOLS_BEG tQSYMBOLS_BEG tSTRING_DEND tUBANG
38
- #if V >= 21
39
- tRATIONAL tIMAGINARY
40
- #endif
41
- #if V >= 22
42
- tLABEL_END
43
- #endif
44
- #if V >= 23
45
- tLONELY
46
- #endif
47
22
 
48
- prechigh
49
- right tBANG tTILDE tUPLUS
50
- right tPOW
51
- right tUMINUS_NUM tUMINUS
52
- left tSTAR2 tDIVIDE tPERCENT
53
- left tPLUS tMINUS
54
- left tLSHFT tRSHFT
55
- left tAMPER2
56
- left tPIPE tCARET
57
- left tGT tGEQ tLT tLEQ
58
- nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
59
- left tANDOP
60
- left tOROP
61
- nonassoc tDOT2 tDOT3
62
- right tEH tCOLON
63
- left kRESCUE_MOD
64
- right tEQL tOP_ASGN
65
- nonassoc kDEFINED
66
- right kNOT
67
- left kOR kAND
68
- nonassoc kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
69
- nonassoc tLBRACE_ARG
70
- nonassoc tLOWEST
71
23
  preclow
24
+ nonassoc tLOWEST
25
+ nonassoc tLBRACE_ARG
26
+ nonassoc kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
27
+ left kOR kAND
28
+ right kNOT
29
+ nonassoc kDEFINED
30
+ right tEQL tOP_ASGN
31
+ left kRESCUE_MOD
32
+ right tEH tCOLON
33
+ nonassoc tDOT2 tDOT3
34
+ left tOROP
35
+ left tANDOP
36
+ nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
37
+ left tGT tGEQ tLT tLEQ
38
+ left tPIPE tCARET
39
+ left tAMPER2
40
+ left tLSHFT tRSHFT
41
+ left tPLUS tMINUS
42
+ left tSTAR2 tDIVIDE tPERCENT # TODO: tSTAR2 -> tMULT
43
+ right tUMINUS_NUM tUMINUS
44
+ right tPOW
45
+ right tBANG tTILDE tUPLUS
46
+ prechigh
72
47
 
73
48
  rule
74
49
 
@@ -82,7 +57,8 @@ rule
82
57
 
83
58
  top_compstmt: top_stmts opt_terms
84
59
  {
85
- result = val[0]
60
+ stmt, _ = val
61
+ result = stmt
86
62
  }
87
63
 
88
64
  top_stmts: none
@@ -94,14 +70,6 @@ rule
94
70
  | error top_stmt
95
71
 
96
72
  top_stmt: stmt
97
- {
98
- result = val[0]
99
-
100
- # TODO: remove once I have more confidence this is fixed
101
- # result.each_of_type :call_args do |s|
102
- # debug20 666, s, result
103
- # end
104
- }
105
73
  | klBEGIN
106
74
  {
107
75
  if (self.in_def || self.in_single > 0) then
@@ -112,14 +80,19 @@ rule
112
80
  }
113
81
  begin_block
114
82
  {
115
- _, _, block = val
116
- result = block
83
+ (_, lineno), _, iter = val
84
+ iter.line lineno
85
+
86
+ (_, preexe,) = iter
87
+ preexe.line lineno
88
+
89
+ result = iter
117
90
  }
118
91
 
119
- begin_block: tLCURLY top_compstmt tRCURLY
92
+ begin_block: tLCURLY { result = lexer.lineno } top_compstmt tRCURLY
120
93
  {
121
- _, stmt, _ = val
122
- result = new_iter s(:preexe), 0, stmt
94
+ _, line, stmt, _ = val
95
+ result = new_iter s(:preexe).line(line), 0, stmt
123
96
  }
124
97
 
125
98
  bodystmt: compstmt opt_rescue k_else
@@ -161,34 +134,27 @@ rule
161
134
  stmt_or_begin: stmt
162
135
  | klBEGIN
163
136
  {
164
- if (self.in_def || self.in_single > 0) then
165
- debug20 1
166
- yyerror "BEGIN in method"
167
- end
168
- self.env.extend
169
- }
170
- begin_block
171
- {
172
- _, _, stmt = val
173
- result = stmt
137
+ yyerror "BEGIN is permitted only at toplevel"
174
138
  }
175
139
 
176
140
  stmt: kALIAS fitem
177
141
  {
178
142
  lexer.lex_state = EXPR_FNAME
179
- result = self.lexer.lineno
180
143
  }
181
144
  fitem
182
145
  {
183
- result = s(:alias, val[1], val[3]).line(val[2])
146
+ (_, line), lhs, _, rhs = val
147
+ result = s(:alias, lhs, rhs).line(line).line line
184
148
  }
185
149
  | kALIAS tGVAR tGVAR
186
150
  {
187
- result = s(:valias, val[1].to_sym, val[2].to_sym)
151
+ (_, line), lhs, rhs = val
152
+ result = s(:valias, lhs.to_sym, rhs.to_sym).line line
188
153
  }
189
154
  | kALIAS tGVAR tBACK_REF
190
155
  {
191
- result = s(:valias, val[1].to_sym, :"$#{val[2]}")
156
+ (_, line), lhs, rhs = val
157
+ result = s(:valias, lhs.to_sym, :"$#{rhs}").line line
192
158
  }
193
159
  | kALIAS tGVAR tNTH_REF
194
160
  {
@@ -200,32 +166,41 @@ rule
200
166
  }
201
167
  | stmt kIF_MOD expr_value
202
168
  {
203
- result = new_if val[2], val[0], nil
169
+ t, _, c = val
170
+ result = new_if c, t, nil
204
171
  }
205
172
  | stmt kUNLESS_MOD expr_value
206
173
  {
207
- result = new_if val[2], nil, val[0]
174
+ f, _, c = val
175
+ result = new_if c, nil, f
208
176
  }
209
177
  | stmt kWHILE_MOD expr_value
210
178
  {
211
- result = new_while val[0], val[2], true
179
+ e, _, c = val
180
+ result = new_while e, c, true
212
181
  }
213
182
  | stmt kUNTIL_MOD expr_value
214
183
  {
215
- result = new_until val[0], val[2], true
184
+ e, _, c = val
185
+ result = new_until e, c, true
216
186
  }
217
187
  | stmt kRESCUE_MOD stmt
218
188
  {
219
189
  body, _, resbody = val
220
- result = new_rescue body, new_resbody(s(:array), resbody)
190
+
191
+ resbody = new_resbody s(:array).line(resbody.line), resbody
192
+ result = new_rescue body, resbody
221
193
  }
222
194
  | klEND tLCURLY compstmt tRCURLY
223
195
  {
196
+ (_, line), _, stmt, _ = val
197
+
224
198
  if (self.in_def || self.in_single > 0) then
225
199
  debug20 3
226
200
  yyerror "END in method; use at_exit"
227
201
  end
228
- result = new_iter s(:postexe), 0, val[2]
202
+
203
+ result = new_iter s(:postexe).line(line), 0, stmt
229
204
  }
230
205
  | command_asgn
231
206
  | mlhs tEQL command_call
@@ -234,17 +209,14 @@ rule
234
209
  }
235
210
  | lhs tEQL mrhs
236
211
  {
237
- result = new_assign val[0], s(:svalue, val[2])
212
+ lhs, _, rhs = val
213
+ result = new_assign lhs, s(:svalue, rhs).line(rhs.line)
238
214
  }
239
- #if V == 20
240
215
  | mlhs tEQL arg_value
241
216
  {
242
217
  result = new_masgn val[0], val[2], :wrap
243
218
  }
244
219
  | mlhs tEQL mrhs
245
- #else
246
- | mlhs tEQL mrhs_arg
247
- #endif
248
220
  {
249
221
  result = new_masgn val[0], val[2]
250
222
  }
@@ -264,11 +236,12 @@ rule
264
236
  }
265
237
  | primary_value tLBRACK2 opt_call_args rbracket tOP_ASGN command_rhs
266
238
  {
267
- result = s(:op_asgn1, val[0], val[2], val[4].to_sym, val[5])
239
+ result = new_op_asgn1 val
268
240
  }
269
241
  | primary_value call_op tIDENTIFIER tOP_ASGN command_rhs
270
242
  {
271
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
243
+ prim, _, id, opasgn, rhs = val
244
+ result = s(:op_asgn, prim, rhs, id.to_sym, opasgn.to_sym)
272
245
  if val[1] == '&.'
273
246
  result.sexp_type = :safe_op_asgn
274
247
  end
@@ -302,32 +275,31 @@ rule
302
275
  expr, = val
303
276
  result = value_expr expr
304
277
  }
305
- #if V >= 24
306
- | command_call kRESCUE_MOD stmt
307
- {
308
- expr, _, resbody = val
309
- expr = value_expr expr
310
- result = new_rescue(expr, new_resbody(s(:array), resbody))
311
- }
312
- #endif
313
278
  | command_asgn
314
279
 
315
280
  expr: command_call
316
281
  | expr kAND expr
317
282
  {
318
- result = logical_op :and, val[0], val[2]
283
+ lhs, _, rhs = val
284
+ result = logical_op :and, lhs, rhs
319
285
  }
320
286
  | expr kOR expr
321
287
  {
322
- result = logical_op :or, val[0], val[2]
288
+ lhs, _, rhs = val
289
+ result = logical_op :or, lhs, rhs
323
290
  }
324
291
  | kNOT opt_nl expr
325
292
  {
326
- result = s(:call, val[2], :"!")
293
+ (_, line), _, expr = val
294
+ result = new_call(expr, :"!").line line
295
+ # REFACTOR: call_uni_op
327
296
  }
328
297
  | tBANG command_call
329
298
  {
330
- result = s(:call, val[1], :"!")
299
+ _, cmd = val
300
+ result = new_call(cmd, :"!").line cmd.line
301
+ # TODO: fix line number to tBANG... but causes BAD shift/reduce conflict
302
+ # REFACTOR: call_uni_op -- see parse26.y
331
303
  }
332
304
  | arg
333
305
 
@@ -354,7 +326,8 @@ rule
354
326
  block_command: block_call
355
327
  | block_call call_op2 operation2 command_args
356
328
  {
357
- result = new_call val[0], val[2].to_sym, val[3]
329
+ blk, _, msg, args = val
330
+ result = new_call(blk, msg.to_sym, args).line blk.line
358
331
  }
359
332
 
360
333
  cmd_brace_block: tLBRACE_ARG
@@ -374,26 +347,32 @@ rule
374
347
 
375
348
  fcall: operation
376
349
  {
377
- result = new_call nil, val[0].to_sym
350
+ msg, = val
351
+ result = new_call(nil, msg.to_sym).line lexer.lineno
378
352
  }
379
353
 
380
354
  command: fcall command_args =tLOWEST
381
355
  {
382
- result = val[0].concat val[1].sexp_body # REFACTOR pattern
356
+ call, args = val
357
+ result = call.concat args.sexp_body
383
358
  }
384
359
  | fcall command_args cmd_brace_block
385
360
  {
386
- result = val[0].concat val[1].sexp_body
387
- if val[2] then
388
- block_dup_check result, val[2]
361
+ call, args, block = val
362
+
363
+ result = call.concat args.sexp_body
364
+
365
+ if block then
366
+ block_dup_check result, block
389
367
 
390
- result, operation = val[2], result
368
+ result, operation = block, result
391
369
  result.insert 1, operation
392
370
  end
393
371
  }
394
372
  | primary_value call_op operation2 command_args =tLOWEST
395
373
  {
396
- result = new_call val[0], val[2].to_sym, val[3], val[1]
374
+ lhs, callop, op, args = val
375
+ result = new_call lhs, op.to_sym, args, callop
397
376
  }
398
377
  | primary_value call_op operation2 command_args cmd_brace_block
399
378
  {
@@ -425,7 +404,9 @@ rule
425
404
  }
426
405
  | kYIELD command_args
427
406
  {
428
- result = new_yield val[1]
407
+ (_, line), args = val
408
+ result = new_yield args
409
+ result.line line # TODO: push to new_yield
429
410
  }
430
411
  | k_return call_args
431
412
  {
@@ -434,8 +415,8 @@ rule
434
415
  }
435
416
  | kBREAK call_args
436
417
  {
437
- line = val[0].last
438
- result = s(:break, ret_args(val[1])).line(line)
418
+ (_, line), args = val
419
+ result = s(:break, ret_args(args)).line line
439
420
  }
440
421
  | kNEXT call_args
441
422
  {
@@ -452,56 +433,79 @@ rule
452
433
  mlhs_inner: mlhs_basic
453
434
  | tLPAREN mlhs_inner rparen
454
435
  {
455
- result = s(:masgn, s(:array, val[1]))
436
+ _, arg, _ = val
437
+ l = arg.line
438
+
439
+ result = s(:masgn, s(:array, arg).line(l)).line l
456
440
  }
457
441
 
458
442
  mlhs_basic: mlhs_head
459
443
  {
460
- result = s(:masgn, val[0])
444
+ head, = val
445
+ result = s(:masgn, head).line head.line
461
446
  }
462
447
  | mlhs_head mlhs_item
463
448
  {
464
- result = s(:masgn, val[0] << val[1].compact)
449
+ lhs, rhs = val
450
+ result = s(:masgn, lhs << rhs.compact).line lhs.line
465
451
  }
466
452
  | mlhs_head tSTAR mlhs_node
467
453
  {
468
- result = s(:masgn, val[0] << s(:splat, val[2]))
454
+ head, _, tail = val
455
+ head << s(:splat, tail).line(tail.line)
456
+ result = s(:masgn, head).line head.line
469
457
  }
470
458
  | mlhs_head tSTAR mlhs_node tCOMMA mlhs_post
471
459
  {
472
460
  ary1, _, splat, _, ary2 = val
473
461
 
474
- result = list_append ary1, s(:splat, splat)
462
+ result = list_append ary1, s(:splat, splat).line(splat.line)
475
463
  result.concat ary2.sexp_body
476
- result = s(:masgn, result)
464
+ result = s(:masgn, result).line result.line
477
465
  }
478
466
  | mlhs_head tSTAR
479
467
  {
480
- result = s(:masgn, val[0] << s(:splat))
468
+ head, _ = val
469
+ l = head.line
470
+ result = s(:masgn, head << s(:splat).line(l)).line l
481
471
  }
482
472
  | mlhs_head tSTAR tCOMMA mlhs_post
483
473
  {
484
- ary = list_append val[0], s(:splat)
485
- ary.concat val[3].sexp_body
486
- result = s(:masgn, ary)
474
+ head, _, _, post = val
475
+ ary = list_append head, s(:splat).line(head.line)
476
+ ary.concat post.sexp_body
477
+ result = s(:masgn, ary).line ary.line
487
478
  }
488
479
  | tSTAR mlhs_node
489
480
  {
490
- result = s(:masgn, s(:array, s(:splat, val[1])))
481
+ _, node = val
482
+ l = node.line
483
+ splat = s(:splat, node).line l
484
+ ary = s(:array, splat).line l
485
+ result = s(:masgn, ary).line l
491
486
  }
492
487
  | tSTAR mlhs_node tCOMMA mlhs_post
493
488
  {
494
- ary = s(:array, s(:splat, val[1]))
495
- ary.concat val[3].sexp_body
496
- result = s(:masgn, ary)
489
+ _, node, _, post = val
490
+
491
+ splat = s(:splat, node).line node.line
492
+ ary = s(:array, splat).line splat.line
493
+ ary.concat post.sexp_body
494
+ result = s(:masgn, ary).line ary.line
497
495
  }
498
496
  | tSTAR
499
497
  {
500
- result = s(:masgn, s(:array, s(:splat)))
498
+ l = lexer.lineno
499
+ result = s(:masgn, s(:array, s(:splat).line(l)).line(l)).line l
501
500
  }
502
501
  | tSTAR tCOMMA mlhs_post
503
502
  {
504
- result = s(:masgn, s(:array, s(:splat), *val[2].sexp_body))
503
+ _, _, post = val
504
+ l = post.line
505
+
506
+ splat = s(:splat).line l
507
+ ary = s(:array, splat, *post.sexp_body).line l
508
+ result = s(:masgn, ary).line l
505
509
  }
506
510
 
507
511
  mlhs_item: mlhs_node
@@ -512,7 +516,8 @@ rule
512
516
 
513
517
  mlhs_head: mlhs_item tCOMMA
514
518
  {
515
- result = s(:array, val[0])
519
+ lhs, _ = val
520
+ result = s(:array, lhs).line lhs.line
516
521
  }
517
522
  | mlhs_head mlhs_item tCOMMA
518
523
  {
@@ -521,7 +526,8 @@ rule
521
526
 
522
527
  mlhs_post: mlhs_item
523
528
  {
524
- result = s(:array, val[0])
529
+ item, = val
530
+ result = s(:array, item).line item.line
525
531
  }
526
532
  | mlhs_post tCOMMA mlhs_item
527
533
  {
@@ -546,7 +552,8 @@ rule
546
552
  }
547
553
  | primary_value tCOLON2 tIDENTIFIER
548
554
  {
549
- result = s(:attrasgn, val[0], :"#{val[2]}=")
555
+ recv, _, id = val
556
+ result = new_attrasgn recv, id
550
557
  }
551
558
  | primary_value call_op tCONSTANT
552
559
  {
@@ -559,7 +566,10 @@ rule
559
566
  yyerror "dynamic constant assignment"
560
567
  end
561
568
 
562
- result = s(:const, s(:colon2, val[0], val[2].to_sym), nil)
569
+ expr, _, id = val
570
+ l = expr.line
571
+
572
+ result = s(:const, s(:colon2, expr, id.to_sym).line(l), nil).line l
563
573
  }
564
574
  | tCOLON3 tCONSTANT
565
575
  {
@@ -568,7 +578,10 @@ rule
568
578
  yyerror "dynamic constant assignment"
569
579
  end
570
580
 
571
- result = s(:const, nil, s(:colon3, val[1].to_sym))
581
+ _, id = val
582
+ l = lexer.lineno
583
+
584
+ result = s(:const, nil, s(:colon3, id.to_sym).line(l)).line l
572
585
  }
573
586
  | backref
574
587
  {
@@ -577,24 +590,31 @@ rule
577
590
 
578
591
  lhs: user_variable
579
592
  {
593
+ line = lexer.lineno
580
594
  result = self.assignable val[0]
595
+ result.line = line
581
596
  }
582
597
  | keyword_variable
583
598
  {
599
+ line = lexer.lineno
584
600
  result = self.assignable val[0]
601
+ result.line = line
585
602
  debug20 9, val, result
586
603
  }
587
604
  | primary_value tLBRACK2 opt_call_args rbracket
588
605
  {
589
- result = self.aryset val[0], val[2]
606
+ lhs, _, args, _ = val
607
+ result = self.aryset lhs, args
590
608
  }
591
609
  | primary_value call_op tIDENTIFIER # REFACTOR
592
610
  {
593
- result = new_attrasgn val[0], val[2], val[1]
611
+ lhs, op, id = val
612
+ result = new_attrasgn lhs, id, op
594
613
  }
595
614
  | primary_value tCOLON2 tIDENTIFIER
596
615
  {
597
- result = s(:attrasgn, val[0], :"#{val[2]}=")
616
+ lhs, _, id = val
617
+ result = new_attrasgn lhs, id
598
618
  }
599
619
  | primary_value call_op tCONSTANT # REFACTOR?
600
620
  {
@@ -602,21 +622,27 @@ rule
602
622
  }
603
623
  | primary_value tCOLON2 tCONSTANT
604
624
  {
625
+ expr, _, id = val
626
+
605
627
  if (self.in_def || self.in_single > 0) then
606
628
  debug20 10
607
629
  yyerror "dynamic constant assignment"
608
630
  end
609
631
 
610
- result = s(:const, s(:colon2, val[0], val[2].to_sym))
632
+ l = expr.line
633
+ result = s(:const, s(:colon2, expr, id.to_sym).line(l)).line l
611
634
  }
612
635
  | tCOLON3 tCONSTANT
613
636
  {
637
+ _, id = val
638
+
614
639
  if (self.in_def || self.in_single > 0) then
615
640
  debug20 11
616
641
  yyerror "dynamic constant assignment"
617
642
  end
618
643
 
619
- result = s(:const, s(:colon3, val[1].to_sym))
644
+ l = lexer.lineno
645
+ result = s(:const, s(:colon3, id.to_sym).line(l)).line l
620
646
  }
621
647
  | backref
622
648
  {
@@ -631,7 +657,8 @@ rule
631
657
 
632
658
  cpath: tCOLON3 cname
633
659
  {
634
- result = s(:colon3, val[1].to_sym)
660
+ _, name = val
661
+ result = s(:colon3, name.to_sym).line lexer.lineno
635
662
  }
636
663
  | cname
637
664
  {
@@ -639,7 +666,10 @@ rule
639
666
  }
640
667
  | primary_value tCOLON2 cname
641
668
  {
642
- result = s(:colon2, val[0], val[2].to_sym)
669
+ pval, _, name = val
670
+
671
+ result = s(:colon2, pval, name.to_sym)
672
+ result.line pval.line
643
673
  }
644
674
 
645
675
  fname: tIDENTIFIER | tCONSTANT | tFID
@@ -660,7 +690,8 @@ rule
660
690
 
661
691
  fitem: fsym
662
692
  {
663
- result = s(:lit, val[0].to_sym)
693
+ id, = val
694
+ result = s(:lit, id.to_sym).line lexer.lineno
664
695
  }
665
696
  | dsym
666
697
 
@@ -683,9 +714,8 @@ rule
683
714
  | tNEQ | tLSHFT | tRSHFT | tPLUS | tMINUS | tSTAR2
684
715
  | tSTAR | tDIVIDE | tPERCENT | tPOW | tDSTAR | tBANG | tTILDE
685
716
  | tUPLUS | tUMINUS | tAREF | tASET | tBACK_REF2
686
- #if V >= 20
717
+ # TODO: tUBANG dead?
687
718
  | tUBANG
688
- #endif
689
719
 
690
720
  reswords: k__LINE__ | k__FILE__ | k__ENCODING__ | klBEGIN | klEND
691
721
  | kALIAS | kAND | kBEGIN | kBREAK | kCASE
@@ -707,8 +737,7 @@ rule
707
737
  }
708
738
  | primary_value tLBRACK2 opt_call_args rbracket tOP_ASGN arg_rhs
709
739
  {
710
- val[2].sexp_type = :arglist if val[2]
711
- result = s(:op_asgn1, val[0], val[2], val[4].to_sym, val[5])
740
+ result = new_op_asgn1 val
712
741
  }
713
742
  | primary_value call_op tIDENTIFIER tOP_ASGN arg_rhs
714
743
  {
@@ -720,7 +749,9 @@ rule
720
749
  }
721
750
  | primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
722
751
  {
723
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
752
+ lhs, _, id, op, rhs = val
753
+
754
+ result = s(:op_asgn, lhs, rhs, id.to_sym, op.to_sym).line lhs.line
724
755
  }
725
756
  | primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
726
757
  {
@@ -750,34 +781,20 @@ rule
750
781
  {
751
782
  v1, v2 = val[0], val[2]
752
783
  if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
753
- result = s(:lit, (v1.last)..(v2.last))
784
+ result = s(:lit, (v1.last)..(v2.last)).line v1.line
754
785
  else
755
- result = s(:dot2, v1, v2)
786
+ result = s(:dot2, v1, v2).line v1.line
756
787
  end
757
788
  }
758
789
  | arg tDOT3 arg
759
790
  {
760
791
  v1, v2 = val[0], val[2]
761
792
  if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
762
- result = s(:lit, (v1.last)...(v2.last))
793
+ result = s(:lit, (v1.last)...(v2.last)).line v1.line
763
794
  else
764
- result = s(:dot3, v1, v2)
795
+ result = s(:dot3, v1, v2).line v1.line
765
796
  end
766
797
  }
767
- #if V >= 26
768
- | arg tDOT2
769
- {
770
- v1, v2 = val[0], nil
771
-
772
- result = s(:dot2, v1, v2)
773
- }
774
- | arg tDOT3
775
- {
776
- v1, v2 = val[0], nil
777
-
778
- result = s(:dot3, v1, v2)
779
- }
780
- #endif
781
798
  | arg tPLUS arg
782
799
  {
783
800
  result = new_call val[0], :+, argl(val[2])
@@ -802,21 +819,18 @@ rule
802
819
  {
803
820
  result = new_call val[0], :**, argl(val[2])
804
821
  }
805
- #if V == 20
806
822
  | tUMINUS_NUM tINTEGER tPOW arg
807
823
  {
808
- result = new_call(new_call(s(:lit, val[1]), :"**", argl(val[3])), :"-@")
824
+ lit = s(:lit, val[1]).line lexer.lineno
825
+ result = new_call(new_call(lit, :"**", argl(val[3])), :"-@")
809
826
  }
810
827
  | tUMINUS_NUM tFLOAT tPOW arg
811
- #else
812
- | tUMINUS_NUM simple_numeric tPOW arg
813
- #endif
814
828
  {
815
- result = new_call(new_call(s(:lit, val[1]), :"**", argl(val[3])), :"-@")
816
- #if V == 20
829
+ lit = s(:lit, val[1]).line lexer.lineno
830
+ result = new_call(new_call(lit, :"**", argl(val[3])), :"-@")
831
+
817
832
  ## TODO: why is this 2.0 only?
818
833
  debug20 12, val, result
819
- #endif
820
834
  }
821
835
  | tUPLUS arg
822
836
  {
@@ -857,15 +871,19 @@ rule
857
871
  }
858
872
  | arg tMATCH arg
859
873
  {
860
- result = new_match val[0], val[2]
874
+ lhs, _, rhs = val
875
+ result = new_match lhs, rhs
861
876
  }
862
877
  | arg tNMATCH arg
863
878
  {
864
- result = s(:not, new_match(val[0], val[2]))
879
+ lhs, _, rhs = val
880
+ result = s(:not, new_match(lhs, rhs)).line lhs.line
865
881
  }
866
882
  | tBANG arg
867
883
  {
868
- result = new_call val[1], :"!"
884
+ _, arg = val
885
+ result = new_call arg, :"!"
886
+ result.line arg.line
869
887
  }
870
888
  | tTILDE arg
871
889
  {
@@ -893,11 +911,13 @@ rule
893
911
  }
894
912
  | kDEFINED opt_nl arg
895
913
  {
896
- result = s(:defined, val[2])
914
+ (_, line), _, arg = val
915
+ result = s(:defined, arg).line line
897
916
  }
898
917
  | arg tEH arg opt_nl tCOLON arg
899
918
  {
900
- result = s(:if, val[0], val[2], val[5])
919
+ c, _, t, _, _, f = val
920
+ result = s(:if, c, t, f).line c.line
901
921
  }
902
922
  | primary
903
923
 
@@ -940,28 +960,25 @@ rule
940
960
  arg_rhs: arg =tOP_ASGN
941
961
  | arg kRESCUE_MOD arg
942
962
  {
943
- body, _, resbody = val
963
+ body, (_, line), resbody = val
944
964
  body = value_expr body
945
965
  resbody = remove_begin resbody
946
- 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))
947
969
  }
948
970
 
949
971
  paren_args: tLPAREN2 opt_call_args rparen
950
972
  {
951
- result = val[1]
973
+ _, args, _ = val
974
+ result = args
952
975
  }
953
976
 
954
977
  opt_paren_args: none
955
978
  | paren_args
956
979
 
957
980
  opt_call_args: none
958
- {
959
- result = val[0]
960
- }
961
981
  | call_args
962
- {
963
- result = val[0]
964
- }
965
982
  | args tCOMMA
966
983
  {
967
984
  result = args val
@@ -1011,7 +1028,8 @@ rule
1011
1028
 
1012
1029
  block_arg: tAMPER arg_value
1013
1030
  {
1014
- result = s(:block_pass, val[1])
1031
+ _, arg = val
1032
+ result = s(:block_pass, arg).line arg.line
1015
1033
  }
1016
1034
 
1017
1035
  opt_block_arg: tCOMMA block_arg
@@ -1022,43 +1040,41 @@ rule
1022
1040
 
1023
1041
  args: arg_value
1024
1042
  {
1025
- result = s(:array, val[0])
1043
+ arg, = val
1044
+
1045
+ result = s(:array, arg).line arg.line
1026
1046
  }
1027
1047
  | tSTAR arg_value
1028
1048
  {
1029
- result = s(:array, s(:splat, val[1]))
1049
+ _, arg = val
1050
+ result = s(:array, s(:splat, arg).line(arg.line)).line arg.line
1030
1051
  }
1031
1052
  | args tCOMMA arg_value
1032
1053
  {
1033
- result = self.list_append val[0], val[2]
1034
- }
1035
- | args tCOMMA tSTAR arg_value
1036
- {
1037
- result = self.list_append val[0], s(:splat, val[3])
1038
- }
1039
-
1040
- #if V >= 21
1041
- mrhs_arg: mrhs
1042
- {
1043
- result = new_masgn_arg val[0]
1054
+ args, _, id = val
1055
+ result = self.list_append args, id
1044
1056
  }
1045
- | arg_value
1057
+ | args tCOMMA tSTAR { result = lexer.lineno } arg_value
1046
1058
  {
1047
- result = new_masgn_arg val[0], :wrap
1059
+ args, _, _, line, id = val
1060
+ result = self.list_append args, s(:splat, id).line(line)
1048
1061
  }
1049
1062
 
1050
- #endif
1051
1063
  mrhs: args tCOMMA arg_value
1052
1064
  {
1053
1065
  result = val[0] << val[2]
1054
1066
  }
1055
1067
  | args tCOMMA tSTAR arg_value
1056
1068
  {
1057
- result = self.arg_concat val[0], val[3]
1069
+ # FIX: bad shift/reduce conflict with rhs' comma star prod
1070
+ # TODO: make all tXXXX terminals include lexer.lineno
1071
+ arg, _, _, splat = val
1072
+ result = self.arg_concat arg, splat
1058
1073
  }
1059
1074
  | tSTAR arg_value
1060
1075
  {
1061
- result = s(:splat, val[1])
1076
+ _, arg = val
1077
+ result = s(:splat, arg).line arg.line
1062
1078
  }
1063
1079
 
1064
1080
  primary: literal
@@ -1073,7 +1089,8 @@ rule
1073
1089
  | backref
1074
1090
  | tFID
1075
1091
  {
1076
- result = new_call nil, val[0].to_sym
1092
+ msg, = val
1093
+ result = new_call nil, msg.to_sym
1077
1094
  }
1078
1095
  | k_begin
1079
1096
  {
@@ -1093,16 +1110,19 @@ rule
1093
1110
 
1094
1111
  result.line = val[1]
1095
1112
  }
1096
- | tLPAREN_ARG rparen
1113
+ | tLPAREN_ARG
1097
1114
  {
1098
- # TODO: lex_state = EXPR_ENDARG in between
1099
- debug20 13, val, result
1115
+ lexer.lex_state = EXPR_ENDARG
1116
+ result = lexer.lineno
1117
+ }
1118
+ rparen
1119
+ {
1120
+ _, line, _ = val
1121
+ result = s(:begin).line line
1100
1122
  }
1101
1123
  | tLPAREN_ARG
1102
1124
  {
1103
1125
  result = lexer.cmdarg.store false
1104
- # result = self.lexer.cmdarg.stack.dup
1105
- # lexer.cmdarg.stack.replace [false] # TODO add api for these
1106
1126
  }
1107
1127
  stmt
1108
1128
  {
@@ -1117,21 +1137,29 @@ rule
1117
1137
  }
1118
1138
  | tLPAREN compstmt tRPAREN
1119
1139
  {
1120
- result = val[1] || s(:nil)
1140
+ _, stmt, _ = val
1141
+ result = stmt
1142
+ result ||= s(:nil).line lexer.lineno
1121
1143
  result.paren = true
1122
1144
  }
1123
1145
  | primary_value tCOLON2 tCONSTANT
1124
1146
  {
1125
- result = s(:colon2, val[0], val[2].to_sym)
1147
+ expr, _, id = val
1148
+
1149
+ result = s(:colon2, expr, id.to_sym).line expr.line
1126
1150
  }
1127
1151
  | tCOLON3 tCONSTANT
1128
1152
  {
1129
- result = s(:colon3, val[1].to_sym)
1153
+ _, id = val
1154
+
1155
+ result = s(:colon3, id.to_sym).line lexer.lineno
1130
1156
  }
1131
- | tLBRACK aref_args tRBRACK
1157
+ | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1132
1158
  {
1133
- result = val[1] || s(:array)
1159
+ _, line, args, _ = val
1160
+ result = args || s(:array)
1134
1161
  result.sexp_type = :array # aref_args is :args
1162
+ result.line line
1135
1163
  }
1136
1164
  | tLBRACE
1137
1165
  {
@@ -1143,7 +1171,8 @@ rule
1143
1171
  }
1144
1172
  | k_return
1145
1173
  {
1146
- result = s(:return)
1174
+ (_, line), = val
1175
+ result = s(:return).line line
1147
1176
  }
1148
1177
  | kYIELD tLPAREN2 call_args rparen
1149
1178
  {
@@ -1159,11 +1188,14 @@ rule
1159
1188
  }
1160
1189
  | kDEFINED opt_nl tLPAREN2 expr rparen
1161
1190
  {
1162
- result = s(:defined, val[3])
1191
+ (_, line), _, _, arg, _ = val
1192
+
1193
+ result = s(:defined, arg).line line
1163
1194
  }
1164
1195
  | kNOT tLPAREN2 expr rparen
1165
1196
  {
1166
- result = s(:call, val[2], :"!")
1197
+ _, _, lhs, _ = val
1198
+ result = new_call lhs, :"!"
1167
1199
  }
1168
1200
  | kNOT tLPAREN2 rparen
1169
1201
  {
@@ -1171,11 +1203,11 @@ rule
1171
1203
  }
1172
1204
  | fcall brace_block
1173
1205
  {
1174
- oper, iter = val[0], val[1]
1175
- call = oper # FIX
1206
+ call, iter = val
1207
+
1176
1208
  iter.insert 1, call
1177
1209
  result = iter
1178
- call.line = iter.line
1210
+ # FIX: probably not: call.line = iter.line
1179
1211
  }
1180
1212
  | method_call
1181
1213
  | method_call brace_block
@@ -1292,7 +1324,7 @@ rule
1292
1324
  # TODO: port local_push_gen and local_pop_gen
1293
1325
  lexer.cmdarg.stack.replace [false]
1294
1326
  }
1295
- f_arglist bodystmt k_end
1327
+ f_arglist bodystmt { result = lexer.lineno } k_end
1296
1328
  {
1297
1329
  in_def, cmdarg = val[2]
1298
1330
 
@@ -1318,9 +1350,8 @@ rule
1318
1350
  }
1319
1351
  f_arglist bodystmt k_end
1320
1352
  {
1321
- line, cmdarg = val[5]
1353
+ _, cmdarg = val[5]
1322
1354
  result = new_defs val
1323
- result[3].line line
1324
1355
 
1325
1356
  lexer.cmdarg.stack.replace cmdarg
1326
1357
 
@@ -1330,19 +1361,23 @@ rule
1330
1361
  }
1331
1362
  | kBREAK
1332
1363
  {
1333
- result = s(:break)
1364
+ (_, line), = val
1365
+ result = s(:break).line line
1334
1366
  }
1335
1367
  | kNEXT
1336
1368
  {
1337
- result = s(:next)
1369
+ (_, line), = val
1370
+ result = s(:next).line line
1338
1371
  }
1339
1372
  | kREDO
1340
1373
  {
1341
- result = s(:redo)
1374
+ (_, line), = val
1375
+ result = s(:redo).line line
1342
1376
  }
1343
1377
  | kRETRY
1344
1378
  {
1345
- result = s(:retry)
1379
+ (_, line), = val
1380
+ result = s(:retry).line line
1346
1381
  }
1347
1382
 
1348
1383
  primary_value: primary
@@ -1381,7 +1416,9 @@ rule
1381
1416
  if_tail: opt_else
1382
1417
  | k_elsif expr_value then compstmt if_tail
1383
1418
  {
1384
- result = s(:if, val[1], val[3], val[4])
1419
+ (_, line), c, _, t, rest = val
1420
+
1421
+ result = s(:if, c, t, rest).line line
1385
1422
  }
1386
1423
 
1387
1424
  opt_else: none
@@ -1404,7 +1441,9 @@ rule
1404
1441
 
1405
1442
  f_marg_list: f_marg
1406
1443
  {
1407
- result = s(:array, val[0])
1444
+ sym, = val
1445
+
1446
+ result = s(:array, sym).line lexer.lineno
1408
1447
  }
1409
1448
  | f_marg_list tCOMMA f_marg
1410
1449
  {
@@ -1478,7 +1517,9 @@ rule
1478
1517
  }
1479
1518
  | f_block_arg
1480
1519
  {
1481
- result = call_args val
1520
+ line = lexer.lineno
1521
+ result = call_args val # TODO: push line down
1522
+ result.line line
1482
1523
  }
1483
1524
 
1484
1525
  opt_block_args_tail: tCOMMA block_args_tail
@@ -1509,7 +1550,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1509
1550
  }
1510
1551
  | f_arg tCOMMA
1511
1552
  {
1512
- result = args val
1553
+ result = args(val) << nil
1513
1554
  }
1514
1555
  | f_arg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
1515
1556
  {
@@ -1561,7 +1602,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1561
1602
  }
1562
1603
  | tOROP
1563
1604
  {
1564
- result = s(:args)
1605
+ result = s(:args).line lexer.lineno
1565
1606
  }
1566
1607
  | tPIPE block_param opt_bv_decl tPIPE
1567
1608
  {
@@ -1586,33 +1627,33 @@ opt_block_args_tail: tCOMMA block_args_tail
1586
1627
 
1587
1628
  bvar: tIDENTIFIER
1588
1629
  {
1589
- result = s(:shadow, val[0].to_sym)
1630
+ id, = val
1631
+ line = lexer.lineno
1632
+ result = s(:shadow, id.to_sym).line line
1590
1633
  }
1591
1634
  | f_bad_arg
1592
1635
 
1593
1636
  lambda: {
1594
1637
  self.env.extend :dynamic
1595
- result = self.lexer.lineno
1596
-
1597
- result = lexer.lpar_beg
1638
+ result = [lexer.lineno, lexer.lpar_beg]
1598
1639
  lexer.paren_nest += 1
1599
1640
  lexer.lpar_beg = lexer.paren_nest
1600
1641
  }
1601
1642
  f_larglist
1602
1643
  {
1603
- result = [lexer.cmdarg.store(false), self.lexer.lineno]
1644
+ result = lexer.cmdarg.store(false)
1604
1645
  }
1605
1646
  lambda_body
1606
1647
  {
1607
- lpar, args, (cmdarg, lineno), body = val
1648
+ (line, lpar), args, cmdarg, body = val
1608
1649
  lexer.lpar_beg = lpar
1609
1650
 
1610
1651
  lexer.cmdarg.restore cmdarg
1611
1652
  lexer.cmdarg.lexpop
1612
1653
 
1613
- call = new_call nil, :lambda
1654
+ call = s(:lambda).line line
1614
1655
  result = new_iter call, args, body
1615
- result.line = lineno
1656
+ result.line = line
1616
1657
  self.env.unextend
1617
1658
  }
1618
1659
 
@@ -1637,8 +1678,8 @@ opt_block_args_tail: tCOMMA block_args_tail
1637
1678
 
1638
1679
  do_block: k_do_block do_body kEND
1639
1680
  {
1640
- # TODO: maybe fix lineno to kDO's lineno?
1641
- result = val[1]
1681
+ (_, line), iter, _ = val
1682
+ result = iter.line line
1642
1683
  }
1643
1684
 
1644
1685
  block_call: command do_block
@@ -1652,8 +1693,10 @@ opt_block_args_tail: tCOMMA block_args_tail
1652
1693
 
1653
1694
  val = invert_block_call val if inverted? val
1654
1695
 
1655
- result = val[1]
1656
- result.insert 1, val[0]
1696
+ cmd, blk = val
1697
+
1698
+ result = blk
1699
+ result.insert 1, cmd
1657
1700
  }
1658
1701
  | block_call call_op2 operation2 opt_paren_args
1659
1702
  {
@@ -1684,8 +1727,10 @@ opt_block_args_tail: tCOMMA block_args_tail
1684
1727
  }
1685
1728
  paren_args
1686
1729
  {
1687
- args = self.call_args val[2..-1]
1688
- result = val[0].concat args.sexp_body
1730
+ call, lineno, args = val
1731
+
1732
+ result = call.concat args.sexp_body if args
1733
+ result.line lineno
1689
1734
  }
1690
1735
  | primary_value call_op operation2 opt_paren_args
1691
1736
  {
@@ -1713,7 +1758,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1713
1758
  }
1714
1759
  | kSUPER
1715
1760
  {
1716
- result = s(:zsuper)
1761
+ result = s(:zsuper).line lexer.lineno
1717
1762
  }
1718
1763
  | primary_value tLBRACK2 opt_call_args rbracket
1719
1764
  {
@@ -1764,11 +1809,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1764
1809
  do_body: { self.env.extend :dynamic; result = self.lexer.lineno }
1765
1810
  { result = lexer.cmdarg.store(false) }
1766
1811
  opt_block_param
1767
- #if V >= 25
1768
- bodystmt
1769
- #else
1770
1812
  compstmt
1771
- #endif
1772
1813
  {
1773
1814
  line, cmdarg, param, cmpstmt = val
1774
1815
 
@@ -1795,7 +1836,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1795
1836
  (_, line), klasses, var, _, body, rest = val
1796
1837
 
1797
1838
  klasses ||= s(:array)
1798
- klasses << new_assign(var, s(:gvar, :"$!")) if var
1839
+ klasses << new_assign(var, s(:gvar, :"$!").line(var.line)) if var
1799
1840
  klasses.line line
1800
1841
 
1801
1842
  result = new_resbody(klasses, body)
@@ -1808,7 +1849,8 @@ opt_block_args_tail: tCOMMA block_args_tail
1808
1849
 
1809
1850
  exc_list: arg_value
1810
1851
  {
1811
- result = s(:array, val[0])
1852
+ arg, = val
1853
+ result = s(:array, arg).line arg.line
1812
1854
  }
1813
1855
  | mrhs
1814
1856
  | none
@@ -1821,26 +1863,31 @@ opt_block_args_tail: tCOMMA block_args_tail
1821
1863
 
1822
1864
  opt_ensure: k_ensure compstmt
1823
1865
  {
1824
- _, body = val
1866
+ (_, line), body = val
1825
1867
 
1826
- result = body || s(:nil)
1868
+ result = body || s(:nil).line(line)
1827
1869
  }
1828
1870
  | none
1829
1871
 
1830
1872
  literal: numeric
1831
1873
  {
1874
+ line = lexer.lineno
1832
1875
  result = s(:lit, val[0])
1876
+ result.line = line
1833
1877
  }
1834
1878
  | symbol
1835
1879
  {
1880
+ line = lexer.lineno
1836
1881
  result = s(:lit, val[0])
1882
+ result.line = line
1837
1883
  }
1838
1884
  | dsym
1839
1885
 
1840
1886
  strings: string
1841
1887
  {
1842
- val[0] = s(:dstr, val[0].value) if val[0].sexp_type == :evstr
1843
- result = val[0]
1888
+ str, = val
1889
+ str = s(:dstr, str.value) if str.sexp_type == :evstr
1890
+ result = str
1844
1891
  }
1845
1892
 
1846
1893
  string: tCHAR
@@ -1855,7 +1902,11 @@ opt_block_args_tail: tCOMMA block_args_tail
1855
1902
 
1856
1903
  string1: tSTRING_BEG string_contents tSTRING_END
1857
1904
  {
1858
- result = val[1]
1905
+ _, str, (_, func) = val
1906
+
1907
+ str = dedent str if func =~ RubyLexer::STR_FUNC_ICNTNT
1908
+
1909
+ result = str
1859
1910
  }
1860
1911
  | tSTRING
1861
1912
  {
@@ -1865,6 +1916,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1865
1916
  xstring: tXSTRING_BEG xstring_contents tSTRING_END
1866
1917
  {
1867
1918
  result = new_xstring val[1]
1919
+ # TODO: dedent?!?! SERIOUSLY?!?
1868
1920
  }
1869
1921
 
1870
1922
  regexp: tREGEXP_BEG regexp_contents tREGEXP_END
@@ -1874,7 +1926,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1874
1926
 
1875
1927
  words: tWORDS_BEG tSPACE tSTRING_END
1876
1928
  {
1877
- result = s(:array)
1929
+ result = s(:array).line lexer.lineno
1878
1930
  }
1879
1931
  | tWORDS_BEG word_list tSTRING_END
1880
1932
  {
@@ -1898,25 +1950,28 @@ opt_block_args_tail: tCOMMA block_args_tail
1898
1950
 
1899
1951
  symbols: tSYMBOLS_BEG tSPACE tSTRING_END
1900
1952
  {
1901
- result = s(:array)
1953
+ result = s(:array).line lexer.lineno
1902
1954
  }
1903
- | tSYMBOLS_BEG symbol_list tSTRING_END
1955
+ | tSYMBOLS_BEG { result = lexer.lineno } symbol_list tSTRING_END
1904
1956
  {
1905
- result = val[1]
1957
+ _, line, list, _, = val
1958
+ list.line = line
1959
+ result = list
1906
1960
  }
1907
1961
 
1908
1962
  symbol_list: none
1909
1963
  {
1910
- result = new_symbol_list
1964
+ result = new_symbol_list.line lexer.lineno
1911
1965
  }
1912
1966
  | symbol_list word tSPACE
1913
1967
  {
1914
- result = val[0].dup << new_symbol_list_entry(val)
1968
+ list, * = val
1969
+ result = list.dup << new_symbol_list_entry(val)
1915
1970
  }
1916
1971
 
1917
1972
  qwords: tQWORDS_BEG tSPACE tSTRING_END
1918
1973
  {
1919
- result = s(:array)
1974
+ result = s(:array).line lexer.lineno
1920
1975
  }
1921
1976
  | tQWORDS_BEG qword_list tSTRING_END
1922
1977
  {
@@ -1925,7 +1980,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1925
1980
 
1926
1981
  qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
1927
1982
  {
1928
- result = s(:array)
1983
+ result = s(:array).line lexer.lineno # FIX
1929
1984
  }
1930
1985
  | tQSYMBOLS_BEG qsym_list tSTRING_END
1931
1986
  {
@@ -1952,11 +2007,12 @@ opt_block_args_tail: tCOMMA block_args_tail
1952
2007
 
1953
2008
  string_contents: none
1954
2009
  {
1955
- result = s(:str, "")
2010
+ result = s(:str, "").line lexer.lineno
1956
2011
  }
1957
2012
  | string_contents string_content
1958
2013
  {
1959
- result = literal_concat(val[0], val[1])
2014
+ v1, v2 = val
2015
+ result = literal_concat v1, v2
1960
2016
  }
1961
2017
 
1962
2018
  xstring_contents: none
@@ -1965,7 +2021,8 @@ xstring_contents: none
1965
2021
  }
1966
2022
  | xstring_contents string_content
1967
2023
  {
1968
- result = literal_concat(val[0], val[1])
2024
+ v1, v2 = val
2025
+ result = literal_concat v1, v2
1969
2026
  }
1970
2027
 
1971
2028
  regexp_contents: none
@@ -1974,7 +2031,8 @@ regexp_contents: none
1974
2031
  }
1975
2032
  | regexp_contents string_content
1976
2033
  {
1977
- result = literal_concat(val[0], val[1])
2034
+ v1, v2 = val
2035
+ result = literal_concat v1, v2
1978
2036
  }
1979
2037
 
1980
2038
  string_content: tSTRING_CONTENT
@@ -1990,8 +2048,9 @@ regexp_contents: none
1990
2048
  }
1991
2049
  string_dvar
1992
2050
  {
1993
- lexer.lex_strterm = val[1]
1994
- result = s(:evstr, val[2])
2051
+ _, strterm, str = val
2052
+ lexer.lex_strterm = strterm
2053
+ result = s(:evstr, str).line str.line
1995
2054
  }
1996
2055
  | tSTRING_DBEG
1997
2056
  {
@@ -2001,6 +2060,7 @@ regexp_contents: none
2001
2060
  lexer.cond.store,
2002
2061
  lexer.cmdarg.store,
2003
2062
  lexer.lex_state,
2063
+ lexer.lineno,
2004
2064
  ]
2005
2065
 
2006
2066
  lexer.lex_strterm = nil
@@ -2014,7 +2074,7 @@ regexp_contents: none
2014
2074
  {
2015
2075
  _, memo, stmt, _ = val
2016
2076
 
2017
- lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state = memo
2077
+ lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state, line = memo
2018
2078
 
2019
2079
  lexer.lex_strterm = lex_strterm
2020
2080
  lexer.brace_nest = brace_nest
@@ -2031,19 +2091,19 @@ regexp_contents: none
2031
2091
  when :str, :dstr, :evstr then
2032
2092
  result = stmt
2033
2093
  else
2034
- result = s(:evstr, stmt)
2094
+ result = s(:evstr, stmt).line line
2035
2095
  end
2036
2096
  when nil then
2037
- result = s(:evstr)
2097
+ result = s(:evstr).line line
2038
2098
  else
2039
2099
  debug20 25
2040
2100
  raise "unknown string body: #{stmt.inspect}"
2041
2101
  end
2042
2102
  }
2043
2103
 
2044
- string_dvar: tGVAR { result = s(:gvar, val[0].to_sym) }
2045
- | tIVAR { result = s(:ivar, val[0].to_sym) }
2046
- | tCVAR { result = s(:cvar, val[0].to_sym) }
2104
+ string_dvar: tGVAR { result = s(:gvar, val[0].to_sym).line lexer.lineno }
2105
+ | tIVAR { result = s(:ivar, val[0].to_sym).line lexer.lineno }
2106
+ | tCVAR { result = s(:cvar, val[0].to_sym).line lexer.lineno }
2047
2107
  | backref
2048
2108
 
2049
2109
  symbol: tSYMBEG sym
@@ -2060,67 +2120,55 @@ regexp_contents: none
2060
2120
 
2061
2121
  dsym: tSYMBEG xstring_contents tSTRING_END
2062
2122
  {
2123
+ _, result, _ = val
2124
+
2063
2125
  lexer.lex_state = EXPR_END
2064
- result = val[1]
2065
2126
 
2066
- result ||= s(:str, "")
2127
+ result ||= s(:str, "").line lexer.lineno
2067
2128
 
2068
2129
  case result.sexp_type
2069
2130
  when :dstr then
2070
2131
  result.sexp_type = :dsym
2071
2132
  when :str then
2072
- result = s(:lit, result.last.to_sym)
2133
+ result = s(:lit, result.last.to_sym).line result.line
2073
2134
  when :evstr then
2074
- result = s(:dsym, "", result)
2135
+ result = s(:dsym, "", result).line result.line
2075
2136
  else
2076
2137
  debug20 26, val, result
2077
2138
  end
2078
2139
  }
2079
2140
 
2080
- #if V == 20
2081
2141
  numeric: tINTEGER
2082
2142
  | tFLOAT
2083
2143
  | tUMINUS_NUM tINTEGER =tLOWEST
2084
- #else
2085
- numeric: simple_numeric
2086
- | tUMINUS_NUM simple_numeric
2087
- #endif
2088
2144
  {
2089
2145
  result = -val[1] # TODO: pt_testcase
2090
- #if V == 20
2091
2146
  }
2092
2147
  | tUMINUS_NUM tFLOAT =tLOWEST
2093
2148
  {
2094
2149
  result = -val[1] # TODO: pt_testcase
2095
- #endif
2096
2150
  }
2097
2151
 
2098
- #if V >= 21
2099
- simple_numeric: tINTEGER
2100
- | tFLOAT
2101
- | tRATIONAL
2102
- | tIMAGINARY
2103
-
2104
- #endif
2105
2152
  user_variable: tIDENTIFIER
2106
2153
  | tIVAR
2107
2154
  | tGVAR
2108
2155
  | tCONSTANT
2109
2156
  | tCVAR
2110
2157
 
2111
- keyword_variable: kNIL { result = s(:nil) }
2112
- | kSELF { result = s(:self) }
2113
- | kTRUE { result = s(:true) }
2114
- | kFALSE { result = s(:false) }
2115
- | k__FILE__ { result = s(:str, self.file) }
2116
- | k__LINE__ { result = s(:lit, lexer.lineno) }
2158
+ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2159
+ | kSELF { result = s(:self).line lexer.lineno }
2160
+ | kTRUE { result = s(:true).line lexer.lineno }
2161
+ | kFALSE { result = s(:false).line lexer.lineno }
2162
+ | k__FILE__ { result = s(:str, self.file).line lexer.lineno }
2163
+ | k__LINE__ { result = s(:lit, lexer.lineno).line lexer.lineno }
2117
2164
  | k__ENCODING__
2118
2165
  {
2166
+ l = lexer.lineno
2119
2167
  result =
2120
2168
  if defined? Encoding then
2121
- s(:colon2, s(:const, :Encoding), :UTF_8)
2169
+ s(:colon2, s(:const, :Encoding).line(l), :UTF_8).line l
2122
2170
  else
2123
- s(:str, "Unsupported!")
2171
+ s(:str, "Unsupported!").line l
2124
2172
  end
2125
2173
  }
2126
2174
 
@@ -2145,8 +2193,8 @@ keyword_variable: kNIL { result = s(:nil) }
2145
2193
  debug20 29, val, result
2146
2194
  }
2147
2195
 
2148
- backref: tNTH_REF { result = s(:nth_ref, val[0]) }
2149
- | tBACK_REF { result = s(:back_ref, val[0]) }
2196
+ backref: tNTH_REF { result = s(:nth_ref, val[0]).line lexer.lineno }
2197
+ | tBACK_REF { result = s(:back_ref, val[0]).line lexer.lineno }
2150
2198
 
2151
2199
  superclass: tLT
2152
2200
  {
@@ -2293,30 +2341,21 @@ keyword_variable: kNIL { result = s(:nil) }
2293
2341
  result = identifier
2294
2342
  }
2295
2343
 
2296
- #if V >= 22
2297
- f_arg_asgn: f_norm_arg
2298
-
2299
- f_arg_item: f_arg_asgn
2300
- | tLPAREN f_margs rparen
2301
- {
2302
- result = val[1]
2303
- }
2304
- #else
2305
2344
  f_arg_item: f_norm_arg
2306
2345
  | tLPAREN f_margs rparen
2307
2346
  {
2308
2347
  result = val[1]
2309
2348
  }
2310
- #endif
2311
2349
 
2312
2350
  f_arg: f_arg_item
2313
2351
  {
2314
- case val[0]
2352
+ arg, = val
2353
+
2354
+ case arg
2315
2355
  when Symbol then
2316
- result = s(:args)
2317
- result << val[0]
2356
+ result = s(:args, arg).line lexer.lineno
2318
2357
  when Sexp then
2319
- result = val[0]
2358
+ result = arg
2320
2359
  else
2321
2360
  debug20 32
2322
2361
  raise "Unknown f_arg type: #{val.inspect}"
@@ -2329,61 +2368,33 @@ keyword_variable: kNIL { result = s(:nil) }
2329
2368
  if list.sexp_type == :args then
2330
2369
  result = list
2331
2370
  else
2332
- result = s(:args, list)
2371
+ result = s(:args, list).line list.line
2333
2372
  end
2334
2373
 
2335
2374
  result << item
2336
2375
  }
2337
2376
 
2338
- #if V == 20
2339
2377
  f_kw: tLABEL arg_value
2340
- #else
2341
- f_label: tLABEL
2342
-
2343
- f_kw: f_label arg_value
2344
- #endif
2345
2378
  {
2346
- # TODO: call_args
2347
- label, _ = val[0] # TODO: fix lineno?
2348
- identifier = label.to_sym
2349
- self.env[identifier] = :lvar
2379
+ # TODO: new_kw_arg
2380
+ (label, line), arg = val
2350
2381
 
2351
- result = s(:array, s(:kwarg, identifier, val[1]))
2352
- }
2353
- #if V >= 21
2354
- | f_label
2355
- {
2356
- label, _ = val[0] # TODO: fix lineno?
2357
2382
  identifier = label.to_sym
2358
2383
  self.env[identifier] = :lvar
2359
2384
 
2360
- result = s(:array, s(:kwarg, identifier))
2385
+ kwarg = s(:kwarg, identifier, arg).line line
2386
+ result = s(:array, kwarg).line line
2361
2387
  }
2362
- #endif
2363
2388
 
2364
- #if V == 20
2365
2389
  f_block_kw: tLABEL primary_value
2366
- #else
2367
- f_block_kw: f_label primary_value
2368
- #endif
2369
- {
2370
- # TODO: call_args
2371
- label, _ = val[0] # TODO: fix lineno?
2372
- identifier = label.to_sym
2373
- self.env[identifier] = :lvar
2374
-
2375
- result = s(:array, s(:kwarg, identifier, val[1]))
2376
- }
2377
- #if V >= 21
2378
- | f_label
2379
2390
  {
2380
- label, _ = val[0] # TODO: fix lineno?
2381
- identifier = label.to_sym
2382
- self.env[identifier] = :lvar
2391
+ # TODO: new_kw_arg
2392
+ (label, line), expr = val
2393
+ id = label.to_sym
2394
+ self.env[id] = :lvar
2383
2395
 
2384
- result = s(:array, s(:kwarg, identifier))
2396
+ result = s(:array, s(:kwarg, id, expr).line(line)).line line
2385
2397
  }
2386
- #endif
2387
2398
 
2388
2399
  f_block_kwarg: f_block_kw
2389
2400
  | f_block_kwarg tCOMMA f_block_kw
@@ -2412,42 +2423,33 @@ keyword_variable: kNIL { result = s(:nil) }
2412
2423
  result = :"**"
2413
2424
  }
2414
2425
 
2415
- #if V == 20
2416
2426
  f_opt: tIDENTIFIER tEQL arg_value
2417
- #elif V == 21
2418
- f_opt: f_norm_arg tEQL arg_value
2419
- #else
2420
- f_opt: f_arg_asgn tEQL arg_value
2421
- #endif
2422
2427
  {
2423
2428
  result = self.assignable val[0], val[2]
2424
2429
  # TODO: detect duplicate names
2425
2430
  }
2426
2431
 
2427
- #if V == 20
2428
2432
  f_block_opt: tIDENTIFIER tEQL primary_value
2429
- #elif V == 21
2430
- f_block_opt: f_norm_arg tEQL primary_value
2431
- #else
2432
- f_block_opt: f_arg_asgn tEQL primary_value
2433
- #endif
2434
2433
  {
2435
2434
  result = self.assignable val[0], val[2]
2436
2435
  }
2437
2436
 
2438
2437
  f_block_optarg: f_block_opt
2439
2438
  {
2440
- result = s(:block, val[0])
2439
+ optblk, = val
2440
+ result = s(:block, optblk).line optblk.line
2441
2441
  }
2442
2442
  | f_block_optarg tCOMMA f_block_opt
2443
2443
  {
2444
- result = val[0]
2445
- result << val[2]
2444
+ optarg, _, optblk = val
2445
+ result = optarg
2446
+ result << optblk
2446
2447
  }
2447
2448
 
2448
2449
  f_optarg: f_opt
2449
2450
  {
2450
- result = s(:block, val[0])
2451
+ opt, = val
2452
+ result = s(:block, opt).line opt.line
2451
2453
  }
2452
2454
  | f_optarg tCOMMA f_opt
2453
2455
  {
@@ -2501,14 +2503,11 @@ keyword_variable: kNIL { result = s(:nil) }
2501
2503
  result.sexp_type == :lit
2502
2504
  }
2503
2505
 
2504
- assoc_list: none # [!nil]
2506
+ assoc_list: none
2505
2507
  {
2506
- result = s(:array)
2507
- }
2508
- | assocs trailer # [!nil]
2509
- {
2510
- result = val[0]
2508
+ result = s(:array).line lexer.lineno
2511
2509
  }
2510
+ | assocs trailer
2512
2511
 
2513
2512
  assocs: assoc
2514
2513
  | assocs tCOMMA assoc
@@ -2522,24 +2521,21 @@ keyword_variable: kNIL { result = s(:nil) }
2522
2521
 
2523
2522
  assoc: arg_value tASSOC arg_value
2524
2523
  {
2525
- result = s(:array, val[0], val[2])
2524
+ v1, _, v2 = val
2525
+ result = s(:array, v1, v2).line v1.line
2526
2526
  }
2527
2527
  | tLABEL arg_value
2528
2528
  {
2529
- (label, _), arg = val
2530
- result = s(:array, s(:lit, label.to_sym), arg)
2531
- }
2532
- #if V >= 22
2533
- | tSTRING_BEG string_contents tLABEL_END arg_value
2534
- {
2535
- _, sym, _, value = val
2536
- sym.sexp_type = :dsym
2537
- result = s(:array, sym, value)
2529
+ (label, line), arg = val
2530
+
2531
+ lit = s(:lit, label.to_sym).line line
2532
+ result = s(:array, lit, arg).line line
2538
2533
  }
2539
- #endif
2540
2534
  | tDSTAR arg_value
2541
2535
  {
2542
- result = s(:array, s(:kwsplat, val[1]))
2536
+ _, arg = val
2537
+ line = arg.line
2538
+ result = s(:array, s(:kwsplat, arg).line(line)).line line
2543
2539
  }
2544
2540
 
2545
2541
  operation: tIDENTIFIER | tCONSTANT | tFID
@@ -2547,9 +2543,6 @@ keyword_variable: kNIL { result = s(:nil) }
2547
2543
  operation3: tIDENTIFIER | tFID | op
2548
2544
  dot_or_colon: tDOT | tCOLON2
2549
2545
  call_op: tDOT
2550
- #if V >= 23
2551
- | tLONELY # TODO: rename tANDDOT?
2552
- #endif
2553
2546
 
2554
2547
  call_op2: call_op
2555
2548
  | tCOLON2