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