brakeman 4.7.2 → 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 +155 -1
- data/README.md +23 -6
- data/bundle/load.rb +15 -13
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/CHANGES.txt +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/MIT-LICENSE +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/README.txt +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/contrib/erubis +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/contrib/erubis-run.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/contrib/inline-require +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/context.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/converter.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ec.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ecpp.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ejava.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ejavascript.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/enhanced.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/eperl.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/eruby.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/escheme.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine/optimized.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/engine.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/enhancer.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/error.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/evaluator.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/generator.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/helper.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/helpers/rails_form_helper.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/helpers/rails_helper.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/local-setting.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/main.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/preprocessing.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/tiny.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis/util.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/lib/erubis.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/erubis-2.7.0/setup.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/CHANGELOG.md +24 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/FAQ.md +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/Gemfile +1 -4
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/MIT-LICENSE +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/README.md +21 -16
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/REFERENCE.md +39 -10
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/TODO +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/haml.gemspec +2 -1
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/attribute_builder.rb +58 -3
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/attribute_compiler.rb +45 -32
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/attribute_parser.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/buffer.rb +0 -56
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/compiler.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/engine.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/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.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/exec.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/filters.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/generator.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/helpers/action_view_extensions.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/helpers/action_view_mods.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/helpers/action_view_xss_mods.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/helpers/safe_erubi_template.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/helpers/safe_erubis_template.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/helpers/xss_mods.rb +6 -3
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/helpers.rb +7 -1
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/options.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/parser.rb +32 -4
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/plugin.rb +18 -1
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/railtie.rb +5 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/sass_rails_filter.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/template/options.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/template.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/temple_engine.rb +2 -1
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/temple_line_counter.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/util.rb +1 -1
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml/version.rb +1 -1
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/lib/haml.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/yard/default/fulldoc/html/css/common.sass +0 -0
- data/bundle/ruby/{2.6.0/gems/haml-5.1.2 → 2.7.0/gems/haml-5.2.2}/yard/default/layout/html/footer.erb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/AUTHORS +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/COPYING +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/Changelog.md +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/Gemfile +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/LICENSE +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/README.md +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/TODO +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/appveyor.yml +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/highline.gemspec +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/builtin_styles.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/color_scheme.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/compatibility.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/custom_errors.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/import.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/io_console_compatible.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/list.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/list_renderer.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/menu/item.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/menu.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/paginator.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/question/answer_converter.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/question.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/question_asker.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/simulate.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/statement.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/string.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/string_extensions.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/style.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/template_renderer.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/terminal/io_console.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/terminal/ncurses.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/terminal/unix_stty.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/terminal.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/version.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline/wrapper.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/highline-2.0.3/lib/highline.rb +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.6.0 → 2.7.0}/gems/ruby2ruby-2.4.4/History.rdoc +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby2ruby-2.4.4/Manifest.txt +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby2ruby-2.4.4/README.rdoc +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby2ruby-2.4.4/lib/ruby2ruby.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/History.rdoc +154 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/Manifest.txt +7 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/README.rdoc +1 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/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.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/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.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/lib/ruby20_parser.y +422 -301
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby21_parser.rb +7182 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/lib/ruby21_parser.y +417 -298
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby22_parser.rb +7228 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/lib/ruby22_parser.y +421 -300
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby23_parser.rb +7237 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/lib/ruby23_parser.y +421 -300
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby24_parser.rb +7268 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/lib/ruby24_parser.y +421 -300
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby25_parser.rb +7268 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1/lib/ruby26_parser.y → 2.7.0/gems/ruby_parser-3.18.1/lib/ruby25_parser.y} +420 -313
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby26_parser.rb +7287 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1/lib/ruby_parser.yy → 2.7.0/gems/ruby_parser-3.18.1/lib/ruby26_parser.y} +421 -404
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby27_parser.rb +8517 -0
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1/lib/ruby25_parser.y → 2.7.0/gems/ruby_parser-3.18.1/lib/ruby27_parser.y} +1032 -299
- 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.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/lib/ruby_lexer.rb +308 -605
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/lib/ruby_lexer.rex +33 -27
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/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.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/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.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/lib/ruby_parser_extras.rb +341 -133
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/tools/munge.rb +43 -10
- data/bundle/ruby/{2.6.0/gems/ruby_parser-3.14.1 → 2.7.0/gems/ruby_parser-3.18.1}/tools/ripper.rb +15 -10
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/History.rdoc +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/Manifest.txt +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/README.rdoc +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby18_parser.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby18_parser.y +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby19_parser.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby19_parser.y +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rex +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rex.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_parser.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_parser_extras.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/CHANGES.md +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/Gemfile +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/LICENSE.txt +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/README.md +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/bundle_install_all_ruby_versions.sh +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/deep.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/libyaml_checker.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/parse/date.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/parse/hexadecimal.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/parse/sexagesimal.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_handler.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/resolver.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/safe_to_ruby_visitor.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/syck_hack.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/syck_node_monkeypatch.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/syck_resolver.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_boolean.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_date.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_float.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_integer.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_nil.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/to_symbol.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform/transformation_map.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/transform.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml/version.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/lib/safe_yaml.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/run_specs_all_ruby_versions.sh +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/safe_yaml-1.0.5/safe_yaml.gemspec +0 -0
- data/bundle/ruby/{2.6.0/gems/sexp_processor-4.13.0 → 2.7.0/gems/sexp_processor-4.16.0}/History.rdoc +55 -0
- data/bundle/ruby/{2.6.0/gems/sexp_processor-4.13.0 → 2.7.0/gems/sexp_processor-4.16.0}/Manifest.txt +0 -0
- data/bundle/ruby/{2.6.0/gems/sexp_processor-4.13.0 → 2.7.0/gems/sexp_processor-4.16.0}/README.rdoc +0 -0
- data/bundle/ruby/{2.6.0/gems/sexp_processor-4.13.0 → 2.7.0/gems/sexp_processor-4.16.0}/lib/composite_sexp_processor.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/sexp_processor-4.13.0 → 2.7.0/gems/sexp_processor-4.16.0}/lib/pt_testcase.rb +9 -4
- data/bundle/ruby/{2.6.0/gems/sexp_processor-4.13.0 → 2.7.0/gems/sexp_processor-4.16.0}/lib/sexp.rb +19 -9
- data/bundle/ruby/{2.6.0/gems/sexp_processor-4.13.0 → 2.7.0/gems/sexp_processor-4.16.0}/lib/sexp_matcher.rb +44 -7
- data/bundle/ruby/{2.6.0/gems/sexp_processor-4.13.0 → 2.7.0/gems/sexp_processor-4.16.0}/lib/sexp_processor.rb +1 -1
- data/bundle/ruby/{2.6.0/gems/sexp_processor-4.13.0 → 2.7.0/gems/sexp_processor-4.16.0}/lib/strict_sexp.rb +25 -3
- data/bundle/ruby/{2.6.0/gems/sexp_processor-4.13.0 → 2.7.0/gems/sexp_processor-4.16.0}/lib/unique.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/CHANGES +4 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/Gemfile +12 -13
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/LICENSE +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/README.jp.md +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/README.md +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/code_attributes.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/command.rb +13 -13
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/controls.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/do_inserter.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/embedded.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/end_inserter.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/engine.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/erb_converter.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/filter.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/grammar.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/include.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/interpolation.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/logic_less/context.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/logic_less/filter.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/logic_less.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/parser.rb +1 -1
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart/escaper.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart/filter.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart/parser.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/smart.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/splat/builder.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/splat/filter.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/template.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/translator.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim/version.rb +1 -1
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/lib/slim.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/slim-4.0.1 → 2.7.0/gems/slim-4.1.0}/slim.gemspec +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/CHANGES +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/EXPRESSIONS.md +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/Gemfile +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/LICENSE +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/README.md +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/engine.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/erb/engine.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/erb/parser.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/erb/template.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/erb/trimming.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/exceptions.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filter.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/code_merger.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/control_flow.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/dynamic_inliner.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/encoding.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/eraser.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/escapable.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/remove_bom.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/static_analyzer.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/static_merger.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/string_splitter.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/filters/validator.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/generator.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/generators/array.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/generators/array_buffer.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/generators/erb.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/generators/rails_output_buffer.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/generators/string_buffer.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/grammar.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/html/attribute_merger.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/html/attribute_remover.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/html/attribute_sorter.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/html/dispatcher.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/html/fast.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/html/filter.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/html/pretty.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/html/safe.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/map.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/mixins/dispatcher.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/mixins/engine_dsl.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/mixins/grammar_dsl.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/mixins/options.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/mixins/template.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/parser.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/static_analyzer.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/templates/rails.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/templates/tilt.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/templates.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/utils.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple/version.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/lib/temple.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/temple-0.8.2/temple.gemspec +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/Gemfile +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/History.rdoc +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/LICENSE.txt +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/Manifest +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/README.rdoc +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/Todo.rdoc +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/cell.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/import.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/row.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/separator.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/style.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/table.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/table_helper.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table/version.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/lib/terminal-table.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/terminal-table-1.8.0/terminal-table.gemspec +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/COPYING +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/asciidoc.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/babel.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/bluecloth.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/builder.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/coffee.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/commonmarker.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/creole.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/csv.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/dummy.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/erb.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/erubi.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/erubis.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/etanni.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/haml.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/kramdown.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/less.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/liquid.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/livescript.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/mapping.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/markaby.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/maruku.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/nokogiri.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/pandoc.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/plain.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/prawn.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/radius.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/rdiscount.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/rdoc.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/redcarpet.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/redcloth.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/rst-pandoc.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/sass.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/sigil.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/string.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/template.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/typescript.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/wikicloth.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt/yajl.rb +0 -0
- data/bundle/ruby/{2.6.0 → 2.7.0}/gems/tilt-2.0.10/lib/tilt.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.8.0}/CHANGELOG.md +12 -0
- data/bundle/ruby/{2.6.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.8.0}/MIT-LICENSE.txt +1 -1
- data/bundle/ruby/{2.6.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.8.0}/README.md +3 -3
- data/bundle/ruby/2.7.0/gems/unicode-display_width-1.8.0/data/display_width.marshal.gz +0 -0
- data/bundle/ruby/{2.6.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.8.0}/lib/unicode/display_width/constants.rb +2 -2
- data/bundle/ruby/{2.6.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.8.0}/lib/unicode/display_width/index.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.8.0}/lib/unicode/display_width/no_string_ext.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.8.0}/lib/unicode/display_width/string_ext.rb +0 -0
- data/bundle/ruby/{2.6.0/gems/unicode-display_width-1.6.0 → 2.7.0/gems/unicode-display_width-1.8.0}/lib/unicode/display_width.rb +1 -1
- data/lib/brakeman/app_tree.rb +37 -4
- data/lib/brakeman/checks/base_check.rb +30 -11
- data/lib/brakeman/checks/check_basic_auth.rb +2 -0
- data/lib/brakeman/checks/check_content_tag.rb +1 -2
- 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 +52 -6
- 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_link_to.rb +1 -1
- data/lib/brakeman/checks/check_link_to_href.rb +1 -3
- 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 -20
- 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/differ.rb +0 -5
- 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 +30 -14
- 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 +10 -2
- 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 +104 -0
- data/lib/brakeman/report/report_markdown.rb +0 -1
- 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 +22 -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 +88 -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 +49 -6
- data/lib/ruby_parser/bm_sexp.rb +33 -9
- metadata +430 -351
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/escapable.rb +0 -50
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.1/debugging.md +0 -18
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.1/lib/rp_stringscanner.rb +0 -64
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.1/lib/ruby20_parser.rb +0 -7045
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.1/lib/ruby21_parser.rb +0 -7116
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.1/lib/ruby22_parser.rb +0 -7149
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.1/lib/ruby23_parser.rb +0 -7166
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.1/lib/ruby24_parser.rb +0 -7178
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.1/lib/ruby25_parser.rb +0 -7178
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.1/lib/ruby26_parser.rb +0 -7198
- data/bundle/ruby/2.6.0/gems/unicode-display_width-1.6.0/data/display_width.marshal.gz +0 -0
@@ -0,0 +1,974 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
require "pp"
|
4
|
+
|
5
|
+
require_relative 'namespace'
|
6
|
+
require_relative 'xmltokens'
|
7
|
+
require_relative 'attribute'
|
8
|
+
require_relative 'parsers/xpathparser'
|
9
|
+
|
10
|
+
module REXML
|
11
|
+
module DClonable
|
12
|
+
refine Object do
|
13
|
+
# provides a unified +clone+ operation, for REXML::XPathParser
|
14
|
+
# to use across multiple Object types
|
15
|
+
def dclone
|
16
|
+
clone
|
17
|
+
end
|
18
|
+
end
|
19
|
+
refine Symbol do
|
20
|
+
# provides a unified +clone+ operation, for REXML::XPathParser
|
21
|
+
# to use across multiple Object types
|
22
|
+
def dclone ; self ; end
|
23
|
+
end
|
24
|
+
refine Integer do
|
25
|
+
# provides a unified +clone+ operation, for REXML::XPathParser
|
26
|
+
# to use across multiple Object types
|
27
|
+
def dclone ; self ; end
|
28
|
+
end
|
29
|
+
refine Float do
|
30
|
+
# provides a unified +clone+ operation, for REXML::XPathParser
|
31
|
+
# to use across multiple Object types
|
32
|
+
def dclone ; self ; end
|
33
|
+
end
|
34
|
+
refine Array do
|
35
|
+
# provides a unified +clone+ operation, for REXML::XPathParser
|
36
|
+
# to use across multiple Object+ types
|
37
|
+
def dclone
|
38
|
+
klone = self.clone
|
39
|
+
klone.clear
|
40
|
+
self.each{|v| klone << v.dclone}
|
41
|
+
klone
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
using REXML::DClonable
|
48
|
+
|
49
|
+
module REXML
|
50
|
+
# You don't want to use this class. Really. Use XPath, which is a wrapper
|
51
|
+
# for this class. Believe me. You don't want to poke around in here.
|
52
|
+
# There is strange, dark magic at work in this code. Beware. Go back! Go
|
53
|
+
# back while you still can!
|
54
|
+
class XPathParser
|
55
|
+
include XMLTokens
|
56
|
+
LITERAL = /^'([^']*)'|^"([^"]*)"/u
|
57
|
+
|
58
|
+
DEBUG = (ENV["REXML_XPATH_PARSER_DEBUG"] == "true")
|
59
|
+
|
60
|
+
def initialize(strict: false)
|
61
|
+
@debug = DEBUG
|
62
|
+
@parser = REXML::Parsers::XPathParser.new
|
63
|
+
@namespaces = nil
|
64
|
+
@variables = {}
|
65
|
+
@nest = 0
|
66
|
+
@strict = strict
|
67
|
+
end
|
68
|
+
|
69
|
+
def namespaces=( namespaces={} )
|
70
|
+
Functions::namespace_context = namespaces
|
71
|
+
@namespaces = namespaces
|
72
|
+
end
|
73
|
+
|
74
|
+
def variables=( vars={} )
|
75
|
+
Functions::variables = vars
|
76
|
+
@variables = vars
|
77
|
+
end
|
78
|
+
|
79
|
+
def parse path, nodeset
|
80
|
+
path_stack = @parser.parse( path )
|
81
|
+
match( path_stack, nodeset )
|
82
|
+
end
|
83
|
+
|
84
|
+
def get_first path, nodeset
|
85
|
+
path_stack = @parser.parse( path )
|
86
|
+
first( path_stack, nodeset )
|
87
|
+
end
|
88
|
+
|
89
|
+
def predicate path, nodeset
|
90
|
+
path_stack = @parser.parse( path )
|
91
|
+
match( path_stack, nodeset )
|
92
|
+
end
|
93
|
+
|
94
|
+
def []=( variable_name, value )
|
95
|
+
@variables[ variable_name ] = value
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
# Performs a depth-first (document order) XPath search, and returns the
|
100
|
+
# first match. This is the fastest, lightest way to return a single result.
|
101
|
+
#
|
102
|
+
# FIXME: This method is incomplete!
|
103
|
+
def first( path_stack, node )
|
104
|
+
return nil if path.size == 0
|
105
|
+
|
106
|
+
case path[0]
|
107
|
+
when :document
|
108
|
+
# do nothing
|
109
|
+
return first( path[1..-1], node )
|
110
|
+
when :child
|
111
|
+
for c in node.children
|
112
|
+
r = first( path[1..-1], c )
|
113
|
+
return r if r
|
114
|
+
end
|
115
|
+
when :qname
|
116
|
+
name = path[2]
|
117
|
+
if node.name == name
|
118
|
+
return node if path.size == 3
|
119
|
+
return first( path[3..-1], node )
|
120
|
+
else
|
121
|
+
return nil
|
122
|
+
end
|
123
|
+
when :descendant_or_self
|
124
|
+
r = first( path[1..-1], node )
|
125
|
+
return r if r
|
126
|
+
for c in node.children
|
127
|
+
r = first( path, c )
|
128
|
+
return r if r
|
129
|
+
end
|
130
|
+
when :node
|
131
|
+
return first( path[1..-1], node )
|
132
|
+
when :any
|
133
|
+
return first( path[1..-1], node )
|
134
|
+
end
|
135
|
+
return nil
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
def match(path_stack, nodeset)
|
140
|
+
nodeset = nodeset.collect.with_index do |node, i|
|
141
|
+
position = i + 1
|
142
|
+
XPathNode.new(node, position: position)
|
143
|
+
end
|
144
|
+
result = expr(path_stack, nodeset)
|
145
|
+
case result
|
146
|
+
when Array # nodeset
|
147
|
+
unnode(result)
|
148
|
+
else
|
149
|
+
[result]
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
private
|
154
|
+
def strict?
|
155
|
+
@strict
|
156
|
+
end
|
157
|
+
|
158
|
+
# Returns a String namespace for a node, given a prefix
|
159
|
+
# The rules are:
|
160
|
+
#
|
161
|
+
# 1. Use the supplied namespace mapping first.
|
162
|
+
# 2. If no mapping was supplied, use the context node to look up the namespace
|
163
|
+
def get_namespace( node, prefix )
|
164
|
+
if @namespaces
|
165
|
+
return @namespaces[prefix] || ''
|
166
|
+
else
|
167
|
+
return node.namespace( prefix ) if node.node_type == :element
|
168
|
+
return ''
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
# Expr takes a stack of path elements and a set of nodes (either a Parent
|
174
|
+
# or an Array and returns an Array of matching nodes
|
175
|
+
def expr( path_stack, nodeset, context=nil )
|
176
|
+
enter(:expr, path_stack, nodeset) if @debug
|
177
|
+
return nodeset if path_stack.length == 0 || nodeset.length == 0
|
178
|
+
while path_stack.length > 0
|
179
|
+
trace(:while, path_stack, nodeset) if @debug
|
180
|
+
if nodeset.length == 0
|
181
|
+
path_stack.clear
|
182
|
+
return []
|
183
|
+
end
|
184
|
+
op = path_stack.shift
|
185
|
+
case op
|
186
|
+
when :document
|
187
|
+
first_raw_node = nodeset.first.raw_node
|
188
|
+
nodeset = [XPathNode.new(first_raw_node.root_node, position: 1)]
|
189
|
+
when :self
|
190
|
+
nodeset = step(path_stack) do
|
191
|
+
[nodeset]
|
192
|
+
end
|
193
|
+
when :child
|
194
|
+
nodeset = step(path_stack) do
|
195
|
+
child(nodeset)
|
196
|
+
end
|
197
|
+
when :literal
|
198
|
+
trace(:literal, path_stack, nodeset) if @debug
|
199
|
+
return path_stack.shift
|
200
|
+
when :attribute
|
201
|
+
nodeset = step(path_stack, any_type: :attribute) do
|
202
|
+
nodesets = []
|
203
|
+
nodeset.each do |node|
|
204
|
+
raw_node = node.raw_node
|
205
|
+
next unless raw_node.node_type == :element
|
206
|
+
attributes = raw_node.attributes
|
207
|
+
next if attributes.empty?
|
208
|
+
nodesets << attributes.each_attribute.collect.with_index do |attribute, i|
|
209
|
+
XPathNode.new(attribute, position: i + 1)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
nodesets
|
213
|
+
end
|
214
|
+
when :namespace
|
215
|
+
pre_defined_namespaces = {
|
216
|
+
"xml" => "http://www.w3.org/XML/1998/namespace",
|
217
|
+
}
|
218
|
+
nodeset = step(path_stack, any_type: :namespace) do
|
219
|
+
nodesets = []
|
220
|
+
nodeset.each do |node|
|
221
|
+
raw_node = node.raw_node
|
222
|
+
case raw_node.node_type
|
223
|
+
when :element
|
224
|
+
if @namespaces
|
225
|
+
nodesets << pre_defined_namespaces.merge(@namespaces)
|
226
|
+
else
|
227
|
+
nodesets << pre_defined_namespaces.merge(raw_node.namespaces)
|
228
|
+
end
|
229
|
+
when :attribute
|
230
|
+
if @namespaces
|
231
|
+
nodesets << pre_defined_namespaces.merge(@namespaces)
|
232
|
+
else
|
233
|
+
nodesets << pre_defined_namespaces.merge(raw_node.element.namespaces)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
nodesets
|
238
|
+
end
|
239
|
+
when :parent
|
240
|
+
nodeset = step(path_stack) do
|
241
|
+
nodesets = []
|
242
|
+
nodeset.each do |node|
|
243
|
+
raw_node = node.raw_node
|
244
|
+
if raw_node.node_type == :attribute
|
245
|
+
parent = raw_node.element
|
246
|
+
else
|
247
|
+
parent = raw_node.parent
|
248
|
+
end
|
249
|
+
nodesets << [XPathNode.new(parent, position: 1)] if parent
|
250
|
+
end
|
251
|
+
nodesets
|
252
|
+
end
|
253
|
+
when :ancestor
|
254
|
+
nodeset = step(path_stack) do
|
255
|
+
nodesets = []
|
256
|
+
# new_nodes = {}
|
257
|
+
nodeset.each do |node|
|
258
|
+
raw_node = node.raw_node
|
259
|
+
new_nodeset = []
|
260
|
+
while raw_node.parent
|
261
|
+
raw_node = raw_node.parent
|
262
|
+
# next if new_nodes.key?(node)
|
263
|
+
new_nodeset << XPathNode.new(raw_node,
|
264
|
+
position: new_nodeset.size + 1)
|
265
|
+
# new_nodes[node] = true
|
266
|
+
end
|
267
|
+
nodesets << new_nodeset unless new_nodeset.empty?
|
268
|
+
end
|
269
|
+
nodesets
|
270
|
+
end
|
271
|
+
when :ancestor_or_self
|
272
|
+
nodeset = step(path_stack) do
|
273
|
+
nodesets = []
|
274
|
+
# new_nodes = {}
|
275
|
+
nodeset.each do |node|
|
276
|
+
raw_node = node.raw_node
|
277
|
+
next unless raw_node.node_type == :element
|
278
|
+
new_nodeset = [XPathNode.new(raw_node, position: 1)]
|
279
|
+
# new_nodes[node] = true
|
280
|
+
while raw_node.parent
|
281
|
+
raw_node = raw_node.parent
|
282
|
+
# next if new_nodes.key?(node)
|
283
|
+
new_nodeset << XPathNode.new(raw_node,
|
284
|
+
position: new_nodeset.size + 1)
|
285
|
+
# new_nodes[node] = true
|
286
|
+
end
|
287
|
+
nodesets << new_nodeset unless new_nodeset.empty?
|
288
|
+
end
|
289
|
+
nodesets
|
290
|
+
end
|
291
|
+
when :descendant_or_self
|
292
|
+
nodeset = step(path_stack) do
|
293
|
+
descendant(nodeset, true)
|
294
|
+
end
|
295
|
+
when :descendant
|
296
|
+
nodeset = step(path_stack) do
|
297
|
+
descendant(nodeset, false)
|
298
|
+
end
|
299
|
+
when :following_sibling
|
300
|
+
nodeset = step(path_stack) do
|
301
|
+
nodesets = []
|
302
|
+
nodeset.each do |node|
|
303
|
+
raw_node = node.raw_node
|
304
|
+
next unless raw_node.respond_to?(:parent)
|
305
|
+
next if raw_node.parent.nil?
|
306
|
+
all_siblings = raw_node.parent.children
|
307
|
+
current_index = all_siblings.index(raw_node)
|
308
|
+
following_siblings = all_siblings[(current_index + 1)..-1]
|
309
|
+
next if following_siblings.empty?
|
310
|
+
nodesets << following_siblings.collect.with_index do |sibling, i|
|
311
|
+
XPathNode.new(sibling, position: i + 1)
|
312
|
+
end
|
313
|
+
end
|
314
|
+
nodesets
|
315
|
+
end
|
316
|
+
when :preceding_sibling
|
317
|
+
nodeset = step(path_stack, order: :reverse) do
|
318
|
+
nodesets = []
|
319
|
+
nodeset.each do |node|
|
320
|
+
raw_node = node.raw_node
|
321
|
+
next unless raw_node.respond_to?(:parent)
|
322
|
+
next if raw_node.parent.nil?
|
323
|
+
all_siblings = raw_node.parent.children
|
324
|
+
current_index = all_siblings.index(raw_node)
|
325
|
+
preceding_siblings = all_siblings[0, current_index].reverse
|
326
|
+
next if preceding_siblings.empty?
|
327
|
+
nodesets << preceding_siblings.collect.with_index do |sibling, i|
|
328
|
+
XPathNode.new(sibling, position: i + 1)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
nodesets
|
332
|
+
end
|
333
|
+
when :preceding
|
334
|
+
nodeset = step(path_stack, order: :reverse) do
|
335
|
+
unnode(nodeset) do |node|
|
336
|
+
preceding(node)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
when :following
|
340
|
+
nodeset = step(path_stack) do
|
341
|
+
unnode(nodeset) do |node|
|
342
|
+
following(node)
|
343
|
+
end
|
344
|
+
end
|
345
|
+
when :variable
|
346
|
+
var_name = path_stack.shift
|
347
|
+
return [@variables[var_name]]
|
348
|
+
|
349
|
+
when :eq, :neq, :lt, :lteq, :gt, :gteq
|
350
|
+
left = expr( path_stack.shift, nodeset.dup, context )
|
351
|
+
right = expr( path_stack.shift, nodeset.dup, context )
|
352
|
+
res = equality_relational_compare( left, op, right )
|
353
|
+
trace(op, left, right, res) if @debug
|
354
|
+
return res
|
355
|
+
|
356
|
+
when :or
|
357
|
+
left = expr(path_stack.shift, nodeset.dup, context)
|
358
|
+
return true if Functions.boolean(left)
|
359
|
+
right = expr(path_stack.shift, nodeset.dup, context)
|
360
|
+
return Functions.boolean(right)
|
361
|
+
|
362
|
+
when :and
|
363
|
+
left = expr(path_stack.shift, nodeset.dup, context)
|
364
|
+
return false unless Functions.boolean(left)
|
365
|
+
right = expr(path_stack.shift, nodeset.dup, context)
|
366
|
+
return Functions.boolean(right)
|
367
|
+
|
368
|
+
when :div, :mod, :mult, :plus, :minus
|
369
|
+
left = expr(path_stack.shift, nodeset, context)
|
370
|
+
right = expr(path_stack.shift, nodeset, context)
|
371
|
+
left = unnode(left) if left.is_a?(Array)
|
372
|
+
right = unnode(right) if right.is_a?(Array)
|
373
|
+
left = Functions::number(left)
|
374
|
+
right = Functions::number(right)
|
375
|
+
case op
|
376
|
+
when :div
|
377
|
+
return left / right
|
378
|
+
when :mod
|
379
|
+
return left % right
|
380
|
+
when :mult
|
381
|
+
return left * right
|
382
|
+
when :plus
|
383
|
+
return left + right
|
384
|
+
when :minus
|
385
|
+
return left - right
|
386
|
+
else
|
387
|
+
raise "[BUG] Unexpected operator: <#{op.inspect}>"
|
388
|
+
end
|
389
|
+
when :union
|
390
|
+
left = expr( path_stack.shift, nodeset, context )
|
391
|
+
right = expr( path_stack.shift, nodeset, context )
|
392
|
+
left = unnode(left) if left.is_a?(Array)
|
393
|
+
right = unnode(right) if right.is_a?(Array)
|
394
|
+
return (left | right)
|
395
|
+
when :neg
|
396
|
+
res = expr( path_stack, nodeset, context )
|
397
|
+
res = unnode(res) if res.is_a?(Array)
|
398
|
+
return -Functions.number(res)
|
399
|
+
when :not
|
400
|
+
when :function
|
401
|
+
func_name = path_stack.shift.tr('-','_')
|
402
|
+
arguments = path_stack.shift
|
403
|
+
|
404
|
+
if nodeset.size != 1
|
405
|
+
message = "[BUG] Node set size must be 1 for function call: "
|
406
|
+
message += "<#{func_name}>: <#{nodeset.inspect}>: "
|
407
|
+
message += "<#{arguments.inspect}>"
|
408
|
+
raise message
|
409
|
+
end
|
410
|
+
|
411
|
+
node = nodeset.first
|
412
|
+
if context
|
413
|
+
target_context = context
|
414
|
+
else
|
415
|
+
target_context = {:size => nodeset.size}
|
416
|
+
if node.is_a?(XPathNode)
|
417
|
+
target_context[:node] = node.raw_node
|
418
|
+
target_context[:index] = node.position
|
419
|
+
else
|
420
|
+
target_context[:node] = node
|
421
|
+
target_context[:index] = 1
|
422
|
+
end
|
423
|
+
end
|
424
|
+
args = arguments.dclone.collect do |arg|
|
425
|
+
result = expr(arg, nodeset, target_context)
|
426
|
+
result = unnode(result) if result.is_a?(Array)
|
427
|
+
result
|
428
|
+
end
|
429
|
+
Functions.context = target_context
|
430
|
+
return Functions.send(func_name, *args)
|
431
|
+
|
432
|
+
else
|
433
|
+
raise "[BUG] Unexpected path: <#{op.inspect}>: <#{path_stack.inspect}>"
|
434
|
+
end
|
435
|
+
end # while
|
436
|
+
return nodeset
|
437
|
+
ensure
|
438
|
+
leave(:expr, path_stack, nodeset) if @debug
|
439
|
+
end
|
440
|
+
|
441
|
+
def step(path_stack, any_type: :element, order: :forward)
|
442
|
+
nodesets = yield
|
443
|
+
begin
|
444
|
+
enter(:step, path_stack, nodesets) if @debug
|
445
|
+
nodesets = node_test(path_stack, nodesets, any_type: any_type)
|
446
|
+
while path_stack[0] == :predicate
|
447
|
+
path_stack.shift # :predicate
|
448
|
+
predicate_expression = path_stack.shift.dclone
|
449
|
+
nodesets = evaluate_predicate(predicate_expression, nodesets)
|
450
|
+
end
|
451
|
+
if nodesets.size == 1
|
452
|
+
ordered_nodeset = nodesets[0]
|
453
|
+
else
|
454
|
+
raw_nodes = []
|
455
|
+
nodesets.each do |nodeset|
|
456
|
+
nodeset.each do |node|
|
457
|
+
if node.respond_to?(:raw_node)
|
458
|
+
raw_nodes << node.raw_node
|
459
|
+
else
|
460
|
+
raw_nodes << node
|
461
|
+
end
|
462
|
+
end
|
463
|
+
end
|
464
|
+
ordered_nodeset = sort(raw_nodes, order)
|
465
|
+
end
|
466
|
+
new_nodeset = []
|
467
|
+
ordered_nodeset.each do |node|
|
468
|
+
# TODO: Remove duplicated
|
469
|
+
new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1)
|
470
|
+
end
|
471
|
+
new_nodeset
|
472
|
+
ensure
|
473
|
+
leave(:step, path_stack, new_nodeset) if @debug
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
def node_test(path_stack, nodesets, any_type: :element)
|
478
|
+
enter(:node_test, path_stack, nodesets) if @debug
|
479
|
+
operator = path_stack.shift
|
480
|
+
case operator
|
481
|
+
when :qname
|
482
|
+
prefix = path_stack.shift
|
483
|
+
name = path_stack.shift
|
484
|
+
new_nodesets = nodesets.collect do |nodeset|
|
485
|
+
filter_nodeset(nodeset) do |node|
|
486
|
+
raw_node = node.raw_node
|
487
|
+
case raw_node.node_type
|
488
|
+
when :element
|
489
|
+
if prefix.nil?
|
490
|
+
raw_node.name == name
|
491
|
+
elsif prefix.empty?
|
492
|
+
if strict?
|
493
|
+
raw_node.name == name and raw_node.namespace == ""
|
494
|
+
else
|
495
|
+
# FIXME: This DOUBLES the time XPath searches take
|
496
|
+
ns = get_namespace(raw_node, prefix)
|
497
|
+
raw_node.name == name and raw_node.namespace == ns
|
498
|
+
end
|
499
|
+
else
|
500
|
+
# FIXME: This DOUBLES the time XPath searches take
|
501
|
+
ns = get_namespace(raw_node, prefix)
|
502
|
+
raw_node.name == name and raw_node.namespace == ns
|
503
|
+
end
|
504
|
+
when :attribute
|
505
|
+
if prefix.nil?
|
506
|
+
raw_node.name == name
|
507
|
+
elsif prefix.empty?
|
508
|
+
raw_node.name == name and raw_node.namespace == ""
|
509
|
+
else
|
510
|
+
# FIXME: This DOUBLES the time XPath searches take
|
511
|
+
ns = get_namespace(raw_node.element, prefix)
|
512
|
+
raw_node.name == name and raw_node.namespace == ns
|
513
|
+
end
|
514
|
+
else
|
515
|
+
false
|
516
|
+
end
|
517
|
+
end
|
518
|
+
end
|
519
|
+
when :namespace
|
520
|
+
prefix = path_stack.shift
|
521
|
+
new_nodesets = nodesets.collect do |nodeset|
|
522
|
+
filter_nodeset(nodeset) do |node|
|
523
|
+
raw_node = node.raw_node
|
524
|
+
case raw_node.node_type
|
525
|
+
when :element
|
526
|
+
namespaces = @namespaces || raw_node.namespaces
|
527
|
+
raw_node.namespace == namespaces[prefix]
|
528
|
+
when :attribute
|
529
|
+
namespaces = @namespaces || raw_node.element.namespaces
|
530
|
+
raw_node.namespace == namespaces[prefix]
|
531
|
+
else
|
532
|
+
false
|
533
|
+
end
|
534
|
+
end
|
535
|
+
end
|
536
|
+
when :any
|
537
|
+
new_nodesets = nodesets.collect do |nodeset|
|
538
|
+
filter_nodeset(nodeset) do |node|
|
539
|
+
raw_node = node.raw_node
|
540
|
+
raw_node.node_type == any_type
|
541
|
+
end
|
542
|
+
end
|
543
|
+
when :comment
|
544
|
+
new_nodesets = nodesets.collect do |nodeset|
|
545
|
+
filter_nodeset(nodeset) do |node|
|
546
|
+
raw_node = node.raw_node
|
547
|
+
raw_node.node_type == :comment
|
548
|
+
end
|
549
|
+
end
|
550
|
+
when :text
|
551
|
+
new_nodesets = nodesets.collect do |nodeset|
|
552
|
+
filter_nodeset(nodeset) do |node|
|
553
|
+
raw_node = node.raw_node
|
554
|
+
raw_node.node_type == :text
|
555
|
+
end
|
556
|
+
end
|
557
|
+
when :processing_instruction
|
558
|
+
target = path_stack.shift
|
559
|
+
new_nodesets = nodesets.collect do |nodeset|
|
560
|
+
filter_nodeset(nodeset) do |node|
|
561
|
+
raw_node = node.raw_node
|
562
|
+
(raw_node.node_type == :processing_instruction) and
|
563
|
+
(target.empty? or (raw_node.target == target))
|
564
|
+
end
|
565
|
+
end
|
566
|
+
when :node
|
567
|
+
new_nodesets = nodesets.collect do |nodeset|
|
568
|
+
filter_nodeset(nodeset) do |node|
|
569
|
+
true
|
570
|
+
end
|
571
|
+
end
|
572
|
+
else
|
573
|
+
message = "[BUG] Unexpected node test: " +
|
574
|
+
"<#{operator.inspect}>: <#{path_stack.inspect}>"
|
575
|
+
raise message
|
576
|
+
end
|
577
|
+
new_nodesets
|
578
|
+
ensure
|
579
|
+
leave(:node_test, path_stack, new_nodesets) if @debug
|
580
|
+
end
|
581
|
+
|
582
|
+
def filter_nodeset(nodeset)
|
583
|
+
new_nodeset = []
|
584
|
+
nodeset.each do |node|
|
585
|
+
next unless yield(node)
|
586
|
+
new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1)
|
587
|
+
end
|
588
|
+
new_nodeset
|
589
|
+
end
|
590
|
+
|
591
|
+
def evaluate_predicate(expression, nodesets)
|
592
|
+
enter(:predicate, expression, nodesets) if @debug
|
593
|
+
new_nodesets = nodesets.collect do |nodeset|
|
594
|
+
new_nodeset = []
|
595
|
+
subcontext = { :size => nodeset.size }
|
596
|
+
nodeset.each_with_index do |node, index|
|
597
|
+
if node.is_a?(XPathNode)
|
598
|
+
subcontext[:node] = node.raw_node
|
599
|
+
subcontext[:index] = node.position
|
600
|
+
else
|
601
|
+
subcontext[:node] = node
|
602
|
+
subcontext[:index] = index + 1
|
603
|
+
end
|
604
|
+
result = expr(expression.dclone, [node], subcontext)
|
605
|
+
trace(:predicate_evaluate, expression, node, subcontext, result) if @debug
|
606
|
+
result = result[0] if result.kind_of? Array and result.length == 1
|
607
|
+
if result.kind_of? Numeric
|
608
|
+
if result == node.position
|
609
|
+
new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1)
|
610
|
+
end
|
611
|
+
elsif result.instance_of? Array
|
612
|
+
if result.size > 0 and result.inject(false) {|k,s| s or k}
|
613
|
+
if result.size > 0
|
614
|
+
new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1)
|
615
|
+
end
|
616
|
+
end
|
617
|
+
else
|
618
|
+
if result
|
619
|
+
new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1)
|
620
|
+
end
|
621
|
+
end
|
622
|
+
end
|
623
|
+
new_nodeset
|
624
|
+
end
|
625
|
+
new_nodesets
|
626
|
+
ensure
|
627
|
+
leave(:predicate, new_nodesets) if @debug
|
628
|
+
end
|
629
|
+
|
630
|
+
def trace(*args)
|
631
|
+
indent = " " * @nest
|
632
|
+
PP.pp(args, "").each_line do |line|
|
633
|
+
puts("#{indent}#{line}")
|
634
|
+
end
|
635
|
+
end
|
636
|
+
|
637
|
+
def enter(tag, *args)
|
638
|
+
trace(:enter, tag, *args)
|
639
|
+
@nest += 1
|
640
|
+
end
|
641
|
+
|
642
|
+
def leave(tag, *args)
|
643
|
+
@nest -= 1
|
644
|
+
trace(:leave, tag, *args)
|
645
|
+
end
|
646
|
+
|
647
|
+
# Reorders an array of nodes so that they are in document order
|
648
|
+
# It tries to do this efficiently.
|
649
|
+
#
|
650
|
+
# FIXME: I need to get rid of this, but the issue is that most of the XPath
|
651
|
+
# interpreter functions as a filter, which means that we lose context going
|
652
|
+
# in and out of function calls. If I knew what the index of the nodes was,
|
653
|
+
# I wouldn't have to do this. Maybe add a document IDX for each node?
|
654
|
+
# Problems with mutable documents. Or, rewrite everything.
|
655
|
+
def sort(array_of_nodes, order)
|
656
|
+
new_arry = []
|
657
|
+
array_of_nodes.each { |node|
|
658
|
+
node_idx = []
|
659
|
+
np = node.node_type == :attribute ? node.element : node
|
660
|
+
while np.parent and np.parent.node_type == :element
|
661
|
+
node_idx << np.parent.index( np )
|
662
|
+
np = np.parent
|
663
|
+
end
|
664
|
+
new_arry << [ node_idx.reverse, node ]
|
665
|
+
}
|
666
|
+
ordered = new_arry.sort_by do |index, node|
|
667
|
+
if order == :forward
|
668
|
+
index
|
669
|
+
else
|
670
|
+
-index
|
671
|
+
end
|
672
|
+
end
|
673
|
+
ordered.collect do |_index, node|
|
674
|
+
node
|
675
|
+
end
|
676
|
+
end
|
677
|
+
|
678
|
+
def descendant(nodeset, include_self)
|
679
|
+
nodesets = []
|
680
|
+
nodeset.each do |node|
|
681
|
+
new_nodeset = []
|
682
|
+
new_nodes = {}
|
683
|
+
descendant_recursive(node.raw_node, new_nodeset, new_nodes, include_self)
|
684
|
+
nodesets << new_nodeset unless new_nodeset.empty?
|
685
|
+
end
|
686
|
+
nodesets
|
687
|
+
end
|
688
|
+
|
689
|
+
def descendant_recursive(raw_node, new_nodeset, new_nodes, include_self)
|
690
|
+
if include_self
|
691
|
+
return if new_nodes.key?(raw_node)
|
692
|
+
new_nodeset << XPathNode.new(raw_node, position: new_nodeset.size + 1)
|
693
|
+
new_nodes[raw_node] = true
|
694
|
+
end
|
695
|
+
|
696
|
+
node_type = raw_node.node_type
|
697
|
+
if node_type == :element or node_type == :document
|
698
|
+
raw_node.children.each do |child|
|
699
|
+
descendant_recursive(child, new_nodeset, new_nodes, true)
|
700
|
+
end
|
701
|
+
end
|
702
|
+
end
|
703
|
+
|
704
|
+
# Builds a nodeset of all of the preceding nodes of the supplied node,
|
705
|
+
# in reverse document order
|
706
|
+
# preceding:: includes every element in the document that precedes this node,
|
707
|
+
# except for ancestors
|
708
|
+
def preceding(node)
|
709
|
+
ancestors = []
|
710
|
+
parent = node.parent
|
711
|
+
while parent
|
712
|
+
ancestors << parent
|
713
|
+
parent = parent.parent
|
714
|
+
end
|
715
|
+
|
716
|
+
precedings = []
|
717
|
+
preceding_node = preceding_node_of(node)
|
718
|
+
while preceding_node
|
719
|
+
if ancestors.include?(preceding_node)
|
720
|
+
ancestors.delete(preceding_node)
|
721
|
+
else
|
722
|
+
precedings << XPathNode.new(preceding_node,
|
723
|
+
position: precedings.size + 1)
|
724
|
+
end
|
725
|
+
preceding_node = preceding_node_of(preceding_node)
|
726
|
+
end
|
727
|
+
precedings
|
728
|
+
end
|
729
|
+
|
730
|
+
def preceding_node_of( node )
|
731
|
+
psn = node.previous_sibling_node
|
732
|
+
if psn.nil?
|
733
|
+
if node.parent.nil? or node.parent.class == Document
|
734
|
+
return nil
|
735
|
+
end
|
736
|
+
return node.parent
|
737
|
+
#psn = preceding_node_of( node.parent )
|
738
|
+
end
|
739
|
+
while psn and psn.kind_of? Element and psn.children.size > 0
|
740
|
+
psn = psn.children[-1]
|
741
|
+
end
|
742
|
+
psn
|
743
|
+
end
|
744
|
+
|
745
|
+
def following(node)
|
746
|
+
followings = []
|
747
|
+
following_node = next_sibling_node(node)
|
748
|
+
while following_node
|
749
|
+
followings << XPathNode.new(following_node,
|
750
|
+
position: followings.size + 1)
|
751
|
+
following_node = following_node_of(following_node)
|
752
|
+
end
|
753
|
+
followings
|
754
|
+
end
|
755
|
+
|
756
|
+
def following_node_of( node )
|
757
|
+
if node.kind_of? Element and node.children.size > 0
|
758
|
+
return node.children[0]
|
759
|
+
end
|
760
|
+
return next_sibling_node(node)
|
761
|
+
end
|
762
|
+
|
763
|
+
def next_sibling_node(node)
|
764
|
+
psn = node.next_sibling_node
|
765
|
+
while psn.nil?
|
766
|
+
if node.parent.nil? or node.parent.class == Document
|
767
|
+
return nil
|
768
|
+
end
|
769
|
+
node = node.parent
|
770
|
+
psn = node.next_sibling_node
|
771
|
+
end
|
772
|
+
return psn
|
773
|
+
end
|
774
|
+
|
775
|
+
def child(nodeset)
|
776
|
+
nodesets = []
|
777
|
+
nodeset.each do |node|
|
778
|
+
raw_node = node.raw_node
|
779
|
+
node_type = raw_node.node_type
|
780
|
+
# trace(:child, node_type, node)
|
781
|
+
case node_type
|
782
|
+
when :element
|
783
|
+
nodesets << raw_node.children.collect.with_index do |child_node, i|
|
784
|
+
XPathNode.new(child_node, position: i + 1)
|
785
|
+
end
|
786
|
+
when :document
|
787
|
+
new_nodeset = []
|
788
|
+
raw_node.children.each do |child|
|
789
|
+
case child
|
790
|
+
when XMLDecl, Text
|
791
|
+
# Ignore
|
792
|
+
else
|
793
|
+
new_nodeset << XPathNode.new(child, position: new_nodeset.size + 1)
|
794
|
+
end
|
795
|
+
end
|
796
|
+
nodesets << new_nodeset unless new_nodeset.empty?
|
797
|
+
end
|
798
|
+
end
|
799
|
+
nodesets
|
800
|
+
end
|
801
|
+
|
802
|
+
def norm b
|
803
|
+
case b
|
804
|
+
when true, false
|
805
|
+
return b
|
806
|
+
when 'true', 'false'
|
807
|
+
return Functions::boolean( b )
|
808
|
+
when /^\d+(\.\d+)?$/, Numeric
|
809
|
+
return Functions::number( b )
|
810
|
+
else
|
811
|
+
return Functions::string( b )
|
812
|
+
end
|
813
|
+
end
|
814
|
+
|
815
|
+
def equality_relational_compare(set1, op, set2)
|
816
|
+
set1 = unnode(set1) if set1.is_a?(Array)
|
817
|
+
set2 = unnode(set2) if set2.is_a?(Array)
|
818
|
+
|
819
|
+
if set1.kind_of? Array and set2.kind_of? Array
|
820
|
+
# If both objects to be compared are node-sets, then the
|
821
|
+
# comparison will be true if and only if there is a node in the
|
822
|
+
# first node-set and a node in the second node-set such that the
|
823
|
+
# result of performing the comparison on the string-values of
|
824
|
+
# the two nodes is true.
|
825
|
+
set1.product(set2).any? do |node1, node2|
|
826
|
+
node_string1 = Functions.string(node1)
|
827
|
+
node_string2 = Functions.string(node2)
|
828
|
+
compare(node_string1, op, node_string2)
|
829
|
+
end
|
830
|
+
elsif set1.kind_of? Array or set2.kind_of? Array
|
831
|
+
# If one is nodeset and other is number, compare number to each item
|
832
|
+
# in nodeset s.t. number op number(string(item))
|
833
|
+
# If one is nodeset and other is string, compare string to each item
|
834
|
+
# in nodeset s.t. string op string(item)
|
835
|
+
# If one is nodeset and other is boolean, compare boolean to each item
|
836
|
+
# in nodeset s.t. boolean op boolean(item)
|
837
|
+
if set1.kind_of? Array
|
838
|
+
a = set1
|
839
|
+
b = set2
|
840
|
+
else
|
841
|
+
a = set2
|
842
|
+
b = set1
|
843
|
+
end
|
844
|
+
|
845
|
+
case b
|
846
|
+
when true, false
|
847
|
+
each_unnode(a).any? do |unnoded|
|
848
|
+
compare(Functions.boolean(unnoded), op, b)
|
849
|
+
end
|
850
|
+
when Numeric
|
851
|
+
each_unnode(a).any? do |unnoded|
|
852
|
+
compare(Functions.number(unnoded), op, b)
|
853
|
+
end
|
854
|
+
when /\A\d+(\.\d+)?\z/
|
855
|
+
b = Functions.number(b)
|
856
|
+
each_unnode(a).any? do |unnoded|
|
857
|
+
compare(Functions.number(unnoded), op, b)
|
858
|
+
end
|
859
|
+
else
|
860
|
+
b = Functions::string(b)
|
861
|
+
each_unnode(a).any? do |unnoded|
|
862
|
+
compare(Functions::string(unnoded), op, b)
|
863
|
+
end
|
864
|
+
end
|
865
|
+
else
|
866
|
+
# If neither is nodeset,
|
867
|
+
# If op is = or !=
|
868
|
+
# If either boolean, convert to boolean
|
869
|
+
# If either number, convert to number
|
870
|
+
# Else, convert to string
|
871
|
+
# Else
|
872
|
+
# Convert both to numbers and compare
|
873
|
+
compare(set1, op, set2)
|
874
|
+
end
|
875
|
+
end
|
876
|
+
|
877
|
+
def value_type(value)
|
878
|
+
case value
|
879
|
+
when true, false
|
880
|
+
:boolean
|
881
|
+
when Numeric
|
882
|
+
:number
|
883
|
+
when String
|
884
|
+
:string
|
885
|
+
else
|
886
|
+
raise "[BUG] Unexpected value type: <#{value.inspect}>"
|
887
|
+
end
|
888
|
+
end
|
889
|
+
|
890
|
+
def normalize_compare_values(a, operator, b)
|
891
|
+
a_type = value_type(a)
|
892
|
+
b_type = value_type(b)
|
893
|
+
case operator
|
894
|
+
when :eq, :neq
|
895
|
+
if a_type == :boolean or b_type == :boolean
|
896
|
+
a = Functions.boolean(a) unless a_type == :boolean
|
897
|
+
b = Functions.boolean(b) unless b_type == :boolean
|
898
|
+
elsif a_type == :number or b_type == :number
|
899
|
+
a = Functions.number(a) unless a_type == :number
|
900
|
+
b = Functions.number(b) unless b_type == :number
|
901
|
+
else
|
902
|
+
a = Functions.string(a) unless a_type == :string
|
903
|
+
b = Functions.string(b) unless b_type == :string
|
904
|
+
end
|
905
|
+
when :lt, :lteq, :gt, :gteq
|
906
|
+
a = Functions.number(a) unless a_type == :number
|
907
|
+
b = Functions.number(b) unless b_type == :number
|
908
|
+
else
|
909
|
+
message = "[BUG] Unexpected compare operator: " +
|
910
|
+
"<#{operator.inspect}>: <#{a.inspect}>: <#{b.inspect}>"
|
911
|
+
raise message
|
912
|
+
end
|
913
|
+
[a, b]
|
914
|
+
end
|
915
|
+
|
916
|
+
def compare(a, operator, b)
|
917
|
+
a, b = normalize_compare_values(a, operator, b)
|
918
|
+
case operator
|
919
|
+
when :eq
|
920
|
+
a == b
|
921
|
+
when :neq
|
922
|
+
a != b
|
923
|
+
when :lt
|
924
|
+
a < b
|
925
|
+
when :lteq
|
926
|
+
a <= b
|
927
|
+
when :gt
|
928
|
+
a > b
|
929
|
+
when :gteq
|
930
|
+
a >= b
|
931
|
+
else
|
932
|
+
message = "[BUG] Unexpected compare operator: " +
|
933
|
+
"<#{operator.inspect}>: <#{a.inspect}>: <#{b.inspect}>"
|
934
|
+
raise message
|
935
|
+
end
|
936
|
+
end
|
937
|
+
|
938
|
+
def each_unnode(nodeset)
|
939
|
+
return to_enum(__method__, nodeset) unless block_given?
|
940
|
+
nodeset.each do |node|
|
941
|
+
if node.is_a?(XPathNode)
|
942
|
+
unnoded = node.raw_node
|
943
|
+
else
|
944
|
+
unnoded = node
|
945
|
+
end
|
946
|
+
yield(unnoded)
|
947
|
+
end
|
948
|
+
end
|
949
|
+
|
950
|
+
def unnode(nodeset)
|
951
|
+
each_unnode(nodeset).collect do |unnoded|
|
952
|
+
unnoded = yield(unnoded) if block_given?
|
953
|
+
unnoded
|
954
|
+
end
|
955
|
+
end
|
956
|
+
end
|
957
|
+
|
958
|
+
# @private
|
959
|
+
class XPathNode
|
960
|
+
attr_reader :raw_node, :context
|
961
|
+
def initialize(node, context=nil)
|
962
|
+
if node.is_a?(XPathNode)
|
963
|
+
@raw_node = node.raw_node
|
964
|
+
else
|
965
|
+
@raw_node = node
|
966
|
+
end
|
967
|
+
@context = context || {}
|
968
|
+
end
|
969
|
+
|
970
|
+
def position
|
971
|
+
@context[:position]
|
972
|
+
end
|
973
|
+
end
|
974
|
+
end
|