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,31 +788,33 @@ 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 tDOT2
734
806
  {
735
- v1, v2 = val[0], nil
807
+ v1, _ = val
808
+ v2 = nil
736
809
 
737
- result = s(:dot2, v1, v2)
810
+ result = s(:dot2, v1, v2).line v1.line
738
811
  }
739
812
  | arg tDOT3
740
813
  {
741
- v1, v2 = val[0], nil
814
+ v1, _ = val
815
+ v2 = nil
742
816
 
743
- result = s(:dot3, v1, v2)
817
+ result = s(:dot3, v1, v2).line v1.line
744
818
  }
745
819
  | arg tPLUS arg
746
820
  {
@@ -768,7 +842,9 @@ rule
768
842
  }
769
843
  | tUMINUS_NUM simple_numeric tPOW arg
770
844
  {
771
- result = new_call(new_call(s(:lit, val[1]), :"**", argl(val[3])), :"-@")
845
+ lit = s(:lit, val[1]).line lexer.lineno
846
+ result = new_call(new_call(lit, :"**", argl(val[3])), :"-@")
847
+
772
848
  }
773
849
  | tUPLUS arg
774
850
  {
@@ -809,15 +885,19 @@ rule
809
885
  }
810
886
  | arg tMATCH arg
811
887
  {
812
- result = new_match val[0], val[2]
888
+ lhs, _, rhs = val
889
+ result = new_match lhs, rhs
813
890
  }
814
891
  | arg tNMATCH arg
815
892
  {
816
- result = s(:not, new_match(val[0], val[2]))
893
+ lhs, _, rhs = val
894
+ result = s(:not, new_match(lhs, rhs)).line lhs.line
817
895
  }
818
896
  | tBANG arg
819
897
  {
820
- result = new_call val[1], :"!"
898
+ _, arg = val
899
+ result = new_call arg, :"!"
900
+ result.line arg.line
821
901
  }
822
902
  | tTILDE arg
823
903
  {
@@ -845,11 +925,13 @@ rule
845
925
  }
846
926
  | kDEFINED opt_nl arg
847
927
  {
848
- result = s(:defined, val[2])
928
+ (_, line), _, arg = val
929
+ result = s(:defined, arg).line line
849
930
  }
850
931
  | arg tEH arg opt_nl tCOLON arg
851
932
  {
852
- result = s(:if, val[0], val[2], val[5])
933
+ c, _, t, _, _, f = val
934
+ result = s(:if, c, t, f).line c.line
853
935
  }
854
936
  | primary
855
937
 
@@ -892,28 +974,25 @@ rule
892
974
  arg_rhs: arg =tOP_ASGN
893
975
  | arg kRESCUE_MOD arg
894
976
  {
895
- body, _, resbody = val
977
+ body, (_, line), resbody = val
896
978
  body = value_expr body
897
979
  resbody = remove_begin resbody
898
- result = new_rescue(body, new_resbody(s(:array), resbody))
980
+
981
+ ary = s(:array).line line
982
+ result = new_rescue(body, new_resbody(ary, resbody))
899
983
  }
900
984
 
901
985
  paren_args: tLPAREN2 opt_call_args rparen
902
986
  {
903
- result = val[1]
987
+ _, args, _ = val
988
+ result = args
904
989
  }
905
990
 
906
991
  opt_paren_args: none
907
992
  | paren_args
908
993
 
909
994
  opt_call_args: none
910
- {
911
- result = val[0]
912
- }
913
995
  | call_args
914
- {
915
- result = val[0]
916
- }
917
996
  | args tCOMMA
918
997
  {
919
998
  result = args val
@@ -963,7 +1042,8 @@ rule
963
1042
 
964
1043
  block_arg: tAMPER arg_value
965
1044
  {
966
- result = s(:block_pass, val[1])
1045
+ _, arg = val
1046
+ result = s(:block_pass, arg).line arg.line
967
1047
  }
968
1048
 
969
1049
  opt_block_arg: tCOMMA block_arg
@@ -974,19 +1054,24 @@ rule
974
1054
 
975
1055
  args: arg_value
976
1056
  {
977
- result = s(:array, val[0])
1057
+ arg, = val
1058
+
1059
+ result = s(:array, arg).line arg.line
978
1060
  }
979
1061
  | tSTAR arg_value
980
1062
  {
981
- result = s(:array, s(:splat, val[1]))
1063
+ _, arg = val
1064
+ result = s(:array, s(:splat, arg).line(arg.line)).line arg.line
982
1065
  }
983
1066
  | args tCOMMA arg_value
984
1067
  {
985
- result = self.list_append val[0], val[2]
1068
+ args, _, id = val
1069
+ result = self.list_append args, id
986
1070
  }
987
- | args tCOMMA tSTAR arg_value
1071
+ | args tCOMMA tSTAR { result = lexer.lineno } arg_value
988
1072
  {
989
- result = self.list_append val[0], s(:splat, val[3])
1073
+ args, _, _, line, id = val
1074
+ result = self.list_append args, s(:splat, id).line(line)
990
1075
  }
991
1076
 
992
1077
  mrhs_arg: mrhs
@@ -1004,11 +1089,15 @@ rule
1004
1089
  }
