brakeman 4.8.0 → 5.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +144 -2
- data/README.md +23 -6
- data/bundle/load.rb +7 -5
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/CHANGELOG.md +24 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/FAQ.md +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/Gemfile +1 -4
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/MIT-LICENSE +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/README.md +21 -16
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/REFERENCE.md +39 -10
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/TODO +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/haml.gemspec +2 -1
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/attribute_builder.rb +58 -3
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/attribute_compiler.rb +45 -32
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/attribute_parser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/buffer.rb +0 -56
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/compiler.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/engine.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/error.rb +0 -0
- data/bundle/ruby/2.7.0/gems/haml-5.2.2/lib/haml/escapable.rb +77 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/exec.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/filters.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/generator.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/action_view_extensions.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/action_view_mods.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/action_view_xss_mods.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/safe_erubi_template.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/safe_erubis_template.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers/xss_mods.rb +6 -3
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/helpers.rb +7 -1
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/options.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/parser.rb +32 -4
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/plugin.rb +18 -1
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/railtie.rb +5 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/sass_rails_filter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/template/options.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/template.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/temple_engine.rb +2 -1
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/temple_line_counter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/util.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml/version.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/lib/haml.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/yard/default/fulldoc/html/css/common.sass +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.1.2 → haml-5.2.2}/yard/default/layout/html/footer.erb +0 -0
- data/bundle/ruby/2.7.0/gems/parallel-1.21.0/MIT-LICENSE.txt +20 -0
- data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel/processor_count.rb +45 -0
- data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel/version.rb +4 -0
- data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel.rb +532 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/LICENSE.txt +22 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/NEWS.md +178 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/README.md +48 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb +63 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/attribute.rb +205 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/cdata.rb +68 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/child.rb +97 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/comment.rb +80 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/doctype.rb +311 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/document.rb +451 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/dtd/attlistdecl.rb +11 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/dtd/dtd.rb +47 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/dtd/elementdecl.rb +18 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/dtd/entitydecl.rb +57 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb +40 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/element.rb +2599 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/encoding.rb +51 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/entity.rb +171 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/formatters/default.rb +116 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/formatters/pretty.rb +142 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/formatters/transitive.rb +58 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/functions.rb +447 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/instruction.rb +79 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/light/node.rb +188 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/namespace.rb +59 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/node.rb +76 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/output.rb +30 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parent.rb +166 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parseexception.rb +52 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb +694 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/lightparser.rb +59 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/pullparser.rb +197 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/sax2parser.rb +273 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/streamparser.rb +61 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb +101 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/ultralightparser.rb +57 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/parsers/xpathparser.rb +689 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/quickpath.rb +266 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/rexml.rb +37 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/sax2listener.rb +98 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/security.rb +28 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/source.rb +298 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/streamlistener.rb +93 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/text.rb +424 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/undefinednamespaceexception.rb +9 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/validation/relaxng.rb +539 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/validation/validation.rb +144 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/validation/validationexception.rb +10 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/xmldecl.rb +130 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/xmltokens.rb +85 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/xpath.rb +81 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/xpath_parser.rb +974 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml.rb +3 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/History.rdoc +148 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/Manifest.txt +7 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/README.rdoc +1 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/compare/normalize.rb +51 -6
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/debugging.md +190 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/gauntlet.md +106 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/rp_extensions.rb +15 -36
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/rp_stringscanner.rb +33 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby20_parser.rb +7128 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby20_parser.y +420 -296
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby21_parser.rb +7182 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby21_parser.y +415 -293
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby22_parser.rb +7228 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby22_parser.y +419 -295
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby23_parser.rb +7237 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby23_parser.y +419 -295
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby24_parser.rb +7268 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby24_parser.y +419 -295
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby25_parser.rb +7268 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2/lib/ruby26_parser.y → ruby_parser-3.18.1/lib/ruby25_parser.y} +418 -308
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby26_parser.rb +7287 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2/lib/ruby_parser.yy → ruby_parser-3.18.1/lib/ruby26_parser.y} +419 -399
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby27_parser.rb +8517 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2/lib/ruby25_parser.y → ruby_parser-3.18.1/lib/ruby27_parser.y} +1030 -294
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby30_parser.rb +8751 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby30_parser.y +3472 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby3_parser.yy +3476 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_lexer.rb +308 -605
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_lexer.rex +33 -27
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_lexer.rex.rb +65 -31
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby_lexer_strings.rb +638 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_parser.rb +4 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby_parser.yy +3487 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_parser_extras.rb +341 -127
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/tools/munge.rb +43 -10
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/tools/ripper.rb +15 -10
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/History.rdoc +39 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/Manifest.txt +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/README.rdoc +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/composite_sexp_processor.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/pt_testcase.rb +9 -4
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/sexp.rb +19 -9
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/sexp_matcher.rb +4 -7
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/sexp_processor.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/strict_sexp.rb +25 -3
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.14.1 → sexp_processor-4.16.0}/lib/unique.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/CHANGES +4 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/Gemfile +12 -13
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/LICENSE +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/README.jp.md +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/README.md +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/code_attributes.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/command.rb +13 -13
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/controls.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/do_inserter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/embedded.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/end_inserter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/engine.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/erb_converter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/filter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/grammar.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/include.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/interpolation.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/logic_less/context.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/logic_less/filter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/logic_less.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/parser.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/smart/escaper.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/smart/filter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/smart/parser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/smart.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/splat/builder.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/splat/filter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/template.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/translator.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim/version.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/lib/slim.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{slim-4.0.1 → slim-4.1.0}/slim.gemspec +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/CHANGELOG.md +8 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/MIT-LICENSE.txt +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/README.md +1 -1
- data/bundle/ruby/2.7.0/gems/unicode-display_width-1.8.0/data/display_width.marshal.gz +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/lib/unicode/display_width/constants.rb +2 -2
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/lib/unicode/display_width/index.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/lib/unicode/display_width/no_string_ext.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/lib/unicode/display_width/string_ext.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.6.1 → unicode-display_width-1.8.0}/lib/unicode/display_width.rb +0 -0
- data/lib/brakeman/app_tree.rb +37 -4
- data/lib/brakeman/checks/base_check.rb +18 -2
- data/lib/brakeman/checks/check_basic_auth.rb +2 -0
- data/lib/brakeman/checks/check_csrf_token_forgery_cve.rb +28 -0
- data/lib/brakeman/checks/check_deserialize.rb +21 -1
- data/lib/brakeman/checks/check_detailed_exceptions.rb +1 -1
- data/lib/brakeman/checks/check_eol_rails.rb +23 -0
- data/lib/brakeman/checks/check_eol_ruby.rb +26 -0
- data/lib/brakeman/checks/check_evaluation.rb +1 -1
- data/lib/brakeman/checks/check_execute.rb +12 -1
- data/lib/brakeman/checks/check_json_entity_escape.rb +38 -0
- data/lib/brakeman/checks/check_json_parsing.rb +1 -1
- data/lib/brakeman/checks/check_mass_assignment.rb +37 -9
- data/lib/brakeman/checks/check_model_attr_accessible.rb +1 -1
- data/lib/brakeman/checks/check_model_attributes.rb +1 -1
- data/lib/brakeman/checks/check_page_caching_cve.rb +37 -0
- data/lib/brakeman/checks/check_permit_attributes.rb +1 -1
- data/lib/brakeman/checks/check_regex_dos.rb +1 -1
- data/lib/brakeman/checks/check_render.rb +15 -1
- data/lib/brakeman/checks/check_sanitize_methods.rb +2 -1
- data/lib/brakeman/checks/check_skip_before_filter.rb +4 -4
- data/lib/brakeman/checks/check_sql.rb +60 -9
- data/lib/brakeman/checks/check_symbol_dos.rb +1 -1
- data/lib/brakeman/checks/check_template_injection.rb +32 -0
- data/lib/brakeman/checks/check_unsafe_reflection_methods.rb +68 -0
- data/lib/brakeman/checks/check_verb_confusion.rb +75 -0
- data/lib/brakeman/checks/eol_check.rb +47 -0
- data/lib/brakeman/commandline.rb +25 -1
- data/lib/brakeman/file_parser.rb +58 -22
- data/lib/brakeman/options.rb +39 -2
- data/lib/brakeman/parsers/template_parser.rb +26 -3
- data/lib/brakeman/processors/alias_processor.rb +132 -24
- data/lib/brakeman/processors/base_processor.rb +4 -4
- data/lib/brakeman/processors/controller_alias_processor.rb +6 -43
- data/lib/brakeman/processors/controller_processor.rb +1 -1
- data/lib/brakeman/processors/gem_processor.rb +3 -0
- data/lib/brakeman/processors/haml_template_processor.rb +17 -1
- data/lib/brakeman/processors/lib/call_conversion_helper.rb +13 -7
- data/lib/brakeman/processors/lib/file_type_detector.rb +64 -0
- data/lib/brakeman/processors/lib/find_all_calls.rb +28 -13
- data/lib/brakeman/processors/lib/rails3_config_processor.rb +16 -16
- data/lib/brakeman/processors/lib/rails3_route_processor.rb +2 -0
- data/lib/brakeman/processors/lib/rails4_config_processor.rb +2 -1
- data/lib/brakeman/processors/lib/render_helper.rb +3 -1
- data/lib/brakeman/processors/library_processor.rb +9 -0
- data/lib/brakeman/processors/model_processor.rb +32 -0
- data/lib/brakeman/processors/output_processor.rb +1 -1
- data/lib/brakeman/processors/template_alias_processor.rb +5 -0
- data/lib/brakeman/report/ignore/config.rb +5 -1
- data/lib/brakeman/report/ignore/interactive.rb +1 -1
- data/lib/brakeman/report/report_base.rb +0 -2
- data/lib/brakeman/report/report_csv.rb +37 -60
- data/lib/brakeman/report/report_github.rb +31 -0
- data/lib/brakeman/report/report_junit.rb +2 -2
- data/lib/brakeman/report/report_sarif.rb +133 -0
- data/lib/brakeman/report/report_sonar.rb +38 -0
- data/lib/brakeman/report/report_tabs.rb +1 -1
- data/lib/brakeman/report/report_text.rb +38 -17
- data/lib/brakeman/report.rb +19 -1
- data/lib/brakeman/rescanner.rb +7 -5
- data/lib/brakeman/scanner.rb +65 -31
- data/lib/brakeman/tracker/collection.rb +57 -7
- data/lib/brakeman/tracker/config.rb +87 -5
- data/lib/brakeman/tracker/constants.rb +8 -7
- data/lib/brakeman/tracker/controller.rb +1 -1
- data/lib/brakeman/tracker/method_info.rb +70 -0
- data/lib/brakeman/tracker.rb +42 -5
- data/lib/brakeman/util.rb +58 -21
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman/warning.rb +10 -2
- data/lib/brakeman/warning_codes.rb +13 -0
- data/lib/brakeman.rb +45 -6
- data/lib/ruby_parser/bm_sexp.rb +33 -9
- metadata +201 -123
- data/bundle/ruby/2.7.0/gems/haml-5.1.2/lib/haml/escapable.rb +0 -50
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/debugging.md +0 -18
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/rp_stringscanner.rb +0 -64
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby20_parser.rb +0 -7042
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby21_parser.rb +0 -7113
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby22_parser.rb +0 -7146
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby23_parser.rb +0 -7163
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby24_parser.rb +0 -7175
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby25_parser.rb +0 -7175
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.14.2/lib/ruby26_parser.rb +0 -7195
- data/bundle/ruby/2.7.0/gems/unicode-display_width-1.6.1/data/display_width.marshal.gz +0 -0
@@ -1,22 +1,6 @@
|
|
1
1
|
# -*- racc -*-
|
2
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
3
|
class Ruby26Parser
|
17
|
-
#else
|
18
|
-
fail "version not specified or supported on code generation"
|
19
|
-
#endif
|
20
4
|
|
21
5
|
token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
|
22
6
|
kTHEN kELSIF kELSE kCASE kWHEN kWHILE kUNTIL kFOR kBREAK kNEXT
|
@@ -34,16 +18,11 @@ token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
|
|
34
18
|
tBACK_REF2 tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG
|
35
19
|
tWORDS_BEG tQWORDS_BEG tSTRING_DBEG tSTRING_DVAR tSTRING_END
|
36
20
|
tSTRING tSYMBOL tNL tEH tCOLON tCOMMA tSPACE tSEMI tLAMBDA
|
37
|
-
tLAMBEG tDSTAR tCHAR tSYMBOLS_BEG tQSYMBOLS_BEG tSTRING_DEND
|
38
|
-
#if V >= 21
|
21
|
+
tLAMBEG tDSTAR tCHAR tSYMBOLS_BEG tQSYMBOLS_BEG tSTRING_DEND
|
39
22
|
tRATIONAL tIMAGINARY
|
40
|
-
#endif
|
41
|
-
#if V >= 22
|
42
23
|
tLABEL_END
|
43
|
-
#endif
|
44
|
-
#if V >= 23
|
45
24
|
tLONELY
|
46
|
-
|
25
|
+
tBDOT2 tBDOT3
|
47
26
|
|
48
27
|
preclow
|
49
28
|
nonassoc tLOWEST
|
@@ -55,7 +34,7 @@ preclow
|
|
55
34
|
right tEQL tOP_ASGN
|
56
35
|
left kRESCUE_MOD
|
57
36
|
right tEH tCOLON
|
58
|
-
nonassoc tDOT2 tDOT3
|
37
|
+
nonassoc tDOT2 tDOT3 tBDOT2 tBDOT3
|
59
38
|
left tOROP
|
60
39
|
left tANDOP
|
61
40
|
nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
|
@@ -78,6 +57,9 @@ rule
|
|
78
57
|
top_compstmt
|
79
58
|
{
|
80
59
|
result = new_compstmt val
|
60
|
+
|
61
|
+
lexer.cond.pop # local_pop
|
62
|
+
lexer.cmdarg.pop
|
81
63
|
}
|
82
64
|
|
83
65
|
top_compstmt: top_stmts opt_terms
|
@@ -98,7 +80,7 @@ rule
|
|
98
80
|
| klBEGIN
|
99
81
|
{
|
100
82
|
if (self.in_def || self.in_single > 0) then
|
101
|
-
|
83
|
+
debug 11
|
102
84
|
yyerror "BEGIN in method"
|
103
85
|
end
|
104
86
|
self.env.extend
|
@@ -123,6 +105,8 @@ rule
|
|
123
105
|
bodystmt: compstmt opt_rescue k_else
|
124
106
|
{
|
125
107
|
res = _values[-2]
|
108
|
+
# TODO: move down to main match so I can just use val
|
109
|
+
|
126
110
|
yyerror "else without rescue is useless" unless res
|
127
111
|
}
|
128
112
|
compstmt
|
@@ -153,7 +137,7 @@ rule
|
|
153
137
|
| error stmt
|
154
138
|
{
|
155
139
|
result = val[1]
|
156
|
-
|
140
|
+
debug 12
|
157
141
|
}
|
158
142
|
|
159
143
|
stmt_or_begin: stmt
|
@@ -161,6 +145,10 @@ rule
|
|
161
145
|
{
|
162
146
|
yyerror "BEGIN is permitted only at toplevel"
|
163
147
|
}
|
148
|
+
begin_block
|
149
|
+
{
|
150
|
+
result = val[2] # wtf?
|
151
|
+
}
|
164
152
|
|
165
153
|
stmt: kALIAS fitem
|
166
154
|
{
|
@@ -173,12 +161,12 @@ rule
|
|
173
161
|
}
|
174
162
|
| kALIAS tGVAR tGVAR
|
175
163
|
{
|
176
|
-
(_, line), lhs, rhs = val
|
164
|
+
(_, line), (lhs, _), (rhs, _) = val
|
177
165
|
result = s(:valias, lhs.to_sym, rhs.to_sym).line line
|
178
166
|
}
|
179
167
|
| kALIAS tGVAR tBACK_REF
|
180
168
|
{
|
181
|
-
(_, line), lhs, rhs = val
|
169
|
+
(_, line), (lhs, _), (rhs, _) = val
|
182
170
|
result = s(:valias, lhs.to_sym, :"$#{rhs}").line line
|
183
171
|
}
|
184
172
|
| kALIAS tGVAR tNTH_REF
|
@@ -221,7 +209,7 @@ rule
|
|
221
209
|
(_, line), _, stmt, _ = val
|
222
210
|
|
223
211
|
if (self.in_def || self.in_single > 0) then
|
224
|
-
|
212
|
+
debug 13
|
225
213
|
yyerror "END in method; use at_exit"
|
226
214
|
end
|
227
215
|
|
@@ -237,15 +225,7 @@ rule
|
|
237
225
|
lhs, _, rhs = val
|
238
226
|
result = new_assign lhs, s(:svalue, rhs).line(rhs.line)
|
239
227
|
}
|
240
|
-
#if V == 20
|
241
|
-
| mlhs tEQL arg_value
|
242
|
-
{
|
243
|
-
result = new_masgn val[0], val[2], :wrap
|
244
|
-
}
|
245
|
-
| mlhs tEQL mrhs
|
246
|
-
#else
|
247
228
|
| mlhs tEQL mrhs_arg
|
248
|
-
#endif
|
249
229
|
{
|
250
230
|
result = new_masgn val[0], val[2]
|
251
231
|
}
|
@@ -269,30 +249,31 @@ rule
|
|
269
249
|
}
|
270
250
|
| primary_value call_op tIDENTIFIER tOP_ASGN command_rhs
|
271
251
|
{
|
272
|
-
prim, _, id,
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
result.line = val[0].line
|
252
|
+
prim, (call_op, _), (id, _), (op_asgn, _), rhs = val
|
253
|
+
|
254
|
+
result = s(:op_asgn, prim, rhs, id.to_sym, op_asgn.to_sym)
|
255
|
+
result.sexp_type = :safe_op_asgn if call_op == '&.'
|
256
|
+
result.line prim.line
|
278
257
|
}
|
279
258
|
| primary_value call_op tCONSTANT tOP_ASGN command_rhs
|
280
259
|
{
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
result.line
|
260
|
+
prim, (call_op, _), (id, _), (op_asgn, _), rhs = val
|
261
|
+
|
262
|
+
result = s(:op_asgn, prim, rhs, id.to_sym, op_asgn.to_sym)
|
263
|
+
result.sexp_type = :safe_op_asgn if call_op == '&.'
|
264
|
+
result.line prim.line
|
286
265
|
}
|
287
266
|
| primary_value tCOLON2 tCONSTANT tOP_ASGN command_rhs
|
288
267
|
{
|
289
|
-
|
290
|
-
|
268
|
+
lhs1, _, (lhs2, line), (id, _), rhs = val
|
269
|
+
|
270
|
+
result = s(:op_asgn, lhs1, rhs, lhs2.to_sym, id.to_sym).line line
|
291
271
|
}
|
292
272
|
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs
|
293
273
|
{
|
294
|
-
|
295
|
-
|
274
|
+
lhs1, _, (lhs2, line), (id, _), rhs = val
|
275
|
+
|
276
|
+
result = s(:op_asgn, lhs1, rhs, lhs2.to_sym, id.to_sym).line line
|
296
277
|
}
|
297
278
|
| backref tOP_ASGN command_rhs
|
298
279
|
{
|
@@ -304,7 +285,6 @@ rule
|
|
304
285
|
expr, = val
|
305
286
|
result = value_expr expr
|
306
287
|
}
|
307
|
-
#if V >= 24
|
308
288
|
| command_call kRESCUE_MOD stmt
|
309
289
|
{
|
310
290
|
expr, (_, line), resbody = val
|
@@ -313,7 +293,6 @@ rule
|
|
313
293
|
ary = s(:array).line line
|
314
294
|
result = new_rescue(expr, new_resbody(ary, resbody))
|
315
295
|
}
|
316
|
-
#endif
|
317
296
|
| command_asgn
|
318
297
|
|
319
298
|
expr: command_call
|
@@ -340,7 +319,7 @@ rule
|
|
340
319
|
# TODO: fix line number to tBANG... but causes BAD shift/reduce conflict
|
341
320
|
# REFACTOR: call_uni_op -- see parse26.y
|
342
321
|
}
|
343
|
-
| arg
|
322
|
+
| arg =tLBRACE_ARG
|
344
323
|
|
345
324
|
expr_value: expr
|
346
325
|
{
|
@@ -365,7 +344,7 @@ rule
|
|
365
344
|
block_command: block_call
|
366
345
|
| block_call call_op2 operation2 command_args
|
367
346
|
{
|
368
|
-
blk, _, msg, args = val
|
347
|
+
blk, _, (msg, _line), args = val
|
369
348
|
result = new_call(blk, msg.to_sym, args).line blk.line
|
370
349
|
}
|
371
350
|
|
@@ -379,15 +358,15 @@ rule
|
|
379
358
|
_, line, body, _ = val
|
380
359
|
|
381
360
|
result = body
|
382
|
-
result.line
|
361
|
+
result.line line
|
383
362
|
|
384
363
|
# self.env.unextend
|
385
364
|
}
|
386
365
|
|
387
366
|
fcall: operation
|
388
367
|
{
|
389
|
-
msg, = val
|
390
|
-
result = new_call(nil, msg.to_sym).line
|
368
|
+
(msg, line), = val
|
369
|
+
result = new_call(nil, msg.to_sym).line line
|
391
370
|
}
|
392
371
|
|
393
372
|
command: fcall command_args =tLOWEST
|
@@ -410,12 +389,14 @@ rule
|
|
410
389
|
}
|
411
390
|
| primary_value call_op operation2 command_args =tLOWEST
|
412
391
|
{
|
413
|
-
lhs, callop, op, args = val
|
392
|
+
lhs, callop, (op, _), args = val
|
393
|
+
|
414
394
|
result = new_call lhs, op.to_sym, args, callop
|
395
|
+
result.line lhs.line
|
415
396
|
}
|
416
397
|
| primary_value call_op operation2 command_args cmd_brace_block
|
417
398
|
{
|
418
|
-
recv, _, msg, args, block = val
|
399
|
+
recv, _, (msg, _line), args, block = val
|
419
400
|
call = new_call recv, msg.to_sym, args, val[1]
|
420
401
|
|
421
402
|
block_dup_check call, block
|
@@ -425,11 +406,14 @@ rule
|
|
425
406
|
}
|
426
407
|
| primary_value tCOLON2 operation2 command_args =tLOWEST
|
427
408
|
{
|
428
|
-
|
409
|
+
lhs, _, (id, line), args = val
|
410
|
+
|
411
|
+
result = new_call lhs, id.to_sym, args
|
412
|
+
result.line line
|
429
413
|
}
|
430
414
|
| primary_value tCOLON2 operation2 command_args cmd_brace_block
|
431
415
|
{
|
432
|
-
recv, _, msg, args, block = val
|
416
|
+
recv, _, (msg, _line), args, block = val
|
433
417
|
call = new_call recv, msg.to_sym, args
|
434
418
|
|
435
419
|
block_dup_check call, block
|
@@ -587,25 +571,29 @@ rule
|
|
587
571
|
}
|
588
572
|
| primary_value call_op tIDENTIFIER
|
589
573
|
{
|
590
|
-
|
574
|
+
lhs, call_op, (id, _line) = val
|
575
|
+
|
576
|
+
result = new_attrasgn lhs, id, call_op
|
591
577
|
}
|
592
578
|
| primary_value tCOLON2 tIDENTIFIER
|
593
579
|
{
|
594
|
-
recv, _, id = val
|
580
|
+
recv, _, (id, _line) = val
|
595
581
|
result = new_attrasgn recv, id
|
596
582
|
}
|
597
583
|
| primary_value call_op tCONSTANT
|
598
584
|
{
|
599
|
-
|
585
|
+
lhs, call_op, (id, _line) = val
|
586
|
+
|
587
|
+
result = new_attrasgn lhs, id, call_op
|
600
588
|
}
|
601
589
|
| primary_value tCOLON2 tCONSTANT
|
602
590
|
{
|
603
591
|
if (self.in_def || self.in_single > 0) then
|
604
|
-
|
592
|
+
debug 14
|
605
593
|
yyerror "dynamic constant assignment"
|
606
594
|
end
|
607
595
|
|
608
|
-
expr, _, id = val
|
596
|
+
expr, _, (id, _line) = val
|
609
597
|
l = expr.line
|
610
598
|
|
611
599
|
result = s(:const, s(:colon2, expr, id.to_sym).line(l), nil).line l
|
@@ -613,58 +601,65 @@ rule
|
|
613
601
|
| tCOLON3 tCONSTANT
|
614
602
|
{
|
615
603
|
if (self.in_def || self.in_single > 0) then
|
616
|
-
|
604
|
+
debug 15
|
617
605
|
yyerror "dynamic constant assignment"
|
618
606
|
end
|
619
607
|
|
620
|
-
_, id = val
|
621
|
-
l = lexer.lineno
|
608
|
+
_, (id, l) = val
|
622
609
|
|
623
610
|
result = s(:const, nil, s(:colon3, id.to_sym).line(l)).line l
|
624
611
|
}
|
625
612
|
| backref
|
626
613
|
{
|
627
|
-
|
614
|
+
ref, = val
|
615
|
+
|
616
|
+
self.backref_assign_error ref
|
628
617
|
}
|
629
618
|
|
630
619
|
lhs: user_variable
|
631
620
|
{
|
632
|
-
|
633
|
-
|
634
|
-
result
|
621
|
+
var, = val
|
622
|
+
|
623
|
+
result = self.assignable var
|
635
624
|
}
|
636
625
|
| keyword_variable
|
637
626
|
{
|
638
|
-
|
639
|
-
|
640
|
-
result
|
641
|
-
|
627
|
+
var, = val
|
628
|
+
|
629
|
+
result = self.assignable var
|
630
|
+
|
631
|
+
debug 16
|
642
632
|
}
|
643
633
|
| primary_value tLBRACK2 opt_call_args rbracket
|
644
634
|
{
|
645
635
|
lhs, _, args, _ = val
|
636
|
+
|
646
637
|
result = self.aryset lhs, args
|
647
638
|
}
|
648
639
|
| primary_value call_op tIDENTIFIER # REFACTOR
|
649
640
|
{
|
650
|
-
lhs, op, id = val
|
641
|
+
lhs, op, (id, _line) = val
|
642
|
+
|
651
643
|
result = new_attrasgn lhs, id, op
|
652
644
|
}
|
653
645
|
| primary_value tCOLON2 tIDENTIFIER
|
654
646
|
{
|
655
|
-
lhs, _, id = val
|
647
|
+
lhs, _, (id, _line) = val
|
648
|
+
|
656
649
|
result = new_attrasgn lhs, id
|
657
650
|
}
|
658
651
|
| primary_value call_op tCONSTANT # REFACTOR?
|
659
652
|
{
|
660
|
-
|
653
|
+
lhs, call_op, (id, _line) = val
|
654
|
+
|
655
|
+
result = new_attrasgn lhs, id, call_op
|
661
656
|
}
|
662
657
|
| primary_value tCOLON2 tCONSTANT
|
663
658
|
{
|
664
|
-
expr, _, id = val
|
659
|
+
expr, _, (id, _line) = val
|
665
660
|
|
666
661
|
if (self.in_def || self.in_single > 0) then
|
667
|
-
|
662
|
+
debug 17
|
668
663
|
yyerror "dynamic constant assignment"
|
669
664
|
end
|
670
665
|
|
@@ -673,14 +668,13 @@ rule
|
|
673
668
|
}
|
674
669
|
| tCOLON3 tCONSTANT
|
675
670
|
{
|
676
|
-
_, id = val
|
671
|
+
_, (id, l) = val
|
677
672
|
|
678
673
|
if (self.in_def || self.in_single > 0) then
|
679
|
-
|
674
|
+
debug 18
|
680
675
|
yyerror "dynamic constant assignment"
|
681
676
|
end
|
682
677
|
|
683
|
-
l = lexer.lineno
|
684
678
|
result = s(:const, s(:colon3, id.to_sym).line(l)).line l
|
685
679
|
}
|
686
680
|
| backref
|
@@ -696,16 +690,17 @@ rule
|
|
696
690
|
|
697
691
|
cpath: tCOLON3 cname
|
698
692
|
{
|
699
|
-
_, name = val
|
700
|
-
result = s(:colon3, name.to_sym).line
|
693
|
+
_, (name, line) = val
|
694
|
+
result = s(:colon3, name.to_sym).line line
|
701
695
|
}
|
702
696
|
| cname
|
703
697
|
{
|
704
|
-
|
698
|
+
(id, line), = val
|
699
|
+
result = [id.to_sym, line] # TODO: sexp?
|
705
700
|
}
|
706
701
|
| primary_value tCOLON2 cname
|
707
702
|
{
|
708
|
-
pval, _, name = val
|
703
|
+
pval, _, (name, _line) = val
|
709
704
|
|
710
705
|
result = s(:colon2, pval, name.to_sym)
|
711
706
|
result.line pval.line
|
@@ -715,24 +710,17 @@ rule
|
|
715
710
|
| op
|
716
711
|
{
|
717
712
|
lexer.lex_state = EXPR_END
|
718
|
-
result = val[0]
|
719
713
|
}
|
720
714
|
|
721
715
|
| reswords
|
722
|
-
{
|
723
|
-
(sym, _line), = val
|
724
|
-
lexer.lex_state = EXPR_END
|
725
|
-
result = sym
|
726
|
-
}
|
727
|
-
|
728
|
-
fsym: fname | symbol
|
729
716
|
|
730
|
-
fitem:
|
717
|
+
fitem: fname
|
731
718
|
{
|
732
|
-
id, = val
|
733
|
-
|
719
|
+
(id, line), = val
|
720
|
+
|
721
|
+
result = s(:lit, id.to_sym).line line
|
734
722
|
}
|
735
|
-
|
|
723
|
+
| symbol
|
736
724
|
|
737
725
|
undef_list: fitem
|
738
726
|
{
|
@@ -753,10 +741,6 @@ rule
|
|
753
741
|
| tNEQ | tLSHFT | tRSHFT | tPLUS | tMINUS | tSTAR2
|
754
742
|
| tSTAR | tDIVIDE | tPERCENT | tPOW | tDSTAR | tBANG | tTILDE
|
755
743
|
| tUPLUS | tUMINUS | tAREF | tASET | tBACK_REF2
|
756
|
-
#if V >= 20
|
757
|
-
# TODO: tUBANG dead?
|
758
|
-
| tUBANG
|
759
|
-
#endif
|
760
744
|
|
761
745
|
reswords: k__LINE__ | k__FILE__ | k__ENCODING__ | klBEGIN | klEND
|
762
746
|
| kALIAS | kAND | kBEGIN | kBREAK | kCASE
|
@@ -790,24 +774,20 @@ rule
|
|
790
774
|
}
|
791
775
|
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
|
792
776
|
{
|
793
|
-
lhs, _, id, op, rhs = val
|
777
|
+
lhs, _, (id, _line), (op, _), rhs = val
|
794
778
|
|
795
779
|
result = s(:op_asgn, lhs, rhs, id.to_sym, op.to_sym).line lhs.line
|
796
780
|
}
|
797
781
|
| primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
|
798
782
|
{
|
799
|
-
lhs1, _, lhs2, op, rhs = val
|
783
|
+
lhs1, _, (lhs2, _line), op, rhs = val
|
800
784
|
|
801
785
|
lhs = s(:colon2, lhs1, lhs2.to_sym).line lhs1.line
|
802
786
|
result = new_const_op_asgn [lhs, op, rhs]
|
803
787
|
}
|
804
|
-
| tCOLON3 tCONSTANT
|
805
|
-
{
|
806
|
-
result = self.lexer.lineno
|
807
|
-
}
|
808
|
-
tOP_ASGN arg_rhs
|
788
|
+
| tCOLON3 tCONSTANT tOP_ASGN arg_rhs
|
809
789
|
{
|
810
|
-
_, lhs, line, op, rhs = val
|
790
|
+
_, (lhs, line), op, rhs = val
|
811
791
|
|
812
792
|
lhs = s(:colon3, lhs.to_sym).line line
|
813
793
|
result = new_const_op_asgn [lhs, op, rhs]
|
@@ -821,7 +801,7 @@ rule
|
|
821
801
|
| arg tDOT2 arg
|
822
802
|
{
|
823
803
|
v1, v2 = val[0], val[2]
|
824
|
-
if v1.
|
804
|
+
if v1.sexp_type == :lit and v2.sexp_type == :lit and Integer === v1.last and Integer === v2.last then
|
825
805
|
result = s(:lit, (v1.last)..(v2.last)).line v1.line
|
826
806
|
else
|
827
807
|
result = s(:dot2, v1, v2).line v1.line
|
@@ -830,13 +810,12 @@ rule
|
|
830
810
|
| arg tDOT3 arg
|
831
811
|
{
|
832
812
|
v1, v2 = val[0], val[2]
|
833
|
-
if v1.
|
813
|
+
if v1.sexp_type == :lit and v2.sexp_type == :lit and Integer === v1.last and Integer === v2.last then
|
834
814
|
result = s(:lit, (v1.last)...(v2.last)).line v1.line
|
835
815
|
else
|
836
816
|
result = s(:dot3, v1, v2).line v1.line
|
837
817
|
end
|
838
818
|
}
|
839
|
-
#if V >= 26
|
840
819
|
| arg tDOT2
|
841
820
|
{
|
842
821
|
v1, _ = val
|
@@ -851,7 +830,8 @@ rule
|
|
851
830
|
|
852
831
|
result = s(:dot3, v1, v2).line v1.line
|
853
832
|
}
|
854
|
-
|
833
|
+
|
834
|
+
|
855
835
|
| arg tPLUS arg
|
856
836
|
{
|
857
837
|
result = new_call val[0], :+, argl(val[2])
|
@@ -876,24 +856,12 @@ rule
|
|
876
856
|
{
|
877
857
|
result = new_call val[0], :**, argl(val[2])
|
878
858
|
}
|
879
|
-
#if V == 20
|
880
|
-
| tUMINUS_NUM tINTEGER tPOW arg
|
881
|
-
{
|
882
|
-
lit = s(:lit, val[1]).line lexer.lineno
|
883
|
-
result = new_call(new_call(lit, :"**", argl(val[3])), :"-@")
|
884
|
-
}
|
885
|
-
| tUMINUS_NUM tFLOAT tPOW arg
|
886
|
-
#else
|
887
859
|
| tUMINUS_NUM simple_numeric tPOW arg
|
888
|
-
#endif
|
889
860
|
{
|
890
|
-
|
891
|
-
|
861
|
+
_, (num, line), _, arg = val
|
862
|
+
lit = s(:lit, num).line line
|
863
|
+
result = new_call(new_call(lit, :"**", argl(arg)), :"-@")
|
892
864
|
|
893
|
-
#if V == 20
|
894
|
-
## TODO: why is this 2.0 only?
|
895
|
-
debug20 12, val, result
|
896
|
-
#endif
|
897
865
|
}
|
898
866
|
| tUPLUS arg
|
899
867
|
{
|
@@ -991,12 +959,12 @@ rule
|
|
991
959
|
|
992
960
|
rel_expr: arg relop arg =tGT
|
993
961
|
{
|
994
|
-
lhs, op, rhs = val
|
962
|
+
lhs, (op, _), rhs = val
|
995
963
|
result = new_call lhs, op.to_sym, argl(rhs)
|
996
964
|
}
|
997
965
|
| rel_expr relop arg =tGT
|
998
966
|
{
|
999
|
-
lhs, op, rhs = val
|
967
|
+
lhs, (op, _), rhs = val
|
1000
968
|
warn "comparison '%s' after comparison", op
|
1001
969
|
result = new_call lhs, op.to_sym, argl(rhs)
|
1002
970
|
}
|
@@ -1078,12 +1046,39 @@ rule
|
|
1078
1046
|
}
|
1079
1047
|
|
1080
1048
|
command_args: {
|
1081
|
-
|
1049
|
+
# parse26.y line 2200
|
1050
|
+
|
1051
|
+
# If call_args starts with a open paren '(' or
|
1052
|
+
# '[', look-ahead reading of the letters calls
|
1053
|
+
# CMDARG_PUSH(0), but the push must be done
|
1054
|
+
# after CMDARG_PUSH(1). So this code makes them
|
1055
|
+
# consistent by first cancelling the premature
|
1056
|
+
# CMDARG_PUSH(0), doing CMDARG_PUSH(1), and
|
1057
|
+
# finally redoing CMDARG_PUSH(0).
|
1058
|
+
|
1059
|
+
result = yychar = self.last_token_type.first
|
1060
|
+
lookahead = [:tLPAREN, :tLPAREN_ARG, :tLPAREN2, :tLBRACK, :tLBRACK2].include?(yychar)
|
1061
|
+
lexer.cmdarg.pop if lookahead
|
1062
|
+
lexer.cmdarg.push true
|
1063
|
+
lexer.cmdarg.push false if lookahead
|
1082
1064
|
}
|
1083
1065
|
call_args
|
1084
1066
|
{
|
1085
|
-
|
1086
|
-
|
1067
|
+
yychar, args = val
|
1068
|
+
|
1069
|
+
# call_args can be followed by tLBRACE_ARG (that
|
1070
|
+
# does CMDARG_PUSH(0) in the lexer) but the push
|
1071
|
+
# must be done after CMDARG_POP() in the parser.
|
1072
|
+
# So this code does CMDARG_POP() to pop 0 pushed
|
1073
|
+
# by tLBRACE_ARG, CMDARG_POP() to pop 1 pushed
|
1074
|
+
# by command_args, and CMDARG_PUSH(0) to restore
|
1075
|
+
# back the flag set by tLBRACE_ARG.
|
1076
|
+
|
1077
|
+
lookahead = [:tLBRACE_ARG].include?(yychar)
|
1078
|
+
lexer.cmdarg.pop if lookahead
|
1079
|
+
lexer.cmdarg.pop
|
1080
|
+
lexer.cmdarg.push false if lookahead
|
1081
|
+
result = args
|
1087
1082
|
}
|
1088
1083
|
|
1089
1084
|
block_arg: tAMPER arg_value
|
@@ -1101,8 +1096,9 @@ rule
|
|
1101
1096
|
args: arg_value
|
1102
1097
|
{
|
1103
1098
|
arg, = val
|
1099
|
+
lineno = arg.line || lexer.lineno # HACK
|
1104
1100
|
|
1105
|
-
result = s(:array, arg).line
|
1101
|
+
result = s(:array, arg).line lineno
|
1106
1102
|
}
|
1107
1103
|
| tSTAR arg_value
|
1108
1104
|
{
|
@@ -1114,13 +1110,14 @@ rule
|
|
1114
1110
|
args, _, id = val
|
1115
1111
|
result = self.list_append args, id
|
1116
1112
|
}
|
1117
|
-
| args tCOMMA tSTAR
|
1113
|
+
| args tCOMMA tSTAR arg_value
|
1118
1114
|
{
|
1119
|
-
|
1115
|
+
# TODO: the line number from tSTAR has been dropped
|
1116
|
+
args, _, _, id = val
|
1117
|
+
line = lexer.lineno
|
1120
1118
|
result = self.list_append args, s(:splat, id).line(line)
|
1121
1119
|
}
|
1122
1120
|
|
1123
|
-
#if V >= 21
|
1124
1121
|
mrhs_arg: mrhs
|
1125
1122
|
{
|
1126
1123
|
result = new_masgn_arg val[0]
|
@@ -1130,14 +1127,12 @@ rule
|
|
1130
1127
|
result = new_masgn_arg val[0], :wrap
|
1131
1128
|
}
|
1132
1129
|
|
1133
|
-
#endif
|
1134
1130
|
mrhs: args tCOMMA arg_value
|
1135
1131
|
{
|
1136
1132
|
result = val[0] << val[2]
|
1137
1133
|
}
|
1138
1134
|
| args tCOMMA tSTAR arg_value
|
1139
1135
|
{
|
1140
|
-
# FIX: bad shift/reduce conflict with rhs' comma star prod
|
1141
1136
|
# TODO: make all tXXXX terminals include lexer.lineno
|
1142
1137
|
arg, _, _, splat = val
|
1143
1138
|
result = self.arg_concat arg, splat
|
@@ -1160,26 +1155,19 @@ rule
|
|
1160
1155
|
| backref
|
1161
1156
|
| tFID
|
1162
1157
|
{
|
1163
|
-
msg, = val
|
1158
|
+
(msg, line), = val
|
1164
1159
|
result = new_call nil, msg.to_sym
|
1160
|
+
result.line line
|
1165
1161
|
}
|
1166
1162
|
| k_begin
|
1167
1163
|
{
|
1164
|
+
lexer.cmdarg.push false
|
1168
1165
|
result = self.lexer.lineno
|
1169
|
-
# TODO:
|
1170
|
-
# $<val>1 = cmdarg_stack;
|
1171
|
-
# CMDARG_SET(0);
|
1172
1166
|
}
|
1173
1167
|
bodystmt k_end
|
1174
1168
|
{
|
1175
|
-
|
1176
|
-
|
1177
|
-
result = s(:nil)
|
1178
|
-
else
|
1179
|
-
result = s(:begin, val[2])
|
1180
|
-
end
|
1181
|
-
|
1182
|
-
result.line = val[1]
|
1169
|
+
lexer.cmdarg.pop
|
1170
|
+
result = new_begin val
|
1183
1171
|
}
|
1184
1172
|
| tLPAREN_ARG
|
1185
1173
|
{
|
@@ -1192,18 +1180,14 @@ rule
|
|
1192
1180
|
result = s(:begin).line line
|
1193
1181
|
}
|
1194
1182
|
| tLPAREN_ARG
|
1195
|
-
{
|
1196
|
-
result = lexer.cmdarg.store false
|
1197
|
-
}
|
1198
1183
|
stmt
|
1199
1184
|
{
|
1200
1185
|
lexer.lex_state = EXPR_ENDARG
|
1201
1186
|
}
|
1202
1187
|
rparen
|
1203
1188
|
{
|
1204
|
-
_,
|
1205
|
-
warning "(...) interpreted as grouped expression"
|
1206
|
-
lexer.cmdarg.restore cmdarg
|
1189
|
+
_, stmt, _, _, = val
|
1190
|
+
# warning "(...) interpreted as grouped expression"
|
1207
1191
|
result = stmt
|
1208
1192
|
}
|
1209
1193
|
| tLPAREN compstmt tRPAREN
|
@@ -1215,15 +1199,15 @@ rule
|
|
1215
1199
|
}
|
1216
1200
|
| primary_value tCOLON2 tCONSTANT
|
1217
1201
|
{
|
1218
|
-
expr, _, id = val
|
1202
|
+
expr, _, (id, _line) = val
|
1219
1203
|
|
1220
1204
|
result = s(:colon2, expr, id.to_sym).line expr.line
|
1221
1205
|
}
|
1222
1206
|
| tCOLON3 tCONSTANT
|
1223
1207
|
{
|
1224
|
-
_, id = val
|
1208
|
+
_, (id, line) = val
|
1225
1209
|
|
1226
|
-
result = s(:colon3, id.to_sym).line
|
1210
|
+
result = s(:colon3, id.to_sym).line line
|
1227
1211
|
}
|
1228
1212
|
| tLBRACK { result = lexer.lineno } aref_args tRBRACK
|
1229
1213
|
{
|
@@ -1247,15 +1231,21 @@ rule
|
|
1247
1231
|
}
|
1248
1232
|
| kYIELD tLPAREN2 call_args rparen
|
1249
1233
|
{
|
1250
|
-
|
1234
|
+
(_, line), _, args, _ = val
|
1235
|
+
|
1236
|
+
result = new_yield(args).line line
|
1251
1237
|
}
|
1252
1238
|
| kYIELD tLPAREN2 rparen
|
1253
1239
|
{
|
1254
|
-
|
1240
|
+
(_, line), _, _ = val
|
1241
|
+
|
1242
|
+
result = new_yield.line line
|
1255
1243
|
}
|
1256
1244
|
| kYIELD
|
1257
1245
|
{
|
1258
|
-
|
1246
|
+
(_, line), = val
|
1247
|
+
|
1248
|
+
result = new_yield.line line
|
1259
1249
|
}
|
1260
1250
|
| kDEFINED opt_nl tLPAREN2 expr rparen
|
1261
1251
|
{
|
@@ -1270,7 +1260,7 @@ rule
|
|
1270
1260
|
}
|
1271
1261
|
| kNOT tLPAREN2 rparen
|
1272
1262
|
{
|
1273
|
-
|
1263
|
+
debug 20
|
1274
1264
|
}
|
1275
1265
|
| fcall brace_block
|
1276
1266
|
{
|
@@ -1288,9 +1278,10 @@ rule
|
|
1288
1278
|
iter.insert 1, call # FIX
|
1289
1279
|
result = iter
|
1290
1280
|
}
|
1291
|
-
|
|
1281
|
+
| lambda
|
1292
1282
|
{
|
1293
|
-
|
1283
|
+
expr, = val
|
1284
|
+
result = expr
|
1294
1285
|
}
|
1295
1286
|
| k_if expr_value then compstmt if_tail k_end
|
1296
1287
|
{
|
@@ -1333,7 +1324,6 @@ rule
|
|
1333
1324
|
}
|
1334
1325
|
cpath superclass
|
1335
1326
|
{
|
1336
|
-
self.comments.push self.lexer.comments
|
1337
1327
|
if (self.in_def || self.in_single > 0) then
|
1338
1328
|
yyerror "class definition in method body"
|
1339
1329
|
end
|
@@ -1343,7 +1333,7 @@ rule
|
|
1343
1333
|
{
|
1344
1334
|
result = new_class val
|
1345
1335
|
self.env.unextend
|
1346
|
-
self.lexer.
|
1336
|
+
self.lexer.ignore_body_comments
|
1347
1337
|
}
|
1348
1338
|
| k_class tLSHFT
|
1349
1339
|
{
|
@@ -1364,7 +1354,7 @@ rule
|
|
1364
1354
|
{
|
1365
1355
|
result = new_sclass val
|
1366
1356
|
self.env.unextend
|
1367
|
-
self.lexer.
|
1357
|
+
self.lexer.ignore_body_comments
|
1368
1358
|
}
|
1369
1359
|
| k_module
|
1370
1360
|
{
|
@@ -1372,7 +1362,6 @@ rule
|
|
1372
1362
|
}
|
1373
1363
|
cpath
|
1374
1364
|
{
|
1375
|
-
self.comments.push self.lexer.comments
|
1376
1365
|
yyerror "module definition in method body" if
|
1377
1366
|
self.in_def or self.in_single > 0
|
1378
1367
|
|
@@ -1382,53 +1371,67 @@ rule
|
|
1382
1371
|
{
|
1383
1372
|
result = new_module val
|
1384
1373
|
self.env.unextend
|
1385
|
-
self.lexer.
|
1374
|
+
self.lexer.ignore_body_comments
|
1386
1375
|
}
|
1387
1376
|
| k_def fname
|
1388
1377
|
{
|
1389
|
-
result =
|
1378
|
+
result = self.in_def
|
1390
1379
|
|
1391
|
-
self.
|
1392
|
-
self.in_def = true
|
1380
|
+
self.in_def = true # group = local_push
|
1393
1381
|
self.env.extend
|
1394
|
-
|
1395
|
-
|
1396
|
-
lexer.cmdarg.stack.replace [false]
|
1382
|
+
lexer.cmdarg.push false
|
1383
|
+
lexer.cond.push false
|
1397
1384
|
}
|
1398
|
-
f_arglist bodystmt
|
1385
|
+
f_arglist bodystmt k_end
|
1399
1386
|
{
|
1400
|
-
|
1387
|
+
result, in_def = new_defn val
|
1401
1388
|
|
1402
|
-
|
1403
|
-
|
1404
|
-
lexer.cmdarg.stack.replace cmdarg
|
1389
|
+
lexer.cond.pop # group = local_pop
|
1390
|
+
lexer.cmdarg.pop
|
1405
1391
|
self.env.unextend
|
1406
1392
|
self.in_def = in_def
|
1407
|
-
|
1393
|
+
|
1394
|
+
self.lexer.ignore_body_comments
|
1408
1395
|
}
|
1409
1396
|
| k_def singleton dot_or_colon
|
1410
1397
|
{
|
1411
|
-
self.comments.push self.lexer.comments
|
1412
1398
|
lexer.lex_state = EXPR_FNAME
|
1413
1399
|
}
|
1414
1400
|
fname
|
1415
1401
|
{
|
1416
|
-
self.
|
1402
|
+
result = self.in_def
|
1403
|
+
|
1404
|
+
self.in_single += 1 # TODO: remove?
|
1405
|
+
|
1406
|
+
self.in_def = true # local_push
|
1417
1407
|
self.env.extend
|
1418
|
-
lexer.
|
1419
|
-
|
1420
|
-
|
1408
|
+
lexer.cmdarg.push false
|
1409
|
+
lexer.cond.push false
|
1410
|
+
|
1411
|
+
lexer.lex_state = EXPR_ENDFN|EXPR_LABEL
|
1421
1412
|
}
|
1422
1413
|
f_arglist bodystmt k_end
|
1423
1414
|
{
|
1424
|
-
_, cmdarg = val[5]
|
1425
|
-
result = new_defs val
|
1426
1415
|
|
1427
|
-
|
1416
|
+
# [kdef, recv, _, _, (name, line), in_def, args, body, kend]
|
1417
|
+
# =>
|
1418
|
+
# [kdef, recv, (name, line), in_def, args, body, kend]
|
1419
|
+
|
1420
|
+
val.delete_at 3
|
1421
|
+
val.delete_at 2
|
1428
1422
|
|
1423
|
+
result, in_def = new_defs val
|
1424
|
+
|
1425
|
+
lexer.cond.pop # group = local_pop
|
1426
|
+
lexer.cmdarg.pop
|
1429
1427
|
self.env.unextend
|
1428
|
+
self.in_def = in_def
|
1429
|
+
|
1430
1430
|
self.in_single -= 1
|
1431
|
-
|
1431
|
+
|
1432
|
+
# TODO: restore cur_arg ? what's cur_arg?
|
1433
|
+
|
1434
|
+
self.lexer.ignore_body_comments
|
1432
1435
|
}
|
1433
1436
|
| kBREAK
|
1434
1437
|
{
|
@@ -1465,8 +1468,17 @@ rule
|
|
1465
1468
|
k_case: kCASE
|
1466
1469
|
k_for: kFOR
|
1467
1470
|
k_class: kCLASS
|
1471
|
+
{
|
1472
|
+
self.comments.push self.lexer.comments
|
1473
|
+
}
|
1468
1474
|
k_module: kMODULE
|
1475
|
+
{
|
1476
|
+
self.comments.push self.lexer.comments
|
1477
|
+
}
|
1469
1478
|
k_def: kDEF
|
1479
|
+
{
|
1480
|
+
self.comments.push self.lexer.comments
|
1481
|
+
}
|
1470
1482
|
k_do: kDO
|
1471
1483
|
k_do_block: kDO_BLOCK
|
1472
1484
|
k_rescue: kRESCUE
|
@@ -1527,51 +1539,42 @@ rule
|
|
1527
1539
|
|
1528
1540
|
result = block_var args
|
1529
1541
|
}
|
1530
|
-
| f_marg_list tCOMMA
|
1542
|
+
| f_marg_list tCOMMA f_rest_marg
|
1531
1543
|
{
|
1532
|
-
args, _,
|
1544
|
+
args, _, rest = val
|
1533
1545
|
|
1534
|
-
result = block_var args,
|
1546
|
+
result = block_var args, rest
|
1535
1547
|
}
|
1536
|
-
| f_marg_list tCOMMA
|
1548
|
+
| f_marg_list tCOMMA f_rest_marg tCOMMA f_marg_list
|
1537
1549
|
{
|
1538
|
-
|
1550
|
+
lhs, _, splat, _, rhs = val
|
1539
1551
|
|
1540
|
-
result = block_var
|
1552
|
+
result = block_var lhs, splat, rhs
|
1541
1553
|
}
|
1542
|
-
|
|
1554
|
+
| f_rest_marg
|
1543
1555
|
{
|
1544
|
-
|
1556
|
+
rest, = val
|
1545
1557
|
|
1546
|
-
result = block_var
|
1558
|
+
result = block_var rest
|
1547
1559
|
}
|
1548
|
-
|
|
1560
|
+
| f_rest_marg tCOMMA f_marg_list
|
1549
1561
|
{
|
1550
|
-
|
1562
|
+
splat, _, rest = val
|
1551
1563
|
|
1552
|
-
result = block_var
|
1564
|
+
result = block_var splat, rest
|
1553
1565
|
}
|
1554
|
-
| tSTAR f_norm_arg
|
1555
|
-
{
|
1556
|
-
_, splat = val
|
1557
1566
|
|
1558
|
-
|
1559
|
-
}
|
1560
|
-
| tSTAR f_norm_arg tCOMMA f_marg_list
|
1567
|
+
f_rest_marg: tSTAR f_norm_arg
|
1561
1568
|
{
|
1562
|
-
_,
|
1569
|
+
_, (id, line) = val
|
1563
1570
|
|
1564
|
-
result =
|
1571
|
+
result = args ["*#{id}".to_sym]
|
1572
|
+
result.line line
|
1565
1573
|
}
|
1566
1574
|
| tSTAR
|
1567
1575
|
{
|
1568
|
-
result =
|
1569
|
-
|
1570
|
-
| tSTAR tCOMMA f_marg_list
|
1571
|
-
{
|
1572
|
-
_, _, args = val
|
1573
|
-
|
1574
|
-
result = block_var :*, args
|
1576
|
+
result = args [:*]
|
1577
|
+
result.line lexer.lineno # FIX: tSTAR -> line
|
1575
1578
|
}
|
1576
1579
|
|
1577
1580
|
block_args_tail: f_block_kwarg tCOMMA f_kwrest opt_f_block_arg
|
@@ -1588,8 +1591,8 @@ rule
|
|
1588
1591
|
}
|
1589
1592
|
| f_block_arg
|
1590
1593
|
{
|
1591
|
-
line =
|
1592
|
-
result = call_args
|
1594
|
+
(id, line), = val
|
1595
|
+
result = call_args [id]
|
1593
1596
|
result.line line
|
1594
1597
|
}
|
1595
1598
|
|
@@ -1698,13 +1701,13 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1698
1701
|
|
1699
1702
|
bvar: tIDENTIFIER
|
1700
1703
|
{
|
1701
|
-
id, = val
|
1702
|
-
line = lexer.lineno
|
1704
|
+
(id, line), = val
|
1703
1705
|
result = s(:shadow, id.to_sym).line line
|
1704
1706
|
}
|
1705
1707
|
| f_bad_arg
|
1706
1708
|
|
1707
|
-
lambda:
|
1709
|
+
lambda: tLAMBDA
|
1710
|
+
{
|
1708
1711
|
self.env.extend :dynamic
|
1709
1712
|
result = [lexer.lineno, lexer.lpar_beg]
|
1710
1713
|
lexer.paren_nest += 1
|
@@ -1712,20 +1715,19 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1712
1715
|
}
|
1713
1716
|
f_larglist
|
1714
1717
|
{
|
1715
|
-
|
1718
|
+
lexer.cmdarg.push false
|
1716
1719
|
}
|
1717
1720
|
lambda_body
|
1718
1721
|
{
|
1719
|
-
(line, lpar), args,
|
1722
|
+
_, (line, lpar), args, _cmdarg, body = val
|
1720
1723
|
lexer.lpar_beg = lpar
|
1721
1724
|
|
1722
|
-
lexer.cmdarg.
|
1723
|
-
lexer.cmdarg.lexpop
|
1725
|
+
lexer.cmdarg.pop
|
1724
1726
|
|
1725
1727
|
call = s(:lambda).line line
|
1726
1728
|
result = new_iter call, args, body
|
1727
|
-
result.line
|
1728
|
-
self.env.unextend
|
1729
|
+
result.line line
|
1730
|
+
self.env.unextend # TODO: dynapush & dynapop
|
1729
1731
|
}
|
1730
1732
|
|
1731
1733
|
f_larglist: tLPAREN2 f_args opt_bv_decl rparen
|
@@ -1759,23 +1761,28 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1759
1761
|
## if (nd_type($1) == NODE_YIELD) {
|
1760
1762
|
## compile_error(PARSER_ARG "block given to yield");
|
1761
1763
|
|
1762
|
-
|
1763
|
-
val[0].block_pass?
|
1764
|
+
cmd, blk = val
|
1764
1765
|
|
1765
|
-
|
1766
|
+
syntax_error "Both block arg and actual block given." if
|
1767
|
+
cmd.block_pass?
|
1766
1768
|
|
1767
|
-
|
1769
|
+
if inverted? val then
|
1770
|
+
val = invert_block_call val
|
1771
|
+
cmd, blk = val
|
1772
|
+
end
|
1768
1773
|
|
1769
1774
|
result = blk
|
1770
1775
|
result.insert 1, cmd
|
1771
1776
|
}
|
1772
1777
|
| block_call call_op2 operation2 opt_paren_args
|
1773
1778
|
{
|
1774
|
-
|
1779
|
+
lhs, _, (id, _line), args = val
|
1780
|
+
|
1781
|
+
result = new_call lhs, id.to_sym, args
|
1775
1782
|
}
|
1776
1783
|
| block_call call_op2 operation2 opt_paren_args brace_block
|
1777
1784
|
{
|
1778
|
-
iter1, _, name, args, iter2 = val
|
1785
|
+
iter1, _, (name, _line), args, iter2 = val
|
1779
1786
|
|
1780
1787
|
call = new_call iter1, name.to_sym, args
|
1781
1788
|
iter2.insert 1, call
|
@@ -1784,7 +1791,7 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1784
1791
|
}
|
1785
1792
|
| block_call call_op2 operation2 command_args do_block
|
1786
1793
|
{
|
1787
|
-
iter1, _, name, args, iter2 = val
|
1794
|
+
iter1, _, (name, _line), args, iter2 = val
|
1788
1795
|
|
1789
1796
|
call = new_call iter1, name.to_sym, args
|
1790
1797
|
iter2.insert 1, call
|
@@ -1792,28 +1799,29 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1792
1799
|
result = iter2
|
1793
1800
|
}
|
1794
1801
|
|
1795
|
-
method_call: fcall
|
1802
|
+
method_call: fcall paren_args
|
1796
1803
|
{
|
1797
|
-
|
1798
|
-
}
|
1799
|
-
paren_args
|
1800
|
-
{
|
1801
|
-
call, lineno, args = val
|
1804
|
+
call, args = val
|
1802
1805
|
|
1803
1806
|
result = call.concat args.sexp_body if args
|
1804
|
-
result.line lineno
|
1805
1807
|
}
|
1806
1808
|
| primary_value call_op operation2 opt_paren_args
|
1807
1809
|
{
|
1808
|
-
|
1810
|
+
recv, call_op, (op, _line), args = val
|
1811
|
+
|
1812
|
+
result = new_call recv, op.to_sym, args, call_op
|
1809
1813
|
}
|
1810
1814
|
| primary_value tCOLON2 operation2 paren_args
|
1811
1815
|
{
|
1812
|
-
|
1816
|
+
recv, _, (op, _line), args = val
|
1817
|
+
|
1818
|
+
result = new_call recv, op.to_sym, args
|
1813
1819
|
}
|
1814
1820
|
| primary_value tCOLON2 operation3
|
1815
1821
|
{
|
1816
|
-
|
1822
|
+
lhs, _, (id, _line) = val
|
1823
|
+
|
1824
|
+
result = new_call lhs, id.to_sym
|
1817
1825
|
}
|
1818
1826
|
| primary_value call_op paren_args
|
1819
1827
|
{
|
@@ -1846,7 +1854,7 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1846
1854
|
_, line, body, _ = val
|
1847
1855
|
|
1848
1856
|
result = body
|
1849
|
-
result.line
|
1857
|
+
result.line line
|
1850
1858
|
|
1851
1859
|
self.env.unextend
|
1852
1860
|
}
|
@@ -1860,7 +1868,7 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1860
1868
|
_, line, body, _ = val
|
1861
1869
|
|
1862
1870
|
result = body
|
1863
|
-
result.line
|
1871
|
+
result.line line
|
1864
1872
|
|
1865
1873
|
self.env.unextend
|
1866
1874
|
}
|
@@ -1878,29 +1886,50 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1878
1886
|
}
|
1879
1887
|
|
1880
1888
|
do_body: { self.env.extend :dynamic; result = self.lexer.lineno }
|
1881
|
-
{
|
1889
|
+
{ lexer.cmdarg.push false }
|
1882
1890
|
opt_block_param
|
1883
|
-
#if V >= 25
|
1884
1891
|
bodystmt
|
1885
|
-
#else
|
1886
|
-
compstmt
|
1887
|
-
#endif
|
1888
1892
|
{
|
1889
|
-
line,
|
1893
|
+
line, _cmdarg, param, cmpstmt = val
|
1890
1894
|
|
1891
1895
|
result = new_do_body param, cmpstmt, line
|
1896
|
+
lexer.cmdarg.pop
|
1892
1897
|
self.env.unextend
|
1893
|
-
|
1898
|
+
}
|
1899
|
+
|
1900
|
+
case_args: arg_value
|
1901
|
+
{
|
1902
|
+
arg, = val
|
1903
|
+
|
1904
|
+
result = s(:array, arg).line arg.line
|
1905
|
+
}
|
1906
|
+
| tSTAR arg_value
|
1907
|
+
{
|
1908
|
+
_, arg = val
|
1909
|
+
|
1910
|
+
result = s(:array, s(:splat, arg).line(arg.line)).line arg.line
|
1911
|
+
}
|
1912
|
+
| case_args tCOMMA arg_value
|
1913
|
+
{
|
1914
|
+
args, _, id = val
|
1915
|
+
|
1916
|
+
result = self.list_append args, id
|
1917
|
+
}
|
1918
|
+
| case_args tCOMMA tSTAR arg_value
|
1919
|
+
{
|
1920
|
+
args, _, _, id = val
|
1921
|
+
|
1922
|
+
result = self.list_append args, s(:splat, id).line(id.line)
|
1894
1923
|
}
|
1895
1924
|
|
1896
1925
|
case_body: k_when
|
1897
1926
|
{
|
1898
1927
|
result = self.lexer.lineno
|
1899
1928
|
}
|
1900
|
-
|
1929
|
+
case_args then compstmt cases
|
1901
1930
|
{
|
1902
1931
|
result = new_when(val[2], val[4])
|
1903
|
-
result.line
|
1932
|
+
result.line val[1]
|
1904
1933
|
result << val[5] if val[5]
|
1905
1934
|
}
|
1906
1935
|
|
@@ -1946,17 +1975,10 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1946
1975
|
|
1947
1976
|
literal: numeric
|
1948
1977
|
{
|
1949
|
-
line =
|
1950
|
-
result = s(:lit,
|
1951
|
-
result.line = line
|
1978
|
+
(lit, line), = val
|
1979
|
+
result = s(:lit, lit).line line
|
1952
1980
|
}
|
1953
1981
|
| symbol
|
1954
|
-
{
|
1955
|
-
line = lexer.lineno
|
1956
|
-
result = s(:lit, val[0])
|
1957
|
-
result.line = line
|
1958
|
-
}
|
1959
|
-
| dsym
|
1960
1982
|
|
1961
1983
|
strings: string
|
1962
1984
|
{
|
@@ -1967,7 +1989,7 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1967
1989
|
|
1968
1990
|
string: tCHAR
|
1969
1991
|
{
|
1970
|
-
|
1992
|
+
debug 37
|
1971
1993
|
}
|
1972
1994
|
| string1
|
1973
1995
|
| string string1
|
@@ -1977,11 +1999,11 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1977
1999
|
|
1978
2000
|
string1: tSTRING_BEG string_contents tSTRING_END
|
1979
2001
|
{
|
1980
|
-
_, str, (_, func) = val
|
2002
|
+
(_, line), str, (_, func) = val
|
1981
2003
|
|
1982
|
-
str = dedent str if func =~ RubyLexer::
|
2004
|
+
str = dedent str if func =~ RubyLexer::STR_FUNC_DEDENT
|
1983
2005
|
|
1984
|
-
result = str
|
2006
|
+
result = str.line line
|
1985
2007
|
}
|
1986
2008
|
| tSTRING
|
1987
2009
|
{
|
@@ -1990,7 +2012,7 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1990
2012
|
|
1991
2013
|
xstring: tXSTRING_BEG xstring_contents tSTRING_END
|
1992
2014
|
{
|
1993
|
-
result = new_xstring val
|
2015
|
+
result = new_xstring val
|
1994
2016
|
# TODO: dedent?!?! SERIOUSLY?!?
|
1995
2017
|
}
|
1996
2018
|
|
@@ -2001,11 +2023,15 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
2001
2023
|
|
2002
2024
|
words: tWORDS_BEG tSPACE tSTRING_END
|
2003
2025
|
{
|
2004
|
-
|
2026
|
+
(_, line), _, _ = val
|
2027
|
+
|
2028
|
+
result = s(:array).line line
|
2005
2029
|
}
|
2006
2030
|
| tWORDS_BEG word_list tSTRING_END
|
2007
2031
|
{
|
2008
|
-
|
2032
|
+
(_, line), list, _ = val
|
2033
|
+
|
2034
|
+
result = list.line line
|
2009
2035
|
}
|
2010
2036
|
|
2011
2037
|
word_list: none
|
@@ -2025,18 +2051,20 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
2025
2051
|
|
2026
2052
|
symbols: tSYMBOLS_BEG tSPACE tSTRING_END
|
2027
2053
|
{
|
2028
|
-
|
2054
|
+
(_, line), _, _ = val
|
2055
|
+
|
2056
|
+
result = s(:array).line line
|
2029
2057
|
}
|
2030
|
-
| tSYMBOLS_BEG
|
2058
|
+
| tSYMBOLS_BEG symbol_list tSTRING_END
|
2031
2059
|
{
|
2032
|
-
_, line, list, _, = val
|
2033
|
-
list.line
|
2060
|
+
(_, line), list, _, = val
|
2061
|
+
list.line line
|
2034
2062
|
result = list
|
2035
2063
|
}
|
2036
2064
|
|
2037
2065
|
symbol_list: none
|
2038
2066
|
{
|
2039
|
-
result = new_symbol_list
|
2067
|
+
result = new_symbol_list
|
2040
2068
|
}
|
2041
2069
|
| symbol_list word tSPACE
|
2042
2070
|
{
|
@@ -2046,20 +2074,28 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
2046
2074
|
|
2047
2075
|
qwords: tQWORDS_BEG tSPACE tSTRING_END
|
2048
2076
|
{
|
2049
|
-
|
2077
|
+
(_, line), _, _ = val
|
2078
|
+
|
2079
|
+
result = s(:array).line line
|
2050
2080
|
}
|
2051
2081
|
| tQWORDS_BEG qword_list tSTRING_END
|
2052
2082
|
{
|
2053
|
-
|
2083
|
+
(_, line), list, _ = val
|
2084
|
+
|
2085
|
+
result = list.line line
|
2054
2086
|
}
|
2055
2087
|
|
2056
2088
|
qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
|
2057
2089
|
{
|
2058
|
-
|
2090
|
+
(_, line), _, _ = val
|
2091
|
+
|
2092
|
+
result = s(:array).line line
|
2059
2093
|
}
|
2060
2094
|
| tQSYMBOLS_BEG qsym_list tSTRING_END
|
2061
2095
|
{
|
2062
|
-
|
2096
|
+
(_, line), list, _ = val
|
2097
|
+
|
2098
|
+
result = list.line line
|
2063
2099
|
}
|
2064
2100
|
|
2065
2101
|
qword_list: none
|
@@ -2082,7 +2118,8 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
2082
2118
|
|
2083
2119
|
string_contents: none
|
2084
2120
|
{
|
2085
|
-
|
2121
|
+
line = prev_value_to_lineno _values.last
|
2122
|
+
result = s(:str, +"").line line
|
2086
2123
|
}
|
2087
2124
|
| string_contents string_content
|
2088
2125
|
{
|
@@ -2132,12 +2169,13 @@ regexp_contents: none
|
|
2132
2169
|
result = [lexer.lex_strterm,
|
2133
2170
|
lexer.brace_nest,
|
2134
2171
|
lexer.string_nest, # TODO: remove
|
2135
|
-
lexer.cond.store,
|
2136
|
-
lexer.cmdarg.store,
|
2137
2172
|
lexer.lex_state,
|
2138
2173
|
lexer.lineno,
|
2139
2174
|
]
|
2140
2175
|
|
2176
|
+
lexer.cmdarg.push false
|
2177
|
+
lexer.cond.push false
|
2178
|
+
|
2141
2179
|
lexer.lex_strterm = nil
|
2142
2180
|
lexer.brace_nest = 0
|
2143
2181
|
lexer.string_nest = 0
|
@@ -2149,14 +2187,15 @@ regexp_contents: none
|
|
2149
2187
|
{
|
2150
2188
|
_, memo, stmt, _ = val
|
2151
2189
|
|
2152
|
-
lex_strterm, brace_nest, string_nest,
|
2190
|
+
lex_strterm, brace_nest, string_nest, oldlex_state, line = memo
|
2191
|
+
# TODO: heredoc_indent
|
2153
2192
|
|
2154
2193
|
lexer.lex_strterm = lex_strterm
|
2155
2194
|
lexer.brace_nest = brace_nest
|
2156
2195
|
lexer.string_nest = string_nest
|
2157
2196
|
|
2158
|
-
lexer.cond.
|
2159
|
-
lexer.cmdarg.
|
2197
|
+
lexer.cond.pop
|
2198
|
+
lexer.cmdarg.pop
|
2160
2199
|
|
2161
2200
|
lexer.lex_state = oldlex_state
|
2162
2201
|
|
@@ -2171,29 +2210,49 @@ regexp_contents: none
|
|
2171
2210
|
when nil then
|
2172
2211
|
result = s(:evstr).line line
|
2173
2212
|
else
|
2174
|
-
|
2213
|
+
debug 38
|
2175
2214
|
raise "unknown string body: #{stmt.inspect}"
|
2176
2215
|
end
|
2177
2216
|
}
|
2178
2217
|
|
2179
|
-
string_dvar: tGVAR
|
2180
|
-
|
2181
|
-
|
2218
|
+
string_dvar: tGVAR
|
2219
|
+
{
|
2220
|
+
(id, line), = val
|
2221
|
+
result = s(:gvar, id.to_sym).line line
|
2222
|
+
}
|
2223
|
+
| tIVAR
|
2224
|
+
{
|
2225
|
+
(id, line), = val
|
2226
|
+
result = s(:ivar, id.to_sym).line line
|
2227
|
+
}
|
2228
|
+
| tCVAR
|
2229
|
+
{
|
2230
|
+
(id, line), = val
|
2231
|
+
result = s(:cvar, id.to_sym).line line
|
2232
|
+
}
|
2182
2233
|
| backref
|
2183
2234
|
|
2184
|
-
symbol:
|
2235
|
+
symbol: ssym
|
2236
|
+
| dsym
|
2237
|
+
|
2238
|
+
ssym: tSYMBEG sym
|
2185
2239
|
{
|
2240
|
+
_, (id, line) = val
|
2241
|
+
|
2186
2242
|
lexer.lex_state = EXPR_END
|
2187
|
-
result =
|
2243
|
+
result = s(:lit, id.to_sym).line line
|
2188
2244
|
}
|
2189
2245
|
| tSYMBOL
|
2190
2246
|
{
|
2191
|
-
|
2247
|
+
(id, line), = val
|
2248
|
+
|
2249
|
+
lexer.lex_state = EXPR_END
|
2250
|
+
result = s(:lit, id.to_sym).line line
|
2192
2251
|
}
|
2193
2252
|
|
2194
2253
|
sym: fname | tIVAR | tGVAR | tCVAR
|
2195
2254
|
|
2196
|
-
dsym: tSYMBEG
|
2255
|
+
dsym: tSYMBEG string_contents tSTRING_END
|
2197
2256
|
{
|
2198
2257
|
_, result, _ = val
|
2199
2258
|
|
@@ -2209,35 +2268,22 @@ regexp_contents: none
|
|
2209
2268
|
when :evstr then
|
2210
2269
|
result = s(:dsym, "", result).line result.line
|
2211
2270
|
else
|
2212
|
-
|
2271
|
+
debug 39
|
2213
2272
|
end
|
2214
2273
|
}
|
2215
2274
|
|
2216
|
-
#if V == 20
|
2217
|
-
numeric: tINTEGER
|
2218
|
-
| tFLOAT
|
2219
|
-
| tUMINUS_NUM tINTEGER =tLOWEST
|
2220
|
-
#else
|
2221
2275
|
numeric: simple_numeric
|
2222
|
-
| tUMINUS_NUM simple_numeric
|
2223
|
-
#endif
|
2276
|
+
| tUMINUS_NUM simple_numeric =tLOWEST
|
2224
2277
|
{
|
2225
|
-
|
2226
|
-
|
2227
|
-
}
|
2228
|
-
| tUMINUS_NUM tFLOAT =tLOWEST
|
2229
|
-
{
|
2230
|
-
result = -val[1] # TODO: pt_testcase
|
2231
|
-
#endif
|
2278
|
+
_, (num, line) = val
|
2279
|
+
result = [-num, line]
|
2232
2280
|
}
|
2233
2281
|
|
2234
|
-
#if V >= 21
|
2235
2282
|
simple_numeric: tINTEGER
|
2236
2283
|
| tFLOAT
|
2237
2284
|
| tRATIONAL
|
2238
2285
|
| tIMAGINARY
|
2239
2286
|
|
2240
|
-
#endif
|
2241
2287
|
user_variable: tIDENTIFIER
|
2242
2288
|
| tIVAR
|
2243
2289
|
| tGVAR
|
@@ -2263,8 +2309,10 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2263
2309
|
|
2264
2310
|
var_ref: user_variable
|
2265
2311
|
{
|
2266
|
-
|
2312
|
+
raise "NO: #{val.inspect}" if Sexp === val.first
|
2313
|
+
(var, line), = val
|
2267
2314
|
result = Sexp === var ? var : self.gettable(var)
|
2315
|
+
result.line line
|
2268
2316
|
}
|
2269
2317
|
| keyword_variable
|
2270
2318
|
{
|
@@ -2279,11 +2327,19 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2279
2327
|
| keyword_variable
|
2280
2328
|
{
|
2281
2329
|
result = self.assignable val[0]
|
2282
|
-
|
2330
|
+
debug 40
|
2283
2331
|
}
|
2284
2332
|
|
2285
|
-
backref: tNTH_REF
|
2286
|
-
|
2333
|
+
backref: tNTH_REF
|
2334
|
+
{
|
2335
|
+
(ref, line), = val
|
2336
|
+
result = s(:nth_ref, ref).line line
|
2337
|
+
}
|
2338
|
+
| tBACK_REF
|
2339
|
+
{
|
2340
|
+
(ref, line), = val
|
2341
|
+
result = s(:back_ref, ref).line line
|
2342
|
+
}
|
2287
2343
|
|
2288
2344
|
superclass: tLT
|
2289
2345
|
{
|
@@ -2301,9 +2357,7 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2301
2357
|
|
2302
2358
|
f_arglist: tLPAREN2 f_args rparen
|
2303
2359
|
{
|
2304
|
-
result = val
|
2305
|
-
self.lexer.lex_state = EXPR_BEG
|
2306
|
-
self.lexer.command_start = true
|
2360
|
+
result = end_args val
|
2307
2361
|
}
|
2308
2362
|
| {
|
2309
2363
|
result = self.in_kwarg
|
@@ -2312,12 +2366,7 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2312
2366
|
}
|
2313
2367
|
f_args term
|
2314
2368
|
{
|
2315
|
-
|
2316
|
-
|
2317
|
-
self.in_kwarg = kwarg
|
2318
|
-
result = args
|
2319
|
-
lexer.lex_state = EXPR_BEG
|
2320
|
-
lexer.command_start = true
|
2369
|
+
result = end_args val
|
2321
2370
|
}
|
2322
2371
|
|
2323
2372
|
args_tail: f_kwarg tCOMMA f_kwrest opt_f_block_arg
|
@@ -2402,8 +2451,10 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2402
2451
|
|
|
2403
2452
|
{
|
2404
2453
|
result = args val
|
2454
|
+
# result.line lexer.lineno
|
2405
2455
|
}
|
2406
2456
|
|
2457
|
+
|
2407
2458
|
f_bad_arg: tCONSTANT
|
2408
2459
|
{
|
2409
2460
|
yyerror "formal argument cannot be a constant"
|
@@ -2424,41 +2475,26 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2424
2475
|
f_norm_arg: f_bad_arg
|
2425
2476
|
| tIDENTIFIER
|
2426
2477
|
{
|
2427
|
-
|
2478
|
+
(id, line), = val
|
2479
|
+
identifier = id.to_sym
|
2428
2480
|
self.env[identifier] = :lvar
|
2429
2481
|
|
2430
|
-
result = identifier
|
2482
|
+
result = [identifier, line]
|
2431
2483
|
}
|
2432
2484
|
|
2433
|
-
#if V >= 22
|
2434
2485
|
f_arg_asgn: f_norm_arg
|
2435
2486
|
|
2436
2487
|
f_arg_item: f_arg_asgn
|
2437
2488
|
| tLPAREN f_margs rparen
|
2438
2489
|
{
|
2439
|
-
|
2440
|
-
|
2441
|
-
|
2442
|
-
f_arg_item: f_norm_arg
|
2443
|
-
| tLPAREN f_margs rparen
|
2444
|
-
{
|
2445
|
-
result = val[1]
|
2490
|
+
_, margs, _ = val
|
2491
|
+
|
2492
|
+
result = margs
|
2446
2493
|
}
|
2447
|
-
#endif
|
2448
2494
|
|
2449
2495
|
f_arg: f_arg_item
|
2450
2496
|
{
|
2451
|
-
|
2452
|
-
|
2453
|
-
case arg
|
2454
|
-
when Symbol then
|
2455
|
-
result = s(:args, arg).line lexer.lineno
|
2456
|
-
when Sexp then
|
2457
|
-
result = arg
|
2458
|
-
else
|
2459
|
-
debug20 32
|
2460
|
-
raise "Unknown f_arg type: #{val.inspect}"
|
2461
|
-
end
|
2497
|
+
result = new_arg val
|
2462
2498
|
}
|
2463
2499
|
| f_arg tCOMMA f_arg_item
|
2464
2500
|
{
|
@@ -2470,16 +2506,12 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2470
2506
|
result = s(:args, list).line list.line
|
2471
2507
|
end
|
2472
2508
|
|
2473
|
-
result << item
|
2509
|
+
result << (Sexp === item ? item : item.first)
|
2474
2510
|
}
|
2475
2511
|
|
2476
|
-
#if V == 20
|
2477
|
-
f_kw: tLABEL arg_value
|
2478
|
-
#else
|
2479
2512
|
f_label: tLABEL
|
2480
2513
|
|
2481
2514
|
f_kw: f_label arg_value
|
2482
|
-
#endif
|
2483
2515
|
{
|
2484
2516
|
# TODO: new_kw_arg
|
2485
2517
|
(label, line), arg = val
|
@@ -2490,7 +2522,6 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2490
2522
|
kwarg = s(:kwarg, identifier, arg).line line
|
2491
2523
|
result = s(:array, kwarg).line line
|
2492
2524
|
}
|
2493
|
-
#if V >= 21
|
2494
2525
|
| f_label
|
2495
2526
|
{
|
2496
2527
|
(label, line), = val
|
@@ -2500,13 +2531,8 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2500
2531
|
|
2501
2532
|
result = s(:array, s(:kwarg, id).line(line)).line line
|
2502
2533
|
}
|
2503
|
-
#endif
|
2504
2534
|
|
2505
|
-
#if V == 20
|
2506
|
-
f_block_kw: tLABEL primary_value
|
2507
|
-
#else
|
2508
2535
|
f_block_kw: f_label primary_value
|
2509
|
-
#endif
|
2510
2536
|
{
|
2511
2537
|
# TODO: new_kw_arg
|
2512
2538
|
(label, line), expr = val
|
@@ -2515,7 +2541,6 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2515
2541
|
|
2516
2542
|
result = s(:array, s(:kwarg, id, expr).line(line)).line line
|
2517
2543
|
}
|
2518
|
-
#if V >= 21
|
2519
2544
|
| f_label
|
2520
2545
|
{
|
2521
2546
|
# TODO: new_kw_arg
|
@@ -2525,7 +2550,6 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2525
2550
|
|
2526
2551
|
result = s(:array, s(:kwarg, id).line(line)).line line
|
2527
2552
|
}
|
2528
|
-
#endif
|
2529
2553
|
|
2530
2554
|
f_block_kwarg: f_block_kw
|
2531
2555
|
| f_block_kwarg tCOMMA f_block_kw
|
@@ -2543,38 +2567,33 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2543
2567
|
kwrest_mark: tPOW
|
2544
2568
|
| tDSTAR
|
2545
2569
|
|
2570
|
+
|
2546
2571
|
f_kwrest: kwrest_mark tIDENTIFIER
|
2547
2572
|
{
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2573
|
+
_, (id, line) = val
|
2574
|
+
|
2575
|
+
name = id.to_sym
|
2576
|
+
self.assignable [name, line]
|
2577
|
+
result = [:"**#{name}", line]
|
2551
2578
|
}
|
2552
2579
|
| kwrest_mark
|
2553
2580
|
{
|
2554
|
-
|
2581
|
+
id = :"**"
|
2582
|
+
self.env[id] = :lvar # TODO: needed?!?
|
2583
|
+
result = [id, lexer.lineno] # TODO: tPOW/tDSTAR include lineno
|
2555
2584
|
}
|
2556
2585
|
|
2557
|
-
#if V == 20
|
2558
|
-
f_opt: tIDENTIFIER tEQL arg_value
|
2559
|
-
#elif V == 21
|
2560
|
-
f_opt: f_norm_arg tEQL arg_value
|
2561
|
-
#else
|
2562
2586
|
f_opt: f_arg_asgn tEQL arg_value
|
2563
|
-
#endif
|
2564
2587
|
{
|
2565
|
-
|
2588
|
+
lhs, _, rhs = val
|
2589
|
+
result = self.assignable lhs, rhs
|
2566
2590
|
# TODO: detect duplicate names
|
2567
2591
|
}
|
2568
2592
|
|
2569
|
-
#if V == 20
|
2570
|
-
f_block_opt: tIDENTIFIER tEQL primary_value
|
2571
|
-
#elif V == 21
|
2572
|
-
f_block_opt: f_norm_arg tEQL primary_value
|
2573
|
-
#else
|
2574
2593
|
f_block_opt: f_arg_asgn tEQL primary_value
|
2575
|
-
#endif
|
2576
2594
|
{
|
2577
|
-
|
2595
|
+
lhs, _, rhs = val
|
2596
|
+
result = self.assignable lhs, rhs
|
2578
2597
|
}
|
2579
2598
|
|
2580
2599
|
f_block_optarg: f_block_opt
|
@@ -2604,30 +2623,33 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2604
2623
|
f_rest_arg: restarg_mark tIDENTIFIER
|
2605
2624
|
{
|
2606
2625
|
# TODO: differs from parse.y - needs tests
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2626
|
+
_, (id, line) = val
|
2627
|
+
name = id.to_sym
|
2628
|
+
self.assignable [name, line]
|
2629
|
+
result = [:"*#{name}", line]
|
2610
2630
|
}
|
2611
2631
|
| restarg_mark
|
2612
2632
|
{
|
2613
2633
|
name = :"*"
|
2614
2634
|
self.env[name] = :lvar
|
2615
|
-
result = name
|
2635
|
+
result = [name, lexer.lineno] # FIX: tSTAR to include lineno
|
2616
2636
|
}
|
2617
2637
|
|
2618
2638
|
blkarg_mark: tAMPER2 | tAMPER
|
2619
2639
|
|
2620
2640
|
f_block_arg: blkarg_mark tIDENTIFIER
|
2621
2641
|
{
|
2622
|
-
|
2642
|
+
_, (id, line) = val
|
2643
|
+
identifier = id.to_sym
|
2623
2644
|
|
2624
2645
|
self.env[identifier] = :lvar
|
2625
|
-
result = "&#{identifier}".to_sym
|
2646
|
+
result = ["&#{identifier}".to_sym, line]
|
2626
2647
|
}
|
2627
2648
|
|
2628
2649
|
opt_f_block_arg: tCOMMA f_block_arg
|
2629
2650
|
{
|
2630
|
-
|
2651
|
+
_, arg = val
|
2652
|
+
result = arg
|
2631
2653
|
}
|
2632
2654
|
|
|
2633
2655
|
{
|
@@ -2674,14 +2696,14 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2674
2696
|
lit = s(:lit, label.to_sym).line line
|
2675
2697
|
result = s(:array, lit, arg).line line
|
2676
2698
|
}
|
2677
|
-
#if V >= 22
|
2678
2699
|
| tSTRING_BEG string_contents tLABEL_END arg_value
|
2679
2700
|
{
|
2680
|
-
_, sym, _, value = val
|
2701
|
+
(_, line), sym, _, value = val
|
2702
|
+
|
2681
2703
|
sym.sexp_type = :dsym
|
2682
|
-
|
2704
|
+
|
2705
|
+
result = s(:array, sym, value).line line
|
2683
2706
|
}
|
2684
|
-
#endif
|
2685
2707
|
| tDSTAR arg_value
|
2686
2708
|
{
|
2687
2709
|
_, arg = val
|
@@ -2694,9 +2716,7 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2694
2716
|
operation3: tIDENTIFIER | tFID | op
|
2695
2717
|
dot_or_colon: tDOT | tCOLON2
|
2696
2718
|
call_op: tDOT
|
2697
|
-
#if V >= 23
|
2698
2719
|
| tLONELY # TODO: rename tANDDOT?
|
2699
|
-
#endif
|
2700
2720
|
|
2701
2721
|
call_op2: call_op
|
2702
2722
|
| tCOLON2
|