@appthreat/atom 2.0.25 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -4
- package/plugins/bin/atom +1 -1
- package/plugins/bin/atom.bat +1 -1
- package/plugins/bin/bundler +14 -0
- package/plugins/bin/ruby_ast_gen +14 -0
- package/plugins/composer/InstalledVersions.php +7 -4
- package/plugins/composer/installed.php +6 -6
- package/plugins/lib/{com.github.javaparser.javaparser-core-3.26.2.jar → com.github.javaparser.javaparser-core-3.26.3.jar} +0 -0
- package/plugins/lib/{com.github.javaparser.javaparser-symbol-solver-core-3.26.2.jar → com.github.javaparser.javaparser-symbol-solver-core-3.26.3.jar} +0 -0
- package/plugins/lib/{com.google.guava.guava-33.3.0-jre.jar → com.google.guava.guava-33.3.1-jre.jar} +0 -0
- package/plugins/lib/{commons-io.commons-io-2.17.0.jar → commons-io.commons-io-2.18.0.jar} +0 -0
- package/plugins/lib/io.appthreat.atom-2.1.0-classpath.jar +0 -0
- package/plugins/lib/io.appthreat.atom-2.1.0.jar +0 -0
- package/plugins/lib/io.appthreat.c2cpg_3-2.3.0.jar +0 -0
- package/plugins/lib/io.appthreat.dataflowengineoss_3-2.3.0.jar +0 -0
- package/plugins/lib/io.appthreat.javasrc2cpg_3-2.3.0.jar +0 -0
- package/plugins/lib/io.appthreat.jimple2cpg_3-2.3.0.jar +0 -0
- package/plugins/lib/io.appthreat.jssrc2cpg_3-2.3.0.jar +0 -0
- package/plugins/lib/{io.appthreat.php2atom_3-2.2.3.jar → io.appthreat.php2atom_3-2.3.0.jar} +0 -0
- package/plugins/lib/io.appthreat.pysrc2cpg_3-2.3.0.jar +0 -0
- package/plugins/lib/io.appthreat.ruby2atom_3-2.3.0.jar +0 -0
- package/plugins/lib/io.appthreat.semanticcpg_3-2.3.0.jar +0 -0
- package/plugins/lib/io.appthreat.x2cpg_3-2.3.0.jar +0 -0
- package/plugins/lib/net.java.dev.jna.jna-5.15.0.jar +0 -0
- package/plugins/lib/net.java.dev.jna.jna-platform-5.15.0.jar +0 -0
- package/plugins/lib/org.eclipse.platform.org.eclipse.core.contenttype-3.9.600.jar +0 -0
- package/plugins/lib/{org.eclipse.platform.org.eclipse.core.filesystem-1.11.0.jar → org.eclipse.platform.org.eclipse.core.filesystem-1.11.100.jar} +0 -0
- package/plugins/lib/{org.eclipse.platform.org.eclipse.core.jobs-3.15.300.jar → org.eclipse.platform.org.eclipse.core.jobs-3.15.400.jar} +0 -0
- package/plugins/lib/{org.eclipse.platform.org.eclipse.core.resources-3.21.0.jar → org.eclipse.platform.org.eclipse.core.resources-3.22.0.jar} +0 -0
- package/plugins/lib/{org.eclipse.platform.org.eclipse.core.runtime-3.31.100.jar → org.eclipse.platform.org.eclipse.core.runtime-3.32.0.jar} +0 -0
- package/plugins/lib/org.eclipse.platform.org.eclipse.equinox.app-1.7.200.jar +0 -0
- package/plugins/lib/{org.eclipse.platform.org.eclipse.equinox.common-3.19.100.jar → org.eclipse.platform.org.eclipse.equinox.common-3.19.200.jar} +0 -0
- package/plugins/lib/org.eclipse.platform.org.eclipse.equinox.preferences-3.11.200.jar +0 -0
- package/plugins/lib/{org.eclipse.platform.org.eclipse.equinox.registry-3.12.100.jar → org.eclipse.platform.org.eclipse.equinox.registry-3.12.200.jar} +0 -0
- package/plugins/lib/{org.eclipse.platform.org.eclipse.osgi-3.21.0.jar → org.eclipse.platform.org.eclipse.osgi-3.22.0.jar} +0 -0
- package/plugins/lib/{org.scala-lang.modules.scala-asm-9.7.0-scala-2.jar → org.scala-lang.modules.scala-asm-9.7.1-scala-1.jar} +0 -0
- package/plugins/lib/org.scala-lang.modules.scala-parallel-collections_3-1.1.0.jar +0 -0
- package/plugins/lib/{org.scala-lang.scala-library-2.13.14.jar → org.scala-lang.scala-library-2.13.15.jar} +0 -0
- package/plugins/lib/org.scala-lang.scala3-library_3-3.6.2.jar +0 -0
- package/plugins/rubyastgen/.bundle/config +5 -0
- package/plugins/rubyastgen/Gemfile +11 -0
- package/plugins/rubyastgen/Gemfile.lock +31 -0
- package/plugins/rubyastgen/bundle/bundler/setup.rb +42 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bin/racc +29 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bin/ruby-parse +29 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bin/ruby-rewrite +29 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bin/ruby_ast_gen +29 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/.rspec +3 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/Gemfile +13 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/LICENSE.txt +213 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/README.md +46 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/Rakefile +8 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/bin/console +11 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/bin/setup +6 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/exe/ruby_ast_gen +59 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/lib/ruby_ast_gen/node_handling.rb +236 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/lib/ruby_ast_gen/version.rb +5 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/lib/ruby_ast_gen.rb +139 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/ruby_ast_gen.gemspec +25 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/sig/ruby_ast_gen.rbs +3 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/spec/ruby_ast_gen_spec.rb +93 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/spec/spec_helper.rb +15 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-1c6e88faec50/update_version.rb +36 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/racc-1.8.1/gem.build_complete +0 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/racc-1.8.1/gem_make.out +18 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/racc-1.8.1/racc/cparse.so +0 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.2/LICENSE.MIT +20 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.2/README.YARD.md +12 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.2/lib/ast/node.rb +268 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.2/lib/ast/processor/mixin.rb +288 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.2/lib/ast/processor.rb +12 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.2/lib/ast/sexp.rb +30 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.2/lib/ast.rb +17 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/BSDL +22 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/COPYING +56 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/Gemfile +10 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/README.md +69 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/Rakefile +18 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/bin/console +14 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/bin/setup +8 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/lib/ostruct.rb +489 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/ostruct.gemspec +24 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/LICENSE.txt +26 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/bin/ruby-parse +7 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/bin/ruby-rewrite +7 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/gauntlet_parser.rb +123 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/all.rb +17 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ast/node.rb +40 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ast/processor.rb +293 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/base.rb +291 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/builders/default.rb +2338 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/clobbering_error.rb +13 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/color.rb +32 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/context.rb +49 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/current.rb +137 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/current_arg_stack.rb +46 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/deprecation.rb +13 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/diagnostic/engine.rb +104 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/diagnostic.rb +163 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/lexer/dedenter.rb +88 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/lexer/explanation.rb +55 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/lexer/literal.rb +284 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/lexer/stack_state.rb +49 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/lexer-F0.rb +12922 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/lexer-F1.rb +14875 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/lexer-strings.rb +5424 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/macruby.rb +9634 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/max_numparam_stack.rb +56 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/messages.rb +125 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/meta.rb +40 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/rewriter.rb +105 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby18.rb +9272 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby19.rb +9558 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby20.rb +10229 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby21.rb +10203 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby22.rb +10302 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby23.rb +10322 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby24.rb +10454 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby25.rb +10374 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby26.rb +10352 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby27.rb +11947 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby28.rb +8047 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby30.rb +12243 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby31.rb +12716 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby32.rb +12704 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby33.rb +12589 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/ruby34.rb +12589 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/rubymotion.rb +9515 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/runner/ruby_parse.rb +157 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/runner/ruby_rewrite.rb +101 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/runner.rb +294 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/buffer.rb +369 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/comment/associator.rb +233 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/comment.rb +134 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/collection.rb +18 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/condition.rb +21 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/constant.rb +32 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/definition.rb +23 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/for.rb +19 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/heredoc.rb +19 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/index.rb +33 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/keyword.rb +20 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/method_definition.rb +25 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/objc_kwarg.rb +19 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/operator.rb +17 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/rescue_body.rb +21 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/send.rb +36 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/ternary.rb +18 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map/variable.rb +31 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/map.rb +186 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/range.rb +326 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/rewriter/action.rb +44 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/rewriter.rb +513 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/tree_rewriter/action.rb +243 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/source/tree_rewriter.rb +431 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/static_environment.rb +134 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/syntax_error.rb +21 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/tree_rewriter.rb +133 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/unknown_encoding_in_magic_comment_error.rb +15 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/variables_stack.rb +36 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser/version.rb +5 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/lib/parser.rb +91 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.6.0/parser.gemspec +43 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/BSDL +22 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/COPYING +56 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/ChangeLog +846 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/README.rdoc +60 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/TODO +5 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/bin/racc +320 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/en/grammar.en.rdoc +218 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/en/grammar2.en.rdoc +219 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/command.ja.html +99 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/debug.ja.rdoc +36 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/grammar.ja.rdoc +348 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/index.ja.html +10 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/parser.ja.rdoc +125 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/usage.ja.html +414 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/ext/racc/cparse/Makefile +273 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/ext/racc/cparse/cparse.c +840 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/ext/racc/cparse/extconf.rb +8 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/compat.rb +33 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/cparse.so +0 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/debugflags.rb +60 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/exception.rb +16 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/grammar.rb +1191 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/grammarfileparser.rb +667 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/info.rb +18 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/iset.rb +92 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/logfilegenerator.rb +212 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/parser-text.rb +644 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/parser.rb +630 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/parserfilegenerator.rb +473 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/sourcetext.rb +35 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/state.rb +976 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/statetransitiontable.rb +311 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/static.rb +5 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc.rb +6 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/specifications/ast-2.4.2.gemspec +30 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/specifications/ostruct-0.6.1.gemspec +21 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/specifications/parser-3.3.6.0.gemspec +37 -0
- package/plugins/rubyastgen/bundle/ruby/3.4.0/specifications/racc-1.8.1.gemspec +28 -0
- package/plugins/rubyastgen/setup.sh +6 -0
- package/rbastgen.js +37 -0
- package/utils.mjs +11 -1
- package/plugins/lib/io.appthreat.atom-2.0.25-classpath.jar +0 -0
- package/plugins/lib/io.appthreat.atom-2.0.25.jar +0 -0
- package/plugins/lib/io.appthreat.c2cpg_3-2.2.3.jar +0 -0
- package/plugins/lib/io.appthreat.dataflowengineoss_3-2.2.3.jar +0 -0
- package/plugins/lib/io.appthreat.javasrc2cpg_3-2.2.3.jar +0 -0
- package/plugins/lib/io.appthreat.jimple2cpg_3-2.2.3.jar +0 -0
- package/plugins/lib/io.appthreat.jssrc2cpg_3-2.2.3.jar +0 -0
- package/plugins/lib/io.appthreat.pysrc2cpg_3-2.2.3.jar +0 -0
- package/plugins/lib/io.appthreat.semanticcpg_3-2.2.3.jar +0 -0
- package/plugins/lib/io.appthreat.x2cpg_3-2.2.3.jar +0 -0
- package/plugins/lib/net.java.dev.jna.jna-5.14.0.jar +0 -0
- package/plugins/lib/net.java.dev.jna.jna-platform-5.14.0.jar +0 -0
- package/plugins/lib/org.eclipse.platform.org.eclipse.core.contenttype-3.9.400.jar +0 -0
- package/plugins/lib/org.eclipse.platform.org.eclipse.equinox.app-1.7.100.jar +0 -0
- package/plugins/lib/org.eclipse.platform.org.eclipse.equinox.preferences-3.11.100.jar +0 -0
- package/plugins/lib/org.scala-lang.modules.scala-parallel-collections_3-1.0.4.jar +0 -0
- package/plugins/lib/org.scala-lang.scala3-library_3-3.5.2.jar +0 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
module AST
|
|
2
|
+
class Processor
|
|
3
|
+
# The processor module is a module which helps transforming one
|
|
4
|
+
# AST into another. In a nutshell, the {#process} method accepts
|
|
5
|
+
# a {Node} and dispatches it to a handler corresponding to its
|
|
6
|
+
# type, and returns a (possibly) updated variant of the node.
|
|
7
|
+
#
|
|
8
|
+
# The processor module has a set of associated design patterns.
|
|
9
|
+
# They are best explained with a concrete example. Let's define a
|
|
10
|
+
# simple arithmetic language and an AST format for it:
|
|
11
|
+
#
|
|
12
|
+
# Terminals (AST nodes which do not have other AST nodes inside):
|
|
13
|
+
#
|
|
14
|
+
# * `(integer <int-literal>)`,
|
|
15
|
+
#
|
|
16
|
+
# Nonterminals (AST nodes with other nodes as children):
|
|
17
|
+
#
|
|
18
|
+
# * `(add <node> <node>)`,
|
|
19
|
+
# * `(multiply <node> <node>)`,
|
|
20
|
+
# * `(divide <node> <node>)`,
|
|
21
|
+
# * `(negate <node>)`,
|
|
22
|
+
# * `(store <node> <string-literal>)`: stores value of `<node>`
|
|
23
|
+
# into a variable named `<string-literal>`,
|
|
24
|
+
# * `(load <string-literal>)`: loads value of a variable named
|
|
25
|
+
# `<string-literal>`,
|
|
26
|
+
# * `(each <node> ...)`: computes each of the `<node>`s and
|
|
27
|
+
# prints the result.
|
|
28
|
+
#
|
|
29
|
+
# All AST nodes have the same Ruby class, and therefore they don't
|
|
30
|
+
# know how to traverse themselves. (A solution which dynamically
|
|
31
|
+
# checks the type of children is possible, but is slow and
|
|
32
|
+
# error-prone.) So, a class including the module which knows how
|
|
33
|
+
# to traverse the entire tree should be defined. Such classes
|
|
34
|
+
# have a handler for each nonterminal node which recursively
|
|
35
|
+
# processes children nodes:
|
|
36
|
+
#
|
|
37
|
+
# require 'ast'
|
|
38
|
+
#
|
|
39
|
+
# class ArithmeticsProcessor
|
|
40
|
+
# include AST::Processor::Mixin
|
|
41
|
+
# # This method traverses any binary operators such as (add)
|
|
42
|
+
# # or (multiply).
|
|
43
|
+
# def process_binary_op(node)
|
|
44
|
+
# # Children aren't decomposed automatically; it is
|
|
45
|
+
# # suggested to use Ruby multiple assignment expansion,
|
|
46
|
+
# # as it is very convenient here.
|
|
47
|
+
# left_expr, right_expr = *node
|
|
48
|
+
#
|
|
49
|
+
# # AST::Node#updated won't change node type if nil is
|
|
50
|
+
# # passed as a first argument, which allows to reuse the
|
|
51
|
+
# # same handler for multiple node types using `alias'
|
|
52
|
+
# # (below).
|
|
53
|
+
# node.updated(nil, [
|
|
54
|
+
# process(left_expr),
|
|
55
|
+
# process(right_expr)
|
|
56
|
+
# ])
|
|
57
|
+
# end
|
|
58
|
+
# alias_method :on_add, :process_binary_op
|
|
59
|
+
# alias_method :on_multiply, :process_binary_op
|
|
60
|
+
# alias_method :on_divide, :process_binary_op
|
|
61
|
+
#
|
|
62
|
+
# def on_negate(node)
|
|
63
|
+
# # It is also possible to use #process_all for more
|
|
64
|
+
# # compact code if every child is a Node.
|
|
65
|
+
# node.updated(nil, process_all(node))
|
|
66
|
+
# end
|
|
67
|
+
#
|
|
68
|
+
# def on_store(node)
|
|
69
|
+
# expr, variable_name = *node
|
|
70
|
+
#
|
|
71
|
+
# # Note that variable_name is not a Node and thus isn't
|
|
72
|
+
# # passed to #process.
|
|
73
|
+
# node.updated(nil, [
|
|
74
|
+
# process(expr),
|
|
75
|
+
# variable_name
|
|
76
|
+
# ])
|
|
77
|
+
# end
|
|
78
|
+
#
|
|
79
|
+
# # (load) is effectively a terminal node, and so it does
|
|
80
|
+
# # not need an explicit handler, as the following is the
|
|
81
|
+
# # default behavior. Essentially, for any nodes that don't
|
|
82
|
+
# # have a defined handler, the node remains unchanged.
|
|
83
|
+
# def on_load(node)
|
|
84
|
+
# nil
|
|
85
|
+
# end
|
|
86
|
+
#
|
|
87
|
+
# def on_each(node)
|
|
88
|
+
# node.updated(nil, process_all(node))
|
|
89
|
+
# end
|
|
90
|
+
# end
|
|
91
|
+
#
|
|
92
|
+
# Let's test our ArithmeticsProcessor:
|
|
93
|
+
#
|
|
94
|
+
# include AST::Sexp
|
|
95
|
+
# expr = s(:add, s(:integer, 2), s(:integer, 2))
|
|
96
|
+
#
|
|
97
|
+
# p ArithmeticsProcessor.new.process(expr) == expr # => true
|
|
98
|
+
#
|
|
99
|
+
# As expected, it does not change anything at all. This isn't
|
|
100
|
+
# actually very useful, so let's now define a Calculator, which
|
|
101
|
+
# will compute the expression values:
|
|
102
|
+
#
|
|
103
|
+
# # This Processor folds nonterminal nodes and returns an
|
|
104
|
+
# # (integer) terminal node.
|
|
105
|
+
# class ArithmeticsCalculator < ArithmeticsProcessor
|
|
106
|
+
# def compute_op(node)
|
|
107
|
+
# # First, node children are processed and then unpacked
|
|
108
|
+
# # to local variables.
|
|
109
|
+
# nodes = process_all(node)
|
|
110
|
+
#
|
|
111
|
+
# if nodes.all? { |node| node.type == :integer }
|
|
112
|
+
# # If each of those nodes represents a literal, we can
|
|
113
|
+
# # fold this node!
|
|
114
|
+
# values = nodes.map { |node| node.children.first }
|
|
115
|
+
# AST::Node.new(:integer, [
|
|
116
|
+
# yield(values)
|
|
117
|
+
# ])
|
|
118
|
+
# else
|
|
119
|
+
# # Otherwise, we can just leave the current node in the
|
|
120
|
+
# # tree and only update it with processed children
|
|
121
|
+
# # nodes, which can be partially folded.
|
|
122
|
+
# node.updated(nil, nodes)
|
|
123
|
+
# end
|
|
124
|
+
# end
|
|
125
|
+
#
|
|
126
|
+
# def on_add(node)
|
|
127
|
+
# compute_op(node) { |left, right| left + right }
|
|
128
|
+
# end
|
|
129
|
+
#
|
|
130
|
+
# def on_multiply(node)
|
|
131
|
+
# compute_op(node) { |left, right| left * right }
|
|
132
|
+
# end
|
|
133
|
+
# end
|
|
134
|
+
#
|
|
135
|
+
# Let's check:
|
|
136
|
+
#
|
|
137
|
+
# p ArithmeticsCalculator.new.process(expr) # => (integer 4)
|
|
138
|
+
#
|
|
139
|
+
# Excellent, the calculator works! Now, a careful reader could
|
|
140
|
+
# notice that the ArithmeticsCalculator does not know how to
|
|
141
|
+
# divide numbers. What if we pass an expression with division to
|
|
142
|
+
# it?
|
|
143
|
+
#
|
|
144
|
+
# expr_with_division = \
|
|
145
|
+
# s(:add,
|
|
146
|
+
# s(:integer, 1),
|
|
147
|
+
# s(:divide,
|
|
148
|
+
# s(:add, s(:integer, 8), s(:integer, 4)),
|
|
149
|
+
# s(:integer, 3))) # 1 + (8 + 4) / 3
|
|
150
|
+
#
|
|
151
|
+
# folded_expr_with_division = ArithmeticsCalculator.new.process(expr_with_division)
|
|
152
|
+
# p folded_expr_with_division
|
|
153
|
+
# # => (add
|
|
154
|
+
# # (integer 1)
|
|
155
|
+
# # (divide
|
|
156
|
+
# # (integer 12)
|
|
157
|
+
# # (integer 3)))
|
|
158
|
+
#
|
|
159
|
+
# As you can see, the expression was folded _partially_: the inner
|
|
160
|
+
# `(add)` node which could be computed was folded to
|
|
161
|
+
# `(integer 12)`, the `(divide)` node is left as-is because there
|
|
162
|
+
# is no computing handler for it, and the root `(add)` node was
|
|
163
|
+
# also left as it is because some of its children were not
|
|
164
|
+
# literals.
|
|
165
|
+
#
|
|
166
|
+
# Note that this partial folding is only possible because the
|
|
167
|
+
# _data_ format, i.e. the format in which the computed values of
|
|
168
|
+
# the nodes are represented, is the same as the AST itself.
|
|
169
|
+
#
|
|
170
|
+
# Let's extend our ArithmeticsCalculator class further.
|
|
171
|
+
#
|
|
172
|
+
# class ArithmeticsCalculator
|
|
173
|
+
# def on_divide(node)
|
|
174
|
+
# compute_op(node) { |left, right| left / right }
|
|
175
|
+
# end
|
|
176
|
+
#
|
|
177
|
+
# def on_negate(node)
|
|
178
|
+
# # Note how #compute_op works regardless of the operator
|
|
179
|
+
# # arity.
|
|
180
|
+
# compute_op(node) { |value| -value }
|
|
181
|
+
# end
|
|
182
|
+
# end
|
|
183
|
+
#
|
|
184
|
+
# Now, let's apply our renewed ArithmeticsCalculator to a partial
|
|
185
|
+
# result of previous evaluation:
|
|
186
|
+
#
|
|
187
|
+
# p ArithmeticsCalculator.new.process(expr_with_division) # => (integer 5)
|
|
188
|
+
#
|
|
189
|
+
# Five! Excellent. This is also pretty much how CRuby 1.8 executed
|
|
190
|
+
# its programs.
|
|
191
|
+
#
|
|
192
|
+
# Now, let's do some automated bug searching. Division by zero is
|
|
193
|
+
# an error, right? So if we could detect that someone has divided
|
|
194
|
+
# by zero before the program is even run, that could save some
|
|
195
|
+
# debugging time.
|
|
196
|
+
#
|
|
197
|
+
# class DivisionByZeroVerifier < ArithmeticsProcessor
|
|
198
|
+
# class VerificationFailure < Exception; end
|
|
199
|
+
#
|
|
200
|
+
# def on_divide(node)
|
|
201
|
+
# # You need to process the children to handle nested divisions
|
|
202
|
+
# # such as:
|
|
203
|
+
# # (divide
|
|
204
|
+
# # (integer 1)
|
|
205
|
+
# # (divide (integer 1) (integer 0))
|
|
206
|
+
# left, right = process_all(node)
|
|
207
|
+
#
|
|
208
|
+
# if right.type == :integer &&
|
|
209
|
+
# right.children.first == 0
|
|
210
|
+
# raise VerificationFailure, "Ouch! This code divides by zero."
|
|
211
|
+
# end
|
|
212
|
+
# end
|
|
213
|
+
#
|
|
214
|
+
# def divides_by_zero?(ast)
|
|
215
|
+
# process(ast)
|
|
216
|
+
# false
|
|
217
|
+
# rescue VerificationFailure
|
|
218
|
+
# true
|
|
219
|
+
# end
|
|
220
|
+
# end
|
|
221
|
+
#
|
|
222
|
+
# nice_expr = \
|
|
223
|
+
# s(:divide,
|
|
224
|
+
# s(:add, s(:integer, 10), s(:integer, 2)),
|
|
225
|
+
# s(:integer, 4))
|
|
226
|
+
#
|
|
227
|
+
# p DivisionByZeroVerifier.new.divides_by_zero?(nice_expr)
|
|
228
|
+
# # => false. Good.
|
|
229
|
+
#
|
|
230
|
+
# bad_expr = \
|
|
231
|
+
# s(:add, s(:integer, 10),
|
|
232
|
+
# s(:divide, s(:integer, 1), s(:integer, 0)))
|
|
233
|
+
#
|
|
234
|
+
# p DivisionByZeroVerifier.new.divides_by_zero?(bad_expr)
|
|
235
|
+
# # => true. WHOOPS. DO NOT RUN THIS.
|
|
236
|
+
#
|
|
237
|
+
# Of course, this won't detect more complex cases... unless you
|
|
238
|
+
# use some partial evaluation before! The possibilites are
|
|
239
|
+
# endless. Have fun.
|
|
240
|
+
module Mixin
|
|
241
|
+
# Dispatches `node`. If a node has type `:foo`, then a handler
|
|
242
|
+
# named `on_foo` is invoked with one argument, the `node`; if
|
|
243
|
+
# there isn't such a handler, {#handler_missing} is invoked
|
|
244
|
+
# with the same argument.
|
|
245
|
+
#
|
|
246
|
+
# If the handler returns `nil`, `node` is returned; otherwise,
|
|
247
|
+
# the return value of the handler is passed along.
|
|
248
|
+
#
|
|
249
|
+
# @param [AST::Node, nil] node
|
|
250
|
+
# @return [AST::Node, nil]
|
|
251
|
+
def process(node)
|
|
252
|
+
return if node.nil?
|
|
253
|
+
|
|
254
|
+
node = node.to_ast
|
|
255
|
+
|
|
256
|
+
# Invoke a specific handler
|
|
257
|
+
on_handler = :"on_#{node.type}"
|
|
258
|
+
if respond_to? on_handler
|
|
259
|
+
new_node = send on_handler, node
|
|
260
|
+
else
|
|
261
|
+
new_node = handler_missing(node)
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
node = new_node if new_node
|
|
265
|
+
|
|
266
|
+
node
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# {#process}es each node from `nodes` and returns an array of
|
|
270
|
+
# results.
|
|
271
|
+
#
|
|
272
|
+
# @param [Array<AST::Node>] nodes
|
|
273
|
+
# @return [Array<AST::Node>]
|
|
274
|
+
def process_all(nodes)
|
|
275
|
+
nodes.to_a.map do |node|
|
|
276
|
+
process node
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# Default handler. Does nothing.
|
|
281
|
+
#
|
|
282
|
+
# @param [AST::Node] node
|
|
283
|
+
# @return [AST::Node, nil]
|
|
284
|
+
def handler_missing(node)
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module AST
|
|
2
|
+
# This class includes {AST::Processor::Mixin}; however, it is
|
|
3
|
+
# deprecated, since the module defines all of the behaviors that
|
|
4
|
+
# the processor includes. Any new libraries should use
|
|
5
|
+
# {AST::Processor::Mixin} instead of subclassing this.
|
|
6
|
+
#
|
|
7
|
+
# @deprecated Use {AST::Processor::Mixin} instead.
|
|
8
|
+
class Processor
|
|
9
|
+
require 'ast/processor/mixin'
|
|
10
|
+
include Mixin
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module AST
|
|
2
|
+
# This simple module is very useful in the cases where one needs
|
|
3
|
+
# to define deeply nested ASTs from Ruby code, for example, in
|
|
4
|
+
# tests. It should be used like this:
|
|
5
|
+
#
|
|
6
|
+
# describe YourLanguage::AST do
|
|
7
|
+
# include Sexp
|
|
8
|
+
#
|
|
9
|
+
# it "should correctly parse expressions" do
|
|
10
|
+
# YourLanguage.parse("1 + 2 * 3").should ==
|
|
11
|
+
# s(:add,
|
|
12
|
+
# s(:integer, 1),
|
|
13
|
+
# s(:multiply,
|
|
14
|
+
# s(:integer, 2),
|
|
15
|
+
# s(:integer, 3)))
|
|
16
|
+
# end
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# This way the amount of boilerplate code is greatly reduced.
|
|
20
|
+
module Sexp
|
|
21
|
+
# Creates a {Node} with type `type` and children `children`.
|
|
22
|
+
# Note that the resulting node is of the type AST::Node and not a
|
|
23
|
+
# subclass.
|
|
24
|
+
# This would not pose a problem with comparisons, as {Node#==}
|
|
25
|
+
# ignores metadata.
|
|
26
|
+
def s(type, *children)
|
|
27
|
+
Node.new(type, children)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# {AST} is a library for manipulating abstract syntax trees.
|
|
2
|
+
#
|
|
3
|
+
# It embraces immutability; each AST node is inherently frozen at
|
|
4
|
+
# creation, and updating a child node requires recreating that node
|
|
5
|
+
# and its every parent, recursively.
|
|
6
|
+
# This is a design choice. It does create some pressure on
|
|
7
|
+
# garbage collector, but completely eliminates all concurrency
|
|
8
|
+
# and aliasing problems.
|
|
9
|
+
#
|
|
10
|
+
# See also {AST::Node}, {AST::Processor::Mixin} and {AST::Sexp} for
|
|
11
|
+
# additional recommendations and design patterns.
|
|
12
|
+
#
|
|
13
|
+
module AST
|
|
14
|
+
require 'ast/node'
|
|
15
|
+
require 'ast/processor'
|
|
16
|
+
require 'ast/sexp'
|
|
17
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions
|
|
5
|
+
are met:
|
|
6
|
+
1. Redistributions of source code must retain the above copyright
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
13
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
14
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
15
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
16
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
17
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
18
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
19
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
20
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
21
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
22
|
+
SUCH DAMAGE.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
|
4
|
+
|
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
6
|
+
software without restriction, provided that you duplicate all of the
|
|
7
|
+
original copyright notices and associated disclaimers.
|
|
8
|
+
|
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
|
10
|
+
you do at least ONE of the following:
|
|
11
|
+
|
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
|
13
|
+
make them Freely Available, such as by posting said
|
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
|
15
|
+
the author to include your modifications in the software.
|
|
16
|
+
|
|
17
|
+
b. use the modified software only within your corporation or
|
|
18
|
+
organization.
|
|
19
|
+
|
|
20
|
+
c. give non-standard binaries non-standard names, with
|
|
21
|
+
instructions on where to get the original software distribution.
|
|
22
|
+
|
|
23
|
+
d. make other distribution arrangements with the author.
|
|
24
|
+
|
|
25
|
+
3. You may distribute the software in object code or binary form,
|
|
26
|
+
provided that you do at least ONE of the following:
|
|
27
|
+
|
|
28
|
+
a. distribute the binaries and library files of the software,
|
|
29
|
+
together with instructions (in the manual page or equivalent)
|
|
30
|
+
on where to get the original distribution.
|
|
31
|
+
|
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
|
33
|
+
the software.
|
|
34
|
+
|
|
35
|
+
c. give non-standard binaries non-standard names, with
|
|
36
|
+
instructions on where to get the original software distribution.
|
|
37
|
+
|
|
38
|
+
d. make other distribution arrangements with the author.
|
|
39
|
+
|
|
40
|
+
4. You may modify and include the part of the software into any other
|
|
41
|
+
software (possibly commercial). But some files in the distribution
|
|
42
|
+
are not written by the author, so that they are not under these terms.
|
|
43
|
+
|
|
44
|
+
For the list of those files and their copying conditions, see the
|
|
45
|
+
file LEGAL.
|
|
46
|
+
|
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
|
48
|
+
output from the software do not automatically fall under the
|
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
|
51
|
+
software.
|
|
52
|
+
|
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
56
|
+
PURPOSE.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# OpenStruct [](https://badge.fury.io/rb/ostruct) [](https://stdgems.org/ostruct/) [](https://github.com/ruby/ostruct/actions?query=workflow%3Atest)
|
|
2
|
+
|
|
3
|
+
An OpenStruct is a data structure, similar to a Hash, that allows the definition of arbitrary attributes with their accompanying values. This is accomplished by using Ruby's metaprogramming to define methods on the class itself.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
The `ostruct` library comes pre-packaged with Ruby. No installation is necessary.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
require "ostruct"
|
|
13
|
+
|
|
14
|
+
person = OpenStruct.new
|
|
15
|
+
person.name = "John Smith"
|
|
16
|
+
person.age = 70
|
|
17
|
+
|
|
18
|
+
person.name # => "John Smith"
|
|
19
|
+
person.age # => 70
|
|
20
|
+
person.address # => nil
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
An OpenStruct employs a Hash internally to store the attributes and values and can even be initialized with one:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
australia = OpenStruct.new(:country => "Australia", :capital => "Canberra")
|
|
27
|
+
# => #<OpenStruct country="Australia", capital="Canberra">
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Hash keys with spaces or characters that could normally not be used for method calls (e.g. <code>()[]*</code>) will not be immediately available on the OpenStruct object as a method for retrieval or assignment, but can still be reached through the Object#send method.
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
measurements = OpenStruct.new("length (in inches)" => 24)
|
|
34
|
+
measurements.send("length (in inches)") # => 24
|
|
35
|
+
|
|
36
|
+
message = OpenStruct.new(:queued? => true)
|
|
37
|
+
message.queued? # => true
|
|
38
|
+
message.send("queued?=", false)
|
|
39
|
+
message.queued? # => false
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Removing the presence of an attribute requires the execution of the delete_field method as setting the property value to +nil+ will not remove the attribute.
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
first_pet = OpenStruct.new(:name => "Rowdy", :owner => "John Smith")
|
|
46
|
+
second_pet = OpenStruct.new(:name => "Rowdy")
|
|
47
|
+
|
|
48
|
+
first_pet.owner = nil
|
|
49
|
+
first_pet # => #<OpenStruct name="Rowdy", owner=nil>
|
|
50
|
+
first_pet == second_pet # => false
|
|
51
|
+
|
|
52
|
+
first_pet.delete_field(:owner)
|
|
53
|
+
first_pet # => #<OpenStruct name="Rowdy">
|
|
54
|
+
first_pet == second_pet # => true
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Development
|
|
58
|
+
|
|
59
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
60
|
+
|
|
61
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
62
|
+
|
|
63
|
+
## Contributing
|
|
64
|
+
|
|
65
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/ostruct.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
The gem is available as open source under the terms of the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
task :release do
|
|
2
|
+
cur = `git branch --show-current`.chomp
|
|
3
|
+
if cur != 'master'
|
|
4
|
+
puts 'Release only from master branch'
|
|
5
|
+
exit(-1)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
require "bundler/gem_tasks"
|
|
10
|
+
require "rake/testtask"
|
|
11
|
+
|
|
12
|
+
Rake::TestTask.new(:test) do |t|
|
|
13
|
+
t.libs << "test/lib"
|
|
14
|
+
t.ruby_opts << "-rhelper"
|
|
15
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
task :default => [:test]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|