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
data/bundle/ruby/2.7.0/gems/{ruby_parser-3.14.2 → ruby_parser-3.18.1}/lib/ruby_parser_extras.rb
RENAMED
@@ -1,4 +1,6 @@
|
|
1
1
|
# encoding: ASCII-8BIT
|
2
|
+
# frozen_string_literal: true
|
3
|
+
# TODO: remove encoding comment
|
2
4
|
|
3
5
|
require "sexp"
|
4
6
|
require "ruby_lexer"
|
@@ -28,7 +30,7 @@ class Sexp
|
|
28
30
|
end
|
29
31
|
|
30
32
|
module RubyParserStuff
|
31
|
-
VERSION = "3.
|
33
|
+
VERSION = "3.18.1"
|
32
34
|
|
33
35
|
attr_accessor :lexer, :in_def, :in_single, :file
|
34
36
|
attr_accessor :in_kwarg
|
@@ -45,6 +47,11 @@ module RubyParserStuff
|
|
45
47
|
|
46
48
|
attr_accessor :canonicalize_conditions
|
47
49
|
|
50
|
+
##
|
51
|
+
# The last token type returned from #next_token
|
52
|
+
|
53
|
+
attr_accessor :last_token_type
|
54
|
+
|
48
55
|
$good20 = []
|
49
56
|
|
50
57
|
%w[
|
@@ -109,7 +116,7 @@ module RubyParserStuff
|
|
109
116
|
def initialize(options = {})
|
110
117
|
super()
|
111
118
|
|
112
|
-
v = self.class.name[/
|
119
|
+
v = self.class.name[/[23]\d/]
|
113
120
|
raise "Bad Class name #{self.class}" unless v
|
114
121
|
|
115
122
|
self.lexer = RubyLexer.new v && v.to_i
|
@@ -149,11 +156,31 @@ module RubyParserStuff
|
|
149
156
|
end
|
150
157
|
|
151
158
|
args.each do |arg|
|
159
|
+
if arg.instance_of? Array and arg.size == 2 and arg.last.is_a? Numeric then
|
160
|
+
arg = arg.first
|
161
|
+
end
|
162
|
+
|
152
163
|
case arg
|
153
164
|
when Sexp then
|
154
165
|
case arg.sexp_type
|
155
166
|
when :args, :block, :array, :call_args then # HACK call_args mismatch
|
156
|
-
|
167
|
+
rest = arg.sexp_body
|
168
|
+
|
169
|
+
rest.map! { |x|
|
170
|
+
if x.instance_of? Array and x.size == 2 and Numeric === x.last then
|
171
|
+
x.first
|
172
|
+
else
|
173
|
+
x
|
174
|
+
end
|
175
|
+
}
|
176
|
+
|
177
|
+
result.concat rest
|
178
|
+
when :forward_args then
|
179
|
+
self.env[:*] = :lvar # TODO: arg_var(p, idFWD_REST) ?
|
180
|
+
self.env[:**] = :lvar
|
181
|
+
self.env[:&] = :lvar
|
182
|
+
|
183
|
+
result << arg
|
157
184
|
when :block_arg then
|
158
185
|
result << :"&#{arg.last}"
|
159
186
|
when :shadow then
|
@@ -173,6 +200,8 @@ module RubyParserStuff
|
|
173
200
|
name = arg.to_s.delete("&*")
|
174
201
|
self.env[name.to_sym] = :lvar unless name.empty?
|
175
202
|
result << arg
|
203
|
+
when true, false then
|
204
|
+
self.in_kwarg = arg
|
176
205
|
when ",", "|", ";", "(", ")", nil then
|
177
206
|
# ignore
|
178
207
|
else
|
@@ -183,6 +212,23 @@ module RubyParserStuff
|
|
183
212
|
result
|
184
213
|
end
|
185
214
|
|
215
|
+
def end_args args
|
216
|
+
lexer.lex_state = RubyLexer::State::Values::EXPR_BEG
|
217
|
+
lexer.command_start = true
|
218
|
+
self.args args
|
219
|
+
end
|
220
|
+
|
221
|
+
def endless_method_name defn_or_defs
|
222
|
+
name = defn_or_defs[1]
|
223
|
+
name = defn_or_defs[2] unless Symbol === name
|
224
|
+
|
225
|
+
if name.end_with? "=" then
|
226
|
+
yyerror "setter method cannot be defined in an endless method definition"
|
227
|
+
end
|
228
|
+
|
229
|
+
# TODO? token_info_drop(p, "def", loc->beg_pos);
|
230
|
+
end
|
231
|
+
|
186
232
|
def array_to_hash array
|
187
233
|
case array.sexp_type
|
188
234
|
when :kwsplat then
|
@@ -202,17 +248,10 @@ module RubyParserStuff
|
|
202
248
|
end
|
203
249
|
|
204
250
|
def assignable(lhs, value = nil)
|
205
|
-
id = lhs
|
206
|
-
|
207
|
-
raise "WTF" if Sexp === id
|
208
|
-
id = id.to_sym if Sexp === id
|
251
|
+
id, line = lhs
|
252
|
+
id = id.to_sym
|
209
253
|
|
210
|
-
|
211
|
-
|
212
|
-
raise SyntaxError, "Can't change the value of #{id}" if
|
213
|
-
id.to_s =~ /^(?:self|nil|true|false|__LINE__|__FILE__)$/
|
214
|
-
|
215
|
-
result = case id.to_s
|
254
|
+
result = case id
|
216
255
|
when /^@@/ then
|
217
256
|
asgn = in_def || in_single > 0
|
218
257
|
s((asgn ? :cvasgn : :cvdecl), id)
|
@@ -233,17 +272,9 @@ module RubyParserStuff
|
|
233
272
|
|
234
273
|
self.env[id] ||= :lvar if result.sexp_type == :lasgn
|
235
274
|
|
236
|
-
line = case lhs
|
237
|
-
when Sexp then
|
238
|
-
lhs.line
|
239
|
-
else
|
240
|
-
value && value.line || lexer.lineno
|
241
|
-
end
|
242
|
-
|
243
275
|
result << value if value
|
244
|
-
result.line
|
245
|
-
|
246
|
-
return result
|
276
|
+
result.line line
|
277
|
+
result
|
247
278
|
end
|
248
279
|
|
249
280
|
def backref_assign_error ref
|
@@ -267,9 +298,9 @@ module RubyParserStuff
|
|
267
298
|
line = [head.line, tail.line].compact.min
|
268
299
|
|
269
300
|
head = remove_begin(head)
|
270
|
-
head = s(:block, head) unless head.
|
301
|
+
head = s(:block, head).line(line) unless head.sexp_type == :block
|
271
302
|
|
272
|
-
head.line = line
|
303
|
+
# head.line = line
|
273
304
|
head << tail
|
274
305
|
end
|
275
306
|
|
@@ -295,6 +326,10 @@ module RubyParserStuff
|
|
295
326
|
end
|
296
327
|
|
297
328
|
args.each do |arg|
|
329
|
+
if arg.instance_of? Array and arg.size == 2 and arg.last.is_a? Numeric then
|
330
|
+
arg = arg.first
|
331
|
+
end
|
332
|
+
|
298
333
|
case arg
|
299
334
|
when Sexp then
|
300
335
|
case arg.sexp_type
|
@@ -305,7 +340,10 @@ module RubyParserStuff
|
|
305
340
|
end
|
306
341
|
when Symbol then
|
307
342
|
result << arg
|
308
|
-
when
|
343
|
+
when Array then
|
344
|
+
id, _line = arg
|
345
|
+
result << id
|
346
|
+
when ",", nil, "(" then
|
309
347
|
# ignore
|
310
348
|
else
|
311
349
|
raise "unhandled: #{arg.inspect} in #{args.inspect}"
|
@@ -429,7 +467,7 @@ module RubyParserStuff
|
|
429
467
|
end
|
430
468
|
else
|
431
469
|
warn "unprocessed: %p" % [s]
|
432
|
-
end.map { |l| whitespace_width l
|
470
|
+
end.map { |l| whitespace_width l.chomp }
|
433
471
|
}.compact.min
|
434
472
|
end
|
435
473
|
|
@@ -453,7 +491,6 @@ module RubyParserStuff
|
|
453
491
|
end
|
454
492
|
|
455
493
|
def gettable(id)
|
456
|
-
lineno = id.lineno if id.respond_to? :lineno
|
457
494
|
id = id.to_sym if String === id
|
458
495
|
|
459
496
|
result = case id.to_s
|
@@ -474,8 +511,6 @@ module RubyParserStuff
|
|
474
511
|
end
|
475
512
|
end
|
476
513
|
|
477
|
-
result.line lineno if lineno
|
478
|
-
|
479
514
|
raise "identifier #{id.inspect} is not valid" unless result
|
480
515
|
|
481
516
|
result
|
@@ -493,6 +528,8 @@ module RubyParserStuff
|
|
493
528
|
str.encode! Encoding::UTF_8
|
494
529
|
break
|
495
530
|
end
|
531
|
+
rescue ArgumentError # unknown encoding name
|
532
|
+
# do nothing
|
496
533
|
rescue Encoding::InvalidByteSequenceError
|
497
534
|
# do nothing
|
498
535
|
rescue Encoding::UndefinedConversionError
|
@@ -532,7 +569,7 @@ module RubyParserStuff
|
|
532
569
|
header.map! { |s| s.force_encoding "ASCII-8BIT" } if has_enc
|
533
570
|
|
534
571
|
first = header.first || ""
|
535
|
-
encoding, str = "utf-8", str[3..-1] if first =~ /\A\xEF\xBB\xBF/
|
572
|
+
encoding, str = +"utf-8", str.b[3..-1] if first =~ /\A\xEF\xBB\xBF/
|
536
573
|
|
537
574
|
encoding = $1.strip if header.find { |s|
|
538
575
|
s[/^#.*?-\*-.*?coding:\s*([^ ;]+).*?-\*-/, 1] ||
|
@@ -592,7 +629,9 @@ module RubyParserStuff
|
|
592
629
|
case ttype
|
593
630
|
when :str then
|
594
631
|
if htype == :str
|
595
|
-
head.last
|
632
|
+
a, b = head.last, tail.last
|
633
|
+
b = b.dup.force_encoding a.encoding unless Encoding.compatible?(a, b)
|
634
|
+
a << b
|
596
635
|
elsif htype == :dstr and head.size == 2 then
|
597
636
|
head.last << tail.last
|
598
637
|
else
|
@@ -614,7 +653,7 @@ module RubyParserStuff
|
|
614
653
|
when :evstr then
|
615
654
|
if htype == :str then
|
616
655
|
f, l = head.file, head.line
|
617
|
-
head = s(:dstr, *head.sexp_body)
|
656
|
+
head = s(:dstr, *head.sexp_body)
|
618
657
|
head.file = f
|
619
658
|
head.line = l
|
620
659
|
end
|
@@ -633,6 +672,13 @@ module RubyParserStuff
|
|
633
672
|
return head
|
634
673
|
end
|
635
674
|
|
675
|
+
def local_pop in_def
|
676
|
+
lexer.cond.pop # group = local_pop
|
677
|
+
lexer.cmdarg.pop
|
678
|
+
self.env.unextend
|
679
|
+
self.in_def = in_def
|
680
|
+
end
|
681
|
+
|
636
682
|
def logical_op type, left, right
|
637
683
|
left = value_expr left
|
638
684
|
|
@@ -662,6 +708,73 @@ module RubyParserStuff
|
|
662
708
|
new_call val[0], :"[]", val[2]
|
663
709
|
end
|
664
710
|
|
711
|
+
def new_arg val
|
712
|
+
arg, = val
|
713
|
+
|
714
|
+
case arg
|
715
|
+
when Symbol then
|
716
|
+
result = s(:args, arg).line line
|
717
|
+
when Sexp then
|
718
|
+
result = arg
|
719
|
+
when Array then
|
720
|
+
(arg, line), = val
|
721
|
+
result = s(:args, arg).line line
|
722
|
+
else
|
723
|
+
debug20 32
|
724
|
+
raise "Unknown f_arg type: #{val.inspect}"
|
725
|
+
end
|
726
|
+
|
727
|
+
result
|
728
|
+
end
|
729
|
+
|
730
|
+
def new_array_pattern const, pre_arg, arypat, loc
|
731
|
+
result = s(:array_pat, const).line loc
|
732
|
+
result << pre_arg if pre_arg
|
733
|
+
|
734
|
+
if arypat && arypat.sexp_type == :array_TAIL then
|
735
|
+
result.concat arypat.sexp_body
|
736
|
+
else
|
737
|
+
raise "NO?: %p" % [arypat]
|
738
|
+
end
|
739
|
+
|
740
|
+
result
|
741
|
+
end
|
742
|
+
|
743
|
+
def array_pat_concat lhs, rhs
|
744
|
+
case lhs.sexp_type
|
745
|
+
when :PATTERN then
|
746
|
+
lhs.sexp_type = :array_pat
|
747
|
+
end
|
748
|
+
|
749
|
+
if rhs then
|
750
|
+
case rhs.sexp_type
|
751
|
+
when :array_pat, :array_TAIL, :PATTERN then
|
752
|
+
lhs.concat rhs.sexp_body
|
753
|
+
else
|
754
|
+
lhs << rhs
|
755
|
+
end
|
756
|
+
end
|
757
|
+
end
|
758
|
+
|
759
|
+
def new_array_pattern_tail pre_args, has_rest, rest_arg, post_args
|
760
|
+
# TODO: remove has_rest once all tests pass !!!
|
761
|
+
rest_arg = if has_rest then
|
762
|
+
:"*#{rest_arg}"
|
763
|
+
else
|
764
|
+
nil
|
765
|
+
end
|
766
|
+
|
767
|
+
result = s(:array_TAIL).line 666
|
768
|
+
|
769
|
+
array_pat_concat result, pre_args
|
770
|
+
|
771
|
+
result << rest_arg if rest_arg
|
772
|
+
|
773
|
+
array_pat_concat result, post_args
|
774
|
+
|
775
|
+
result
|
776
|
+
end
|
777
|
+
|
665
778
|
def new_assign lhs, rhs
|
666
779
|
return nil unless lhs
|
667
780
|
|
@@ -681,6 +794,8 @@ module RubyParserStuff
|
|
681
794
|
end
|
682
795
|
|
683
796
|
def new_attrasgn recv, meth, call_op = :"."
|
797
|
+
call_op = call_op.first if Array === call_op
|
798
|
+
|
684
799
|
meth = :"#{meth}="
|
685
800
|
|
686
801
|
result = case call_op.to_sym
|
@@ -696,6 +811,15 @@ module RubyParserStuff
|
|
696
811
|
result
|
697
812
|
end
|
698
813
|
|
814
|
+
def new_begin val
|
815
|
+
_, lineno, body, _ = val
|
816
|
+
|
817
|
+
result = body ? s(:begin, body) : s(:nil)
|
818
|
+
result.line lineno
|
819
|
+
|
820
|
+
result
|
821
|
+
end
|
822
|
+
|
699
823
|
def new_body val
|
700
824
|
body, resbody, elsebody, ensurebody = val
|
701
825
|
|
@@ -723,7 +847,10 @@ module RubyParserStuff
|
|
723
847
|
result = block_append(result, elsebody)
|
724
848
|
end
|
725
849
|
|
726
|
-
|
850
|
+
if ensurebody
|
851
|
+
lineno = (result || ensurebody).line
|
852
|
+
result = s(:ensure, result, ensurebody).compact.line lineno
|
853
|
+
end
|
727
854
|
|
728
855
|
result
|
729
856
|
end
|
@@ -733,6 +860,8 @@ module RubyParserStuff
|
|
733
860
|
end
|
734
861
|
|
735
862
|
def new_call recv, meth, args = nil, call_op = :"."
|
863
|
+
call_op = call_op.first if Array === call_op
|
864
|
+
|
736
865
|
result = case call_op.to_sym
|
737
866
|
when :"."
|
738
867
|
s(:call, recv, meth)
|
@@ -760,10 +889,14 @@ module RubyParserStuff
|
|
760
889
|
result
|
761
890
|
end
|
762
891
|
|
892
|
+
def new_in pat, body, cases, line
|
893
|
+
s(:in, pat, body, cases).line line
|
894
|
+
end
|
895
|
+
|
763
896
|
def new_case expr, body, line
|
764
897
|
result = s(:case, expr)
|
765
898
|
|
766
|
-
while body and body.
|
899
|
+
while body and [:when, :in].include? body.sexp_type
|
767
900
|
result << body
|
768
901
|
body = body.delete_at 3
|
769
902
|
end
|
@@ -782,8 +915,11 @@ module RubyParserStuff
|
|
782
915
|
end
|
783
916
|
|
784
917
|
def new_class val
|
918
|
+
# TODO: get line from class keyword
|
785
919
|
line, path, superclass, body = val[1], val[2], val[3], val[5]
|
786
920
|
|
921
|
+
path = path.first if path.instance_of? Array
|
922
|
+
|
787
923
|
result = s(:class, path, superclass)
|
788
924
|
|
789
925
|
if body then
|
@@ -806,7 +942,8 @@ module RubyParserStuff
|
|
806
942
|
end
|
807
943
|
|
808
944
|
def new_const_op_asgn val
|
809
|
-
lhs, asgn_op, rhs = val
|
945
|
+
lhs, (asgn_op, _), rhs = val
|
946
|
+
asgn_op = asgn_op.to_sym
|
810
947
|
|
811
948
|
result = case asgn_op
|
812
949
|
when :"||" then
|
@@ -822,52 +959,71 @@ module RubyParserStuff
|
|
822
959
|
end
|
823
960
|
|
824
961
|
def new_defn val
|
825
|
-
|
826
|
-
|
962
|
+
_, (name, line), in_def, args, body, _ = val
|
963
|
+
|
964
|
+
body ||= s(:nil).line line
|
827
965
|
|
828
966
|
args.line line
|
829
967
|
|
830
968
|
result = s(:defn, name.to_sym, args).line line
|
831
969
|
|
832
|
-
if body then
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
result.push body
|
837
|
-
end
|
970
|
+
if body.sexp_type == :block then
|
971
|
+
result.push(*body.sexp_body)
|
972
|
+
else
|
973
|
+
result.push body
|
838
974
|
end
|
839
975
|
|
840
976
|
result.comments = self.comments.pop
|
841
977
|
|
842
|
-
result
|
978
|
+
[result, in_def]
|
843
979
|
end
|
844
980
|
|
845
981
|
def new_defs val
|
846
|
-
recv, (name,
|
847
|
-
|
982
|
+
_, recv, (name, line), in_def, args, body, _ = val
|
983
|
+
|
848
984
|
body ||= s(:nil).line line
|
849
985
|
|
850
986
|
args.line line
|
851
987
|
|
852
|
-
result = s(:defs, recv, name.to_sym, args)
|
988
|
+
result = s(:defs, recv, name.to_sym, args).line line
|
853
989
|
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
990
|
+
# TODO: remove_begin
|
991
|
+
# TODO: reduce_nodes
|
992
|
+
|
993
|
+
if body.sexp_type == :block then
|
994
|
+
result.push(*body.sexp_body)
|
995
|
+
else
|
996
|
+
result.push body
|
860
997
|
end
|
861
998
|
|
862
|
-
result.line = recv.line
|
863
999
|
result.comments = self.comments.pop
|
864
|
-
|
1000
|
+
|
1001
|
+
[result, in_def]
|
865
1002
|
end
|
866
1003
|
|
867
1004
|
def new_do_body args, body, lineno
|
868
1005
|
new_iter(nil, args, body).line(lineno)
|
869
1006
|
end
|
870
1007
|
|
1008
|
+
def new_find_pattern const, pat
|
1009
|
+
pat.sexp_type = :find_pat
|
1010
|
+
pat.insert 1, const
|
1011
|
+
end
|
1012
|
+
|
1013
|
+
def new_find_pattern_tail lhs, mid, rhs
|
1014
|
+
lhs_id, line = lhs
|
1015
|
+
rhs_id, _line = rhs
|
1016
|
+
|
1017
|
+
# TODO: fpinfo->pre_rest_arg = pre_rest_arg ? assignable(p, pre_rest_arg, 0, loc) : NODE_SPECIAL_NO_NAME_REST;
|
1018
|
+
|
1019
|
+
lhs_id = "*#{lhs_id}".to_sym
|
1020
|
+
rhs_id = "*#{rhs_id}".to_sym
|
1021
|
+
|
1022
|
+
mid.sexp_type = :array_pat # HACK?
|
1023
|
+
|
1024
|
+
s(:find_pat_TAIL, lhs_id, mid, rhs_id).line line
|
1025
|
+
end
|
1026
|
+
|
871
1027
|
def new_for expr, var, body
|
872
1028
|
result = s(:for, expr, var).line(var.line)
|
873
1029
|
result << body if body
|
@@ -875,7 +1031,49 @@ module RubyParserStuff
|
|
875
1031
|
end
|
876
1032
|
|
877
1033
|
def new_hash val
|
878
|
-
|
1034
|
+
_, line, assocs = val
|
1035
|
+
|
1036
|
+
s(:hash).line(line).concat assocs.sexp_body
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
def new_hash_pattern const, hash_pat, loc
|
1040
|
+
_, pat, kw_args, kw_rest_arg = hash_pat
|
1041
|
+
|
1042
|
+
line = (const||hash_pat).line
|
1043
|
+
|
1044
|
+
result = s(:hash_pat, const).line line
|
1045
|
+
result.concat pat.sexp_body if pat
|
1046
|
+
result << kw_args if kw_args
|
1047
|
+
result << kw_rest_arg if kw_rest_arg
|
1048
|
+
result
|
1049
|
+
end
|
1050
|
+
|
1051
|
+
def new_hash_pattern_tail kw_args, kw_rest_arg, line # TODO: remove line arg
|
1052
|
+
# kw_rest_arg = assignable(kw_rest_arg, nil).line line if kw_rest_arg
|
1053
|
+
|
1054
|
+
result = s(:hash_pat).line line
|
1055
|
+
result << kw_args
|
1056
|
+
|
1057
|
+
if kw_rest_arg then
|
1058
|
+
name = kw_rest_arg.value
|
1059
|
+
# TODO: I _hate_ this:
|
1060
|
+
assignable [name, kw_rest_arg.line] if name != :**
|
1061
|
+
result << kw_rest_arg
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
result
|
1065
|
+
end
|
1066
|
+
|
1067
|
+
def push_pktbl
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
def pop_pktbl
|
1071
|
+
end
|
1072
|
+
|
1073
|
+
def push_pvtbl
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
def pop_pvtbl
|
879
1077
|
end
|
880
1078
|
|
881
1079
|
def new_if c, t, f
|
@@ -952,9 +1150,12 @@ module RubyParserStuff
|
|
952
1150
|
end
|
953
1151
|
|
954
1152
|
def new_module val
|
1153
|
+
# TODO: get line from module keyword
|
955
1154
|
line, path, body = val[1], val[2], val[4]
|
956
1155
|
|
957
|
-
|
1156
|
+
path = path.first if path.instance_of? Array
|
1157
|
+
|
1158
|
+
result = s(:module, path).line line
|
958
1159
|
|
959
1160
|
if body then # REFACTOR?
|
960
1161
|
if body.sexp_type == :block then
|
@@ -964,32 +1165,33 @@ module RubyParserStuff
|
|
964
1165
|
end
|
965
1166
|
end
|
966
1167
|
|
967
|
-
result.line = line
|
968
1168
|
result.comments = self.comments.pop
|
969
1169
|
result
|
970
1170
|
end
|
971
1171
|
|
972
1172
|
def new_op_asgn val
|
973
|
-
lhs,
|
974
|
-
|
975
|
-
|
976
|
-
|
1173
|
+
lhs, (op, _line), rhs = val
|
1174
|
+
op = op.to_sym
|
1175
|
+
|
1176
|
+
name = gettable(lhs.last).line lhs.line
|
1177
|
+
arg = remove_begin rhs
|
1178
|
+
result = case op # REFACTOR
|
977
1179
|
when :"||" then
|
978
1180
|
lhs << arg
|
979
|
-
s(:op_asgn_or, name, lhs)
|
1181
|
+
s(:op_asgn_or, name, lhs).line lhs.line
|
980
1182
|
when :"&&" then
|
981
1183
|
lhs << arg
|
982
|
-
s(:op_asgn_and, name, lhs)
|
1184
|
+
s(:op_asgn_and, name, lhs).line lhs.line
|
983
1185
|
else
|
984
|
-
lhs << new_call(name,
|
1186
|
+
lhs << new_call(name, op, argl(arg))
|
985
1187
|
lhs
|
986
1188
|
end
|
987
|
-
|
1189
|
+
|
988
1190
|
result
|
989
1191
|
end
|
990
1192
|
|
991
1193
|
def new_op_asgn1 val
|
992
|
-
lhs, _, args, _, op, rhs = val
|
1194
|
+
lhs, _, args, _, (op, _), rhs = val
|
993
1195
|
|
994
1196
|
args.sexp_type = :arglist if args
|
995
1197
|
|
@@ -999,7 +1201,7 @@ module RubyParserStuff
|
|
999
1201
|
end
|
1000
1202
|
|
1001
1203
|
def new_op_asgn2 val
|
1002
|
-
recv, call_op, meth, op, arg = val
|
1204
|
+
recv, (call_op, _), (meth, _), (op, _), arg = val
|
1003
1205
|
meth = :"#{meth}="
|
1004
1206
|
|
1005
1207
|
result = case call_op.to_sym
|
@@ -1016,36 +1218,28 @@ module RubyParserStuff
|
|
1016
1218
|
end
|
1017
1219
|
|
1018
1220
|
def new_qsym_list
|
1019
|
-
|
1020
|
-
self.lexer.fixup_lineno
|
1021
|
-
result
|
1221
|
+
s(:array).line lexer.lineno
|
1022
1222
|
end
|
1023
1223
|
|
1024
1224
|
def new_qsym_list_entry val
|
1025
|
-
_, str, _ = val
|
1026
|
-
|
1027
|
-
self.lexer.fixup_lineno
|
1028
|
-
result
|
1225
|
+
_, (str, line), _ = val
|
1226
|
+
s(:lit, str.to_sym).line line
|
1029
1227
|
end
|
1030
1228
|
|
1031
1229
|
def new_qword_list
|
1032
|
-
|
1033
|
-
self.lexer.fixup_lineno
|
1034
|
-
result
|
1230
|
+
s(:array).line lexer.lineno
|
1035
1231
|
end
|
1036
1232
|
|
1037
1233
|
def new_qword_list_entry val
|
1038
|
-
_, str, _ = val
|
1234
|
+
_, (str, line), _ = val
|
1039
1235
|
str.force_encoding("ASCII-8BIT") unless str.valid_encoding?
|
1040
|
-
|
1041
|
-
self.lexer.fixup_lineno
|
1042
|
-
result
|
1236
|
+
s(:str, str).line line
|
1043
1237
|
end
|
1044
1238
|
|
1045
1239
|
def new_regexp val
|
1046
|
-
_, node, options = val
|
1240
|
+
(_, line), node, (options, _) = val
|
1047
1241
|
|
1048
|
-
node ||= s(:str, "").line
|
1242
|
+
node ||= s(:str, "").line line
|
1049
1243
|
|
1050
1244
|
o, k = 0, nil
|
1051
1245
|
options.split(//).uniq.each do |c| # FIX: this has a better home
|
@@ -1072,12 +1266,12 @@ module RubyParserStuff
|
|
1072
1266
|
begin
|
1073
1267
|
Regexp.new(node[1], o)
|
1074
1268
|
rescue RegexpError => e
|
1075
|
-
warn "
|
1269
|
+
warn "WARNING: #{e.message} for #{node[1].inspect} #{options.inspect}"
|
1076
1270
|
begin
|
1077
|
-
warn "
|
1271
|
+
warn "WARNING: trying to recover with ENC_UTF8"
|
1078
1272
|
Regexp.new(node[1], Regexp::ENC_UTF8)
|
1079
1273
|
rescue RegexpError => e
|
1080
|
-
warn "
|
1274
|
+
warn "WARNING: trying to recover with ENC_NONE"
|
1081
1275
|
Regexp.new(node[1], Regexp::ENC_NONE)
|
1082
1276
|
end
|
1083
1277
|
end
|
@@ -1090,7 +1284,7 @@ module RubyParserStuff
|
|
1090
1284
|
end
|
1091
1285
|
node << o if o and o != 0
|
1092
1286
|
else
|
1093
|
-
node = s(:dregx, "", node).line
|
1287
|
+
node = s(:dregx, "", node).line line
|
1094
1288
|
node.sexp_type = :dregx_once if options =~ /o/
|
1095
1289
|
node << o if o and o != 0
|
1096
1290
|
end
|
@@ -1132,16 +1326,16 @@ module RubyParserStuff
|
|
1132
1326
|
end
|
1133
1327
|
|
1134
1328
|
def new_string val
|
1135
|
-
str, = val
|
1329
|
+
(str, line), = val
|
1330
|
+
|
1136
1331
|
str.force_encoding("UTF-8")
|
1332
|
+
# TODO: remove:
|
1137
1333
|
str.force_encoding("ASCII-8BIT") unless str.valid_encoding?
|
1138
|
-
|
1139
|
-
self.lexer.fixup_lineno str.count("\n")
|
1140
|
-
result
|
1334
|
+
s(:str, str).line line
|
1141
1335
|
end
|
1142
1336
|
|
1143
1337
|
def new_super args
|
1144
|
-
if args && args.
|
1338
|
+
if args && args.sexp_type == :block_pass then
|
1145
1339
|
s(:super, args).line args.line
|
1146
1340
|
else
|
1147
1341
|
args ||= s(:arglist).line lexer.lineno
|
@@ -1149,32 +1343,30 @@ module RubyParserStuff
|
|
1149
1343
|
end
|
1150
1344
|
end
|
1151
1345
|
|
1346
|
+
def new_symbol val
|
1347
|
+
name = val.last
|
1348
|
+
s(:lit, name.to_sym).line lexer.lineno
|
1349
|
+
end
|
1350
|
+
|
1152
1351
|
def new_symbol_list
|
1153
|
-
|
1154
|
-
|
1155
|
-
result
|
1352
|
+
# TODO: hunt down and try to remove ALL lexer.lineno usage!
|
1353
|
+
s(:array).line lexer.lineno
|
1156
1354
|
end
|
1157
1355
|
|
1158
1356
|
def new_symbol_list_entry val
|
1159
1357
|
_, sym, _ = val
|
1160
1358
|
|
1161
|
-
sym ||= s(:str, "")
|
1162
|
-
|
1163
|
-
line = lexer.lineno
|
1359
|
+
sym ||= s(:str, "").line lexer.lineno
|
1164
1360
|
|
1165
1361
|
case sym.sexp_type
|
1166
1362
|
when :dstr then
|
1167
1363
|
sym.sexp_type = :dsym
|
1168
1364
|
when :str then
|
1169
|
-
sym = s(:lit, sym.last.to_sym)
|
1365
|
+
sym = s(:lit, sym.last.to_sym).line sym.line
|
1170
1366
|
else
|
1171
|
-
sym = s(:dsym, "", sym
|
1367
|
+
sym = s(:dsym, "", sym).line sym.line
|
1172
1368
|
end
|
1173
1369
|
|
1174
|
-
sym.line line
|
1175
|
-
|
1176
|
-
self.lexer.fixup_lineno
|
1177
|
-
|
1178
1370
|
sym
|
1179
1371
|
end
|
1180
1372
|
|
@@ -1216,39 +1408,38 @@ module RubyParserStuff
|
|
1216
1408
|
end
|
1217
1409
|
|
1218
1410
|
def new_word_list
|
1219
|
-
|
1220
|
-
self.lexer.fixup_lineno
|
1221
|
-
result
|
1411
|
+
s(:array).line lexer.lineno
|
1222
1412
|
end
|
1223
1413
|
|
1224
1414
|
def new_word_list_entry val
|
1225
1415
|
_, word, _ = val
|
1226
|
-
|
1227
|
-
self.lexer.fixup_lineno
|
1228
|
-
result
|
1416
|
+
word.sexp_type == :evstr ? s(:dstr, "", word).line(word.line) : word
|
1229
1417
|
end
|
1230
1418
|
|
1231
|
-
def new_xstring
|
1232
|
-
|
1233
|
-
|
1419
|
+
def new_xstring val
|
1420
|
+
_, node = val
|
1421
|
+
|
1422
|
+
node ||= s(:str, "").line lexer.lineno
|
1423
|
+
|
1424
|
+
if node then
|
1425
|
+
case node.sexp_type
|
1234
1426
|
when :str
|
1235
|
-
|
1427
|
+
node.sexp_type = :xstr
|
1236
1428
|
when :dstr
|
1237
|
-
|
1429
|
+
node.sexp_type = :dxstr
|
1238
1430
|
else
|
1239
|
-
|
1431
|
+
node = s(:dxstr, "", node).line node.line
|
1240
1432
|
end
|
1241
|
-
str
|
1242
|
-
else
|
1243
|
-
s(:xstr, "")
|
1244
1433
|
end
|
1434
|
+
|
1435
|
+
node
|
1245
1436
|
end
|
1246
1437
|
|
1247
1438
|
def new_yield args = nil
|
1248
1439
|
# TODO: raise args.inspect unless [:arglist].include? args.first # HACK
|
1249
|
-
raise "write a test 4" if args && args.
|
1440
|
+
raise "write a test 4" if args && args.sexp_type == :block_pass
|
1250
1441
|
raise SyntaxError, "Block argument should not be given." if
|
1251
|
-
args && args.
|
1442
|
+
args && args.sexp_type == :block_pass
|
1252
1443
|
|
1253
1444
|
args ||= s(:arglist).line lexer.lineno
|
1254
1445
|
|
@@ -1258,17 +1449,30 @@ module RubyParserStuff
|
|
1258
1449
|
s(:yield, *args.sexp_body).line args.line
|
1259
1450
|
end
|
1260
1451
|
|
1452
|
+
def prev_value_to_lineno v
|
1453
|
+
s, n = v
|
1454
|
+
if String === s then
|
1455
|
+
n
|
1456
|
+
else
|
1457
|
+
lexer.lineno
|
1458
|
+
end
|
1459
|
+
end
|
1460
|
+
|
1261
1461
|
def next_token
|
1262
1462
|
token = self.lexer.next_token
|
1263
1463
|
|
1264
1464
|
if token and token.first != RubyLexer::EOF then
|
1465
|
+
self.last_token_type = token
|
1265
1466
|
return token
|
1467
|
+
elsif !token
|
1468
|
+
return self.lexer.next_token
|
1266
1469
|
else
|
1267
1470
|
return [false, false]
|
1268
1471
|
end
|
1269
1472
|
end
|
1270
1473
|
|
1271
1474
|
def on_error(et, ev, values)
|
1475
|
+
ev = ev.first if ev.instance_of?(Array) && ev.size == 2 && ev.last.is_a?(Integer)
|
1272
1476
|
super
|
1273
1477
|
rescue Racc::ParseError => e
|
1274
1478
|
# I don't like how the exception obscures the error message
|
@@ -1282,18 +1486,17 @@ module RubyParserStuff
|
|
1282
1486
|
# Timeout::Error if it runs for more than +time+ seconds.
|
1283
1487
|
|
1284
1488
|
def process(str, file = "(string)", time = 10)
|
1489
|
+
str.freeze
|
1490
|
+
|
1285
1491
|
Timeout.timeout time do
|
1286
1492
|
raise "bad val: #{str.inspect}" unless String === str
|
1287
1493
|
|
1288
|
-
|
1494
|
+
self.lexer.string = handle_encoding str
|
1289
1495
|
|
1290
1496
|
self.file = file.dup
|
1291
1497
|
|
1292
1498
|
@yydebug = ENV.has_key? "DEBUG"
|
1293
1499
|
|
1294
|
-
# HACK -- need to get tests passing more than have graceful code
|
1295
|
-
self.lexer.ss = RPStringScanner.new str
|
1296
|
-
|
1297
1500
|
do_parse
|
1298
1501
|
end
|
1299
1502
|
end
|
@@ -1320,6 +1523,7 @@ module RubyParserStuff
|
|
1320
1523
|
self.in_single = 0
|
1321
1524
|
self.env.reset
|
1322
1525
|
self.comments.clear
|
1526
|
+
self.last_token_type = nil
|
1323
1527
|
end
|
1324
1528
|
|
1325
1529
|
def ret_args node
|
@@ -1348,6 +1552,14 @@ module RubyParserStuff
|
|
1348
1552
|
result
|
1349
1553
|
end
|
1350
1554
|
|
1555
|
+
def debug n
|
1556
|
+
if ENV["PRY"] then
|
1557
|
+
require "pry"; binding.pry
|
1558
|
+
end
|
1559
|
+
|
1560
|
+
raise RubyParser::SyntaxError, "debug #{n}"
|
1561
|
+
end
|
1562
|
+
|
1351
1563
|
def syntax_error msg
|
1352
1564
|
raise RubyParser::SyntaxError, msg
|
1353
1565
|
end
|
@@ -1392,6 +1604,8 @@ module RubyParserStuff
|
|
1392
1604
|
|
1393
1605
|
if remove_width then
|
1394
1606
|
line[idx..-1]
|
1607
|
+
elsif line[idx].nil?
|
1608
|
+
nil
|
1395
1609
|
else
|
1396
1610
|
col
|
1397
1611
|
end
|