brakeman 6.1.2 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +14 -0
- data/README.md +5 -1
- data/bundle/load.rb +16 -13
- data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/Changelog.md +4 -0
- data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/highline.gemspec +4 -1
- data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/terminal.rb +2 -2
- data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/version.rb +1 -1
- data/bundle/ruby/3.1.0/gems/io-console-0.7.2/README.md +46 -0
- data/bundle/ruby/3.1.0/gems/io-console-0.7.2/ext/io/console/Makefile +270 -0
- data/bundle/ruby/3.1.0/gems/io-console-0.7.2/ext/io/console/console.c +1838 -0
- data/bundle/ruby/3.1.0/gems/io-console-0.7.2/ext/io/console/console.o +0 -0
- data/bundle/ruby/3.1.0/gems/io-console-0.7.2/ext/io/console/console.so +0 -0
- data/bundle/ruby/3.1.0/gems/io-console-0.7.2/ext/io/console/extconf.rb +43 -0
- data/bundle/ruby/3.1.0/gems/io-console-0.7.2/ext/io/console/win32_vk.inc +1391 -0
- data/bundle/ruby/3.1.0/gems/io-console-0.7.2/lib/io/console/size.rb +23 -0
- data/bundle/ruby/3.1.0/gems/io-console-0.7.2/lib/io/console.so +0 -0
- data/bundle/ruby/3.1.0/gems/parallel-1.26.3/lib/parallel/version.rb +4 -0
- data/bundle/ruby/{3.3.0/gems/parallel-1.24.0 → 3.1.0/gems/parallel-1.26.3}/lib/parallel.rb +51 -19
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/BSDL +22 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/COPYING +56 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/README.md +94 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/config.rb +382 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/face.rb +199 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/history.rb +76 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/io/ansi.rb +364 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/io/dumb.rb +106 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/io/windows.rb +503 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/io.rb +41 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/key_actor/base.rb +31 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/key_actor/composite.rb +17 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/key_actor/emacs.rb +517 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/key_actor/vi_command.rb +518 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/key_actor/vi_insert.rb +517 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/key_actor.rb +8 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/key_stroke.rb +109 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/kill_ring.rb +125 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/line_editor.rb +2557 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/terminfo.rb +158 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/unicode/east_asian_width.rb +1196 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/unicode.rb +696 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline/version.rb +3 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/lib/reline.rb +516 -0
- data/bundle/ruby/3.1.0/gems/reline-0.5.9/license_of_rb-readline +25 -0
- data/bundle/ruby/3.1.0/gems/rexml-3.3.6/LICENSE.txt +22 -0
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/NEWS.md +306 -0
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/element.rb +16 -31
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/entity.rb +5 -47
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/formatters/pretty.rb +1 -1
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/functions.rb +1 -2
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/node.rb +8 -4
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/parseexception.rb +1 -0
- data/bundle/ruby/3.1.0/gems/rexml-3.3.6/lib/rexml/parsers/baseparser.rb +852 -0
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/parsers/pullparser.rb +4 -0
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/parsers/sax2parser.rb +6 -19
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/parsers/streamparser.rb +8 -10
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/parsers/treeparser.rb +9 -21
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/rexml.rb +1 -1
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/source.rb +128 -98
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/text.rb +34 -14
- data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/xpath_parser.rb +7 -3
- data/bundle/ruby/{3.3.0/gems/ruby2ruby-2.4.4 → 3.1.0/gems/ruby2ruby-2.5.1}/History.rdoc +22 -0
- data/bundle/ruby/{3.3.0/gems/ruby2ruby-2.4.4 → 3.1.0/gems/ruby2ruby-2.5.1}/lib/ruby2ruby.rb +162 -26
- data/bundle/ruby/{3.3.0/gems/sexp_processor-4.17.1 → 3.1.0/gems/sexp_processor-4.17.2}/History.rdoc +6 -0
- data/bundle/ruby/{3.3.0/gems/sexp_processor-4.17.1 → 3.1.0/gems/sexp_processor-4.17.2}/lib/sexp_matcher.rb +1 -1
- data/bundle/ruby/{3.3.0/gems/sexp_processor-4.17.1 → 3.1.0/gems/sexp_processor-4.17.2}/lib/sexp_processor.rb +1 -1
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/CHANGES +44 -8
- data/bundle/ruby/3.1.0/gems/slim-5.2.1/Gemfile +43 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/LICENSE +1 -1
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/README.jp.md +28 -41
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/README.md +66 -43
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/code_attributes.rb +2 -1
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/command.rb +2 -8
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/controls.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/do_inserter.rb +4 -3
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/embedded.rb +17 -17
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/end_inserter.rb +3 -2
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/engine.rb +3 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/erb_converter.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/filter.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/grammar.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/include.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/interpolation.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/logic_less/context.rb +6 -7
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/logic_less/filter.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/logic_less.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/parser.rb +26 -39
- data/bundle/ruby/3.1.0/gems/slim-5.2.1/lib/slim/railtie.rb +19 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/smart/escaper.rb +1 -1
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/smart/filter.rb +3 -2
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/smart/parser.rb +4 -3
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/smart.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/splat/builder.rb +16 -8
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/splat/filter.rb +6 -4
- data/bundle/ruby/3.1.0/gems/slim-5.2.1/lib/slim/template.rb +6 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/translator.rb +4 -3
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim/version.rb +2 -1
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/lib/slim.rb +2 -0
- data/bundle/ruby/{3.3.0/gems/slim-4.1.0 → 3.1.0/gems/slim-5.2.1}/slim.gemspec +14 -5
- data/bundle/ruby/3.1.0/gems/strscan-3.1.0/COPYING +56 -0
- data/bundle/ruby/3.1.0/gems/strscan-3.1.0/LICENSE.txt +22 -0
- data/bundle/ruby/3.1.0/gems/strscan-3.1.0/ext/strscan/Makefile +268 -0
- data/bundle/ruby/3.1.0/gems/strscan-3.1.0/ext/strscan/extconf.rb +10 -0
- data/bundle/ruby/3.1.0/gems/strscan-3.1.0/ext/strscan/strscan.c +1741 -0
- data/bundle/ruby/3.1.0/gems/strscan-3.1.0/ext/strscan/strscan.o +0 -0
- data/bundle/ruby/3.1.0/gems/strscan-3.1.0/ext/strscan/strscan.so +0 -0
- data/bundle/ruby/3.1.0/gems/strscan-3.1.0/lib/strscan.so +0 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/CHANGES +39 -1
- data/bundle/ruby/3.1.0/gems/temple-0.10.3/Gemfile +2 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/README.md +1 -1
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/engine.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/erb/engine.rb +3 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/erb/parser.rb +2 -1
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/erb/template.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/erb/trimming.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/exceptions.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filter.rb +1 -0
- data/bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/filters/ambles.rb +22 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/code_merger.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/control_flow.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/dynamic_inliner.rb +2 -1
- data/bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/filters/dynamic_merger.rb +69 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/encoding.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/eraser.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/escapable.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/multi_flattener.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/remove_bom.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/static_analyzer.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/static_merger.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/string_splitter.rb +13 -1
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/filters/validator.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/generator.rb +5 -2
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/generators/array.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/generators/array_buffer.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/generators/erb.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/generators/rails_output_buffer.rb +4 -4
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/generators/string_buffer.rb +2 -1
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/grammar.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/html/attribute_merger.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/html/attribute_remover.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/html/attribute_sorter.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/html/dispatcher.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/html/fast.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/html/filter.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/html/pretty.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/html/safe.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/map.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/mixins/dispatcher.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/mixins/engine_dsl.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/mixins/grammar_dsl.rb +4 -2
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/mixins/options.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/mixins/template.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/parser.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/static_analyzer.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/templates/rails.rb +7 -2
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/templates/tilt.rb +2 -9
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/templates.rb +1 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple/utils.rb +5 -15
- data/bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/version.rb +4 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/lib/temple.rb +3 -0
- data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/temple.gemspec +4 -6
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/COPYING +1 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/_emacs_org.rb +2 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/_handlebars.rb +2 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/_jbuilder.rb +2 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/_org.rb +2 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/asciidoc.rb +15 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/babel.rb +8 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/builder.rb +42 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/cli.rb +134 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/coffee.rb +39 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/commonmarker.rb +95 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/creole.rb +14 -0
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/csv.rb +6 -18
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/erb.rb +23 -21
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/erubi.rb +55 -0
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/erubis.rb +19 -11
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/etanni.rb +5 -4
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/haml.rb +94 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/kramdown.rb +13 -0
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/liquid.rb +10 -14
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/livescript.rb +11 -0
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/mapping.rb +228 -109
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/markaby.rb +5 -7
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/maruku.rb +10 -0
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/nokogiri.rb +11 -10
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/pandoc.rb +39 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/pipeline.rb +19 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/plain.rb +5 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/prawn.rb +28 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/radius.rb +41 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/rdiscount.rb +23 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/rdoc.rb +19 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/redcarpet.rb +31 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/redcloth.rb +13 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/rst-pandoc.rb +10 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/sass.rb +78 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/slim.rb +5 -0
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/string.rb +9 -3
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/template.rb +229 -82
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/typescript.rb +19 -0
- data/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/wikicloth.rb +12 -0
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt/yajl.rb +5 -11
- data/bundle/ruby/{3.3.0/gems/tilt-2.0.11 → 3.1.0/gems/tilt-2.4.0}/lib/tilt.rb +60 -40
- data/lib/brakeman/app_tree.rb +20 -5
- data/lib/brakeman/checks/check_session_settings.rb +1 -1
- data/lib/brakeman/checks/check_unscoped_find.rb +1 -1
- data/lib/brakeman/file_parser.rb +34 -2
- data/lib/brakeman/options.rb +34 -4
- data/lib/brakeman/parsers/erubis_patch.rb +11 -0
- data/lib/brakeman/parsers/rails2_erubis.rb +3 -0
- data/lib/brakeman/parsers/rails2_xss_plugin_erubis.rb +4 -0
- data/lib/brakeman/parsers/rails3_erubis.rb +5 -1
- data/lib/brakeman/parsers/slim_embedded.rb +2 -0
- data/lib/brakeman/processors/alias_processor.rb +34 -13
- data/lib/brakeman/report/report_markdown.rb +1 -1
- data/lib/brakeman/report/report_table.rb +2 -2
- data/lib/brakeman/report/report_tabs.rb +0 -1
- data/lib/brakeman/report/report_text.rb +8 -1
- data/lib/brakeman/scanner.rb +2 -2
- data/lib/brakeman/tracker/config.rb +9 -1
- data/lib/brakeman/util.rb +1 -3
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman/warning.rb +1 -1
- data/lib/brakeman.rb +2 -0
- data/lib/ruby_parser/bm_sexp.rb +5 -1
- metadata +422 -372
- data/bundle/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel/version.rb +0 -4
- data/bundle/ruby/3.3.0/gems/rexml-3.2.6/lib/rexml/parsers/baseparser.rb +0 -694
- data/bundle/ruby/3.3.0/gems/slim-4.1.0/Gemfile +0 -70
- data/bundle/ruby/3.3.0/gems/slim-4.1.0/lib/slim/template.rb +0 -19
- data/bundle/ruby/3.3.0/gems/temple-0.8.2/Gemfile +0 -3
- data/bundle/ruby/3.3.0/gems/temple-0.8.2/lib/temple/version.rb +0 -3
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/asciidoc.rb +0 -27
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/babel.rb +0 -16
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/bluecloth.rb +0 -24
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/builder.rb +0 -37
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/coffee.rb +0 -58
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/commonmarker.rb +0 -88
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/creole.rb +0 -25
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/dummy.rb +0 -3
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/erubi.rb +0 -32
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/haml.rb +0 -86
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/kramdown.rb +0 -25
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/less.rb +0 -30
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/livescript.rb +0 -23
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/maruku.rb +0 -22
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/pandoc.rb +0 -57
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/plain.rb +0 -16
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/prawn.rb +0 -43
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/radius.rb +0 -48
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/rdiscount.rb +0 -39
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/rdoc.rb +0 -40
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/redcarpet.rb +0 -86
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/redcloth.rb +0 -23
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/rst-pandoc.rb +0 -23
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/sass.rb +0 -78
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/sigil.rb +0 -34
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/typescript.rb +0 -26
- data/bundle/ruby/3.3.0/gems/tilt-2.0.11/lib/tilt/wikicloth.rb +0 -22
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/CHANGES.txt +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/MIT-LICENSE +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/README.txt +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/contrib/erubis +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/contrib/erubis-run.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/contrib/inline-require +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/context.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/converter.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine/ec.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine/ecpp.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine/ejava.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine/ejavascript.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine/enhanced.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine/eperl.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine/eruby.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine/escheme.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine/optimized.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/engine.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/enhancer.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/error.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/evaluator.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/generator.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/helper.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/helpers/rails_form_helper.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/helpers/rails_helper.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/local-setting.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/main.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/preprocessing.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/tiny.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis/util.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/lib/erubis.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/erubis-2.7.0/setup.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/CHANGELOG.md +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/FAQ.md +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/Gemfile +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/MIT-LICENSE +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/README.md +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/REFERENCE.md +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/TODO +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/haml.gemspec +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/attribute_builder.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/attribute_compiler.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/attribute_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/buffer.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/compiler.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/engine.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/error.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/escapable.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/exec.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/filters.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/generator.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/helpers/action_view_extensions.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/helpers/action_view_mods.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/helpers/action_view_xss_mods.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/helpers/safe_erubi_template.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/helpers/safe_erubis_template.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/helpers/xss_mods.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/helpers.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/options.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/plugin.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/railtie.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/sass_rails_filter.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/template/options.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/template.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/temple_engine.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/temple_line_counter.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/util.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml/version.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/lib/haml.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/yard/default/fulldoc/html/css/common.sass +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/haml-5.2.2/yard/default/layout/html/footer.erb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/AUTHORS +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/COPYING +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/Gemfile +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/LICENSE +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/README.md +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/TODO +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/builtin_styles.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/color_scheme.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/compatibility.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/custom_errors.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/import.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/io_console_compatible.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/list.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/list_renderer.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/menu/item.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/menu.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/paginator.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/question/answer_converter.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/question.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/question_asker.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/simulate.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/statement.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/string.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/string_extensions.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/style.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/template_renderer.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/terminal/io_console.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/terminal/ncurses.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/terminal/unix_stty.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline/wrapper.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/highline-3.0.1 → 3.1.0/gems/highline-3.1.0}/lib/highline.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/io-console-0.7.2}/LICENSE.txt +0 -0
- /data/bundle/ruby/{3.3.0/gems/parallel-1.24.0 → 3.1.0/gems/parallel-1.26.3}/MIT-LICENSE.txt +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/README.md +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/attlistdecl.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/attribute.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/cdata.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/child.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/comment.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/doctype.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/document.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/dtd/attlistdecl.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/dtd/dtd.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/dtd/elementdecl.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/dtd/entitydecl.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/dtd/notationdecl.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/encoding.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/formatters/default.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/formatters/transitive.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/instruction.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/light/node.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/namespace.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/output.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/parent.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/parsers/lightparser.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/parsers/ultralightparser.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/parsers/xpathparser.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/quickpath.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/sax2listener.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/security.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/streamlistener.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/undefinednamespaceexception.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/validation/relaxng.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/validation/validation.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/validation/validationexception.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/xmldecl.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/xmltokens.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml/xpath.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/rexml-3.2.6 → 3.1.0/gems/rexml-3.3.6}/lib/rexml.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/ruby2ruby-2.4.4 → 3.1.0/gems/ruby2ruby-2.5.1}/Manifest.txt +0 -0
- /data/bundle/ruby/{3.3.0/gems/ruby2ruby-2.4.4 → 3.1.0/gems/ruby2ruby-2.5.1}/README.rdoc +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/History.rdoc +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/Manifest.txt +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/README.rdoc +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/compare/normalize.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/debugging.md +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/gauntlet.md +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/rp_extensions.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/rp_stringscanner.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby20_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby20_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby21_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby21_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby22_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby22_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby23_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby23_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby24_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby24_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby25_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby25_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby26_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby26_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby27_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby27_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby30_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby30_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby31_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby31_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby32_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby32_parser.y +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby3_parser.yy +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby_lexer.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby_lexer.rex +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby_lexer.rex.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby_lexer_strings.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby_parser.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby_parser.yy +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/lib/ruby_parser_extras.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/tools/munge.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/ruby_parser-3.20.3/tools/ripper.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/sexp_processor-4.17.1 → 3.1.0/gems/sexp_processor-4.17.2}/Manifest.txt +0 -0
- /data/bundle/ruby/{3.3.0/gems/sexp_processor-4.17.1 → 3.1.0/gems/sexp_processor-4.17.2}/README.rdoc +0 -0
- /data/bundle/ruby/{3.3.0/gems/sexp_processor-4.17.1 → 3.1.0/gems/sexp_processor-4.17.2}/lib/composite_sexp_processor.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/sexp_processor-4.17.1 → 3.1.0/gems/sexp_processor-4.17.2}/lib/pt_testcase.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/sexp_processor-4.17.1 → 3.1.0/gems/sexp_processor-4.17.2}/lib/sexp.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/sexp_processor-4.17.1 → 3.1.0/gems/sexp_processor-4.17.2}/lib/strict_sexp.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/sexp_processor-4.17.1 → 3.1.0/gems/sexp_processor-4.17.2}/lib/unique.rb +0 -0
- /data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/EXPRESSIONS.md +0 -0
- /data/bundle/ruby/{3.3.0/gems/temple-0.8.2 → 3.1.0/gems/temple-0.10.3}/LICENSE +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/Gemfile +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/History.rdoc +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/LICENSE.txt +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/Manifest +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/README.rdoc +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/Todo.rdoc +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/lib/terminal-table/cell.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/lib/terminal-table/import.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/lib/terminal-table/row.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/lib/terminal-table/separator.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/lib/terminal-table/style.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/lib/terminal-table/table.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/lib/terminal-table/table_helper.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/lib/terminal-table/version.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/lib/terminal-table.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/terminal-table-1.8.0/terminal-table.gemspec +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/unicode-display_width-1.8.0/CHANGELOG.md +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/unicode-display_width-1.8.0/MIT-LICENSE.txt +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/unicode-display_width-1.8.0/README.md +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/unicode-display_width-1.8.0/data/display_width.marshal.gz +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/unicode-display_width-1.8.0/lib/unicode/display_width/constants.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/unicode-display_width-1.8.0/lib/unicode/display_width/index.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/unicode-display_width-1.8.0/lib/unicode/display_width/no_string_ext.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/unicode-display_width-1.8.0/lib/unicode/display_width/string_ext.rb +0 -0
- /data/bundle/ruby/{3.3.0 → 3.1.0}/gems/unicode-display_width-1.8.0/lib/unicode/display_width.rb +0 -0
@@ -0,0 +1,1741 @@
|
|
1
|
+
/*
|
2
|
+
$Id$
|
3
|
+
|
4
|
+
Copyright (c) 1999-2006 Minero Aoki
|
5
|
+
|
6
|
+
This program is free software.
|
7
|
+
You can redistribute this program under the terms of the Ruby's or 2-clause
|
8
|
+
BSD License. For details, see the COPYING and LICENSE.txt files.
|
9
|
+
*/
|
10
|
+
|
11
|
+
#include "ruby/ruby.h"
|
12
|
+
#include "ruby/re.h"
|
13
|
+
#include "ruby/encoding.h"
|
14
|
+
|
15
|
+
#ifdef RUBY_EXTCONF_H
|
16
|
+
# include RUBY_EXTCONF_H
|
17
|
+
#endif
|
18
|
+
|
19
|
+
#ifdef HAVE_ONIG_REGION_MEMSIZE
|
20
|
+
extern size_t onig_region_memsize(const struct re_registers *regs);
|
21
|
+
#endif
|
22
|
+
|
23
|
+
#include <stdbool.h>
|
24
|
+
|
25
|
+
#define STRSCAN_VERSION "3.1.0"
|
26
|
+
|
27
|
+
/* =======================================================================
|
28
|
+
Data Type Definitions
|
29
|
+
======================================================================= */
|
30
|
+
|
31
|
+
static VALUE StringScanner;
|
32
|
+
static VALUE ScanError;
|
33
|
+
static ID id_byteslice;
|
34
|
+
|
35
|
+
struct strscanner
|
36
|
+
{
|
37
|
+
/* multi-purpose flags */
|
38
|
+
unsigned long flags;
|
39
|
+
#define FLAG_MATCHED (1 << 0)
|
40
|
+
|
41
|
+
/* the string to scan */
|
42
|
+
VALUE str;
|
43
|
+
|
44
|
+
/* scan pointers */
|
45
|
+
long prev; /* legal only when MATCHED_P(s) */
|
46
|
+
long curr; /* always legal */
|
47
|
+
|
48
|
+
/* the regexp register; legal only when MATCHED_P(s) */
|
49
|
+
struct re_registers regs;
|
50
|
+
|
51
|
+
/* regexp used for last scan */
|
52
|
+
VALUE regex;
|
53
|
+
|
54
|
+
/* anchor mode */
|
55
|
+
bool fixed_anchor_p;
|
56
|
+
};
|
57
|
+
|
58
|
+
#define MATCHED_P(s) ((s)->flags & FLAG_MATCHED)
|
59
|
+
#define MATCHED(s) (s)->flags |= FLAG_MATCHED
|
60
|
+
#define CLEAR_MATCH_STATUS(s) (s)->flags &= ~FLAG_MATCHED
|
61
|
+
|
62
|
+
#define S_PBEG(s) (RSTRING_PTR((s)->str))
|
63
|
+
#define S_LEN(s) (RSTRING_LEN((s)->str))
|
64
|
+
#define S_PEND(s) (S_PBEG(s) + S_LEN(s))
|
65
|
+
#define CURPTR(s) (S_PBEG(s) + (s)->curr)
|
66
|
+
#define S_RESTLEN(s) (S_LEN(s) - (s)->curr)
|
67
|
+
|
68
|
+
#define EOS_P(s) ((s)->curr >= RSTRING_LEN(p->str))
|
69
|
+
|
70
|
+
#define GET_SCANNER(obj,var) do {\
|
71
|
+
(var) = check_strscan(obj);\
|
72
|
+
if (NIL_P((var)->str)) rb_raise(rb_eArgError, "uninitialized StringScanner object");\
|
73
|
+
} while (0)
|
74
|
+
|
75
|
+
/* =======================================================================
|
76
|
+
Function Prototypes
|
77
|
+
======================================================================= */
|
78
|
+
|
79
|
+
static inline long minl _((const long n, const long x));
|
80
|
+
static VALUE extract_range _((struct strscanner *p, long beg_i, long end_i));
|
81
|
+
static VALUE extract_beg_len _((struct strscanner *p, long beg_i, long len));
|
82
|
+
|
83
|
+
static struct strscanner *check_strscan _((VALUE obj));
|
84
|
+
static void strscan_mark _((void *p));
|
85
|
+
static void strscan_free _((void *p));
|
86
|
+
static size_t strscan_memsize _((const void *p));
|
87
|
+
static VALUE strscan_s_allocate _((VALUE klass));
|
88
|
+
static VALUE strscan_initialize _((int argc, VALUE *argv, VALUE self));
|
89
|
+
static VALUE strscan_init_copy _((VALUE vself, VALUE vorig));
|
90
|
+
|
91
|
+
static VALUE strscan_s_mustc _((VALUE self));
|
92
|
+
static VALUE strscan_terminate _((VALUE self));
|
93
|
+
static VALUE strscan_clear _((VALUE self));
|
94
|
+
static VALUE strscan_get_string _((VALUE self));
|
95
|
+
static VALUE strscan_set_string _((VALUE self, VALUE str));
|
96
|
+
static VALUE strscan_concat _((VALUE self, VALUE str));
|
97
|
+
static VALUE strscan_get_pos _((VALUE self));
|
98
|
+
static VALUE strscan_set_pos _((VALUE self, VALUE pos));
|
99
|
+
static VALUE strscan_do_scan _((VALUE self, VALUE regex,
|
100
|
+
int succptr, int getstr, int headonly));
|
101
|
+
static VALUE strscan_scan _((VALUE self, VALUE re));
|
102
|
+
static VALUE strscan_match_p _((VALUE self, VALUE re));
|
103
|
+
static VALUE strscan_skip _((VALUE self, VALUE re));
|
104
|
+
static VALUE strscan_check _((VALUE self, VALUE re));
|
105
|
+
static VALUE strscan_scan_full _((VALUE self, VALUE re,
|
106
|
+
VALUE succp, VALUE getp));
|
107
|
+
static VALUE strscan_scan_until _((VALUE self, VALUE re));
|
108
|
+
static VALUE strscan_skip_until _((VALUE self, VALUE re));
|
109
|
+
static VALUE strscan_check_until _((VALUE self, VALUE re));
|
110
|
+
static VALUE strscan_search_full _((VALUE self, VALUE re,
|
111
|
+
VALUE succp, VALUE getp));
|
112
|
+
static void adjust_registers_to_matched _((struct strscanner *p));
|
113
|
+
static VALUE strscan_getch _((VALUE self));
|
114
|
+
static VALUE strscan_get_byte _((VALUE self));
|
115
|
+
static VALUE strscan_getbyte _((VALUE self));
|
116
|
+
static VALUE strscan_peek _((VALUE self, VALUE len));
|
117
|
+
static VALUE strscan_peep _((VALUE self, VALUE len));
|
118
|
+
static VALUE strscan_unscan _((VALUE self));
|
119
|
+
static VALUE strscan_bol_p _((VALUE self));
|
120
|
+
static VALUE strscan_eos_p _((VALUE self));
|
121
|
+
static VALUE strscan_empty_p _((VALUE self));
|
122
|
+
static VALUE strscan_rest_p _((VALUE self));
|
123
|
+
static VALUE strscan_matched_p _((VALUE self));
|
124
|
+
static VALUE strscan_matched _((VALUE self));
|
125
|
+
static VALUE strscan_matched_size _((VALUE self));
|
126
|
+
static VALUE strscan_aref _((VALUE self, VALUE idx));
|
127
|
+
static VALUE strscan_pre_match _((VALUE self));
|
128
|
+
static VALUE strscan_post_match _((VALUE self));
|
129
|
+
static VALUE strscan_rest _((VALUE self));
|
130
|
+
static VALUE strscan_rest_size _((VALUE self));
|
131
|
+
|
132
|
+
static VALUE strscan_inspect _((VALUE self));
|
133
|
+
static VALUE inspect1 _((struct strscanner *p));
|
134
|
+
static VALUE inspect2 _((struct strscanner *p));
|
135
|
+
|
136
|
+
/* =======================================================================
|
137
|
+
Utils
|
138
|
+
======================================================================= */
|
139
|
+
|
140
|
+
static VALUE
|
141
|
+
str_new(struct strscanner *p, const char *ptr, long len)
|
142
|
+
{
|
143
|
+
VALUE str = rb_str_new(ptr, len);
|
144
|
+
rb_enc_copy(str, p->str);
|
145
|
+
return str;
|
146
|
+
}
|
147
|
+
|
148
|
+
static inline long
|
149
|
+
minl(const long x, const long y)
|
150
|
+
{
|
151
|
+
return (x < y) ? x : y;
|
152
|
+
}
|
153
|
+
|
154
|
+
static VALUE
|
155
|
+
extract_range(struct strscanner *p, long beg_i, long end_i)
|
156
|
+
{
|
157
|
+
if (beg_i > S_LEN(p)) return Qnil;
|
158
|
+
end_i = minl(end_i, S_LEN(p));
|
159
|
+
return str_new(p, S_PBEG(p) + beg_i, end_i - beg_i);
|
160
|
+
}
|
161
|
+
|
162
|
+
static VALUE
|
163
|
+
extract_beg_len(struct strscanner *p, long beg_i, long len)
|
164
|
+
{
|
165
|
+
if (beg_i > S_LEN(p)) return Qnil;
|
166
|
+
len = minl(len, S_LEN(p) - beg_i);
|
167
|
+
return str_new(p, S_PBEG(p) + beg_i, len);
|
168
|
+
}
|
169
|
+
|
170
|
+
/* =======================================================================
|
171
|
+
Constructor
|
172
|
+
======================================================================= */
|
173
|
+
|
174
|
+
static void
|
175
|
+
strscan_mark(void *ptr)
|
176
|
+
{
|
177
|
+
struct strscanner *p = ptr;
|
178
|
+
rb_gc_mark(p->str);
|
179
|
+
rb_gc_mark(p->regex);
|
180
|
+
}
|
181
|
+
|
182
|
+
static void
|
183
|
+
strscan_free(void *ptr)
|
184
|
+
{
|
185
|
+
struct strscanner *p = ptr;
|
186
|
+
onig_region_free(&(p->regs), 0);
|
187
|
+
ruby_xfree(p);
|
188
|
+
}
|
189
|
+
|
190
|
+
static size_t
|
191
|
+
strscan_memsize(const void *ptr)
|
192
|
+
{
|
193
|
+
const struct strscanner *p = ptr;
|
194
|
+
size_t size = sizeof(*p) - sizeof(p->regs);
|
195
|
+
#ifdef HAVE_ONIG_REGION_MEMSIZE
|
196
|
+
size += onig_region_memsize(&p->regs);
|
197
|
+
#endif
|
198
|
+
return size;
|
199
|
+
}
|
200
|
+
|
201
|
+
static const rb_data_type_t strscanner_type = {
|
202
|
+
"StringScanner",
|
203
|
+
{strscan_mark, strscan_free, strscan_memsize},
|
204
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY
|
205
|
+
};
|
206
|
+
|
207
|
+
static VALUE
|
208
|
+
strscan_s_allocate(VALUE klass)
|
209
|
+
{
|
210
|
+
struct strscanner *p;
|
211
|
+
VALUE obj = TypedData_Make_Struct(klass, struct strscanner, &strscanner_type, p);
|
212
|
+
|
213
|
+
CLEAR_MATCH_STATUS(p);
|
214
|
+
onig_region_init(&(p->regs));
|
215
|
+
p->str = Qnil;
|
216
|
+
p->regex = Qnil;
|
217
|
+
return obj;
|
218
|
+
}
|
219
|
+
|
220
|
+
/*
|
221
|
+
* call-seq:
|
222
|
+
* StringScanner.new(string, fixed_anchor: false)
|
223
|
+
* StringScanner.new(string, dup = false)
|
224
|
+
*
|
225
|
+
* Creates a new StringScanner object to scan over the given +string+.
|
226
|
+
*
|
227
|
+
* If +fixed_anchor+ is +true+, +\A+ always matches the beginning of
|
228
|
+
* the string. Otherwise, +\A+ always matches the current position.
|
229
|
+
*
|
230
|
+
* +dup+ argument is obsolete and not used now.
|
231
|
+
*/
|
232
|
+
static VALUE
|
233
|
+
strscan_initialize(int argc, VALUE *argv, VALUE self)
|
234
|
+
{
|
235
|
+
struct strscanner *p;
|
236
|
+
VALUE str, options;
|
237
|
+
|
238
|
+
p = check_strscan(self);
|
239
|
+
rb_scan_args(argc, argv, "11", &str, &options);
|
240
|
+
options = rb_check_hash_type(options);
|
241
|
+
if (!NIL_P(options)) {
|
242
|
+
VALUE fixed_anchor;
|
243
|
+
ID keyword_ids[1];
|
244
|
+
keyword_ids[0] = rb_intern("fixed_anchor");
|
245
|
+
rb_get_kwargs(options, keyword_ids, 0, 1, &fixed_anchor);
|
246
|
+
if (fixed_anchor == Qundef) {
|
247
|
+
p->fixed_anchor_p = false;
|
248
|
+
}
|
249
|
+
else {
|
250
|
+
p->fixed_anchor_p = RTEST(fixed_anchor);
|
251
|
+
}
|
252
|
+
}
|
253
|
+
else {
|
254
|
+
p->fixed_anchor_p = false;
|
255
|
+
}
|
256
|
+
StringValue(str);
|
257
|
+
p->str = str;
|
258
|
+
|
259
|
+
return self;
|
260
|
+
}
|
261
|
+
|
262
|
+
static struct strscanner *
|
263
|
+
check_strscan(VALUE obj)
|
264
|
+
{
|
265
|
+
return rb_check_typeddata(obj, &strscanner_type);
|
266
|
+
}
|
267
|
+
|
268
|
+
/*
|
269
|
+
* call-seq:
|
270
|
+
* dup
|
271
|
+
* clone
|
272
|
+
*
|
273
|
+
* Duplicates a StringScanner object.
|
274
|
+
*/
|
275
|
+
static VALUE
|
276
|
+
strscan_init_copy(VALUE vself, VALUE vorig)
|
277
|
+
{
|
278
|
+
struct strscanner *self, *orig;
|
279
|
+
|
280
|
+
self = check_strscan(vself);
|
281
|
+
orig = check_strscan(vorig);
|
282
|
+
if (self != orig) {
|
283
|
+
self->flags = orig->flags;
|
284
|
+
self->str = orig->str;
|
285
|
+
self->prev = orig->prev;
|
286
|
+
self->curr = orig->curr;
|
287
|
+
if (rb_reg_region_copy(&self->regs, &orig->regs))
|
288
|
+
rb_memerror();
|
289
|
+
RB_GC_GUARD(vorig);
|
290
|
+
}
|
291
|
+
|
292
|
+
return vself;
|
293
|
+
}
|
294
|
+
|
295
|
+
/* =======================================================================
|
296
|
+
Instance Methods
|
297
|
+
======================================================================= */
|
298
|
+
|
299
|
+
/*
|
300
|
+
* call-seq: StringScanner.must_C_version
|
301
|
+
*
|
302
|
+
* This method is defined for backward compatibility.
|
303
|
+
*/
|
304
|
+
static VALUE
|
305
|
+
strscan_s_mustc(VALUE self)
|
306
|
+
{
|
307
|
+
return self;
|
308
|
+
}
|
309
|
+
|
310
|
+
/*
|
311
|
+
* Reset the scan pointer (index 0) and clear matching data.
|
312
|
+
*/
|
313
|
+
static VALUE
|
314
|
+
strscan_reset(VALUE self)
|
315
|
+
{
|
316
|
+
struct strscanner *p;
|
317
|
+
|
318
|
+
GET_SCANNER(self, p);
|
319
|
+
p->curr = 0;
|
320
|
+
CLEAR_MATCH_STATUS(p);
|
321
|
+
return self;
|
322
|
+
}
|
323
|
+
|
324
|
+
/*
|
325
|
+
* call-seq:
|
326
|
+
* terminate
|
327
|
+
* clear
|
328
|
+
*
|
329
|
+
* Sets the scan pointer to the end of the string and clear matching data.
|
330
|
+
*/
|
331
|
+
static VALUE
|
332
|
+
strscan_terminate(VALUE self)
|
333
|
+
{
|
334
|
+
struct strscanner *p;
|
335
|
+
|
336
|
+
GET_SCANNER(self, p);
|
337
|
+
p->curr = S_LEN(p);
|
338
|
+
CLEAR_MATCH_STATUS(p);
|
339
|
+
return self;
|
340
|
+
}
|
341
|
+
|
342
|
+
/*
|
343
|
+
* Equivalent to #terminate.
|
344
|
+
* This method is obsolete; use #terminate instead.
|
345
|
+
*/
|
346
|
+
static VALUE
|
347
|
+
strscan_clear(VALUE self)
|
348
|
+
{
|
349
|
+
rb_warning("StringScanner#clear is obsolete; use #terminate instead");
|
350
|
+
return strscan_terminate(self);
|
351
|
+
}
|
352
|
+
|
353
|
+
/*
|
354
|
+
* Returns the string being scanned.
|
355
|
+
*/
|
356
|
+
static VALUE
|
357
|
+
strscan_get_string(VALUE self)
|
358
|
+
{
|
359
|
+
struct strscanner *p;
|
360
|
+
|
361
|
+
GET_SCANNER(self, p);
|
362
|
+
return p->str;
|
363
|
+
}
|
364
|
+
|
365
|
+
/*
|
366
|
+
* call-seq: string=(str)
|
367
|
+
*
|
368
|
+
* Changes the string being scanned to +str+ and resets the scanner.
|
369
|
+
* Returns +str+.
|
370
|
+
*/
|
371
|
+
static VALUE
|
372
|
+
strscan_set_string(VALUE self, VALUE str)
|
373
|
+
{
|
374
|
+
struct strscanner *p = check_strscan(self);
|
375
|
+
|
376
|
+
StringValue(str);
|
377
|
+
p->str = str;
|
378
|
+
p->curr = 0;
|
379
|
+
CLEAR_MATCH_STATUS(p);
|
380
|
+
return str;
|
381
|
+
}
|
382
|
+
|
383
|
+
/*
|
384
|
+
* call-seq:
|
385
|
+
* concat(str)
|
386
|
+
* <<(str)
|
387
|
+
*
|
388
|
+
* Appends +str+ to the string being scanned.
|
389
|
+
* This method does not affect scan pointer.
|
390
|
+
*
|
391
|
+
* s = StringScanner.new("Fri Dec 12 1975 14:39")
|
392
|
+
* s.scan(/Fri /)
|
393
|
+
* s << " +1000 GMT"
|
394
|
+
* s.string # -> "Fri Dec 12 1975 14:39 +1000 GMT"
|
395
|
+
* s.scan(/Dec/) # -> "Dec"
|
396
|
+
*/
|
397
|
+
static VALUE
|
398
|
+
strscan_concat(VALUE self, VALUE str)
|
399
|
+
{
|
400
|
+
struct strscanner *p;
|
401
|
+
|
402
|
+
GET_SCANNER(self, p);
|
403
|
+
StringValue(str);
|
404
|
+
rb_str_append(p->str, str);
|
405
|
+
return self;
|
406
|
+
}
|
407
|
+
|
408
|
+
/*
|
409
|
+
* Returns the byte position of the scan pointer. In the 'reset' position, this
|
410
|
+
* value is zero. In the 'terminated' position (i.e. the string is exhausted),
|
411
|
+
* this value is the bytesize of the string.
|
412
|
+
*
|
413
|
+
* In short, it's a 0-based index into bytes of the string.
|
414
|
+
*
|
415
|
+
* s = StringScanner.new('test string')
|
416
|
+
* s.pos # -> 0
|
417
|
+
* s.scan_until /str/ # -> "test str"
|
418
|
+
* s.pos # -> 8
|
419
|
+
* s.terminate # -> #<StringScanner fin>
|
420
|
+
* s.pos # -> 11
|
421
|
+
*/
|
422
|
+
static VALUE
|
423
|
+
strscan_get_pos(VALUE self)
|
424
|
+
{
|
425
|
+
struct strscanner *p;
|
426
|
+
|
427
|
+
GET_SCANNER(self, p);
|
428
|
+
return INT2FIX(p->curr);
|
429
|
+
}
|
430
|
+
|
431
|
+
/*
|
432
|
+
* Returns the character position of the scan pointer. In the 'reset' position, this
|
433
|
+
* value is zero. In the 'terminated' position (i.e. the string is exhausted),
|
434
|
+
* this value is the size of the string.
|
435
|
+
*
|
436
|
+
* In short, it's a 0-based index into the string.
|
437
|
+
*
|
438
|
+
* s = StringScanner.new("abc\u00e4def\u00f6ghi")
|
439
|
+
* s.charpos # -> 0
|
440
|
+
* s.scan_until(/\u00e4/) # -> "abc\u00E4"
|
441
|
+
* s.pos # -> 5
|
442
|
+
* s.charpos # -> 4
|
443
|
+
*/
|
444
|
+
static VALUE
|
445
|
+
strscan_get_charpos(VALUE self)
|
446
|
+
{
|
447
|
+
struct strscanner *p;
|
448
|
+
|
449
|
+
GET_SCANNER(self, p);
|
450
|
+
|
451
|
+
return LONG2NUM(rb_enc_strlen(S_PBEG(p), CURPTR(p), rb_enc_get(p->str)));
|
452
|
+
}
|
453
|
+
|
454
|
+
/*
|
455
|
+
* call-seq: pos=(n)
|
456
|
+
*
|
457
|
+
* Sets the byte position of the scan pointer.
|
458
|
+
*
|
459
|
+
* s = StringScanner.new('test string')
|
460
|
+
* s.pos = 7 # -> 7
|
461
|
+
* s.rest # -> "ring"
|
462
|
+
*/
|
463
|
+
static VALUE
|
464
|
+
strscan_set_pos(VALUE self, VALUE v)
|
465
|
+
{
|
466
|
+
struct strscanner *p;
|
467
|
+
long i;
|
468
|
+
|
469
|
+
GET_SCANNER(self, p);
|
470
|
+
i = NUM2INT(v);
|
471
|
+
if (i < 0) i += S_LEN(p);
|
472
|
+
if (i < 0) rb_raise(rb_eRangeError, "index out of range");
|
473
|
+
if (i > S_LEN(p)) rb_raise(rb_eRangeError, "index out of range");
|
474
|
+
p->curr = i;
|
475
|
+
return LONG2NUM(i);
|
476
|
+
}
|
477
|
+
|
478
|
+
static inline UChar *
|
479
|
+
match_target(struct strscanner *p)
|
480
|
+
{
|
481
|
+
if (p->fixed_anchor_p) {
|
482
|
+
return (UChar *)S_PBEG(p);
|
483
|
+
}
|
484
|
+
else
|
485
|
+
{
|
486
|
+
return (UChar *)CURPTR(p);
|
487
|
+
}
|
488
|
+
}
|
489
|
+
|
490
|
+
static inline void
|
491
|
+
set_registers(struct strscanner *p, size_t length)
|
492
|
+
{
|
493
|
+
const int at = 0;
|
494
|
+
OnigRegion *regs = &(p->regs);
|
495
|
+
onig_region_clear(regs);
|
496
|
+
if (onig_region_set(regs, at, 0, 0)) return;
|
497
|
+
if (p->fixed_anchor_p) {
|
498
|
+
regs->beg[at] = p->curr;
|
499
|
+
regs->end[at] = p->curr + length;
|
500
|
+
}
|
501
|
+
else
|
502
|
+
{
|
503
|
+
regs->end[at] = length;
|
504
|
+
}
|
505
|
+
}
|
506
|
+
|
507
|
+
static inline void
|
508
|
+
succ(struct strscanner *p)
|
509
|
+
{
|
510
|
+
if (p->fixed_anchor_p) {
|
511
|
+
p->curr = p->regs.end[0];
|
512
|
+
}
|
513
|
+
else
|
514
|
+
{
|
515
|
+
p->curr += p->regs.end[0];
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
static inline long
|
520
|
+
last_match_length(struct strscanner *p)
|
521
|
+
{
|
522
|
+
if (p->fixed_anchor_p) {
|
523
|
+
return p->regs.end[0] - p->prev;
|
524
|
+
}
|
525
|
+
else
|
526
|
+
{
|
527
|
+
return p->regs.end[0];
|
528
|
+
}
|
529
|
+
}
|
530
|
+
|
531
|
+
static inline long
|
532
|
+
adjust_register_position(struct strscanner *p, long position)
|
533
|
+
{
|
534
|
+
if (p->fixed_anchor_p) {
|
535
|
+
return position;
|
536
|
+
}
|
537
|
+
else {
|
538
|
+
return p->prev + position;
|
539
|
+
}
|
540
|
+
}
|
541
|
+
|
542
|
+
/* rb_reg_onig_match is available in Ruby 3.3 and later. */
|
543
|
+
#ifndef HAVE_RB_REG_ONIG_MATCH
|
544
|
+
static OnigPosition
|
545
|
+
rb_reg_onig_match(VALUE re, VALUE str,
|
546
|
+
OnigPosition (*match)(regex_t *reg, VALUE str, struct re_registers *regs, void *args),
|
547
|
+
void *args, struct re_registers *regs)
|
548
|
+
{
|
549
|
+
regex_t *reg = rb_reg_prepare_re(re, str);
|
550
|
+
|
551
|
+
bool tmpreg = reg != RREGEXP_PTR(re);
|
552
|
+
if (!tmpreg) RREGEXP(re)->usecnt++;
|
553
|
+
|
554
|
+
OnigPosition result = match(reg, str, regs, args);
|
555
|
+
|
556
|
+
if (!tmpreg) RREGEXP(re)->usecnt--;
|
557
|
+
if (tmpreg) {
|
558
|
+
if (RREGEXP(re)->usecnt) {
|
559
|
+
onig_free(reg);
|
560
|
+
}
|
561
|
+
else {
|
562
|
+
onig_free(RREGEXP_PTR(re));
|
563
|
+
RREGEXP_PTR(re) = reg;
|
564
|
+
}
|
565
|
+
}
|
566
|
+
|
567
|
+
if (result < 0) {
|
568
|
+
if (result != ONIG_MISMATCH) {
|
569
|
+
rb_raise(ScanError, "regexp buffer overflow");
|
570
|
+
}
|
571
|
+
}
|
572
|
+
|
573
|
+
return result;
|
574
|
+
}
|
575
|
+
#endif
|
576
|
+
|
577
|
+
static OnigPosition
|
578
|
+
strscan_match(regex_t *reg, VALUE str, struct re_registers *regs, void *args_ptr)
|
579
|
+
{
|
580
|
+
struct strscanner *p = (struct strscanner *)args_ptr;
|
581
|
+
|
582
|
+
return onig_match(reg,
|
583
|
+
match_target(p),
|
584
|
+
(UChar* )(CURPTR(p) + S_RESTLEN(p)),
|
585
|
+
(UChar* )CURPTR(p),
|
586
|
+
regs,
|
587
|
+
ONIG_OPTION_NONE);
|
588
|
+
}
|
589
|
+
|
590
|
+
static OnigPosition
|
591
|
+
strscan_search(regex_t *reg, VALUE str, struct re_registers *regs, void *args_ptr)
|
592
|
+
{
|
593
|
+
struct strscanner *p = (struct strscanner *)args_ptr;
|
594
|
+
|
595
|
+
return onig_search(reg,
|
596
|
+
match_target(p),
|
597
|
+
(UChar *)(CURPTR(p) + S_RESTLEN(p)),
|
598
|
+
(UChar *)CURPTR(p),
|
599
|
+
(UChar *)(CURPTR(p) + S_RESTLEN(p)),
|
600
|
+
regs,
|
601
|
+
ONIG_OPTION_NONE);
|
602
|
+
}
|
603
|
+
|
604
|
+
static VALUE
|
605
|
+
strscan_do_scan(VALUE self, VALUE pattern, int succptr, int getstr, int headonly)
|
606
|
+
{
|
607
|
+
struct strscanner *p;
|
608
|
+
|
609
|
+
if (headonly) {
|
610
|
+
if (!RB_TYPE_P(pattern, T_REGEXP)) {
|
611
|
+
StringValue(pattern);
|
612
|
+
}
|
613
|
+
}
|
614
|
+
else {
|
615
|
+
Check_Type(pattern, T_REGEXP);
|
616
|
+
}
|
617
|
+
GET_SCANNER(self, p);
|
618
|
+
|
619
|
+
CLEAR_MATCH_STATUS(p);
|
620
|
+
if (S_RESTLEN(p) < 0) {
|
621
|
+
return Qnil;
|
622
|
+
}
|
623
|
+
|
624
|
+
if (RB_TYPE_P(pattern, T_REGEXP)) {
|
625
|
+
p->regex = pattern;
|
626
|
+
OnigPosition ret = rb_reg_onig_match(pattern,
|
627
|
+
p->str,
|
628
|
+
headonly ? strscan_match : strscan_search,
|
629
|
+
(void *)p,
|
630
|
+
&(p->regs));
|
631
|
+
|
632
|
+
if (ret == ONIG_MISMATCH) {
|
633
|
+
return Qnil;
|
634
|
+
}
|
635
|
+
}
|
636
|
+
else {
|
637
|
+
rb_enc_check(p->str, pattern);
|
638
|
+
if (S_RESTLEN(p) < RSTRING_LEN(pattern)) {
|
639
|
+
return Qnil;
|
640
|
+
}
|
641
|
+
if (memcmp(CURPTR(p), RSTRING_PTR(pattern), RSTRING_LEN(pattern)) != 0) {
|
642
|
+
return Qnil;
|
643
|
+
}
|
644
|
+
set_registers(p, RSTRING_LEN(pattern));
|
645
|
+
}
|
646
|
+
|
647
|
+
MATCHED(p);
|
648
|
+
p->prev = p->curr;
|
649
|
+
|
650
|
+
if (succptr) {
|
651
|
+
succ(p);
|
652
|
+
}
|
653
|
+
{
|
654
|
+
const long length = last_match_length(p);
|
655
|
+
if (getstr) {
|
656
|
+
return extract_beg_len(p, p->prev, length);
|
657
|
+
}
|
658
|
+
else {
|
659
|
+
return INT2FIX(length);
|
660
|
+
}
|
661
|
+
}
|
662
|
+
}
|
663
|
+
|
664
|
+
/*
|
665
|
+
* call-seq: scan(pattern) => String
|
666
|
+
*
|
667
|
+
* Tries to match with +pattern+ at the current position. If there's a match,
|
668
|
+
* the scanner advances the "scan pointer" and returns the matched string.
|
669
|
+
* Otherwise, the scanner returns +nil+.
|
670
|
+
*
|
671
|
+
* s = StringScanner.new('test string')
|
672
|
+
* p s.scan(/\w+/) # -> "test"
|
673
|
+
* p s.scan(/\w+/) # -> nil
|
674
|
+
* p s.scan(/\s+/) # -> " "
|
675
|
+
* p s.scan("str") # -> "str"
|
676
|
+
* p s.scan(/\w+/) # -> "ing"
|
677
|
+
* p s.scan(/./) # -> nil
|
678
|
+
*
|
679
|
+
*/
|
680
|
+
static VALUE
|
681
|
+
strscan_scan(VALUE self, VALUE re)
|
682
|
+
{
|
683
|
+
return strscan_do_scan(self, re, 1, 1, 1);
|
684
|
+
}
|
685
|
+
|
686
|
+
/*
|
687
|
+
* call-seq: match?(pattern)
|
688
|
+
*
|
689
|
+
* Tests whether the given +pattern+ is matched from the current scan pointer.
|
690
|
+
* Returns the length of the match, or +nil+. The scan pointer is not advanced.
|
691
|
+
*
|
692
|
+
* s = StringScanner.new('test string')
|
693
|
+
* p s.match?(/\w+/) # -> 4
|
694
|
+
* p s.match?(/\w+/) # -> 4
|
695
|
+
* p s.match?("test") # -> 4
|
696
|
+
* p s.match?(/\s+/) # -> nil
|
697
|
+
*/
|
698
|
+
static VALUE
|
699
|
+
strscan_match_p(VALUE self, VALUE re)
|
700
|
+
{
|
701
|
+
return strscan_do_scan(self, re, 0, 0, 1);
|
702
|
+
}
|
703
|
+
|
704
|
+
/*
|
705
|
+
* call-seq: skip(pattern)
|
706
|
+
*
|
707
|
+
* Attempts to skip over the given +pattern+ beginning with the scan pointer.
|
708
|
+
* If it matches, the scan pointer is advanced to the end of the match, and the
|
709
|
+
* length of the match is returned. Otherwise, +nil+ is returned.
|
710
|
+
*
|
711
|
+
* It's similar to #scan, but without returning the matched string.
|
712
|
+
*
|
713
|
+
* s = StringScanner.new('test string')
|
714
|
+
* p s.skip(/\w+/) # -> 4
|
715
|
+
* p s.skip(/\w+/) # -> nil
|
716
|
+
* p s.skip(/\s+/) # -> 1
|
717
|
+
* p s.skip("st") # -> 2
|
718
|
+
* p s.skip(/\w+/) # -> 4
|
719
|
+
* p s.skip(/./) # -> nil
|
720
|
+
*
|
721
|
+
*/
|
722
|
+
static VALUE
|
723
|
+
strscan_skip(VALUE self, VALUE re)
|
724
|
+
{
|
725
|
+
return strscan_do_scan(self, re, 1, 0, 1);
|
726
|
+
}
|
727
|
+
|
728
|
+
/*
|
729
|
+
* call-seq: check(pattern)
|
730
|
+
*
|
731
|
+
* This returns the value that #scan would return, without advancing the scan
|
732
|
+
* pointer. The match register is affected, though.
|
733
|
+
*
|
734
|
+
* s = StringScanner.new("Fri Dec 12 1975 14:39")
|
735
|
+
* s.check /Fri/ # -> "Fri"
|
736
|
+
* s.pos # -> 0
|
737
|
+
* s.matched # -> "Fri"
|
738
|
+
* s.check /12/ # -> nil
|
739
|
+
* s.matched # -> nil
|
740
|
+
*
|
741
|
+
* Mnemonic: it "checks" to see whether a #scan will return a value.
|
742
|
+
*/
|
743
|
+
static VALUE
|
744
|
+
strscan_check(VALUE self, VALUE re)
|
745
|
+
{
|
746
|
+
return strscan_do_scan(self, re, 0, 1, 1);
|
747
|
+
}
|
748
|
+
|
749
|
+
/*
|
750
|
+
* call-seq: scan_full(pattern, advance_pointer_p, return_string_p)
|
751
|
+
*
|
752
|
+
* Tests whether the given +pattern+ is matched from the current scan pointer.
|
753
|
+
* Advances the scan pointer if +advance_pointer_p+ is true.
|
754
|
+
* Returns the matched string if +return_string_p+ is true.
|
755
|
+
* The match register is affected.
|
756
|
+
*
|
757
|
+
* "full" means "#scan with full parameters".
|
758
|
+
*/
|
759
|
+
static VALUE
|
760
|
+
strscan_scan_full(VALUE self, VALUE re, VALUE s, VALUE f)
|
761
|
+
{
|
762
|
+
return strscan_do_scan(self, re, RTEST(s), RTEST(f), 1);
|
763
|
+
}
|
764
|
+
|
765
|
+
/*
|
766
|
+
* call-seq: scan_until(pattern)
|
767
|
+
*
|
768
|
+
* Scans the string _until_ the +pattern+ is matched. Returns the substring up
|
769
|
+
* to and including the end of the match, advancing the scan pointer to that
|
770
|
+
* location. If there is no match, +nil+ is returned.
|
771
|
+
*
|
772
|
+
* s = StringScanner.new("Fri Dec 12 1975 14:39")
|
773
|
+
* s.scan_until(/1/) # -> "Fri Dec 1"
|
774
|
+
* s.pre_match # -> "Fri Dec "
|
775
|
+
* s.scan_until(/XYZ/) # -> nil
|
776
|
+
*/
|
777
|
+
static VALUE
|
778
|
+
strscan_scan_until(VALUE self, VALUE re)
|
779
|
+
{
|
780
|
+
return strscan_do_scan(self, re, 1, 1, 0);
|
781
|
+
}
|
782
|
+
|
783
|
+
/*
|
784
|
+
* call-seq: exist?(pattern)
|
785
|
+
*
|
786
|
+
* Looks _ahead_ to see if the +pattern+ exists _anywhere_ in the string,
|
787
|
+
* without advancing the scan pointer. This predicates whether a #scan_until
|
788
|
+
* will return a value.
|
789
|
+
*
|
790
|
+
* s = StringScanner.new('test string')
|
791
|
+
* s.exist? /s/ # -> 3
|
792
|
+
* s.scan /test/ # -> "test"
|
793
|
+
* s.exist? /s/ # -> 2
|
794
|
+
* s.exist? /e/ # -> nil
|
795
|
+
*/
|
796
|
+
static VALUE
|
797
|
+
strscan_exist_p(VALUE self, VALUE re)
|
798
|
+
{
|
799
|
+
return strscan_do_scan(self, re, 0, 0, 0);
|
800
|
+
}
|
801
|
+
|
802
|
+
/*
|
803
|
+
* call-seq: skip_until(pattern)
|
804
|
+
*
|
805
|
+
* Advances the scan pointer until +pattern+ is matched and consumed. Returns
|
806
|
+
* the number of bytes advanced, or +nil+ if no match was found.
|
807
|
+
*
|
808
|
+
* Look ahead to match +pattern+, and advance the scan pointer to the _end_
|
809
|
+
* of the match. Return the number of characters advanced, or +nil+ if the
|
810
|
+
* match was unsuccessful.
|
811
|
+
*
|
812
|
+
* It's similar to #scan_until, but without returning the intervening string.
|
813
|
+
*
|
814
|
+
* s = StringScanner.new("Fri Dec 12 1975 14:39")
|
815
|
+
* s.skip_until /12/ # -> 10
|
816
|
+
* s #
|
817
|
+
*/
|
818
|
+
static VALUE
|
819
|
+
strscan_skip_until(VALUE self, VALUE re)
|
820
|
+
{
|
821
|
+
return strscan_do_scan(self, re, 1, 0, 0);
|
822
|
+
}
|
823
|
+
|
824
|
+
/*
|
825
|
+
* call-seq: check_until(pattern)
|
826
|
+
*
|
827
|
+
* This returns the value that #scan_until would return, without advancing the
|
828
|
+
* scan pointer. The match register is affected, though.
|
829
|
+
*
|
830
|
+
* s = StringScanner.new("Fri Dec 12 1975 14:39")
|
831
|
+
* s.check_until /12/ # -> "Fri Dec 12"
|
832
|
+
* s.pos # -> 0
|
833
|
+
* s.matched # -> 12
|
834
|
+
*
|
835
|
+
* Mnemonic: it "checks" to see whether a #scan_until will return a value.
|
836
|
+
*/
|
837
|
+
static VALUE
|
838
|
+
strscan_check_until(VALUE self, VALUE re)
|
839
|
+
{
|
840
|
+
return strscan_do_scan(self, re, 0, 1, 0);
|
841
|
+
}
|
842
|
+
|
843
|
+
/*
|
844
|
+
* call-seq: search_full(pattern, advance_pointer_p, return_string_p)
|
845
|
+
*
|
846
|
+
* Scans the string _until_ the +pattern+ is matched.
|
847
|
+
* Advances the scan pointer if +advance_pointer_p+, otherwise not.
|
848
|
+
* Returns the matched string if +return_string_p+ is true, otherwise
|
849
|
+
* returns the number of bytes advanced.
|
850
|
+
* This method does affect the match register.
|
851
|
+
*/
|
852
|
+
static VALUE
|
853
|
+
strscan_search_full(VALUE self, VALUE re, VALUE s, VALUE f)
|
854
|
+
{
|
855
|
+
return strscan_do_scan(self, re, RTEST(s), RTEST(f), 0);
|
856
|
+
}
|
857
|
+
|
858
|
+
static void
|
859
|
+
adjust_registers_to_matched(struct strscanner *p)
|
860
|
+
{
|
861
|
+
onig_region_clear(&(p->regs));
|
862
|
+
if (p->fixed_anchor_p) {
|
863
|
+
onig_region_set(&(p->regs), 0, (int)p->prev, (int)p->curr);
|
864
|
+
}
|
865
|
+
else {
|
866
|
+
onig_region_set(&(p->regs), 0, 0, (int)(p->curr - p->prev));
|
867
|
+
}
|
868
|
+
}
|
869
|
+
|
870
|
+
/*
|
871
|
+
* Scans one character and returns it.
|
872
|
+
* This method is multibyte character sensitive.
|
873
|
+
*
|
874
|
+
* s = StringScanner.new("ab")
|
875
|
+
* s.getch # => "a"
|
876
|
+
* s.getch # => "b"
|
877
|
+
* s.getch # => nil
|
878
|
+
*
|
879
|
+
* s = StringScanner.new("\244\242".force_encoding("euc-jp"))
|
880
|
+
* s.getch # => "\x{A4A2}" # Japanese hira-kana "A" in EUC-JP
|
881
|
+
* s.getch # => nil
|
882
|
+
*/
|
883
|
+
static VALUE
|
884
|
+
strscan_getch(VALUE self)
|
885
|
+
{
|
886
|
+
struct strscanner *p;
|
887
|
+
long len;
|
888
|
+
|
889
|
+
GET_SCANNER(self, p);
|
890
|
+
CLEAR_MATCH_STATUS(p);
|
891
|
+
if (EOS_P(p))
|
892
|
+
return Qnil;
|
893
|
+
|
894
|
+
len = rb_enc_mbclen(CURPTR(p), S_PEND(p), rb_enc_get(p->str));
|
895
|
+
len = minl(len, S_RESTLEN(p));
|
896
|
+
p->prev = p->curr;
|
897
|
+
p->curr += len;
|
898
|
+
MATCHED(p);
|
899
|
+
adjust_registers_to_matched(p);
|
900
|
+
return extract_range(p,
|
901
|
+
adjust_register_position(p, p->regs.beg[0]),
|
902
|
+
adjust_register_position(p, p->regs.end[0]));
|
903
|
+
}
|
904
|
+
|
905
|
+
/*
|
906
|
+
* Scans one byte and returns it.
|
907
|
+
* This method is not multibyte character sensitive.
|
908
|
+
* See also: #getch.
|
909
|
+
*
|
910
|
+
* s = StringScanner.new('ab')
|
911
|
+
* s.get_byte # => "a"
|
912
|
+
* s.get_byte # => "b"
|
913
|
+
* s.get_byte # => nil
|
914
|
+
*
|
915
|
+
* s = StringScanner.new("\244\242".force_encoding("euc-jp"))
|
916
|
+
* s.get_byte # => "\xA4"
|
917
|
+
* s.get_byte # => "\xA2"
|
918
|
+
* s.get_byte # => nil
|
919
|
+
*/
|
920
|
+
static VALUE
|
921
|
+
strscan_get_byte(VALUE self)
|
922
|
+
{
|
923
|
+
struct strscanner *p;
|
924
|
+
|
925
|
+
GET_SCANNER(self, p);
|
926
|
+
CLEAR_MATCH_STATUS(p);
|
927
|
+
if (EOS_P(p))
|
928
|
+
return Qnil;
|
929
|
+
|
930
|
+
p->prev = p->curr;
|
931
|
+
p->curr++;
|
932
|
+
MATCHED(p);
|
933
|
+
adjust_registers_to_matched(p);
|
934
|
+
return extract_range(p,
|
935
|
+
adjust_register_position(p, p->regs.beg[0]),
|
936
|
+
adjust_register_position(p, p->regs.end[0]));
|
937
|
+
}
|
938
|
+
|
939
|
+
/*
|
940
|
+
* Equivalent to #get_byte.
|
941
|
+
* This method is obsolete; use #get_byte instead.
|
942
|
+
*/
|
943
|
+
static VALUE
|
944
|
+
strscan_getbyte(VALUE self)
|
945
|
+
{
|
946
|
+
rb_warning("StringScanner#getbyte is obsolete; use #get_byte instead");
|
947
|
+
return strscan_get_byte(self);
|
948
|
+
}
|
949
|
+
|
950
|
+
/*
|
951
|
+
* call-seq: peek(len)
|
952
|
+
*
|
953
|
+
* Extracts a string corresponding to <tt>string[pos,len]</tt>, without
|
954
|
+
* advancing the scan pointer.
|
955
|
+
*
|
956
|
+
* s = StringScanner.new('test string')
|
957
|
+
* s.peek(7) # => "test st"
|
958
|
+
* s.peek(7) # => "test st"
|
959
|
+
*
|
960
|
+
*/
|
961
|
+
static VALUE
|
962
|
+
strscan_peek(VALUE self, VALUE vlen)
|
963
|
+
{
|
964
|
+
struct strscanner *p;
|
965
|
+
long len;
|
966
|
+
|
967
|
+
GET_SCANNER(self, p);
|
968
|
+
|
969
|
+
len = NUM2LONG(vlen);
|
970
|
+
if (EOS_P(p))
|
971
|
+
return str_new(p, "", 0);
|
972
|
+
|
973
|
+
len = minl(len, S_RESTLEN(p));
|
974
|
+
return extract_beg_len(p, p->curr, len);
|
975
|
+
}
|
976
|
+
|
977
|
+
/*
|
978
|
+
* Equivalent to #peek.
|
979
|
+
* This method is obsolete; use #peek instead.
|
980
|
+
*/
|
981
|
+
static VALUE
|
982
|
+
strscan_peep(VALUE self, VALUE vlen)
|
983
|
+
{
|
984
|
+
rb_warning("StringScanner#peep is obsolete; use #peek instead");
|
985
|
+
return strscan_peek(self, vlen);
|
986
|
+
}
|
987
|
+
|
988
|
+
/*
|
989
|
+
* Sets the scan pointer to the previous position. Only one previous position is
|
990
|
+
* remembered, and it changes with each scanning operation.
|
991
|
+
*
|
992
|
+
* s = StringScanner.new('test string')
|
993
|
+
* s.scan(/\w+/) # => "test"
|
994
|
+
* s.unscan
|
995
|
+
* s.scan(/../) # => "te"
|
996
|
+
* s.scan(/\d/) # => nil
|
997
|
+
* s.unscan # ScanError: unscan failed: previous match record not exist
|
998
|
+
*/
|
999
|
+
static VALUE
|
1000
|
+
strscan_unscan(VALUE self)
|
1001
|
+
{
|
1002
|
+
struct strscanner *p;
|
1003
|
+
|
1004
|
+
GET_SCANNER(self, p);
|
1005
|
+
if (! MATCHED_P(p))
|
1006
|
+
rb_raise(ScanError, "unscan failed: previous match record not exist");
|
1007
|
+
p->curr = p->prev;
|
1008
|
+
CLEAR_MATCH_STATUS(p);
|
1009
|
+
return self;
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
/*
|
1013
|
+
* Returns +true+ if and only if the scan pointer is at the beginning of the line.
|
1014
|
+
*
|
1015
|
+
* s = StringScanner.new("test\ntest\n")
|
1016
|
+
* s.bol? # => true
|
1017
|
+
* s.scan(/te/)
|
1018
|
+
* s.bol? # => false
|
1019
|
+
* s.scan(/st\n/)
|
1020
|
+
* s.bol? # => true
|
1021
|
+
* s.terminate
|
1022
|
+
* s.bol? # => true
|
1023
|
+
*/
|
1024
|
+
static VALUE
|
1025
|
+
strscan_bol_p(VALUE self)
|
1026
|
+
{
|
1027
|
+
struct strscanner *p;
|
1028
|
+
|
1029
|
+
GET_SCANNER(self, p);
|
1030
|
+
if (CURPTR(p) > S_PEND(p)) return Qnil;
|
1031
|
+
if (p->curr == 0) return Qtrue;
|
1032
|
+
return (*(CURPTR(p) - 1) == '\n') ? Qtrue : Qfalse;
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
/*
|
1036
|
+
* Returns +true+ if the scan pointer is at the end of the string.
|
1037
|
+
*
|
1038
|
+
* s = StringScanner.new('test string')
|
1039
|
+
* p s.eos? # => false
|
1040
|
+
* s.scan(/test/)
|
1041
|
+
* p s.eos? # => false
|
1042
|
+
* s.terminate
|
1043
|
+
* p s.eos? # => true
|
1044
|
+
*/
|
1045
|
+
static VALUE
|
1046
|
+
strscan_eos_p(VALUE self)
|
1047
|
+
{
|
1048
|
+
struct strscanner *p;
|
1049
|
+
|
1050
|
+
GET_SCANNER(self, p);
|
1051
|
+
return EOS_P(p) ? Qtrue : Qfalse;
|
1052
|
+
}
|
1053
|
+
|
1054
|
+
/*
|
1055
|
+
* Equivalent to #eos?.
|
1056
|
+
* This method is obsolete, use #eos? instead.
|
1057
|
+
*/
|
1058
|
+
static VALUE
|
1059
|
+
strscan_empty_p(VALUE self)
|
1060
|
+
{
|
1061
|
+
rb_warning("StringScanner#empty? is obsolete; use #eos? instead");
|
1062
|
+
return strscan_eos_p(self);
|
1063
|
+
}
|
1064
|
+
|
1065
|
+
/*
|
1066
|
+
* Returns true if and only if there is more data in the string. See #eos?.
|
1067
|
+
* This method is obsolete; use #eos? instead.
|
1068
|
+
*
|
1069
|
+
* s = StringScanner.new('test string')
|
1070
|
+
* # These two are opposites
|
1071
|
+
* s.eos? # => false
|
1072
|
+
* s.rest? # => true
|
1073
|
+
*/
|
1074
|
+
static VALUE
|
1075
|
+
strscan_rest_p(VALUE self)
|
1076
|
+
{
|
1077
|
+
struct strscanner *p;
|
1078
|
+
|
1079
|
+
GET_SCANNER(self, p);
|
1080
|
+
return EOS_P(p) ? Qfalse : Qtrue;
|
1081
|
+
}
|
1082
|
+
|
1083
|
+
/*
|
1084
|
+
* Returns +true+ if and only if the last match was successful.
|
1085
|
+
*
|
1086
|
+
* s = StringScanner.new('test string')
|
1087
|
+
* s.match?(/\w+/) # => 4
|
1088
|
+
* s.matched? # => true
|
1089
|
+
* s.match?(/\d+/) # => nil
|
1090
|
+
* s.matched? # => false
|
1091
|
+
*/
|
1092
|
+
static VALUE
|
1093
|
+
strscan_matched_p(VALUE self)
|
1094
|
+
{
|
1095
|
+
struct strscanner *p;
|
1096
|
+
|
1097
|
+
GET_SCANNER(self, p);
|
1098
|
+
return MATCHED_P(p) ? Qtrue : Qfalse;
|
1099
|
+
}
|
1100
|
+
|
1101
|
+
/*
|
1102
|
+
* Returns the last matched string.
|
1103
|
+
*
|
1104
|
+
* s = StringScanner.new('test string')
|
1105
|
+
* s.match?(/\w+/) # -> 4
|
1106
|
+
* s.matched # -> "test"
|
1107
|
+
*/
|
1108
|
+
static VALUE
|
1109
|
+
strscan_matched(VALUE self)
|
1110
|
+
{
|
1111
|
+
struct strscanner *p;
|
1112
|
+
|
1113
|
+
GET_SCANNER(self, p);
|
1114
|
+
if (! MATCHED_P(p)) return Qnil;
|
1115
|
+
return extract_range(p,
|
1116
|
+
adjust_register_position(p, p->regs.beg[0]),
|
1117
|
+
adjust_register_position(p, p->regs.end[0]));
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
/*
|
1121
|
+
* Returns the size of the most recent match in bytes, or +nil+ if there
|
1122
|
+
* was no recent match. This is different than <tt>matched.size</tt>,
|
1123
|
+
* which will return the size in characters.
|
1124
|
+
*
|
1125
|
+
* s = StringScanner.new('test string')
|
1126
|
+
* s.check /\w+/ # -> "test"
|
1127
|
+
* s.matched_size # -> 4
|
1128
|
+
* s.check /\d+/ # -> nil
|
1129
|
+
* s.matched_size # -> nil
|
1130
|
+
*/
|
1131
|
+
static VALUE
|
1132
|
+
strscan_matched_size(VALUE self)
|
1133
|
+
{
|
1134
|
+
struct strscanner *p;
|
1135
|
+
|
1136
|
+
GET_SCANNER(self, p);
|
1137
|
+
if (! MATCHED_P(p)) return Qnil;
|
1138
|
+
return LONG2NUM(p->regs.end[0] - p->regs.beg[0]);
|
1139
|
+
}
|
1140
|
+
|
1141
|
+
static int
|
1142
|
+
name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name, const char* name_end, rb_encoding *enc)
|
1143
|
+
{
|
1144
|
+
int num;
|
1145
|
+
|
1146
|
+
num = onig_name_to_backref_number(RREGEXP_PTR(regexp),
|
1147
|
+
(const unsigned char* )name, (const unsigned char* )name_end, regs);
|
1148
|
+
if (num >= 1) {
|
1149
|
+
return num;
|
1150
|
+
}
|
1151
|
+
else {
|
1152
|
+
rb_enc_raise(enc, rb_eIndexError, "undefined group name reference: %.*s",
|
1153
|
+
rb_long2int(name_end - name), name);
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
UNREACHABLE;
|
1157
|
+
}
|
1158
|
+
|
1159
|
+
/*
|
1160
|
+
* call-seq: [](n)
|
1161
|
+
*
|
1162
|
+
* Returns the n-th subgroup in the most recent match.
|
1163
|
+
*
|
1164
|
+
* s = StringScanner.new("Fri Dec 12 1975 14:39")
|
1165
|
+
* s.scan(/(\w+) (\w+) (\d+) /) # -> "Fri Dec 12 "
|
1166
|
+
* s[0] # -> "Fri Dec 12 "
|
1167
|
+
* s[1] # -> "Fri"
|
1168
|
+
* s[2] # -> "Dec"
|
1169
|
+
* s[3] # -> "12"
|
1170
|
+
* s.post_match # -> "1975 14:39"
|
1171
|
+
* s.pre_match # -> ""
|
1172
|
+
*
|
1173
|
+
* s.reset
|
1174
|
+
* s.scan(/(?<wday>\w+) (?<month>\w+) (?<day>\d+) /) # -> "Fri Dec 12 "
|
1175
|
+
* s[0] # -> "Fri Dec 12 "
|
1176
|
+
* s[1] # -> "Fri"
|
1177
|
+
* s[2] # -> "Dec"
|
1178
|
+
* s[3] # -> "12"
|
1179
|
+
* s[:wday] # -> "Fri"
|
1180
|
+
* s[:month] # -> "Dec"
|
1181
|
+
* s[:day] # -> "12"
|
1182
|
+
* s.post_match # -> "1975 14:39"
|
1183
|
+
* s.pre_match # -> ""
|
1184
|
+
*/
|
1185
|
+
static VALUE
|
1186
|
+
strscan_aref(VALUE self, VALUE idx)
|
1187
|
+
{
|
1188
|
+
const char *name;
|
1189
|
+
struct strscanner *p;
|
1190
|
+
long i;
|
1191
|
+
|
1192
|
+
GET_SCANNER(self, p);
|
1193
|
+
if (! MATCHED_P(p)) return Qnil;
|
1194
|
+
|
1195
|
+
switch (TYPE(idx)) {
|
1196
|
+
case T_SYMBOL:
|
1197
|
+
idx = rb_sym2str(idx);
|
1198
|
+
/* fall through */
|
1199
|
+
case T_STRING:
|
1200
|
+
if (!RTEST(p->regex)) return Qnil;
|
1201
|
+
RSTRING_GETMEM(idx, name, i);
|
1202
|
+
i = name_to_backref_number(&(p->regs), p->regex, name, name + i, rb_enc_get(idx));
|
1203
|
+
break;
|
1204
|
+
default:
|
1205
|
+
i = NUM2LONG(idx);
|
1206
|
+
}
|
1207
|
+
|
1208
|
+
if (i < 0)
|
1209
|
+
i += p->regs.num_regs;
|
1210
|
+
if (i < 0) return Qnil;
|
1211
|
+
if (i >= p->regs.num_regs) return Qnil;
|
1212
|
+
if (p->regs.beg[i] == -1) return Qnil;
|
1213
|
+
|
1214
|
+
return extract_range(p,
|
1215
|
+
adjust_register_position(p, p->regs.beg[i]),
|
1216
|
+
adjust_register_position(p, p->regs.end[i]));
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
/*
|
1220
|
+
* call-seq: size
|
1221
|
+
*
|
1222
|
+
* Returns the amount of subgroups in the most recent match.
|
1223
|
+
* The full match counts as a subgroup.
|
1224
|
+
*
|
1225
|
+
* s = StringScanner.new("Fri Dec 12 1975 14:39")
|
1226
|
+
* s.scan(/(\w+) (\w+) (\d+) /) # -> "Fri Dec 12 "
|
1227
|
+
* s.size # -> 4
|
1228
|
+
*/
|
1229
|
+
static VALUE
|
1230
|
+
strscan_size(VALUE self)
|
1231
|
+
{
|
1232
|
+
struct strscanner *p;
|
1233
|
+
|
1234
|
+
GET_SCANNER(self, p);
|
1235
|
+
if (! MATCHED_P(p)) return Qnil;
|
1236
|
+
return INT2FIX(p->regs.num_regs);
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
/*
|
1240
|
+
* call-seq: captures
|
1241
|
+
*
|
1242
|
+
* Returns the subgroups in the most recent match (not including the full match).
|
1243
|
+
* If nothing was priorly matched, it returns nil.
|
1244
|
+
*
|
1245
|
+
* s = StringScanner.new("Fri Dec 12 1975 14:39")
|
1246
|
+
* s.scan(/(\w+) (\w+) (\d+) (1980)?/) # -> "Fri Dec 12 "
|
1247
|
+
* s.captures # -> ["Fri", "Dec", "12", nil]
|
1248
|
+
* s.scan(/(\w+) (\w+) (\d+) (1980)?/) # -> nil
|
1249
|
+
* s.captures # -> nil
|
1250
|
+
*/
|
1251
|
+
static VALUE
|
1252
|
+
strscan_captures(VALUE self)
|
1253
|
+
{
|
1254
|
+
struct strscanner *p;
|
1255
|
+
int i, num_regs;
|
1256
|
+
VALUE new_ary;
|
1257
|
+
|
1258
|
+
GET_SCANNER(self, p);
|
1259
|
+
if (! MATCHED_P(p)) return Qnil;
|
1260
|
+
|
1261
|
+
num_regs = p->regs.num_regs;
|
1262
|
+
new_ary = rb_ary_new2(num_regs);
|
1263
|
+
|
1264
|
+
for (i = 1; i < num_regs; i++) {
|
1265
|
+
VALUE str;
|
1266
|
+
if (p->regs.beg[i] == -1)
|
1267
|
+
str = Qnil;
|
1268
|
+
else
|
1269
|
+
str = extract_range(p,
|
1270
|
+
adjust_register_position(p, p->regs.beg[i]),
|
1271
|
+
adjust_register_position(p, p->regs.end[i]));
|
1272
|
+
rb_ary_push(new_ary, str);
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
return new_ary;
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
/*
|
1279
|
+
* call-seq:
|
1280
|
+
* scanner.values_at( i1, i2, ... iN ) -> an_array
|
1281
|
+
*
|
1282
|
+
* Returns the subgroups in the most recent match at the given indices.
|
1283
|
+
* If nothing was priorly matched, it returns nil.
|
1284
|
+
*
|
1285
|
+
* s = StringScanner.new("Fri Dec 12 1975 14:39")
|
1286
|
+
* s.scan(/(\w+) (\w+) (\d+) /) # -> "Fri Dec 12 "
|
1287
|
+
* s.values_at 0, -1, 5, 2 # -> ["Fri Dec 12 ", "12", nil, "Dec"]
|
1288
|
+
* s.scan(/(\w+) (\w+) (\d+) /) # -> nil
|
1289
|
+
* s.values_at 0, -1, 5, 2 # -> nil
|
1290
|
+
*/
|
1291
|
+
|
1292
|
+
static VALUE
|
1293
|
+
strscan_values_at(int argc, VALUE *argv, VALUE self)
|
1294
|
+
{
|
1295
|
+
struct strscanner *p;
|
1296
|
+
long i;
|
1297
|
+
VALUE new_ary;
|
1298
|
+
|
1299
|
+
GET_SCANNER(self, p);
|
1300
|
+
if (! MATCHED_P(p)) return Qnil;
|
1301
|
+
|
1302
|
+
new_ary = rb_ary_new2(argc);
|
1303
|
+
for (i = 0; i<argc; i++) {
|
1304
|
+
rb_ary_push(new_ary, strscan_aref(self, argv[i]));
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
return new_ary;
|
1308
|
+
}
|
1309
|
+
|
1310
|
+
/*
|
1311
|
+
* Returns the <i><b>pre</b>-match</i> (in the regular expression sense) of the last scan.
|
1312
|
+
*
|
1313
|
+
* s = StringScanner.new('test string')
|
1314
|
+
* s.scan(/\w+/) # -> "test"
|
1315
|
+
* s.scan(/\s+/) # -> " "
|
1316
|
+
* s.pre_match # -> "test"
|
1317
|
+
* s.post_match # -> "string"
|
1318
|
+
*/
|
1319
|
+
static VALUE
|
1320
|
+
strscan_pre_match(VALUE self)
|
1321
|
+
{
|
1322
|
+
struct strscanner *p;
|
1323
|
+
|
1324
|
+
GET_SCANNER(self, p);
|
1325
|
+
if (! MATCHED_P(p)) return Qnil;
|
1326
|
+
return extract_range(p,
|
1327
|
+
0,
|
1328
|
+
adjust_register_position(p, p->regs.beg[0]));
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
/*
|
1332
|
+
* Returns the <i><b>post</b>-match</i> (in the regular expression sense) of the last scan.
|
1333
|
+
*
|
1334
|
+
* s = StringScanner.new('test string')
|
1335
|
+
* s.scan(/\w+/) # -> "test"
|
1336
|
+
* s.scan(/\s+/) # -> " "
|
1337
|
+
* s.pre_match # -> "test"
|
1338
|
+
* s.post_match # -> "string"
|
1339
|
+
*/
|
1340
|
+
static VALUE
|
1341
|
+
strscan_post_match(VALUE self)
|
1342
|
+
{
|
1343
|
+
struct strscanner *p;
|
1344
|
+
|
1345
|
+
GET_SCANNER(self, p);
|
1346
|
+
if (! MATCHED_P(p)) return Qnil;
|
1347
|
+
return extract_range(p,
|
1348
|
+
adjust_register_position(p, p->regs.end[0]),
|
1349
|
+
S_LEN(p));
|
1350
|
+
}
|
1351
|
+
|
1352
|
+
/*
|
1353
|
+
* Returns the "rest" of the string (i.e. everything after the scan pointer).
|
1354
|
+
* If there is no more data (eos? = true), it returns <tt>""</tt>.
|
1355
|
+
*/
|
1356
|
+
static VALUE
|
1357
|
+
strscan_rest(VALUE self)
|
1358
|
+
{
|
1359
|
+
struct strscanner *p;
|
1360
|
+
|
1361
|
+
GET_SCANNER(self, p);
|
1362
|
+
if (EOS_P(p)) {
|
1363
|
+
return str_new(p, "", 0);
|
1364
|
+
}
|
1365
|
+
return extract_range(p, p->curr, S_LEN(p));
|
1366
|
+
}
|
1367
|
+
|
1368
|
+
/*
|
1369
|
+
* <tt>s.rest_size</tt> is equivalent to <tt>s.rest.size</tt>.
|
1370
|
+
*/
|
1371
|
+
static VALUE
|
1372
|
+
strscan_rest_size(VALUE self)
|
1373
|
+
{
|
1374
|
+
struct strscanner *p;
|
1375
|
+
long i;
|
1376
|
+
|
1377
|
+
GET_SCANNER(self, p);
|
1378
|
+
if (EOS_P(p)) {
|
1379
|
+
return INT2FIX(0);
|
1380
|
+
}
|
1381
|
+
i = S_RESTLEN(p);
|
1382
|
+
return INT2FIX(i);
|
1383
|
+
}
|
1384
|
+
|
1385
|
+
/*
|
1386
|
+
* <tt>s.restsize</tt> is equivalent to <tt>s.rest_size</tt>.
|
1387
|
+
* This method is obsolete; use #rest_size instead.
|
1388
|
+
*/
|
1389
|
+
static VALUE
|
1390
|
+
strscan_restsize(VALUE self)
|
1391
|
+
{
|
1392
|
+
rb_warning("StringScanner#restsize is obsolete; use #rest_size instead");
|
1393
|
+
return strscan_rest_size(self);
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
#define INSPECT_LENGTH 5
|
1397
|
+
|
1398
|
+
/*
|
1399
|
+
* Returns a string that represents the StringScanner object, showing:
|
1400
|
+
* - the current position
|
1401
|
+
* - the size of the string
|
1402
|
+
* - the characters surrounding the scan pointer
|
1403
|
+
*
|
1404
|
+
* s = StringScanner.new("Fri Dec 12 1975 14:39")
|
1405
|
+
* s.inspect # -> '#<StringScanner 0/21 @ "Fri D...">'
|
1406
|
+
* s.scan_until /12/ # -> "Fri Dec 12"
|
1407
|
+
* s.inspect # -> '#<StringScanner 10/21 "...ec 12" @ " 1975...">'
|
1408
|
+
*/
|
1409
|
+
static VALUE
|
1410
|
+
strscan_inspect(VALUE self)
|
1411
|
+
{
|
1412
|
+
struct strscanner *p;
|
1413
|
+
VALUE a, b;
|
1414
|
+
|
1415
|
+
p = check_strscan(self);
|
1416
|
+
if (NIL_P(p->str)) {
|
1417
|
+
a = rb_sprintf("#<%"PRIsVALUE" (uninitialized)>", rb_obj_class(self));
|
1418
|
+
return a;
|
1419
|
+
}
|
1420
|
+
if (EOS_P(p)) {
|
1421
|
+
a = rb_sprintf("#<%"PRIsVALUE" fin>", rb_obj_class(self));
|
1422
|
+
return a;
|
1423
|
+
}
|
1424
|
+
if (p->curr == 0) {
|
1425
|
+
b = inspect2(p);
|
1426
|
+
a = rb_sprintf("#<%"PRIsVALUE" %ld/%ld @ %"PRIsVALUE">",
|
1427
|
+
rb_obj_class(self),
|
1428
|
+
p->curr, S_LEN(p),
|
1429
|
+
b);
|
1430
|
+
return a;
|
1431
|
+
}
|
1432
|
+
a = inspect1(p);
|
1433
|
+
b = inspect2(p);
|
1434
|
+
a = rb_sprintf("#<%"PRIsVALUE" %ld/%ld %"PRIsVALUE" @ %"PRIsVALUE">",
|
1435
|
+
rb_obj_class(self),
|
1436
|
+
p->curr, S_LEN(p),
|
1437
|
+
a, b);
|
1438
|
+
return a;
|
1439
|
+
}
|
1440
|
+
|
1441
|
+
static VALUE
|
1442
|
+
inspect1(struct strscanner *p)
|
1443
|
+
{
|
1444
|
+
VALUE str;
|
1445
|
+
long len;
|
1446
|
+
|
1447
|
+
if (p->curr == 0) return rb_str_new2("");
|
1448
|
+
if (p->curr > INSPECT_LENGTH) {
|
1449
|
+
str = rb_str_new_cstr("...");
|
1450
|
+
len = INSPECT_LENGTH;
|
1451
|
+
}
|
1452
|
+
else {
|
1453
|
+
str = rb_str_new(0, 0);
|
1454
|
+
len = p->curr;
|
1455
|
+
}
|
1456
|
+
rb_str_cat(str, CURPTR(p) - len, len);
|
1457
|
+
return rb_str_dump(str);
|
1458
|
+
}
|
1459
|
+
|
1460
|
+
static VALUE
|
1461
|
+
inspect2(struct strscanner *p)
|
1462
|
+
{
|
1463
|
+
VALUE str;
|
1464
|
+
long len;
|
1465
|
+
|
1466
|
+
if (EOS_P(p)) return rb_str_new2("");
|
1467
|
+
len = S_RESTLEN(p);
|
1468
|
+
if (len > INSPECT_LENGTH) {
|
1469
|
+
str = rb_str_new(CURPTR(p), INSPECT_LENGTH);
|
1470
|
+
rb_str_cat2(str, "...");
|
1471
|
+
}
|
1472
|
+
else {
|
1473
|
+
str = rb_str_new(CURPTR(p), len);
|
1474
|
+
}
|
1475
|
+
return rb_str_dump(str);
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
/*
|
1479
|
+
* call-seq:
|
1480
|
+
* scanner.fixed_anchor? -> true or false
|
1481
|
+
*
|
1482
|
+
* Whether +scanner+ uses fixed anchor mode or not.
|
1483
|
+
*
|
1484
|
+
* If fixed anchor mode is used, +\A+ always matches the beginning of
|
1485
|
+
* the string. Otherwise, +\A+ always matches the current position.
|
1486
|
+
*/
|
1487
|
+
static VALUE
|
1488
|
+
strscan_fixed_anchor_p(VALUE self)
|
1489
|
+
{
|
1490
|
+
struct strscanner *p;
|
1491
|
+
p = check_strscan(self);
|
1492
|
+
return p->fixed_anchor_p ? Qtrue : Qfalse;
|
1493
|
+
}
|
1494
|
+
|
1495
|
+
typedef struct {
|
1496
|
+
VALUE self;
|
1497
|
+
VALUE captures;
|
1498
|
+
} named_captures_data;
|
1499
|
+
|
1500
|
+
static int
|
1501
|
+
named_captures_iter(const OnigUChar *name,
|
1502
|
+
const OnigUChar *name_end,
|
1503
|
+
int back_num,
|
1504
|
+
int *back_refs,
|
1505
|
+
OnigRegex regex,
|
1506
|
+
void *arg)
|
1507
|
+
{
|
1508
|
+
named_captures_data *data = arg;
|
1509
|
+
|
1510
|
+
VALUE key = rb_str_new((const char *)name, name_end - name);
|
1511
|
+
VALUE value = RUBY_Qnil;
|
1512
|
+
int i;
|
1513
|
+
for (i = 0; i < back_num; i++) {
|
1514
|
+
value = strscan_aref(data->self, INT2NUM(back_refs[i]));
|
1515
|
+
}
|
1516
|
+
rb_hash_aset(data->captures, key, value);
|
1517
|
+
return 0;
|
1518
|
+
}
|
1519
|
+
|
1520
|
+
/*
|
1521
|
+
* call-seq:
|
1522
|
+
* scanner.named_captures -> hash
|
1523
|
+
*
|
1524
|
+
* Returns a hash of string variables matching the regular expression.
|
1525
|
+
*
|
1526
|
+
* scan = StringScanner.new('foobarbaz')
|
1527
|
+
* scan.match?(/(?<f>foo)(?<r>bar)(?<z>baz)/)
|
1528
|
+
* scan.named_captures # -> {"f"=>"foo", "r"=>"bar", "z"=>"baz"}
|
1529
|
+
*/
|
1530
|
+
static VALUE
|
1531
|
+
strscan_named_captures(VALUE self)
|
1532
|
+
{
|
1533
|
+
struct strscanner *p;
|
1534
|
+
GET_SCANNER(self, p);
|
1535
|
+
named_captures_data data;
|
1536
|
+
data.self = self;
|
1537
|
+
data.captures = rb_hash_new();
|
1538
|
+
if (!RB_NIL_P(p->regex)) {
|
1539
|
+
onig_foreach_name(RREGEXP_PTR(p->regex), named_captures_iter, &data);
|
1540
|
+
}
|
1541
|
+
|
1542
|
+
return data.captures;
|
1543
|
+
}
|
1544
|
+
|
1545
|
+
/* =======================================================================
|
1546
|
+
Ruby Interface
|
1547
|
+
======================================================================= */
|
1548
|
+
|
1549
|
+
/*
|
1550
|
+
* Document-class: StringScanner
|
1551
|
+
*
|
1552
|
+
* StringScanner provides for lexical scanning operations on a String. Here is
|
1553
|
+
* an example of its usage:
|
1554
|
+
*
|
1555
|
+
* require 'strscan'
|
1556
|
+
*
|
1557
|
+
* s = StringScanner.new('This is an example string')
|
1558
|
+
* s.eos? # -> false
|
1559
|
+
*
|
1560
|
+
* p s.scan(/\w+/) # -> "This"
|
1561
|
+
* p s.scan(/\w+/) # -> nil
|
1562
|
+
* p s.scan(/\s+/) # -> " "
|
1563
|
+
* p s.scan(/\s+/) # -> nil
|
1564
|
+
* p s.scan(/\w+/) # -> "is"
|
1565
|
+
* s.eos? # -> false
|
1566
|
+
*
|
1567
|
+
* p s.scan(/\s+/) # -> " "
|
1568
|
+
* p s.scan(/\w+/) # -> "an"
|
1569
|
+
* p s.scan(/\s+/) # -> " "
|
1570
|
+
* p s.scan(/\w+/) # -> "example"
|
1571
|
+
* p s.scan(/\s+/) # -> " "
|
1572
|
+
* p s.scan(/\w+/) # -> "string"
|
1573
|
+
* s.eos? # -> true
|
1574
|
+
*
|
1575
|
+
* p s.scan(/\s+/) # -> nil
|
1576
|
+
* p s.scan(/\w+/) # -> nil
|
1577
|
+
*
|
1578
|
+
* Scanning a string means remembering the position of a <i>scan pointer</i>,
|
1579
|
+
* which is just an index. The point of scanning is to move forward a bit at
|
1580
|
+
* a time, so matches are sought after the scan pointer; usually immediately
|
1581
|
+
* after it.
|
1582
|
+
*
|
1583
|
+
* Given the string "test string", here are the pertinent scan pointer
|
1584
|
+
* positions:
|
1585
|
+
*
|
1586
|
+
* t e s t s t r i n g
|
1587
|
+
* 0 1 2 ... 1
|
1588
|
+
* 0
|
1589
|
+
*
|
1590
|
+
* When you #scan for a pattern (a regular expression), the match must occur
|
1591
|
+
* at the character after the scan pointer. If you use #scan_until, then the
|
1592
|
+
* match can occur anywhere after the scan pointer. In both cases, the scan
|
1593
|
+
* pointer moves <i>just beyond</i> the last character of the match, ready to
|
1594
|
+
* scan again from the next character onwards. This is demonstrated by the
|
1595
|
+
* example above.
|
1596
|
+
*
|
1597
|
+
* == Method Categories
|
1598
|
+
*
|
1599
|
+
* There are other methods besides the plain scanners. You can look ahead in
|
1600
|
+
* the string without actually scanning. You can access the most recent match.
|
1601
|
+
* You can modify the string being scanned, reset or terminate the scanner,
|
1602
|
+
* find out or change the position of the scan pointer, skip ahead, and so on.
|
1603
|
+
*
|
1604
|
+
* === Advancing the Scan Pointer
|
1605
|
+
*
|
1606
|
+
* - #getch
|
1607
|
+
* - #get_byte
|
1608
|
+
* - #scan
|
1609
|
+
* - #scan_until
|
1610
|
+
* - #skip
|
1611
|
+
* - #skip_until
|
1612
|
+
*
|
1613
|
+
* === Looking Ahead
|
1614
|
+
*
|
1615
|
+
* - #check
|
1616
|
+
* - #check_until
|
1617
|
+
* - #exist?
|
1618
|
+
* - #match?
|
1619
|
+
* - #peek
|
1620
|
+
*
|
1621
|
+
* === Finding Where we Are
|
1622
|
+
*
|
1623
|
+
* - #beginning_of_line? (<tt>#bol?</tt>)
|
1624
|
+
* - #eos?
|
1625
|
+
* - #rest?
|
1626
|
+
* - #rest_size
|
1627
|
+
* - #pos
|
1628
|
+
*
|
1629
|
+
* === Setting Where we Are
|
1630
|
+
*
|
1631
|
+
* - #reset
|
1632
|
+
* - #terminate
|
1633
|
+
* - #pos=
|
1634
|
+
*
|
1635
|
+
* === Match Data
|
1636
|
+
*
|
1637
|
+
* - #matched
|
1638
|
+
* - #matched?
|
1639
|
+
* - #matched_size
|
1640
|
+
* - <tt>#[]</tt>
|
1641
|
+
* - #pre_match
|
1642
|
+
* - #post_match
|
1643
|
+
*
|
1644
|
+
* === Miscellaneous
|
1645
|
+
*
|
1646
|
+
* - <tt><<</tt>
|
1647
|
+
* - #concat
|
1648
|
+
* - #string
|
1649
|
+
* - #string=
|
1650
|
+
* - #unscan
|
1651
|
+
*
|
1652
|
+
* There are aliases to several of the methods.
|
1653
|
+
*/
|
1654
|
+
void
|
1655
|
+
Init_strscan(void)
|
1656
|
+
{
|
1657
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
1658
|
+
rb_ext_ractor_safe(true);
|
1659
|
+
#endif
|
1660
|
+
|
1661
|
+
#undef rb_intern
|
1662
|
+
ID id_scanerr = rb_intern("ScanError");
|
1663
|
+
VALUE tmp;
|
1664
|
+
|
1665
|
+
id_byteslice = rb_intern("byteslice");
|
1666
|
+
|
1667
|
+
StringScanner = rb_define_class("StringScanner", rb_cObject);
|
1668
|
+
ScanError = rb_define_class_under(StringScanner, "Error", rb_eStandardError);
|
1669
|
+
if (!rb_const_defined(rb_cObject, id_scanerr)) {
|
1670
|
+
rb_const_set(rb_cObject, id_scanerr, ScanError);
|
1671
|
+
}
|
1672
|
+
tmp = rb_str_new2(STRSCAN_VERSION);
|
1673
|
+
rb_obj_freeze(tmp);
|
1674
|
+
rb_const_set(StringScanner, rb_intern("Version"), tmp);
|
1675
|
+
tmp = rb_str_new2("$Id$");
|
1676
|
+
rb_obj_freeze(tmp);
|
1677
|
+
rb_const_set(StringScanner, rb_intern("Id"), tmp);
|
1678
|
+
|
1679
|
+
rb_define_alloc_func(StringScanner, strscan_s_allocate);
|
1680
|
+
rb_define_private_method(StringScanner, "initialize", strscan_initialize, -1);
|
1681
|
+
rb_define_private_method(StringScanner, "initialize_copy", strscan_init_copy, 1);
|
1682
|
+
rb_define_singleton_method(StringScanner, "must_C_version", strscan_s_mustc, 0);
|
1683
|
+
rb_define_method(StringScanner, "reset", strscan_reset, 0);
|
1684
|
+
rb_define_method(StringScanner, "terminate", strscan_terminate, 0);
|
1685
|
+
rb_define_method(StringScanner, "clear", strscan_clear, 0);
|
1686
|
+
rb_define_method(StringScanner, "string", strscan_get_string, 0);
|
1687
|
+
rb_define_method(StringScanner, "string=", strscan_set_string, 1);
|
1688
|
+
rb_define_method(StringScanner, "concat", strscan_concat, 1);
|
1689
|
+
rb_define_method(StringScanner, "<<", strscan_concat, 1);
|
1690
|
+
rb_define_method(StringScanner, "pos", strscan_get_pos, 0);
|
1691
|
+
rb_define_method(StringScanner, "pos=", strscan_set_pos, 1);
|
1692
|
+
rb_define_method(StringScanner, "charpos", strscan_get_charpos, 0);
|
1693
|
+
rb_define_method(StringScanner, "pointer", strscan_get_pos, 0);
|
1694
|
+
rb_define_method(StringScanner, "pointer=", strscan_set_pos, 1);
|
1695
|
+
|
1696
|
+
rb_define_method(StringScanner, "scan", strscan_scan, 1);
|
1697
|
+
rb_define_method(StringScanner, "skip", strscan_skip, 1);
|
1698
|
+
rb_define_method(StringScanner, "match?", strscan_match_p, 1);
|
1699
|
+
rb_define_method(StringScanner, "check", strscan_check, 1);
|
1700
|
+
rb_define_method(StringScanner, "scan_full", strscan_scan_full, 3);
|
1701
|
+
|
1702
|
+
rb_define_method(StringScanner, "scan_until", strscan_scan_until, 1);
|
1703
|
+
rb_define_method(StringScanner, "skip_until", strscan_skip_until, 1);
|
1704
|
+
rb_define_method(StringScanner, "exist?", strscan_exist_p, 1);
|
1705
|
+
rb_define_method(StringScanner, "check_until", strscan_check_until, 1);
|
1706
|
+
rb_define_method(StringScanner, "search_full", strscan_search_full, 3);
|
1707
|
+
|
1708
|
+
rb_define_method(StringScanner, "getch", strscan_getch, 0);
|
1709
|
+
rb_define_method(StringScanner, "get_byte", strscan_get_byte, 0);
|
1710
|
+
rb_define_method(StringScanner, "getbyte", strscan_getbyte, 0);
|
1711
|
+
rb_define_method(StringScanner, "peek", strscan_peek, 1);
|
1712
|
+
rb_define_method(StringScanner, "peep", strscan_peep, 1);
|
1713
|
+
|
1714
|
+
rb_define_method(StringScanner, "unscan", strscan_unscan, 0);
|
1715
|
+
|
1716
|
+
rb_define_method(StringScanner, "beginning_of_line?", strscan_bol_p, 0);
|
1717
|
+
rb_alias(StringScanner, rb_intern("bol?"), rb_intern("beginning_of_line?"));
|
1718
|
+
rb_define_method(StringScanner, "eos?", strscan_eos_p, 0);
|
1719
|
+
rb_define_method(StringScanner, "empty?", strscan_empty_p, 0);
|
1720
|
+
rb_define_method(StringScanner, "rest?", strscan_rest_p, 0);
|
1721
|
+
|
1722
|
+
rb_define_method(StringScanner, "matched?", strscan_matched_p, 0);
|
1723
|
+
rb_define_method(StringScanner, "matched", strscan_matched, 0);
|
1724
|
+
rb_define_method(StringScanner, "matched_size", strscan_matched_size, 0);
|
1725
|
+
rb_define_method(StringScanner, "[]", strscan_aref, 1);
|
1726
|
+
rb_define_method(StringScanner, "pre_match", strscan_pre_match, 0);
|
1727
|
+
rb_define_method(StringScanner, "post_match", strscan_post_match, 0);
|
1728
|
+
rb_define_method(StringScanner, "size", strscan_size, 0);
|
1729
|
+
rb_define_method(StringScanner, "captures", strscan_captures, 0);
|
1730
|
+
rb_define_method(StringScanner, "values_at", strscan_values_at, -1);
|
1731
|
+
|
1732
|
+
rb_define_method(StringScanner, "rest", strscan_rest, 0);
|
1733
|
+
rb_define_method(StringScanner, "rest_size", strscan_rest_size, 0);
|
1734
|
+
rb_define_method(StringScanner, "restsize", strscan_restsize, 0);
|
1735
|
+
|
1736
|
+
rb_define_method(StringScanner, "inspect", strscan_inspect, 0);
|
1737
|
+
|
1738
|
+
rb_define_method(StringScanner, "fixed_anchor?", strscan_fixed_anchor_p, 0);
|
1739
|
+
|
1740
|
+
rb_define_method(StringScanner, "named_captures", strscan_named_captures, 0);
|
1741
|
+
}
|