1005
1090
  | args tCOMMA tSTAR arg_value
1006
1091
  {
1007
- result = self.arg_concat val[0], val[3]
1092
+ # FIX: bad shift/reduce conflict with rhs' comma star prod
1093
+ # TODO: make all tXXXX terminals include lexer.lineno
1094
+ arg, _, _, splat = val
1095
+ result = self.arg_concat arg, splat
1008
1096
  }
1009
1097
  | tSTAR arg_value
1010
1098
  {
1011
- result = s(:splat, val[1])
1099
+ _, arg = val
1100
+ result = s(:splat, arg).line arg.line
1012
1101
  }
1013
1102
 
1014
1103
  primary: literal
@@ -1023,7 +1112,8 @@ rule
1023
1112
  | backref
1024
1113
  | tFID
1025
1114
  {
1026
- result = new_call nil, val[0].to_sym
1115
+ msg, = val
1116
+ result = new_call nil, msg.to_sym
1027
1117
  }
1028
1118
  | k_begin
1029
1119
  {
@@ -1043,16 +1133,19 @@ rule
1043
1133
 
1044
1134
  result.line = val[1]
1045
1135
  }
1046
- | tLPAREN_ARG rparen
1136
+ | tLPAREN_ARG
1047
1137
  {
1048
- # TODO: lex_state = EXPR_ENDARG in between
1049
- debug20 13, val, result
1138
+ lexer.lex_state = EXPR_ENDARG
1139
+ result = lexer.lineno
1140
+ }
1141
+ rparen
1142
+ {
1143
+ _, line, _ = val
1144
+ result = s(:begin).line line
1050
1145
  }
1051
1146
  | tLPAREN_ARG
1052
1147
  {
1053
1148
  result = lexer.cmdarg.store false
1054
- # result = self.lexer.cmdarg.stack.dup
1055
- # lexer.cmdarg.stack.replace [false] # TODO add api for these
1056
1149
  }
1057
1150
  stmt
1058
1151
  {
@@ -1067,21 +1160,29 @@ rule
1067
1160
  }
1068
1161
  | tLPAREN compstmt tRPAREN
1069
1162
  {
1070
- result = val[1] || s(:nil)
1163
+ _, stmt, _ = val
1164
+ result = stmt
1165
+ result ||= s(:nil).line lexer.lineno
1071
1166
  result.paren = true
1072
1167
  }
1073
1168
  | primary_value tCOLON2 tCONSTANT
1074
1169
  {
1075
- result = s(:colon2, val[0], val[2].to_sym)
1170
+ expr, _, id = val
1171
+
1172
+ result = s(:colon2, expr, id.to_sym).line expr.line
1076
1173
  }
1077
1174
  | tCOLON3 tCONSTANT
1078
1175
  {
1079
- result = s(:colon3, val[1].to_sym)
1176
+ _, id = val
1177
+
1178
+ result = s(:colon3, id.to_sym).line lexer.lineno
1080
1179
  }
1081
- | tLBRACK aref_args tRBRACK
1180
+ | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1082
1181
  {
1083
- result = val[1] || s(:array)
1182
+ _, line, args, _ = val
1183
+ result = args || s(:array)
1084
1184
  result.sexp_type = :array # aref_args is :args
1185
+ result.line line
1085
1186
  }
1086
1187
  | tLBRACE
1087
1188
  {
@@ -1093,7 +1194,8 @@ rule
1093
1194
  }
1094
1195
  | k_return
1095
1196
  {
1096
- result = s(:return)
1197
+ (_, line), = val
1198
+ result = s(:return).line line
1097
1199
  }
1098
1200
  | kYIELD tLPAREN2 call_args rparen
1099
1201
  {
@@ -1109,11 +1211,14 @@ rule
1109
1211
  }
