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,2431 +0,0 @@
1
- # -*- racc -*-
2
-
3
- class Ruby20Parser
4
-
5
- token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
6
- kTHEN kELSIF kELSE kCASE kWHEN kWHILE kUNTIL kFOR kBREAK kNEXT
7
- kREDO kRETRY kIN kDO kDO_COND kDO_BLOCK kDO_LAMBDA kRETURN kYIELD kSUPER
8
- kSELF kNIL kTRUE kFALSE kAND kOR kNOT kIF_MOD kUNLESS_MOD kWHILE_MOD
9
- kUNTIL_MOD kRESCUE_MOD kALIAS kDEFINED klBEGIN klEND k__LINE__
10
- k__FILE__ k__ENCODING__ tIDENTIFIER tFID tGVAR tIVAR tCONSTANT
11
- tLABEL tCVAR tNTH_REF tBACK_REF tSTRING_CONTENT tINTEGER tFLOAT
12
- tREGEXP_END tUPLUS tUMINUS tUMINUS_NUM tPOW tCMP tEQ tEQQ tNEQ
13
- tGEQ tLEQ tANDOP tOROP tMATCH tNMATCH tDOT tDOT2 tDOT3 tAREF
14
- tASET tLSHFT tRSHFT tCOLON2 tCOLON3 tOP_ASGN tASSOC tLPAREN
15
- tLPAREN2 tRPAREN tLPAREN_ARG tLBRACK tLBRACK2 tRBRACK tLBRACE
16
- tLBRACE_ARG tSTAR tSTAR2 tAMPER tAMPER2 tTILDE tPERCENT tDIVIDE
17
- tPLUS tMINUS tLT tGT tPIPE tBANG tCARET tLCURLY tRCURLY
18
- tBACK_REF2 tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG
19
- tWORDS_BEG tQWORDS_BEG tSTRING_DBEG tSTRING_DVAR tSTRING_END
20
- tSTRING tSYMBOL tNL tEH tCOLON tCOMMA tSPACE tSEMI tLAMBDA
21
- tLAMBEG tDSTAR tCHAR tSYMBOLS_BEG tQSYMBOLS_BEG tSTRING_DEND tUBANG
22
-
23
- prechigh
24
- right tBANG tTILDE tUPLUS
25
- right tPOW
26
- right tUMINUS_NUM tUMINUS
27
- left tSTAR2 tDIVIDE tPERCENT
28
- left tPLUS tMINUS
29
- left tLSHFT tRSHFT
30
- left tAMPER2
31
- left tPIPE tCARET
32
- left tGT tGEQ tLT tLEQ
33
- nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
34
- left tANDOP
35
- left tOROP
36
- nonassoc tDOT2 tDOT3
37
- right tEH tCOLON
38
- left kRESCUE_MOD
39
- right tEQL tOP_ASGN
40
- nonassoc kDEFINED
41
- right kNOT
42
- left kOR kAND
43
- nonassoc kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
44
- nonassoc tLBRACE_ARG
45
- nonassoc tLOWEST
46
- preclow
47
-
48
- rule
49
-
50
- program: {
51
- self.lexer.lex_state = EXPR_BEG
52
- }
53
- top_compstmt
54
- {
55
- result = new_compstmt val
56
- }
57
-
58
- top_compstmt: top_stmts opt_terms
59
- {
60
- result = val[0]
61
- }
62
-
63
- top_stmts: none
64
- | top_stmt
65
- | top_stmts terms top_stmt
66
- {
67
- result = self.block_append val[0], val[2]
68
- }
69
- | error top_stmt
70
-
71
- top_stmt: stmt
72
- {
73
- result = val[0]
74
-
75
- # TODO: remove once I have more confidence this is fixed
76
- # result.each_of_type :call_args do |s|
77
- # debug20 666, s, result
78
- # end
79
- }
80
- | klBEGIN
81
- {
82
- if (self.in_def || self.in_single > 0) then
83
- debug20 1
84
- yyerror "BEGIN in method"
85
- end
86
- self.env.extend
87
- }
88
- begin_block
89
- {
90
- _, _, block = val
91
- result = block
92
- }
93
-
94
- begin_block: tLCURLY top_compstmt tRCURLY
95
- {
96
- _, stmt, _ = val
97
- result = new_iter s(:preexe), 0, stmt
98
- }
99
-
100
- bodystmt: compstmt opt_rescue k_else
101
- {
102
- res = _values[-2]
103
- yyerror "else without rescue is useless" unless res
104
- }
105
- compstmt
106
- opt_ensure
107
- {
108
- body, resc, _, _, els, ens = val
109
-
110
- result = new_body [body, resc, els, ens]
111
- }
112
- | compstmt opt_rescue opt_ensure
113
- {
114
- body, resc, ens = val
115
-
116
- result = new_body [body, resc, nil, ens]
117
- }
118
-
119
- compstmt: stmts opt_terms
120
- {
121
- result = new_compstmt val
122
- }
123
-
124
- stmts: none
125
- | stmt_or_begin # TODO: newline_node ?
126
- | stmts terms stmt_or_begin
127
- {
128
- result = self.block_append val[0], val[2]
129
- }
130
- | error stmt
131
- {
132
- result = val[1]
133
- debug20 2, val, result
134
- }
135
-
136
- stmt_or_begin: stmt
137
- | klBEGIN
138
- {
139
- if (self.in_def || self.in_single > 0) then
140
- debug20 1
141
- yyerror "BEGIN in method"
142
- end
143
- self.env.extend
144
- }
145
- begin_block
146
- {
147
- _, _, stmt = val
148
- result = stmt
149
- }
150
-
151
- stmt: kALIAS fitem
152
- {
153
- lexer.lex_state = EXPR_FNAME
154
- result = self.lexer.lineno
155
- }
156
- fitem
157
- {
158
- result = s(:alias, val[1], val[3]).line(val[2])
159
- }
160
- | kALIAS tGVAR tGVAR
161
- {
162
- result = s(:valias, val[1].to_sym, val[2].to_sym)
163
- }
164
- | kALIAS tGVAR tBACK_REF
165
- {
166
- result = s(:valias, val[1].to_sym, :"$#{val[2]}")
167
- }
168
- | kALIAS tGVAR tNTH_REF
169
- {
170
- yyerror "can't make alias for the number variables"
171
- }
172
- | kUNDEF undef_list
173
- {
174
- result = val[1]
175
- }
176
- | stmt kIF_MOD expr_value
177
- {
178
- result = new_if val[2], val[0], nil
179
- }
180
- | stmt kUNLESS_MOD expr_value
181
- {
182
- result = new_if val[2], nil, val[0]
183
- }
184
- | stmt kWHILE_MOD expr_value
185
- {
186
- result = new_while val[0], val[2], true
187
- }
188
- | stmt kUNTIL_MOD expr_value
189
- {
190
- result = new_until val[0], val[2], true
191
- }
192
- | stmt kRESCUE_MOD stmt
193
- {
194
- body, _, resbody = val
195
- result = new_rescue body, new_resbody(s(:array), resbody)
196
- }
197
- | klEND tLCURLY compstmt tRCURLY
198
- {
199
- if (self.in_def || self.in_single > 0) then
200
- debug20 3
201
- yyerror "END in method; use at_exit"
202
- end
203
- result = new_iter s(:postexe), 0, val[2]
204
- }
205
- | command_asgn
206
- | mlhs tEQL command_call
207
- {
208
- result = new_masgn val[0], val[2], :wrap
209
- }
210
- | lhs tEQL mrhs
211
- {
212
- result = new_assign val[0], s(:svalue, val[2])
213
- }
214
- | mlhs tEQL arg_value
215
- {
216
- result = new_masgn val[0], val[2], :wrap
217
- }
218
- | mlhs tEQL mrhs
219
- {
220
- result = new_masgn val[0], val[2]
221
- }
222
- | expr
223
-
224
- command_asgn: lhs tEQL command_rhs
225
- {
226
- result = new_assign val[0], val[2]
227
- }
228
- # | lhs tEQL command_asgn
229
- # {
230
- # result = new_assign val[0], val[2]
231
- # }
232
- | var_lhs tOP_ASGN command_rhs
233
- {
234
- result = new_op_asgn val
235
- }
236
- | primary_value tLBRACK2 opt_call_args rbracket tOP_ASGN command_rhs
237
- {
238
- result = s(:op_asgn1, val[0], val[2], val[4].to_sym, val[5])
239
- }
240
- | primary_value call_op tIDENTIFIER tOP_ASGN command_rhs
241
- {
242
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
243
- if val[1] == '&.'
244
- result.sexp_type = :safe_op_asgn
245
- end
246
- result.line = val[0].line
247
- }
248
- | primary_value call_op tCONSTANT tOP_ASGN command_rhs
249
- {
250
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
251
- if val[1] == '&.'
252
- result.sexp_type = :safe_op_asgn
253
- end
254
- result.line = val[0].line
255
- }
256
- | primary_value tCOLON2 tCONSTANT tOP_ASGN command_rhs
257
- {
258
- result = s(:op_asgn, val[0], val[4], val[2], val[3])
259
- debug20 4, val, result
260
- }
261
- | primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs
262
- {
263
- result = s(:op_asgn, val[0], val[4], val[2], val[3])
264
- debug20 5, val, result
265
- }
266
- | backref tOP_ASGN command_rhs
267
- {
268
- self.backref_assign_error val[0]
269
- }
270
-
271
- command_rhs: command_call =tOP_ASGN
272
- {
273
- expr, = val
274
- result = value_expr expr
275
- }
276
- | command_asgn
277
-
278
- expr: command_call
279
- | expr kAND expr
280
- {
281
- result = logical_op :and, val[0], val[2]
282
- }
283
- | expr kOR expr
284
- {
285
- result = logical_op :or, val[0], val[2]
286
- }
287
- | kNOT opt_nl expr
288
- {
289
- result = s(:call, val[2], :"!")
290
- }
291
- | tBANG command_call
292
- {
293
- result = s(:call, val[1], :"!")
294
- }
295
- | arg
296
-
297
- expr_value: expr
298
- {
299
- result = value_expr(val[0])
300
- }
301
-
302
- expr_value_do: {
303
- lexer.cond.push true
304
- }
305
- expr_value do
306
- {
307
- lexer.cond.pop
308
- }
309
- {
310
- _, expr, _, _ = val
311
- result = expr
312
- }
313
-
314
- command_call: command
315
- | block_command
316
-
317
- block_command: block_call
318
- | block_call call_op2 operation2 command_args
319
- {
320
- result = new_call val[0], val[2].to_sym, val[3]
321
- }
322
-
323
- cmd_brace_block: tLBRACE_ARG
324
- {
325
- # self.env.extend(:dynamic)
326
- result = self.lexer.lineno
327
- }
328
- brace_body tRCURLY
329
- {
330
- _, line, body, _ = val
331
-
332
- result = body
333
- result.line = line
334
-
335
- # self.env.unextend
336
- }
337
-
338
- fcall: operation
339
- {
340
- result = new_call nil, val[0].to_sym
341
- }
342
-
343
- command: fcall command_args =tLOWEST
344
- {
345
- result = val[0].concat val[1].sexp_body # REFACTOR pattern
346
- }
347
- | fcall command_args cmd_brace_block
348
- {
349
- result = val[0].concat val[1].sexp_body
350
- if val[2] then
351
- block_dup_check result, val[2]
352
-
353
- result, operation = val[2], result
354
- result.insert 1, operation
355
- end
356
- }
357
- | primary_value call_op operation2 command_args =tLOWEST
358
- {
359
- result = new_call val[0], val[2].to_sym, val[3], val[1]
360
- }
361
- | primary_value call_op operation2 command_args cmd_brace_block
362
- {
363
- recv, _, msg, args, block = val
364
- call = new_call recv, msg.to_sym, args, val[1]
365
-
366
- block_dup_check call, block
367
-
368
- block.insert 1, call
369
- result = block
370
- }
371
- | primary_value tCOLON2 operation2 command_args =tLOWEST
372
- {
373
- result = new_call val[0], val[2].to_sym, val[3]
374
- }
375
- | primary_value tCOLON2 operation2 command_args cmd_brace_block
376
- {
377
- recv, _, msg, args, block = val
378
- call = new_call recv, msg.to_sym, args
379
-
380
- block_dup_check call, block
381
-
382
- block.insert 1, call
383
- result = block
384
- }
385
- | kSUPER command_args
386
- {
387
- result = new_super val[1]
388
- }
389
- | kYIELD command_args
390
- {
391
- result = new_yield val[1]
392
- }
393
- | k_return call_args
394
- {
395
- line = val[0].last
396
- result = s(:return, ret_args(val[1])).line(line)
397
- }
398
- | kBREAK call_args
399
- {
400
- line = val[0].last
401
- result = s(:break, ret_args(val[1])).line(line)
402
- }
403
- | kNEXT call_args
404
- {
405
- line = val[0].last
406
- result = s(:next, ret_args(val[1])).line(line)
407
- }
408
-
409
- mlhs: mlhs_basic
410
- | tLPAREN mlhs_inner rparen
411
- {
412
- result = val[1]
413
- }
414
-
415
- mlhs_inner: mlhs_basic
416
- | tLPAREN mlhs_inner rparen
417
- {
418
- result = s(:masgn, s(:array, val[1]))
419
- }
420
-
421
- mlhs_basic: mlhs_head
422
- {
423
- result = s(:masgn, val[0])
424
- }
425
- | mlhs_head mlhs_item
426
- {
427
- result = s(:masgn, val[0] << val[1].compact)
428
- }
429
- | mlhs_head tSTAR mlhs_node
430
- {
431
- result = s(:masgn, val[0] << s(:splat, val[2]))
432
- }
433
- | mlhs_head tSTAR mlhs_node tCOMMA mlhs_post
434
- {
435
- ary1, _, splat, _, ary2 = val
436
-
437
- result = list_append ary1, s(:splat, splat)
438
- result.concat ary2.sexp_body
439
- result = s(:masgn, result)
440
- }
441
- | mlhs_head tSTAR
442
- {
443
- result = s(:masgn, val[0] << s(:splat))
444
- }
445
- | mlhs_head tSTAR tCOMMA mlhs_post
446
- {
447
- ary = list_append val[0], s(:splat)
448
- ary.concat val[3].sexp_body
449
- result = s(:masgn, ary)
450
- }
451
- | tSTAR mlhs_node
452
- {
453
- result = s(:masgn, s(:array, s(:splat, val[1])))
454
- }
455
- | tSTAR mlhs_node tCOMMA mlhs_post
456
- {
457
- ary = s(:array, s(:splat, val[1]))
458
- ary.concat val[3].sexp_body
459
- result = s(:masgn, ary)
460
- }
461
- | tSTAR
462
- {
463
- result = s(:masgn, s(:array, s(:splat)))
464
- }
465
- | tSTAR tCOMMA mlhs_post
466
- {
467
- result = s(:masgn, s(:array, s(:splat), *val[2].sexp_body))
468
- }
469
-
470
- mlhs_item: mlhs_node
471
- | tLPAREN mlhs_inner rparen
472
- {
473
- result = val[1]
474
- }
475
-
476
- mlhs_head: mlhs_item tCOMMA
477
- {
478
- result = s(:array, val[0])
479
- }
480
- | mlhs_head mlhs_item tCOMMA
481
- {
482
- result = val[0] << val[1].compact
483
- }
484
-
485
- mlhs_post: mlhs_item
486
- {
487
- result = s(:array, val[0])
488
- }
489
- | mlhs_post tCOMMA mlhs_item
490
- {
491
- result = list_append val[0], val[2]
492
- }
493
-
494
- mlhs_node: user_variable
495
- {
496
- result = self.assignable val[0]
497
- }
498
- | keyword_variable
499
- {
500
- result = self.assignable val[0]
501
- }
502
- | primary_value tLBRACK2 opt_call_args rbracket
503
- {
504
- result = self.aryset val[0], val[2]
505
- }
506
- | primary_value call_op tIDENTIFIER
507
- {
508
- result = new_attrasgn val[0], val[2], val[1]
509
- }
510
- | primary_value tCOLON2 tIDENTIFIER
511
- {
512
- result = s(:attrasgn, val[0], :"#{val[2]}=")
513
- }
514
- | primary_value call_op tCONSTANT
515
- {
516
- result = new_attrasgn val[0], val[2], val[1]
517
- }
518
- | primary_value tCOLON2 tCONSTANT
519
- {
520
- if (self.in_def || self.in_single > 0) then
521
- debug20 7
522
- yyerror "dynamic constant assignment"
523
- end
524
-
525
- result = s(:const, s(:colon2, val[0], val[2].to_sym), nil)
526
- }
527
- | tCOLON3 tCONSTANT
528
- {
529
- if (self.in_def || self.in_single > 0) then
530
- debug20 8
531
- yyerror "dynamic constant assignment"
532
- end
533
-
534
- result = s(:const, nil, s(:colon3, val[1].to_sym))
535
- }
536
- | backref
537
- {
538
- self.backref_assign_error val[0]
539
- }
540
-
541
- lhs: user_variable
542
- {
543
- result = self.assignable val[0]
544
- }
545
- | keyword_variable
546
- {
547
- result = self.assignable val[0]
548
- debug20 9, val, result
549
- }
550
- | primary_value tLBRACK2 opt_call_args rbracket
551
- {
552
- result = self.aryset val[0], val[2]
553
- }
554
- | primary_value call_op tIDENTIFIER # REFACTOR
555
- {
556
- result = new_attrasgn val[0], val[2], val[1]
557
- }
558
- | primary_value tCOLON2 tIDENTIFIER
559
- {
560
- result = s(:attrasgn, val[0], :"#{val[2]}=")
561
- }
562
- | primary_value call_op tCONSTANT # REFACTOR?
563
- {
564
- result = new_attrasgn val[0], val[2], val[1]
565
- }
566
- | primary_value tCOLON2 tCONSTANT
567
- {
568
- if (self.in_def || self.in_single > 0) then
569
- debug20 10
570
- yyerror "dynamic constant assignment"
571
- end
572
-
573
- result = s(:const, s(:colon2, val[0], val[2].to_sym))
574
- }
575
- | tCOLON3 tCONSTANT
576
- {
577
- if (self.in_def || self.in_single > 0) then
578
- debug20 11
579
- yyerror "dynamic constant assignment"
580
- end
581
-
582
- result = s(:const, s(:colon3, val[1].to_sym))
583
- }
584
- | backref
585
- {
586
- self.backref_assign_error val[0]
587
- }
588
-
589
- cname: tIDENTIFIER
590
- {
591
- yyerror "class/module name must be CONSTANT"
592
- }
593
- | tCONSTANT
594
-
595
- cpath: tCOLON3 cname
596
- {
597
- result = s(:colon3, val[1].to_sym)
598
- }
599
- | cname
600
- {
601
- result = val[0].to_sym
602
- }
603
- | primary_value tCOLON2 cname
604
- {
605
- result = s(:colon2, val[0], val[2].to_sym)
606
- }
607
-
608
- fname: tIDENTIFIER | tCONSTANT | tFID
609
- | op
610
- {
611
- lexer.lex_state = EXPR_END
612
- result = val[0]
613
- }
614
-
615
- | reswords
616
- {
617
- (sym, _line), = val
618
- lexer.lex_state = EXPR_END
619
- result = sym
620
- }
621
-
622
- fsym: fname | symbol
623
-
624
- fitem: fsym
625
- {
626
- result = s(:lit, val[0].to_sym)
627
- }
628
- | dsym
629
-
630
- undef_list: fitem
631
- {
632
- result = new_undef val[0]
633
- }
634
- |
635
- undef_list tCOMMA
636
- {
637
- lexer.lex_state = EXPR_FNAME
638
- }
639
- fitem
640
- {
641
- result = new_undef val[0], val[3]
642
- }
643
-
644
- op: tPIPE | tCARET | tAMPER2 | tCMP | tEQ | tEQQ
645
- | tMATCH | tNMATCH | tGT | tGEQ | tLT | tLEQ
646
- | tNEQ | tLSHFT | tRSHFT | tPLUS | tMINUS | tSTAR2
647
- | tSTAR | tDIVIDE | tPERCENT | tPOW | tDSTAR | tBANG | tTILDE
648
- | tUPLUS | tUMINUS | tAREF | tASET | tBACK_REF2
649
- | tUBANG
650
-
651
- reswords: k__LINE__ | k__FILE__ | k__ENCODING__ | klBEGIN | klEND
652
- | kALIAS | kAND | kBEGIN | kBREAK | kCASE
653
- | kCLASS | kDEF | kDEFINED | kDO | kELSE
654
- | kELSIF | kEND | kENSURE | kFALSE | kFOR
655
- | kIN | kMODULE | kNEXT | kNIL | kNOT
656
- | kOR | kREDO | kRESCUE | kRETRY | kRETURN
657
- | kSELF | kSUPER | kTHEN | kTRUE | kUNDEF
658
- | kWHEN | kYIELD | kIF | kUNLESS | kWHILE
659
- | kUNTIL
660
-
661
- arg: lhs tEQL arg_rhs
662
- {
663
- result = new_assign val[0], val[2]
664
- }
665
- | var_lhs tOP_ASGN arg_rhs
666
- {
667
- result = new_op_asgn val
668
- }
669
- | primary_value tLBRACK2 opt_call_args rbracket tOP_ASGN arg_rhs
670
- {
671
- val[2].sexp_type = :arglist if val[2]
672
- result = s(:op_asgn1, val[0], val[2], val[4].to_sym, val[5])
673
- }
674
- | primary_value call_op tIDENTIFIER tOP_ASGN arg_rhs
675
- {
676
- result = new_op_asgn2 val
677
- }
678
- | primary_value call_op tCONSTANT tOP_ASGN arg_rhs
679
- {
680
- result = new_op_asgn2 val
681
- }
682
- | primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
683
- {
684
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
685
- }
686
- | primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
687
- {
688
- lhs1, _, lhs2, op, rhs = val
689
-
690
- lhs = s(:colon2, lhs1, lhs2.to_sym).line lhs1.line
691
- result = new_const_op_asgn [lhs, op, rhs]
692
- }
693
- | tCOLON3 tCONSTANT
694
- {
695
- result = self.lexer.lineno
696
- }
697
- tOP_ASGN arg_rhs
698
- {
699
- _, lhs, line, op, rhs = val
700
-
701
- lhs = s(:colon3, lhs.to_sym).line line
702
- result = new_const_op_asgn [lhs, op, rhs]
703
- }
704
- | backref tOP_ASGN arg_rhs
705
- {
706
- # TODO: lhs = var_field val[0]
707
- asgn = new_op_asgn val
708
- result = self.backref_assign_error asgn
709
- }
710
- | arg tDOT2 arg
711
- {
712
- v1, v2 = val[0], val[2]
713
- if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
714
- result = s(:lit, (v1.last)..(v2.last))
715
- else
716
- result = s(:dot2, v1, v2)
717
- end
718
- }
719
- | arg tDOT3 arg
720
- {
721
- v1, v2 = val[0], val[2]
722
- if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
723
- result = s(:lit, (v1.last)...(v2.last))
724
- else
725
- result = s(:dot3, v1, v2)
726
- end
727
- }
728
- | arg tPLUS arg
729
- {
730
- result = new_call val[0], :+, argl(val[2])
731
- }
732
- | arg tMINUS arg
733
- {
734
- result = new_call val[0], :-, argl(val[2])
735
- }
736
- | arg tSTAR2 arg # TODO: rename
737
- {
738
- result = new_call val[0], :*, argl(val[2])
739
- }
740
- | arg tDIVIDE arg
741
- {
742
- result = new_call val[0], :"/", argl(val[2])
743
- }
744
- | arg tPERCENT arg
745
- {
746
- result = new_call val[0], :"%", argl(val[2])
747
- }
748
- | arg tPOW arg
749
- {
750
- result = new_call val[0], :**, argl(val[2])
751
- }
752
- | tUMINUS_NUM tINTEGER tPOW arg
753
- {
754
- result = new_call(new_call(s(:lit, val[1]), :"**", argl(val[3])), :"-@")
755
- }
756
- | tUMINUS_NUM tFLOAT tPOW arg
757
- {
758
- result = new_call(new_call(s(:lit, val[1]), :"**", argl(val[3])), :"-@")
759
- ## TODO: why is this 2.0 only?
760
- debug20 12, val, result
761
- }
762
- | tUPLUS arg
763
- {
764
- result = new_call val[1], :"+@"
765
- }
766
- | tUMINUS arg
767
- {
768
- result = new_call val[1], :"-@"
769
- }
770
- | arg tPIPE arg
771
- {
772
- result = new_call val[0], :"|", argl(val[2])
773
- }
774
- | arg tCARET arg
775
- {
776
- result = new_call val[0], :"^", argl(val[2])
777
- }
778
- | arg tAMPER2 arg
779
- {
780
- result = new_call val[0], :"&", argl(val[2])
781
- }
782
- | arg tCMP arg
783
- {
784
- result = new_call val[0], :"<=>", argl(val[2])
785
- }
786
- | rel_expr =tCMP
787
- | arg tEQ arg
788
- {
789
- result = new_call val[0], :"==", argl(val[2])
790
- }
791
- | arg tEQQ arg
792
- {
793
- result = new_call val[0], :"===", argl(val[2])
794
- }
795
- | arg tNEQ arg
796
- {
797
- result = new_call val[0], :"!=", argl(val[2])
798
- }
799
- | arg tMATCH arg
800
- {
801
- result = new_match val[0], val[2]
802
- }
803
- | arg tNMATCH arg
804
- {
805
- result = s(:not, new_match(val[0], val[2]))
806
- }
807
- | tBANG arg
808
- {
809
- result = new_call val[1], :"!"
810
- }
811
- | tTILDE arg
812
- {
813
- result = new_call value_expr(val[1]), :"~"
814
- }
815
- | arg tLSHFT arg
816
- {
817
- val[0] = value_expr val[0]
818
- val[2] = value_expr val[2]
819
- result = new_call val[0], :"\<\<", argl(val[2])
820
- }
821
- | arg tRSHFT arg
822
- {
823
- val[0] = value_expr val[0]
824
- val[2] = value_expr val[2]
825
- result = new_call val[0], :">>", argl(val[2])
826
- }
827
- | arg tANDOP arg
828
- {
829
- result = logical_op :and, val[0], val[2]
830
- }
831
- | arg tOROP arg
832
- {
833
- result = logical_op :or, val[0], val[2]
834
- }
835
- | kDEFINED opt_nl arg
836
- {
837
- result = s(:defined, val[2])
838
- }
839
- | arg tEH arg opt_nl tCOLON arg
840
- {
841
- result = s(:if, val[0], val[2], val[5])
842
- }
843
- | primary
844
-
845
- relop: tGT
846
- | tLT
847
- | tGEQ
848
- | tLEQ
849
-
850
- rel_expr: arg relop arg =tGT
851
- {
852
- lhs, op, rhs = val
853
- result = new_call lhs, op.to_sym, argl(rhs)
854
- }
855
- | rel_expr relop arg =tGT
856
- {
857
- lhs, op, rhs = val
858
- warn "comparison '%s' after comparison", op
859
- result = new_call lhs, op.to_sym, argl(rhs)
860
- }
861
-
862
- arg_value: arg
863
- {
864
- result = value_expr(val[0])
865
- }
866
-
867
- aref_args: none
868
- | args trailer
869
- {
870
- result = args [val[0]]
871
- }
872
- | args tCOMMA assocs trailer
873
- {
874
- result = args [val[0], array_to_hash(val[2])]
875
- }
876
- | assocs trailer
877
- {
878
- result = args [array_to_hash(val[0])]
879
- }
880
-
881
- arg_rhs: arg =tOP_ASGN
882
- | arg kRESCUE_MOD arg
883
- {
884
- body, _, resbody = val
885
- body = value_expr body
886
- resbody = remove_begin resbody
887
- result = new_rescue(body, new_resbody(s(:array), resbody))
888
- }
889
-
890
- paren_args: tLPAREN2 opt_call_args rparen
891
- {
892
- result = val[1]
893
- }
894
-
895
- opt_paren_args: none
896
- | paren_args
897
-
898
- opt_call_args: none
899
- {
900
- result = val[0]
901
- }
902
- | call_args
903
- {
904
- result = val[0]
905
- }
906
- | args tCOMMA
907
- {
908
- result = args val
909
- }
910
- | args tCOMMA assocs tCOMMA
911
- {
912
- result = args [val[0], array_to_hash(val[2])]
913
- }
914
- | assocs tCOMMA
915
- {
916
- result = args [array_to_hash(val[0])]
917
- }
918
-
919
- call_args: command
920
- {
921
- warning "parenthesize argument(s) for future version"
922
- result = call_args val
923
- }
924
- | args opt_block_arg
925
- {
926
- result = call_args val
927
- result = self.arg_blk_pass val[0], val[1]
928
- }
929
- | assocs opt_block_arg
930
- {
931
- result = call_args [array_to_hash(val[0])]
932
- result = self.arg_blk_pass result, val[1]
933
- }
934
- | args tCOMMA assocs opt_block_arg
935
- {
936
- result = call_args [val[0], array_to_hash(val[2])]
937
- result = self.arg_blk_pass result, val[3]
938
- }
939
- | block_arg
940
- {
941
- result = call_args val
942
- }
943
-
944
- command_args: {
945
- result = lexer.cmdarg.store true
946
- }
947
- call_args
948
- {
949
- lexer.cmdarg.restore val[0]
950
- result = val[1]
951
- }
952
-
953
- block_arg: tAMPER arg_value
954
- {
955
- result = s(:block_pass, val[1])
956
- }
957
-
958
- opt_block_arg: tCOMMA block_arg
959
- {
960
- result = val[1]
961
- }
962
- | none
963
-
964
- args: arg_value
965
- {
966
- result = s(:array, val[0])
967
- }
968
- | tSTAR arg_value
969
- {
970
- result = s(:array, s(:splat, val[1]))
971
- }
972
- | args tCOMMA arg_value
973
- {
974
- result = self.list_append val[0], val[2]
975
- }
976
- | args tCOMMA tSTAR arg_value
977
- {
978
- result = self.list_append val[0], s(:splat, val[3])
979
- }
980
-
981
- mrhs: args tCOMMA arg_value
982
- {
983
- result = val[0] << val[2]
984
- }
985
- | args tCOMMA tSTAR arg_value
986
- {
987
- result = self.arg_concat val[0], val[3]
988
- }
989
- | tSTAR arg_value
990
- {
991
- result = s(:splat, val[1])
992
- }
993
-
994
- primary: literal
995
- | strings
996
- | xstring
997
- | regexp
998
- | words
999
- | qwords
1000
- | symbols
1001
- | qsymbols
1002
- | var_ref
1003
- | backref
1004
- | tFID
1005
- {
1006
- result = new_call nil, val[0].to_sym
1007
- }
1008
- | k_begin
1009
- {
1010
- result = self.lexer.lineno
1011
- # TODO:
1012
- # $<val>1 = cmdarg_stack;
1013
- # CMDARG_SET(0);
1014
- }
1015
- bodystmt k_end
1016
- {
1017
- # TODO: CMDARG_SET($<val>1);
1018
- unless val[2] then
1019
- result = s(:nil)
1020
- else
1021
- result = s(:begin, val[2])
1022
- end
1023
-
1024
- result.line = val[1]
1025
- }
1026
- | tLPAREN_ARG rparen
1027
- {
1028
- # TODO: lex_state = EXPR_ENDARG in between
1029
- debug20 13, val, result
1030
- }
1031
- | tLPAREN_ARG
1032
- {
1033
- result = lexer.cmdarg.store false
1034
- # result = self.lexer.cmdarg.stack.dup
1035
- # lexer.cmdarg.stack.replace [false] # TODO add api for these
1036
- }
1037
- stmt
1038
- {
1039
- lexer.lex_state = EXPR_ENDARG
1040
- }
1041
- rparen
1042
- {
1043
- _, cmdarg, stmt, _, _, = val
1044
- warning "(...) interpreted as grouped expression"
1045
- lexer.cmdarg.restore cmdarg
1046
- result = stmt
1047
- }
1048
- | tLPAREN compstmt tRPAREN
1049
- {
1050
- result = val[1] || s(:nil)
1051
- result.paren = true
1052
- }
1053
- | primary_value tCOLON2 tCONSTANT
1054
- {
1055
- result = s(:colon2, val[0], val[2].to_sym)
1056
- }
1057
- | tCOLON3 tCONSTANT
1058
- {
1059
- result = s(:colon3, val[1].to_sym)
1060
- }
1061
- | tLBRACK aref_args tRBRACK
1062
- {
1063
- result = val[1] || s(:array)
1064
- result.sexp_type = :array # aref_args is :args
1065
- }
1066
- | tLBRACE
1067
- {
1068
- result = self.lexer.lineno
1069
- }
1070
- assoc_list tRCURLY
1071
- {
1072
- result = new_hash val
1073
- }
1074
- | k_return
1075
- {
1076
- result = s(:return)
1077
- }
1078
- | kYIELD tLPAREN2 call_args rparen
1079
- {
1080
- result = new_yield val[2]
1081
- }
1082
- | kYIELD tLPAREN2 rparen
1083
- {
1084
- result = new_yield
1085
- }
1086
- | kYIELD
1087
- {
1088
- result = new_yield
1089
- }
1090
- | kDEFINED opt_nl tLPAREN2 expr rparen
1091
- {
1092
- result = s(:defined, val[3])
1093
- }
1094
- | kNOT tLPAREN2 expr rparen
1095
- {
1096
- result = s(:call, val[2], :"!")
1097
- }
1098
- | kNOT tLPAREN2 rparen
1099
- {
1100
- debug20 14, val, result
1101
- }
1102
- | fcall brace_block
1103
- {
1104
- oper, iter = val[0], val[1]
1105
- call = oper # FIX
1106
- iter.insert 1, call
1107
- result = iter
1108
- call.line = iter.line
1109
- }
1110
- | method_call
1111
- | method_call brace_block
1112
- {
1113
- call, iter = val[0], val[1]
1114
- block_dup_check call, iter
1115
- iter.insert 1, call # FIX
1116
- result = iter
1117
- }
1118
- | tLAMBDA lambda
1119
- {
1120
- result = val[1] # TODO: fix lineno
1121
- }
1122
- | k_if expr_value then compstmt if_tail k_end
1123
- {
1124
- _, c, _, t, f, _ = val
1125
- result = new_if c, t, f
1126
- }
1127
- | k_unless expr_value then compstmt opt_else k_end
1128
- {
1129
- _, c, _, t, f, _ = val
1130
- result = new_if c, f, t
1131
- }
1132
- | k_while expr_value_do compstmt k_end
1133
- {
1134
- _, cond, body, _ = val
1135
- result = new_while body, cond, true
1136
- }
1137
- | k_until expr_value_do compstmt k_end
1138
- {
1139
- _, cond, body, _ = val
1140
- result = new_until body, cond, true
1141
- }
1142
- | k_case expr_value opt_terms case_body k_end
1143
- {
1144
- (_, line), expr, _, body, _ = val
1145
- result = new_case expr, body, line
1146
- }
1147
- | k_case opt_terms case_body k_end
1148
- {
1149
- (_, line), _, body, _ = val
1150
- result = new_case nil, body, line
1151
- }
1152
- | k_for for_var kIN expr_value_do compstmt k_end
1153
- {
1154
- _, var, _, iter, body, _ = val
1155
- result = new_for iter, var, body
1156
- }
1157
- | k_class
1158
- {
1159
- result = self.lexer.lineno
1160
- }
1161
- cpath superclass
1162
- {
1163
- self.comments.push self.lexer.comments
1164
- if (self.in_def || self.in_single > 0) then
1165
- yyerror "class definition in method body"
1166
- end
1167
- self.env.extend
1168
- }
1169
- bodystmt k_end
1170
- {
1171
- result = new_class val
1172
- self.env.unextend
1173
- self.lexer.comments # we don't care about comments in the body
1174
- }
1175
- | k_class tLSHFT
1176
- {
1177
- result = self.lexer.lineno
1178
- }
1179
- expr
1180
- {
1181
- result = self.in_def
1182
- self.in_def = false
1183
- }
1184
- term
1185
- {
1186
- result = self.in_single
1187
- self.in_single = 0
1188
- self.env.extend
1189
- }
1190
- bodystmt k_end
1191
- {
1192
- result = new_sclass val
1193
- self.env.unextend
1194
- self.lexer.comments # we don't care about comments in the body
1195
- }
1196
- | k_module
1197
- {
1198
- result = self.lexer.lineno
1199
- }
1200
- cpath
1201
- {
1202
- self.comments.push self.lexer.comments
1203
- yyerror "module definition in method body" if
1204
- self.in_def or self.in_single > 0
1205
-
1206
- self.env.extend
1207
- }
1208
- bodystmt k_end
1209
- {
1210
- result = new_module val
1211
- self.env.unextend
1212
- self.lexer.comments # we don't care about comments in the body
1213
- }
1214
- | k_def fname
1215
- {
1216
- result = [self.in_def, self.lexer.cmdarg.stack.dup]
1217
-
1218
- self.comments.push self.lexer.comments
1219
- self.in_def = true
1220
- self.env.extend
1221
- # TODO: local->cmdargs = cmdarg_stack;
1222
- # TODO: port local_push_gen and local_pop_gen
1223
- lexer.cmdarg.stack.replace [false]
1224
- }
1225
- f_arglist bodystmt k_end
1226
- {
1227
- in_def, cmdarg = val[2]
1228
-
1229
- result = new_defn val
1230
-
1231
- lexer.cmdarg.stack.replace cmdarg
1232
- self.env.unextend
1233
- self.in_def = in_def
1234
- self.lexer.comments # we don't care about comments in the body
1235
- }
1236
- | k_def singleton dot_or_colon
1237
- {
1238
- self.comments.push self.lexer.comments
1239
- lexer.lex_state = EXPR_FNAME
1240
- }
1241
- fname
1242
- {
1243
- self.in_single += 1
1244
- self.env.extend
1245
- lexer.lex_state = EXPR_ENDFN # force for args
1246
- result = [lexer.lineno, self.lexer.cmdarg.stack.dup]
1247
- lexer.cmdarg.stack.replace [false]
1248
- }
1249
- f_arglist bodystmt k_end
1250
- {
1251
- line, cmdarg = val[5]
1252
- result = new_defs val
1253
- result[3].line line
1254
-
1255
- lexer.cmdarg.stack.replace cmdarg
1256
-
1257
- self.env.unextend
1258
- self.in_single -= 1
1259
- self.lexer.comments # we don't care about comments in the body
1260
- }
1261
- | kBREAK
1262
- {
1263
- result = s(:break)
1264
- }
1265
- | kNEXT
1266
- {
1267
- result = s(:next)
1268
- }
1269
- | kREDO
1270
- {
1271
- result = s(:redo)
1272
- }
1273
- | kRETRY
1274
- {
1275
- result = s(:retry)
1276
- }
1277
-
1278
- primary_value: primary
1279
- {
1280
- result = value_expr(val[0])
1281
- }
1282
-
1283
- # These are really stupid
1284
- k_begin: kBEGIN
1285
- k_if: kIF
1286
- k_unless: kUNLESS
1287
- k_while: kWHILE
1288
- k_until: kUNTIL
1289
- k_case: kCASE
1290
- k_for: kFOR
1291
- k_class: kCLASS
1292
- k_module: kMODULE
1293
- k_def: kDEF
1294
- k_do: kDO
1295
- k_do_block: kDO_BLOCK
1296
- k_rescue: kRESCUE
1297
- k_ensure: kENSURE
1298
- k_when: kWHEN
1299
- k_else: kELSE
1300
- k_elsif: kELSIF
1301
- k_end: kEND
1302
- k_return: kRETURN
1303
-
1304
- then: term
1305
- | kTHEN
1306
- | term kTHEN
1307
-
1308
- do: term
1309
- | kDO_COND
1310
-
1311
- if_tail: opt_else
1312
- | k_elsif expr_value then compstmt if_tail
1313
- {
1314
- result = s(:if, val[1], val[3], val[4])
1315
- }
1316
-
1317
- opt_else: none
1318
- | kELSE compstmt
1319
- {
1320
- result = val[1]
1321
- }
1322
-
1323
- for_var: lhs
1324
- | mlhs
1325
- {
1326
- val[0].delete_at 1 if val[0][1].nil? # HACK
1327
- }
1328
-
1329
- f_marg: f_norm_arg
1330
- | tLPAREN f_margs rparen
1331
- {
1332
- result = val[1]
1333
- }
1334
-
1335
- f_marg_list: f_marg
1336
- {
1337
- result = s(:array, val[0])
1338
- }
1339
- | f_marg_list tCOMMA f_marg
1340
- {
1341
- result = list_append val[0], val[2]
1342
- }
1343
-
1344
- f_margs: f_marg_list
1345
- {
1346
- args, = val
1347
-
1348
- result = block_var args
1349
- }
1350
- | f_marg_list tCOMMA tSTAR f_norm_arg
1351
- {
1352
- args, _, _, splat = val
1353
-
1354
- result = block_var args, "*#{splat}".to_sym
1355
- }
1356
- | f_marg_list tCOMMA tSTAR f_norm_arg tCOMMA f_marg_list
1357
- {
1358
- args, _, _, splat, _, args2 = val
1359
-
1360
- result = block_var args, "*#{splat}".to_sym, args2
1361
- }
1362
- | f_marg_list tCOMMA tSTAR
1363
- {
1364
- args, _, _ = val
1365
-
1366
- result = block_var args, :*
1367
- }
1368
- | f_marg_list tCOMMA tSTAR tCOMMA f_marg_list
1369
- {
1370
- args, _, _, _, args2 = val
1371
-
1372
- result = block_var args, :*, args2
1373
- }
1374
- | tSTAR f_norm_arg
1375
- {
1376
- _, splat = val
1377
-
1378
- result = block_var :"*#{splat}"
1379
- }
1380
- | tSTAR f_norm_arg tCOMMA f_marg_list
1381
- {
1382
- _, splat, _, args = val
1383
-
1384
- result = block_var :"*#{splat}", args
1385
- }
1386
- | tSTAR
1387
- {
1388
- result = block_var :*
1389
- }
1390
- | tSTAR tCOMMA f_marg_list
1391
- {
1392
- _, _, args = val
1393
-
1394
- result = block_var :*, args
1395
- }
1396
-
1397
- block_args_tail: f_block_kwarg tCOMMA f_kwrest opt_f_block_arg
1398
- {
1399
- result = call_args val
1400
- }
1401
- | f_block_kwarg opt_f_block_arg
1402
- {
1403
- result = call_args val
1404
- }
1405
- | f_kwrest opt_f_block_arg
1406
- {
1407
- result = call_args val
1408
- }
1409
- | f_block_arg
1410
- {
1411
- result = call_args val
1412
- }
1413
-
1414
- opt_block_args_tail: tCOMMA block_args_tail
1415
- {
1416
- result = args val
1417
- }
1418
- | none
1419
-
1420
- block_param: f_arg tCOMMA f_block_optarg tCOMMA f_rest_arg opt_block_args_tail
1421
- {
1422
- result = args val
1423
- }
1424
- | f_arg tCOMMA f_block_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
1425
- {
1426
- result = args val
1427
- }
1428
- | f_arg tCOMMA f_block_optarg opt_block_args_tail
1429
- {
1430
- result = args val
1431
- }
1432
- | f_arg tCOMMA f_block_optarg tCOMMA f_arg opt_block_args_tail
1433
- {
1434
- result = args val
1435
- }
1436
- | f_arg tCOMMA f_rest_arg opt_block_args_tail
1437
- {
1438
- result = args val
1439
- }
1440
- | f_arg tCOMMA
1441
- {
1442
- result = args val
1443
- }
1444
- | f_arg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
1445
- {
1446
- result = args val
1447
- }
1448
- | f_arg opt_block_args_tail
1449
- {
1450
- result = args val
1451
- }
1452
- | f_block_optarg tCOMMA f_rest_arg opt_block_args_tail
1453
- {
1454
- result = args val
1455
- }
1456
- | f_block_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
1457
- {
1458
- result = args val
1459
- }
1460
- | f_block_optarg opt_block_args_tail
1461
- {
1462
- result = args val
1463
- }
1464
- | f_block_optarg tCOMMA f_arg opt_block_args_tail
1465
- {
1466
- result = args val
1467
- }
1468
- | f_rest_arg opt_block_args_tail
1469
- {
1470
- result = args val
1471
- }
1472
- | f_rest_arg tCOMMA f_arg opt_block_args_tail
1473
- {
1474
- result = args val
1475
- }
1476
- | block_args_tail
1477
- {
1478
- result = args val
1479
- }
1480
-
1481
- opt_block_param: none { result = 0 }
1482
- | block_param_def
1483
- {
1484
- self.lexer.command_start = true
1485
- }
1486
-
1487
- block_param_def: tPIPE opt_bv_decl tPIPE
1488
- {
1489
- # TODO: current_arg = 0
1490
- result = args val
1491
- }
1492
- | tOROP
1493
- {
1494
- result = s(:args)
1495
- }
1496
- | tPIPE block_param opt_bv_decl tPIPE
1497
- {
1498
- # TODO: current_arg = 0
1499
- result = args val
1500
- }
1501
-
1502
- opt_bv_decl: opt_nl
1503
- | opt_nl tSEMI bv_decls opt_nl
1504
- {
1505
- result = args val
1506
- }
1507
-
1508
- bv_decls: bvar
1509
- {
1510
- result = args val
1511
- }
1512
- | bv_decls tCOMMA bvar
1513
- {
1514
- result = args val
1515
- }
1516
-
1517
- bvar: tIDENTIFIER
1518
- {
1519
- result = s(:shadow, val[0].to_sym)
1520
- }
1521
- | f_bad_arg
1522
-
1523
- lambda: {
1524
- self.env.extend :dynamic
1525
- result = self.lexer.lineno
1526
-
1527
- result = lexer.lpar_beg
1528
- lexer.paren_nest += 1
1529
- lexer.lpar_beg = lexer.paren_nest
1530
- }
1531
- f_larglist
1532
- {
1533
- result = [lexer.cmdarg.store(false), self.lexer.lineno]
1534
- }
1535
- lambda_body
1536
- {
1537
- lpar, args, (cmdarg, lineno), body = val
1538
- lexer.lpar_beg = lpar
1539
-
1540
- lexer.cmdarg.restore cmdarg
1541
- lexer.cmdarg.lexpop
1542
-
1543
- call = new_call nil, :lambda
1544
- result = new_iter call, args, body
1545
- result.line = lineno
1546
- self.env.unextend
1547
- }
1548
-
1549
- f_larglist: tLPAREN2 f_args opt_bv_decl rparen
1550
- {
1551
- result = args val
1552
- }
1553
- | f_args
1554
- {
1555
- result = val[0]
1556
- result = 0 if result == s(:args)
1557
- }
1558
-
1559
- lambda_body: tLAMBEG compstmt tRCURLY
1560
- {
1561
- result = val[1]
1562
- }
1563
- | kDO_LAMBDA bodystmt kEND
1564
- {
1565
- result = val[1]
1566
- }
1567
-
1568
- do_block: k_do_block do_body kEND
1569
- {
1570
- # TODO: maybe fix lineno to kDO's lineno?
1571
- result = val[1]
1572
- }
1573
-
1574
- block_call: command do_block
1575
- {
1576
- # TODO:
1577
- ## if (nd_type($1) == NODE_YIELD) {
1578
- ## compile_error(PARSER_ARG "block given to yield");
1579
-
1580
- syntax_error "Both block arg and actual block given." if
1581
- val[0].block_pass?
1582
-
1583
- val = invert_block_call val if inverted? val
1584
-
1585
- result = val[1]
1586
- result.insert 1, val[0]
1587
- }
1588
- | block_call call_op2 operation2 opt_paren_args
1589
- {
1590
- result = new_call val[0], val[2].to_sym, val[3]
1591
- }
1592
- | block_call call_op2 operation2 opt_paren_args brace_block
1593
- {
1594
- iter1, _, name, args, iter2 = val
1595
-
1596
- call = new_call iter1, name.to_sym, args
1597
- iter2.insert 1, call
1598
-
1599
- result = iter2
1600
- }
1601
- | block_call call_op2 operation2 command_args do_block
1602
- {
1603
- iter1, _, name, args, iter2 = val
1604
-
1605
- call = new_call iter1, name.to_sym, args
1606
- iter2.insert 1, call
1607
-
1608
- result = iter2
1609
- }
1610
-
1611
- method_call: fcall
1612
- {
1613
- result = self.lexer.lineno
1614
- }
1615
- paren_args
1616
- {
1617
- args = self.call_args val[2..-1]
1618
- result = val[0].concat args.sexp_body
1619
- }
1620
- | primary_value call_op operation2 opt_paren_args
1621
- {
1622
- result = new_call val[0], val[2].to_sym, val[3], val[1]
1623
- }
1624
- | primary_value tCOLON2 operation2 paren_args
1625
- {
1626
- result = new_call val[0], val[2].to_sym, val[3]
1627
- }
1628
- | primary_value tCOLON2 operation3
1629
- {
1630
- result = new_call val[0], val[2].to_sym
1631
- }
1632
- | primary_value call_op paren_args
1633
- {
1634
- result = new_call val[0], :call, val[2], val[1]
1635
- }
1636
- | primary_value tCOLON2 paren_args
1637
- {
1638
- result = new_call val[0], :call, val[2]
1639
- }
1640
- | kSUPER paren_args
1641
- {
1642
- result = new_super val[1]
1643
- }
1644
- | kSUPER
1645
- {
1646
- result = s(:zsuper)
1647
- }
1648
- | primary_value tLBRACK2 opt_call_args rbracket
1649
- {
1650
- result = new_aref val
1651
- }
1652
-
1653
- brace_block: tLCURLY
1654
- {
1655
- self.env.extend :dynamic
1656
- result = self.lexer.lineno
1657
- }
1658
- brace_body tRCURLY
1659
- {
1660
- _, line, body, _ = val
1661
-
1662
- result = body
1663
- result.line = line
1664
-
1665
- self.env.unextend
1666
- }
1667
- | k_do
1668
- {
1669
- self.env.extend :dynamic
1670
- result = self.lexer.lineno
1671
- }
1672
- do_body kEND
1673
- {
1674
- _, line, body, _ = val
1675
-
1676
- result = body
1677
- result.line = line
1678
-
1679
- self.env.unextend
1680
- }
1681
-
1682
- brace_body: { self.env.extend :dynamic; result = self.lexer.lineno }
1683
- { result = lexer.cmdarg.store(false) }
1684
- opt_block_param compstmt
1685
- {
1686
- line, cmdarg, param, cmpstmt = val
1687
-
1688
- result = new_brace_body param, cmpstmt, line
1689
- self.env.unextend
1690
- lexer.cmdarg.restore cmdarg
1691
- lexer.cmdarg.pop # because of: cmdarg_stack >> 1 ?
1692
- }
1693
-
1694
- do_body: { self.env.extend :dynamic; result = self.lexer.lineno }
1695
- { result = lexer.cmdarg.store(false) }
1696
- opt_block_param
1697
- compstmt
1698
- {
1699
- line, cmdarg, param, cmpstmt = val
1700
-
1701
- result = new_do_body param, cmpstmt, line
1702
- self.env.unextend
1703
- lexer.cmdarg.restore cmdarg
1704
- }
1705
-
1706
- case_body: k_when
1707
- {
1708
- result = self.lexer.lineno
1709
- }
1710
- args then compstmt cases
1711
- {
1712
- result = new_when(val[2], val[4])
1713
- result.line = val[1]
1714
- result << val[5] if val[5]
1715
- }
1716
-
1717
- cases: opt_else | case_body
1718
-
1719
- opt_rescue: k_rescue exc_list exc_var then compstmt opt_rescue
1720
- {
1721
- (_, line), klasses, var, _, body, rest = val
1722
-
1723
- klasses ||= s(:array)
1724
- klasses << new_assign(var, s(:gvar, :"$!")) if var
1725
- klasses.line line
1726
-
1727
- result = new_resbody(klasses, body)
1728
- result << rest if rest # UGH, rewritten above
1729
- }
1730
- |
1731
- {
1732
- result = nil
1733
- }
1734
-
1735
- exc_list: arg_value
1736
- {
1737
- result = s(:array, val[0])
1738
- }
1739
- | mrhs
1740
- | none
1741
-
1742
- exc_var: tASSOC lhs
1743
- {
1744
- result = val[1]
1745
- }
1746
- | none
1747
-
1748
- opt_ensure: k_ensure compstmt
1749
- {
1750
- _, body = val
1751
-
1752
- result = body || s(:nil)
1753
- }
1754
- | none
1755
-
1756
- literal: numeric
1757
- {
1758
- result = s(:lit, val[0])
1759
- }
1760
- | symbol
1761
- {
1762
- result = s(:lit, val[0])
1763
- }
1764
- | dsym
1765
-
1766
- strings: string
1767
- {
1768
- val[0] = s(:dstr, val[0].value) if val[0].sexp_type == :evstr
1769
- result = val[0]
1770
- }
1771
-
1772
- string: tCHAR
1773
- {
1774
- debug20 23, val, result
1775
- }
1776
- | string1
1777
- | string string1
1778
- {
1779
- result = self.literal_concat val[0], val[1]
1780
- }
1781
-
1782
- string1: tSTRING_BEG string_contents tSTRING_END
1783
- {
1784
- result = val[1]
1785
- }
1786
- | tSTRING
1787
- {
1788
- result = new_string val
1789
- }
1790
-
1791
- xstring: tXSTRING_BEG xstring_contents tSTRING_END
1792
- {
1793
- result = new_xstring val[1]
1794
- }
1795
-
1796
- regexp: tREGEXP_BEG regexp_contents tREGEXP_END
1797
- {
1798
- result = new_regexp val
1799
- }
1800
-
1801
- words: tWORDS_BEG tSPACE tSTRING_END
1802
- {
1803
- result = s(:array)
1804
- }
1805
- | tWORDS_BEG word_list tSTRING_END
1806
- {
1807
- result = val[1]
1808
- }
1809
-
1810
- word_list: none
1811
- {
1812
- result = new_word_list
1813
- }
1814
- | word_list word tSPACE
1815
- {
1816
- result = val[0].dup << new_word_list_entry(val)
1817
- }
1818
-
1819
- word: string_content
1820
- | word string_content
1821
- {
1822
- result = self.literal_concat val[0], val[1]
1823
- }
1824
-
1825
- symbols: tSYMBOLS_BEG tSPACE tSTRING_END
1826
- {
1827
- result = s(:array)
1828
- }
1829
- | tSYMBOLS_BEG symbol_list tSTRING_END
1830
- {
1831
- result = val[1]
1832
- }
1833
-
1834
- symbol_list: none
1835
- {
1836
- result = new_symbol_list
1837
- }
1838
- | symbol_list word tSPACE
1839
- {
1840
- result = val[0].dup << new_symbol_list_entry(val)
1841
- }
1842
-
1843
- qwords: tQWORDS_BEG tSPACE tSTRING_END
1844
- {
1845
- result = s(:array)
1846
- }
1847
- | tQWORDS_BEG qword_list tSTRING_END
1848
- {
1849
- result = val[1]
1850
- }
1851
-
1852
- qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
1853
- {
1854
- result = s(:array)
1855
- }
1856
- | tQSYMBOLS_BEG qsym_list tSTRING_END
1857
- {
1858
- result = val[1]
1859
- }
1860
-
1861
- qword_list: none
1862
- {
1863
- result = new_qword_list
1864
- }
1865
- | qword_list tSTRING_CONTENT tSPACE
1866
- {
1867
- result = val[0].dup << new_qword_list_entry(val)
1868
- }
1869
-
1870
- qsym_list: none
1871
- {
1872
- result = new_qsym_list
1873
- }
1874
- | qsym_list tSTRING_CONTENT tSPACE
1875
- {
1876
- result = val[0].dup << new_qsym_list_entry(val)
1877
- }
1878
-
1879
- string_contents: none
1880
- {
1881
- result = s(:str, "")
1882
- }
1883
- | string_contents string_content
1884
- {
1885
- result = literal_concat(val[0], val[1])
1886
- }
1887
-
1888
- xstring_contents: none
1889
- {
1890
- result = nil
1891
- }
1892
- | xstring_contents string_content
1893
- {
1894
- result = literal_concat(val[0], val[1])
1895
- }
1896
-
1897
- regexp_contents: none
1898
- {
1899
- result = nil
1900
- }
1901
- | regexp_contents string_content
1902
- {
1903
- result = literal_concat(val[0], val[1])
1904
- }
1905
-
1906
- string_content: tSTRING_CONTENT
1907
- {
1908
- result = new_string val
1909
- }
1910
- | tSTRING_DVAR
1911
- {
1912
- result = lexer.lex_strterm
1913
-
1914
- lexer.lex_strterm = nil
1915
- lexer.lex_state = EXPR_BEG
1916
- }
1917
- string_dvar
1918
- {
1919
- lexer.lex_strterm = val[1]
1920
- result = s(:evstr, val[2])
1921
- }
1922
- | tSTRING_DBEG
1923
- {
1924
- result = [lexer.lex_strterm,
1925
- lexer.brace_nest,
1926
- lexer.string_nest, # TODO: remove
1927
- lexer.cond.store,
1928
- lexer.cmdarg.store,
1929
- lexer.lex_state,
1930
- ]
1931
-
1932
- lexer.lex_strterm = nil
1933
- lexer.brace_nest = 0
1934
- lexer.string_nest = 0
1935
-
1936
- lexer.lex_state = EXPR_BEG
1937
- }
1938
- compstmt
1939
- tSTRING_DEND
1940
- {
1941
- _, memo, stmt, _ = val
1942
-
1943
- lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state = memo
1944
-
1945
- lexer.lex_strterm = lex_strterm
1946
- lexer.brace_nest = brace_nest
1947
- lexer.string_nest = string_nest
1948
-
1949
- lexer.cond.restore oldcond
1950
- lexer.cmdarg.restore oldcmdarg
1951
-
1952
- lexer.lex_state = oldlex_state
1953
-
1954
- case stmt
1955
- when Sexp then
1956
- case stmt.sexp_type
1957
- when :str, :dstr, :evstr then
1958
- result = stmt
1959
- else
1960
- result = s(:evstr, stmt)
1961
- end
1962
- when nil then
1963
- result = s(:evstr)
1964
- else
1965
- debug20 25
1966
- raise "unknown string body: #{stmt.inspect}"
1967
- end
1968
- }
1969
-
1970
- string_dvar: tGVAR { result = s(:gvar, val[0].to_sym) }
1971
- | tIVAR { result = s(:ivar, val[0].to_sym) }
1972
- | tCVAR { result = s(:cvar, val[0].to_sym) }
1973
- | backref
1974
-
1975
- symbol: tSYMBEG sym
1976
- {
1977
- lexer.lex_state = EXPR_END
1978
- result = val[1].to_sym
1979
- }
1980
- | tSYMBOL
1981
- {
1982
- result = val[0].to_sym
1983
- }
1984
-
1985
- sym: fname | tIVAR | tGVAR | tCVAR
1986
-
1987
- dsym: tSYMBEG xstring_contents tSTRING_END
1988
- {
1989
- lexer.lex_state = EXPR_END
1990
- result = val[1]
1991
-
1992
- result ||= s(:str, "")
1993
-
1994
- case result.sexp_type
1995
- when :dstr then
1996
- result.sexp_type = :dsym
1997
- when :str then
1998
- result = s(:lit, result.last.to_sym)
1999
- when :evstr then
2000
- result = s(:dsym, "", result)
2001
- else
2002
- debug20 26, val, result
2003
- end
2004
- }
2005
-
2006
- numeric: tINTEGER
2007
- | tFLOAT
2008
- | tUMINUS_NUM tINTEGER =tLOWEST
2009
- {
2010
- result = -val[1] # TODO: pt_testcase
2011
- }
2012
- | tUMINUS_NUM tFLOAT =tLOWEST
2013
- {
2014
- result = -val[1] # TODO: pt_testcase
2015
- }
2016
-
2017
- user_variable: tIDENTIFIER
2018
- | tIVAR
2019
- | tGVAR
2020
- | tCONSTANT
2021
- | tCVAR
2022
-
2023
- keyword_variable: kNIL { result = s(:nil) }
2024
- | kSELF { result = s(:self) }
2025
- | kTRUE { result = s(:true) }
2026
- | kFALSE { result = s(:false) }
2027
- | k__FILE__ { result = s(:str, self.file) }
2028
- | k__LINE__ { result = s(:lit, lexer.lineno) }
2029
- | k__ENCODING__
2030
- {
2031
- result =
2032
- if defined? Encoding then
2033
- s(:colon2, s(:const, :Encoding), :UTF_8)
2034
- else
2035
- s(:str, "Unsupported!")
2036
- end
2037
- }
2038
-
2039
- var_ref: user_variable
2040
- {
2041
- var = val[0]
2042
- result = Sexp === var ? var : self.gettable(var)
2043
- }
2044
- | keyword_variable
2045
- {
2046
- var = val[0]
2047
- result = Sexp === var ? var : self.gettable(var)
2048
- }
2049
-
2050
- var_lhs: user_variable
2051
- {
2052
- result = self.assignable val[0]
2053
- }
2054
- | keyword_variable
2055
- {
2056
- result = self.assignable val[0]
2057
- debug20 29, val, result
2058
- }
2059
-
2060
- backref: tNTH_REF { result = s(:nth_ref, val[0]) }
2061
- | tBACK_REF { result = s(:back_ref, val[0]) }
2062
-
2063
- superclass: tLT
2064
- {
2065
- lexer.lex_state = EXPR_BEG
2066
- lexer.command_start = true
2067
- }
2068
- expr_value term
2069
- {
2070
- result = val[2]
2071
- }
2072
- | none
2073
- {
2074
- result = nil
2075
- }
2076
-
2077
- f_arglist: tLPAREN2 f_args rparen
2078
- {
2079
- result = val[1]
2080
- self.lexer.lex_state = EXPR_BEG
2081
- self.lexer.command_start = true
2082
- }
2083
- | {
2084
- result = self.in_kwarg
2085
- self.in_kwarg = true
2086
- self.lexer.lex_state |= EXPR_LABEL
2087
- }
2088
- f_args term
2089
- {
2090
- kwarg, args, _ = val
2091
-
2092
- self.in_kwarg = kwarg
2093
- result = args
2094
- lexer.lex_state = EXPR_BEG
2095
- lexer.command_start = true
2096
- }
2097
-
2098
- args_tail: f_kwarg tCOMMA f_kwrest opt_f_block_arg
2099
- {
2100
- result = args val
2101
- }
2102
- | f_kwarg opt_f_block_arg
2103
- {
2104
- result = args val
2105
- }
2106
- | f_kwrest opt_f_block_arg
2107
- {
2108
- result = args val
2109
- }
2110
- | f_block_arg
2111
-
2112
- opt_args_tail: tCOMMA args_tail
2113
- {
2114
- result = val[1]
2115
- }
2116
- |
2117
- {
2118
- result = nil
2119
- }
2120
-
2121
- f_args: f_arg tCOMMA f_optarg tCOMMA f_rest_arg opt_args_tail
2122
- {
2123
- result = args val
2124
- }
2125
- | f_arg tCOMMA f_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_args_tail
2126
- {
2127
- result = args val
2128
- }
2129
- | f_arg tCOMMA f_optarg opt_args_tail
2130
- {
2131
- result = args val
2132
- }
2133
- | f_arg tCOMMA f_optarg tCOMMA f_arg opt_args_tail
2134
- {
2135
- result = args val
2136
- }
2137
- | f_arg tCOMMA f_rest_arg opt_args_tail
2138
- {
2139
- result = args val
2140
- }
2141
- | f_arg tCOMMA f_rest_arg tCOMMA f_arg opt_args_tail
2142
- {
2143
- result = args val
2144
- }
2145
- | f_arg opt_args_tail
2146
- {
2147
- result = args val
2148
- }
2149
- | f_optarg tCOMMA f_rest_arg opt_args_tail
2150
- {
2151
- result = args val
2152
- }
2153
- | f_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_args_tail
2154
- {
2155
- result = args val
2156
- }
2157
- | f_optarg opt_args_tail
2158
- {
2159
- result = args val
2160
- }
2161
- | f_optarg tCOMMA f_arg opt_args_tail
2162
- {
2163
- result = args val
2164
- }
2165
- | f_rest_arg opt_args_tail
2166
- {
2167
- result = args val
2168
- }
2169
- | f_rest_arg tCOMMA f_arg opt_args_tail
2170
- {
2171
- result = args val
2172
- }
2173
- | args_tail
2174
- {
2175
- result = args val
2176
- }
2177
- |
2178
- {
2179
- result = args val
2180
- }
2181
-
2182
- f_bad_arg: tCONSTANT
2183
- {
2184
- yyerror "formal argument cannot be a constant"
2185
- }
2186
- | tIVAR
2187
- {
2188
- yyerror "formal argument cannot be an instance variable"
2189
- }
2190
- | tGVAR
2191
- {
2192
- yyerror "formal argument cannot be a global variable"
2193
- }
2194
- | tCVAR
2195
- {
2196
- yyerror "formal argument cannot be a class variable"
2197
- }
2198
-
2199
- f_norm_arg: f_bad_arg
2200
- | tIDENTIFIER
2201
- {
2202
- identifier = val[0].to_sym
2203
- self.env[identifier] = :lvar
2204
-
2205
- result = identifier
2206
- }
2207
-
2208
- f_arg_item: f_norm_arg
2209
- | tLPAREN f_margs rparen
2210
- {
2211
- result = val[1]
2212
- }
2213
-
2214
- f_arg: f_arg_item
2215
- {
2216
- case val[0]
2217
- when Symbol then
2218
- result = s(:args)
2219
- result << val[0]
2220
- when Sexp then
2221
- result = val[0]
2222
- else
2223
- debug20 32
2224
- raise "Unknown f_arg type: #{val.inspect}"
2225
- end
2226
- }
2227
- | f_arg tCOMMA f_arg_item
2228
- {
2229
- list, _, item = val
2230
-
2231
- if list.sexp_type == :args then
2232
- result = list
2233
- else
2234
- result = s(:args, list)
2235
- end
2236
-
2237
- result << item
2238
- }
2239
-
2240
- f_kw: tLABEL arg_value
2241
- {
2242
- # TODO: call_args
2243
- label, _ = val[0] # TODO: fix lineno?
2244
- identifier = label.to_sym
2245
- self.env[identifier] = :lvar
2246
-
2247
- result = s(:array, s(:kwarg, identifier, val[1]))
2248
- }
2249
-
2250
- f_block_kw: tLABEL primary_value
2251
- {
2252
- # TODO: call_args
2253
- label, _ = val[0] # TODO: fix lineno?
2254
- identifier = label.to_sym
2255
- self.env[identifier] = :lvar
2256
-
2257
- result = s(:array, s(:kwarg, identifier, val[1]))
2258
- }
2259
-
2260
- f_block_kwarg: f_block_kw
2261
- | f_block_kwarg tCOMMA f_block_kw
2262
- {
2263
- list, _, item = val
2264
- result = list << item.last
2265
- }
2266
-
2267
- f_kwarg: f_kw
2268
- | f_kwarg tCOMMA f_kw
2269
- {
2270
- result = args val
2271
- }
2272
-
2273
- kwrest_mark: tPOW
2274
- | tDSTAR
2275
-
2276
- f_kwrest: kwrest_mark tIDENTIFIER
2277
- {
2278
- name = val[1].to_sym
2279
- self.assignable name
2280
- result = :"**#{name}"
2281
- }
2282
- | kwrest_mark
2283
- {
2284
- result = :"**"
2285
- }
2286
-
2287
- f_opt: tIDENTIFIER tEQL arg_value
2288
- {
2289
- result = self.assignable val[0], val[2]
2290
- # TODO: detect duplicate names
2291
- }
2292
-
2293
- f_block_opt: tIDENTIFIER tEQL primary_value
2294
- {
2295
- result = self.assignable val[0], val[2]
2296
- }
2297
-
2298
- f_block_optarg: f_block_opt
2299
- {
2300
- result = s(:block, val[0])
2301
- }
2302
- | f_block_optarg tCOMMA f_block_opt
2303
- {
2304
- result = val[0]
2305
- result << val[2]
2306
- }
2307
-
2308
- f_optarg: f_opt
2309
- {
2310
- result = s(:block, val[0])
2311
- }
2312
- | f_optarg tCOMMA f_opt
2313
- {
2314
- result = self.block_append val[0], val[2]
2315
- }
2316
-
2317
- restarg_mark: tSTAR2 | tSTAR
2318
-
2319
- f_rest_arg: restarg_mark tIDENTIFIER
2320
- {
2321
- # TODO: differs from parse.y - needs tests
2322
- name = val[1].to_sym
2323
- self.assignable name
2324
- result = :"*#{name}"
2325
- }
2326
- | restarg_mark
2327
- {
2328
- name = :"*"
2329
- self.env[name] = :lvar
2330
- result = name
2331
- }
2332
-
2333
- blkarg_mark: tAMPER2 | tAMPER
2334
-
2335
- f_block_arg: blkarg_mark tIDENTIFIER
2336
- {
2337
- identifier = val[1].to_sym
2338
-
2339
- self.env[identifier] = :lvar
2340
- result = "&#{identifier}".to_sym
2341
- }
2342
-
2343
- opt_f_block_arg: tCOMMA f_block_arg
2344
- {
2345
- result = val[1]
2346
- }
2347
- |
2348
- {
2349
- result = nil
2350
- }
2351
-
2352
- singleton: var_ref
2353
- | tLPAREN2
2354
- {
2355
- lexer.lex_state = EXPR_BEG
2356
- }
2357
- expr rparen
2358
- {
2359
- result = val[2]
2360
- yyerror "Can't define single method for literals." if
2361
- result.sexp_type == :lit
2362
- }
2363
-
2364
- assoc_list: none # [!nil]
2365
- {
2366
- result = s(:array)
2367
- }
2368
- | assocs trailer # [!nil]
2369
- {
2370
- result = val[0]
2371
- }
2372
-
2373
- assocs: assoc
2374
- | assocs tCOMMA assoc
2375
- {
2376
- list = val[0].dup
2377
- more = val[2].sexp_body
2378
- list.push(*more) unless more.empty?
2379
- result = list
2380
- result.sexp_type = :hash
2381
- }
2382
-
2383
- assoc: arg_value tASSOC arg_value
2384
- {
2385
- result = s(:array, val[0], val[2])
2386
- }
2387
- | tLABEL arg_value
2388
- {
2389
- (label, _), arg = val
2390
- result = s(:array, s(:lit, label.to_sym), arg)
2391
- }
2392
- | tDSTAR arg_value
2393
- {
2394
- result = s(:array, s(:kwsplat, val[1]))
2395
- }
2396
-
2397
- operation: tIDENTIFIER | tCONSTANT | tFID
2398
- operation2: tIDENTIFIER | tCONSTANT | tFID | op
2399
- operation3: tIDENTIFIER | tFID | op
2400
- dot_or_colon: tDOT | tCOLON2
2401
- call_op: tDOT
2402
-
2403
- call_op2: call_op
2404
- | tCOLON2
2405
-
2406
- opt_terms: | terms
2407
- opt_nl: | tNL
2408
- rparen: opt_nl tRPAREN
2409
- rbracket: opt_nl tRBRACK
2410
- trailer: | tNL | tCOMMA
2411
-
2412
- term: tSEMI { yyerrok }
2413
- | tNL
2414
-
2415
- terms: term
2416
- | terms tSEMI { yyerrok }
2417
-
2418
- none: { result = nil; }
2419
- end
2420
-
2421
- ---- inner
2422
-
2423
- require "ruby_lexer"
2424
- require "ruby_parser_extras"
2425
- include RubyLexer::State::Values
2426
-
2427
- # :stopdoc:
2428
-
2429
- # Local Variables: **
2430
- # racc-token-length-max:14 **
2431
- # End: **