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