1110
1212
  | kDEFINED opt_nl tLPAREN2 expr rparen
1111
1213
  {
1112
- result = s(:defined, val[3])
1214
+ (_, line), _, _, arg, _ = val
1215
+
1216
+ result = s(:defined, arg).line line
1113
1217
  }
1114
1218
  | kNOT tLPAREN2 expr rparen
1115
1219
  {
1116
- result = s(:call, val[2], :"!")
1220
+ _, _, lhs, _ = val
1221
+ result = new_call lhs, :"!"
1117
1222
  }
1118
1223
  | kNOT tLPAREN2 rparen
1119
1224
  {
@@ -1121,11 +1226,11 @@ rule
1121
1226
  }
1122
1227
  | fcall brace_block
1123
1228
  {
1124
- oper, iter = val[0], val[1]
1125
- call = oper # FIX
1229
+ call, iter = val
1230
+
1126
1231
  iter.insert 1, call
1127
1232
  result = iter
1128
- call.line = iter.line
1233
+ # FIX: probably not: call.line = iter.line
1129
1234
  }
1130
1235
  | method_call
1131
1236
  | method_call brace_block
@@ -1242,7 +1347,7 @@ rule
1242
1347
  # TODO: port local_push_gen and local_pop_gen
1243
1348
  lexer.cmdarg.stack.replace [false]
1244
1349
  }
1245
- f_arglist bodystmt k_end
1350
+ f_arglist bodystmt { result = lexer.lineno } k_end
1246
1351
  {
1247
1352
  in_def, cmdarg = val[2]
1248
1353
 
@@ -1268,9 +1373,8 @@ rule
1268
1373
  }
1269
1374
  f_arglist bodystmt k_end
1270
1375
  {
1271
- line, cmdarg = val[5]
1376
+ _, cmdarg = val[5]
1272
1377
  result = new_defs val
1273
- result[3].line line
1274
1378
 
1275
1379
  lexer.cmdarg.stack.replace cmdarg
1276
1380
 
@@ -1280,19 +1384,23 @@ rule
1280
1384
  }
1281
1385
  | kBREAK
1282
1386
  {
1283
- result = s(:break)
1387
+ (_, line), = val
1388
+ result = s(:break).line line
1284
1389
  }
1285
1390
  | kNEXT
1286
1391
  {
1287
- result = s(:next)
1392
+ (_, line), = val
1393
+ result = s(:next).line line
1288
1394
  }
1289
1395
  | kREDO
1290
1396
  {
1291
- result = s(:redo)
1397
+ (_, line), = val
1398
+ result = s(:redo).line line
1292
1399
  }
1293
1400
  | kRETRY
1294
1401
  {
1295
- result = s(:retry)
1402
+ (_, line), = val
1403
+ result = s(:retry).line line
1296
1404
  }
1297
1405
 
1298
1406
  primary_value: primary
@@ -1331,7 +1439,9 @@ rule
1331
1439
  if_tail: opt_else
1332
1440
  | k_elsif expr_value then compstmt if_tail
1333
1441
  {
1334
- result = s(:if, val[1], val[3], val[4])
1442
+ (_, line), c, _, t, rest = val
1443
+
1444
+ result = s(:if, c, t, rest).line line
1335
1445
  }
1336
1446
 
1337
1447
  opt_else: none
@@ -1354,7 +1464,9 @@ rule
1354
1464
 
1355
1465
  f_marg_list: f_marg
1356
1466
  {
1357
- result = s(:array, val[0])
1467
+ sym, = val
1468
+
1469
+ result = s(:array, sym).line lexer.lineno
1358
1470
  }
1359
1471
  | f_marg_list tCOMMA f_marg
1360
1472
  {
@@ -1428,7 +1540,9 @@ rule
1428
1540
  }
1429
1541
  | f_block_arg
1430
1542
  {
1431
- result = call_args val
1543
+ line = lexer.lineno
1544
+ result = call_args val # TODO: push line down
1545
+ result.line line
1432
1546
  }
1433
1547
 
1434
1548
  opt_block_args_tail: tCOMMA block_args_tail
@@ -1459,7 +1573,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1459
1573
  }
1460
1574
  | f_arg tCOMMA
1461
1575
  {
1462
- result = args val
1576
+ result = args(val) << nil
1463
1577
  }
1464
1578
  | f_arg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
1465
1579
  {
@@ -1511,7 +1625,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1511
1625
  }
1512
1626
  | tOROP
1513
1627
  {
1514
- result = s(:args)
1628
+ result = s(:args).line lexer.lineno
1515
1629
  }
1516
1630
  | tPIPE block_param opt_bv_decl tPIPE
1517
1631
  {
@@ -1536,33 +1650,33 @@ opt_block_args_tail: tCOMMA block_args_tail
1536
1650
 
1537
1651
  bvar: tIDENTIFIER
1538
1652
  {
1539
- result = s(:shadow, val[0].to_sym)
1653
+ id, = val
1654
+ line = lexer.lineno
1655
+ result = s(:shadow, id.to_sym).line line
1540
1656
  }
1541
1657
  | f_bad_arg
1542
1658
 
1543
1659
  lambda: {
1544
1660
  self.env.extend :dynamic
1545
- result = self.lexer.lineno
1546
-
1547
- result = lexer.lpar_beg
1661
+ result = [lexer.lineno, lexer.lpar_beg]
1548
1662
  lexer.paren_nest += 1
1549
1663
  lexer.lpar_beg = lexer.paren_nest
1550
1664
  }
1551
1665
  f_larglist
1552
1666
  {
1553
- result = [lexer.cmdarg.store(false), self.lexer.lineno]
1667
+ result = lexer.cmdarg.store(false)
1554
1668
  }
1555
1669
  lambda_body
1556
1670
  {
1557
- lpar, args, (cmdarg, lineno), body = val
1671
+ (line, lpar), args, cmdarg, body = val
1558
1672
  lexer.lpar_beg = lpar
1559
1673
 
1560
1674
  lexer.cmdarg.restore cmdarg
1561
1675
  lexer.cmdarg.lexpop
1562
1676
 
1563
- call = new_call nil, :lambda
1677
+ call = s(:lambda).line line
1564
1678
  result = new_iter call, args, body
1565
- result.line = lineno
1679
+ result.line = line
1566
1680
  self.env.unextend
1567
1681
  }
1568
1682
 
@@ -1587,8 +1701,8 @@ opt_block_args_tail: tCOMMA block_args_tail
1587
1701
 
1588
1702
  do_block: k_do_block do_body kEND
1589
1703
  {
1590
- # TODO: maybe fix lineno to kDO's lineno?
1591
- result = val[1]
1704
+ (_, line), iter, _ = val
1705
+ result = iter.line line
1592
1706
  }
1593
1707
 
1594
1708
  block_call: command do_block
@@ -1602,8 +1716,10 @@ opt_block_args_tail: tCOMMA block_args_tail
1602
1716
 
1603
1717
  val = invert_block_call val if inverted? val
1604
1718
 
1605
- result = val[1]
1606
- result.insert 1, val[0]
1719
+ cmd, blk = val
1720
+
1721
+ result = blk
1722
+ result.insert 1, cmd
1607
1723
  }
1608
1724
  | block_call call_op2 operation2 opt_paren_args
1609
1725
  {
@@ -1634,8 +1750,10 @@ opt_block_args_tail: tCOMMA block_args_tail
1634
1750
  }
1635
1751
  paren_args
1636
1752
  {
1637
- args = self.call_args val[2..-1]
1638
- result = val[0].concat args.sexp_body
1753
+ call, lineno, args = val
1754
+
1755
+ result = call.concat args.sexp_body if args
1756
+ result.line lineno
1639
1757
  }
1640
1758
  | primary_value call_op operation2 opt_paren_args
1641
1759
  {
@@ -1663,7 +1781,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1663
1781
  }
1664
1782
  | kSUPER
1665
1783
  {
1666
- result = s(:zsuper)
1784
+ result = s(:zsuper).line lexer.lineno
1667
1785
  }
1668
1786
  | primary_value tLBRACK2 opt_call_args rbracket
1669
1787
  {
@@ -1741,7 +1859,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1741
1859
  (_, line), klasses, var, _, body, rest = val
1742
1860
 
1743
1861
  klasses ||= s(:array)
1744
- klasses << new_assign(var, s(:gvar, :"$!")) if var
1862
+ klasses << new_assign(var, s(:gvar, :"$!").line(var.line)) if var
1745
1863
  klasses.line line
1746
1864
 
1747
1865
  result = new_resbody(klasses, body)
@@ -1754,7 +1872,8 @@ opt_block_args_tail: tCOMMA block_args_tail
1754
1872
 
1755
1873
  exc_list: arg_value
1756
1874
  {
1757
- result = s(:array, val[0])
1875
+ arg, = val
1876
+ result = s(:array, arg).line arg.line
1758
1877
  }
1759
1878
  | mrhs
1760
1879
  | none
@@ -1767,26 +1886,31 @@ opt_block_args_tail: tCOMMA block_args_tail
1767
1886
 
1768
1887
  opt_ensure: k_ensure compstmt
1769
1888
  {
1770
- _, body = val
1889
+ (_, line), body = val
1771
1890
 
1772
- result = body || s(:nil)
1891
+ result = body || s(:nil).line(line)
1773
1892
  }
1774
1893
  | none
1775
1894
 
1776
1895
  literal: numeric
1777
1896
  {
1897
+ line = lexer.lineno
1778
1898
  result = s(:lit, val[0])
1899
+ result.line = line
1779
1900
  }
1780
1901
  | symbol
1781
1902
  {
1903
+ line = lexer.lineno
1782
1904
  result = s(:lit, val[0])
1905
+ result.line = line
1783
1906
  }
1784
1907
  | dsym
1785
1908
 
1786
1909
  strings: string
1787
1910
  {
1788
- val[0] = s(:dstr, val[0].value) if val[0].sexp_type == :evstr
1789
- result = val[0]
1911
+ str, = val
1912
+ str = s(:dstr, str.value) if str.sexp_type == :evstr
1913
+ result = str
1790
1914
  }
1791
1915
 
1792
1916
  string: tCHAR
@@ -1801,7 +1925,11 @@ opt_block_args_tail: tCOMMA block_args_tail
1801
1925
 
1802
1926
  string1: tSTRING_BEG string_contents tSTRING_END
1803
1927
  {
1804
- result = val[1]
1928
+ _, str, (_, func) = val
1929
+
1930
+ str = dedent str if func =~ RubyLexer::STR_FUNC_ICNTNT
1931
+
1932
+ result = str
1805
1933
  }
1806
1934
  | tSTRING
1807
1935
  {
@@ -1811,6 +1939,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1811
1939
  xstring: tXSTRING_BEG xstring_contents tSTRING_END
1812
1940
  {
1813
1941
  result = new_xstring val[1]
1942
+ # TODO: dedent?!?! SERIOUSLY?!?
1814
1943
  }
1815
1944
 
1816
1945
  regexp: tREGEXP_BEG regexp_contents tREGEXP_END
@@ -1820,7 +1949,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1820
1949
 
1821
1950
  words: tWORDS_BEG tSPACE tSTRING_END
1822
1951
  {
1823
- result = s(:array)
1952
+ result = s(:array).line lexer.lineno
1824
1953
  }
1825
1954
  | tWORDS_BEG word_list tSTRING_END
1826
1955
  {
@@ -1844,25 +1973,28 @@ opt_block_args_tail: tCOMMA block_args_tail
1844
1973
 
1845
1974
  symbols: tSYMBOLS_BEG tSPACE tSTRING_END
1846
1975
  {
1847
- result = s(:array)
1976
+ result = s(:array).line lexer.lineno
1848
1977
  }
1849
- | tSYMBOLS_BEG symbol_list tSTRING_END
1978
+ | tSYMBOLS_BEG { result = lexer.lineno } symbol_list tSTRING_END
1850
1979
  {
1851
- result = val[1]
1980
+ _, line, list, _, = val
1981
+ list.line = line
1982
+ result = list
1852
1983
  }
1853
1984
 
1854
1985
  symbol_list: none
1855
1986
  {
1856
- result = new_symbol_list
1987
+ result = new_symbol_list.line lexer.lineno
1857
1988
  }
1858
1989
  | symbol_list word tSPACE
1859
1990
  {
1860
- result = val[0].dup << new_symbol_list_entry(val)
1991
+ list, * = val
1992
+ result = list.dup << new_symbol_list_entry(val)
1861
1993
  }
1862
1994
 
1863
1995
  qwords: tQWORDS_BEG tSPACE tSTRING_END
1864
1996
  {
1865
- result = s(:array)
1997
+ result = s(:array).line lexer.lineno
1866
1998
  }
1867
1999
  | tQWORDS_BEG qword_list tSTRING_END
1868
2000
  {
@@ -1871,7 +2003,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1871
2003
 
1872
2004
  qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
1873
2005
  {
1874
- result = s(:array)
2006
+ result = s(:array).line lexer.lineno # FIX
1875
2007
  }
1876
2008
  | tQSYMBOLS_BEG qsym_list tSTRING_END
1877
2009
  {
@@ -1898,11 +2030,12 @@ opt_block_args_tail: tCOMMA block_args_tail
1898
2030
 
1899
2031
  string_contents: none
1900
2032
  {
1901
- result = s(:str, "")
2033
+ result = s(:str, "").line lexer.lineno
1902
2034
  }
1903
2035
  | string_contents string_content
1904
2036
  {
1905
- result = literal_concat(val[0], val[1])
2037
+ v1, v2 = val
2038
+ result = literal_concat v1, v2
1906
2039
  }
1907
2040
 
1908
2041
  xstring_contents: none
@@ -1911,7 +2044,8 @@ xstring_contents: none
1911
2044
  }
1912
2045
  | xstring_contents string_content
1913
2046
  {
1914
- result = literal_concat(val[0], val[1])
2047
+ v1, v2 = val
2048
+ result = literal_concat v1, v2
1915
2049
  }
1916
2050
 
1917
2051
  regexp_contents: none
@@ -1920,7 +2054,8 @@ regexp_contents: none
1920
2054
  }
1921
2055
  | regexp_contents string_content
1922
2056
  {
1923
- result = literal_concat(val[0], val[1])
2057
+ v1, v2 = val
2058
+ result = literal_concat v1, v2
1924
2059
  }
1925
2060
 
1926
2061
  string_content: tSTRING_CONTENT
@@ -1936,8 +2071,9 @@ regexp_contents: none
1936
2071
  }
1937
2072
  string_dvar
1938
2073
  {
1939
- lexer.lex_strterm = val[1]
1940
- result = s(:evstr, val[2])
2074
+ _, strterm, str = val
2075
+ lexer.lex_strterm = strterm
2076
+ result = s(:evstr, str).line str.line
1941
2077
  }
1942
2078
  | tSTRING_DBEG
1943
2079
  {
@@ -1947,6 +2083,7 @@ regexp_contents: none
1947
2083
  lexer.cond.store,
1948
2084
  lexer.cmdarg.store,
1949
2085
  lexer.lex_state,
2086
+ lexer.lineno,
1950
2087
  ]
1951
2088
 
1952
2089
  lexer.lex_strterm = nil
@@ -1960,7 +2097,7 @@ regexp_contents: none
1960
2097
  {
1961
2098
  _, memo, stmt, _ = val
1962
2099
 
1963
- lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state = memo
2100
+ lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state, line = memo
1964
2101
 
1965
2102
  lexer.lex_strterm = lex_strterm
1966
2103
  lexer.brace_nest = brace_nest
@@ -1977,19 +2114,19 @@ regexp_contents: none
1977
2114
  when :str, :dstr, :evstr then
1978
2115
  result = stmt
1979
2116
  else
1980
- result = s(:evstr, stmt)
2117
+ result = s(:evstr, stmt).line line
1981
2118
  end
1982
2119
  when nil then
1983
- result = s(:evstr)
2120
+ result = s(:evstr).line line
1984
2121
  else
1985
2122
  debug20 25
1986
2123
  raise "unknown string body: #{stmt.inspect}"
1987
2124
  end
1988
2125
  }
1989
2126
 
1990
- string_dvar: tGVAR { result = s(:gvar, val[0].to_sym) }
1991
- | tIVAR { result = s(:ivar, val[0].to_sym) }
1992
- | tCVAR { result = s(:cvar, val[0].to_sym) }
2127
+ string_dvar: tGVAR { result = s(:gvar, val[0].to_sym).line lexer.lineno }
2128
+ | tIVAR { result = s(:ivar, val[0].to_sym).line lexer.lineno }
2129
+ | tCVAR { result = s(:cvar, val[0].to_sym).line lexer.lineno }
1993
2130
  | backref
1994
2131
 
1995
2132
  symbol: tSYMBEG sym
@@ -2006,18 +2143,19 @@ regexp_contents: none
2006
2143
 
2007
2144
  dsym: tSYMBEG xstring_contents tSTRING_END
2008
2145
  {
2146
+ _, result, _ = val
2147
+
2009
2148
  lexer.lex_state = EXPR_END
2010
- result = val[1]
2011
2149
 
2012
- result ||= s(:str, "")
2150
+ result ||= s(:str, "").line lexer.lineno
2013
2151
 
2014
2152
  case result.sexp_type
2015
2153
  when :dstr then
2016
2154
  result.sexp_type = :dsym
2017
2155
  when :str then
2018
- result = s(:lit, result.last.to_sym)
2156
+ result = s(:lit, result.last.to_sym).line result.line
2019
2157
  when :evstr then
2020
- result = s(:dsym, "", result)
2158
+ result = s(:dsym, "", result).line result.line
2021
2159
  else
2022
2160
  debug20 26, val, result
2023
2161
  end
@@ -2040,19 +2178,20 @@ regexp_contents: none
2040
2178
  | tCONSTANT
2041
2179
  | tCVAR
2042
2180
 
2043
- keyword_variable: kNIL { result = s(:nil) }
2044
- | kSELF { result = s(:self) }
2045
- | kTRUE { result = s(:true) }
2046
- | kFALSE { result = s(:false) }
2047
- | k__FILE__ { result = s(:str, self.file) }
2048
- | k__LINE__ { result = s(:lit, lexer.lineno) }
2181
+ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2182
+ | kSELF { result = s(:self).line lexer.lineno }
2183
+ | kTRUE { result = s(:true).line lexer.lineno }
2184
+ | kFALSE { result = s(:false).line lexer.lineno }
2185
+ | k__FILE__ { result = s(:str, self.file).line lexer.lineno }
2186
+ | k__LINE__ { result = s(:lit, lexer.lineno).line lexer.lineno }
2049
2187
  | k__ENCODING__
2050
2188
  {
2189
+ l = lexer.lineno
2051
2190
  result =
2052
2191
  if defined? Encoding then
2053
- s(:colon2, s(:const, :Encoding), :UTF_8)
2192
+ s(:colon2, s(:const, :Encoding).line(l), :UTF_8).line l
2054
2193
  else
2055
- s(:str, "Unsupported!")
2194
+ s(:str, "Unsupported!").line l
2056
2195
  end
2057
2196
  }
2058
2197
 
@@ -2077,8 +2216,8 @@ keyword_variable: kNIL { result = s(:nil) }
2077
2216
  debug20 29, val, result
2078
2217
  }
2079
2218
 
2080
- backref: tNTH_REF { result = s(:nth_ref, val[0]) }
2081
- | tBACK_REF { result = s(:back_ref, val[0]) }
2219
+ backref: tNTH_REF { result = s(:nth_ref, val[0]).line lexer.lineno }
2220
+ | tBACK_REF { result = s(:back_ref, val[0]).line lexer.lineno }
2082
2221
 
2083
2222
  superclass: tLT
2084
2223
  {
@@ -2235,12 +2374,13 @@ keyword_variable: kNIL { result = s(:nil) }
2235
2374
 
2236
2375
  f_arg: f_arg_item
2237
2376
  {
2238
- case val[0]
2377
+ arg, = val
2378
+
2379
+ case arg
2239
2380
  when Symbol then
2240
- result = s(:args)
2241
- result << val[0]
2381
+ result = s(:args, arg).line lexer.lineno
2242
2382
  when Sexp then
2243
- result = val[0]
2383
+ result = arg
2244
2384
  else
2245
2385
  debug20 32
2246
2386
  raise "Unknown f_arg type: #{val.inspect}"
@@ -2253,7 +2393,7 @@ keyword_variable: kNIL { result = s(:nil) }
2253
2393
  if list.sexp_type == :args then
2254
2394
  result = list
2255
2395
  else
2256
- result = s(:args, list)
2396
+ result = s(:args, list).line list.line
2257
2397
  end
2258
2398
 
2259
2399
  result << item
@@ -2263,38 +2403,42 @@ keyword_variable: kNIL { result = s(:nil) }
2263
2403
 
2264
2404
  f_kw: f_label arg_value
2265
2405
  {
2266
- # TODO: call_args
2267
- label, _ = val[0] # TODO: fix lineno?
2406
+ # TODO: new_kw_arg
2407
+ (label, line), arg = val
2408
+
2268
2409
  identifier = label.to_sym
2269
2410
  self.env[identifier] = :lvar
2270
2411
 
2271
- result = s(:array, s(:kwarg, identifier, val[1]))
2412
+ kwarg = s(:kwarg, identifier, arg).line line
2413
+ result = s(:array, kwarg).line line
2272
2414
  }
2273
2415
  | f_label
2274
2416
  {
2275
- label, _ = val[0] # TODO: fix lineno?
2276
- identifier = label.to_sym
2277
- self.env[identifier] = :lvar
2417
+ (label, line), = val
2278
2418
 
2279
- result = s(:array, s(:kwarg, identifier))
2419
+ id = label.to_sym
2420
+ self.env[id] = :lvar
2421
+
2422
+ result = s(:array, s(:kwarg, id).line(line)).line line
2280
2423
  }
2281
2424
 
2282
2425
  f_block_kw: f_label primary_value
2283
2426
  {
2284
- # TODO: call_args
2285
- label, _ = val[0] # TODO: fix lineno?
2286
- identifier = label.to_sym
2287
- self.env[identifier] = :lvar
2427
+ # TODO: new_kw_arg
2428
+ (label, line), expr = val
2429
+ id = label.to_sym
2430
+ self.env[id] = :lvar
2288
2431
 
2289
- result = s(:array, s(:kwarg, identifier, val[1]))
2432
+ result = s(:array, s(:kwarg, id, expr).line(line)).line line
2290
2433
  }
2291
2434
  | f_label
2292
2435
  {
2293
- label, _ = val[0] # TODO: fix lineno?
2294
- identifier = label.to_sym
2295
- self.env[identifier] = :lvar
2436
+ # TODO: new_kw_arg
2437
+ (label, line), = val
2438
+ id = label.to_sym
2439
+ self.env[id] = :lvar
2296
2440
 
2297
- result = s(:array, s(:kwarg, identifier))
2441
+ result = s(:array, s(:kwarg, id).line(line)).line line
2298
2442
  }
2299
2443
 
2300
2444
  f_block_kwarg: f_block_kw
@@ -2337,17 +2481,20 @@ keyword_variable: kNIL { result = s(:nil) }
2337
2481
 
2338
2482
  f_block_optarg: f_block_opt
2339
2483
  {
2340
- result = s(:block, val[0])
2484
+ optblk, = val
2485
+ result = s(:block, optblk).line optblk.line
2341
2486
  }
2342
2487
  | f_block_optarg tCOMMA f_block_opt
2343
2488
  {
2344
- result = val[0]
2345
- result << val[2]
2489
+ optarg, _, optblk = val
2490
+ result = optarg
2491
+ result << optblk
2346
2492
  }
2347
2493
 
2348
2494
  f_optarg: f_opt
2349
2495
  {
2350
- result = s(:block, val[0])
2496
+ opt, = val
2497
+ result = s(:block, opt).line opt.line
2351
2498
  }
2352
2499
  | f_optarg tCOMMA f_opt
2353
2500
  {
@@ -2401,14 +2548,11 @@ keyword_variable: kNIL { result = s(:nil) }
2401
2548
  result.sexp_type == :lit
2402
2549
  }
2403
2550
 
2404
- assoc_list: none # [!nil]
2551
+ assoc_list: none
2405
2552
  {
2406
- result = s(:array)
2407
- }
2408
- | assocs trailer # [!nil]
2409
- {
2410
- result = val[0]
2553
+ result = s(:array).line lexer.lineno
2411
2554
  }
2555
+ | assocs trailer
2412
2556
 
2413
2557
  assocs: assoc
2414
2558
  | assocs tCOMMA assoc
@@ -2422,22 +2566,27 @@ keyword_variable: kNIL { result = s(:nil) }
2422
2566
 
2423
2567
  assoc: arg_value tASSOC arg_value
2424
2568
  {
2425
- result = s(:array, val[0], val[2])
2569
+ v1, _, v2 = val
2570
+ result = s(:array, v1, v2).line v1.line
2426
2571
  }
2427
2572
  | tLABEL arg_value
2428
2573
  {
2429
- (label, _), arg = val
2430
- result = s(:array, s(:lit, label.to_sym), arg)
2574
+ (label, line), arg = val
2575
+
2576
+ lit = s(:lit, label.to_sym).line line
2577
+ result = s(:array, lit, arg).line line
2431
2578
  }
2432
2579
  | tSTRING_BEG string_contents tLABEL_END arg_value
2433
2580
  {
2434
2581
  _, sym, _, value = val
2435
2582
  sym.sexp_type = :dsym
2436
- result = s(:array, sym, value)
2583
+ result = s(:array, sym, value).line sym.line
2437
2584
  }
2438
2585
  | tDSTAR arg_value
2439
2586
  {
2440
- result = s(:array, s(:kwsplat, val[1]))
2587
+ _, arg = val
2588
+ line = arg.line
2589
+ result = s(:array, s(:kwsplat, arg).line(line)).line line
2441
2590
  }
2442
2591
 
2443
2592
  operation: tIDENTIFIER | tCONSTANT | tFID