@voxgig/sdkgen 4.8.2 → 4.8.3
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/bin/voxgig-sdkgen +1 -1
- package/dist/action/doctor.d.ts +1 -0
- package/dist/action/doctor.js +50 -2
- package/dist/action/doctor.js.map +1 -1
- package/dist/helpers/naming.js +4 -2
- package/dist/helpers/naming.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aon +21 -0
- package/package.json +1 -1
- package/project/.sdk/model/feature/secrets.aon +120 -18
- package/project/.sdk/model/target/c.aon +10 -0
- package/project/.sdk/model/target/clojure.aon +13 -0
- package/project/.sdk/model/target/cpp.aon +10 -0
- package/project/.sdk/model/target/csharp.aon +9 -0
- package/project/.sdk/model/target/dart.aon +10 -0
- package/project/.sdk/model/target/elixir.aon +9 -0
- package/project/.sdk/model/target/go.aon +13 -0
- package/project/.sdk/model/target/java.aon +9 -0
- package/project/.sdk/model/target/js.aon +7 -0
- package/project/.sdk/model/target/kotlin.aon +9 -0
- package/project/.sdk/model/target/lean.aon +17 -0
- package/project/.sdk/model/target/lua.aon +8 -0
- package/project/.sdk/model/target/ocaml.aon +9 -0
- package/project/.sdk/model/target/perl.aon +8 -0
- package/project/.sdk/model/target/php.aon +8 -0
- package/project/.sdk/model/target/py.aon +13 -0
- package/project/.sdk/model/target/rb.aon +8 -0
- package/project/.sdk/model/target/rust.aon +10 -0
- package/project/.sdk/model/target/scala.aon +21 -2
- package/project/.sdk/model/target/swift.aon +18 -0
- package/project/.sdk/model/target/ts.aon +13 -0
- package/project/.sdk/src/cmp/clojure/Package_clojure.ts +9 -2
- package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +3 -0
- package/project/.sdk/src/cmp/dart/Test_dart.ts +2 -0
- package/project/.sdk/src/cmp/elixir/Package_elixir.ts +4 -1
- package/project/.sdk/src/cmp/go/Config_go.ts +59 -2
- package/project/.sdk/src/cmp/go/Main_go.ts +8 -2
- package/project/.sdk/src/cmp/java/Test_java.ts +6 -5
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +6 -5
- package/project/.sdk/src/cmp/lean/Package_lean.ts +23 -0
- package/project/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +1 -0
- package/project/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/Gitignore_ocaml.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +7 -3
- package/project/.sdk/src/cmp/py/Config_py.ts +82 -1
- package/project/.sdk/src/cmp/py/Main_py.ts +44 -0
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +2 -0
- package/project/.sdk/src/cmp/swift/Main_swift.ts +10 -0
- package/project/.sdk/src/cmp/swift/Package_swift.ts +13 -1
- package/project/.sdk/src/cmp/ts/Config_ts.ts +42 -17
- package/project/.sdk/src/cmp/ts/fragment/Config.data.fragment.ts +13 -1
- package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +13 -1
- package/project/.sdk/tm/c/Makefile +38 -3
- package/project/.sdk/tm/c/tests/omni_resolver.h +361 -0
- package/project/.sdk/tm/c/tests/omni_smoke_test.c +237 -0
- package/project/.sdk/tm/c/tests/primary_corpus_test.c +205 -284
- package/project/.sdk/tm/c/tests/struct_corpus_test.c +292 -212
- package/project/.sdk/tm/c/tests/vendor/omni/json.c +811 -0
- package/project/.sdk/tm/c/tests/vendor/omni/omni.h +240 -0
- package/project/.sdk/tm/c/tests/vendor/omni/runner.c +940 -0
- package/project/.sdk/tm/c/tests/vendor/omni/util.c +351 -0
- package/project/.sdk/tm/c/utility/struct/utility.c +7 -2
- package/project/.sdk/tm/clojure/test/sdk/test/omni.clj +401 -0
- package/project/.sdk/tm/clojure/test/sdk/test/omni_smoke.clj +81 -0
- package/project/.sdk/tm/clojure/test/sdk/test/primary.clj +92 -58
- package/project/.sdk/tm/clojure/test/sdk/test/struct_corpus.clj +122 -149
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +8 -3
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/json.clj +145 -0
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/runner.clj +445 -0
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/util.clj +145 -0
- package/project/.sdk/tm/cpp/Makefile +5 -1
- package/project/.sdk/tm/cpp/test/omni_resolver.hpp +473 -0
- package/project/.sdk/tm/cpp/test/omni_smoke_test.cpp +209 -0
- package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +243 -184
- package/project/.sdk/tm/cpp/test/runner_support.hpp +68 -181
- package/project/.sdk/tm/cpp/test/struct_corpus_test.cpp +183 -56
- package/project/.sdk/tm/cpp/test/vendor/omni/json.hpp +406 -0
- package/project/.sdk/tm/cpp/test/vendor/omni/omni.hpp +751 -0
- package/project/.sdk/tm/cpp/test/vendor/omni/util.hpp +256 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +7 -1
- package/project/.sdk/tm/csharp/test/OmniResolver.cs +491 -0
- package/project/.sdk/tm/csharp/test/OmniSmokeTest.cs +106 -0
- package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +299 -316
- package/project/.sdk/tm/csharp/test/Runner.cs +104 -269
- package/project/.sdk/tm/csharp/test/StructUtilityTest.cs +535 -724
- package/project/.sdk/tm/csharp/test/vendor/omni/Runner.cs +864 -0
- package/project/.sdk/tm/csharp/test/vendor/omni/Util.cs +347 -0
- package/project/.sdk/tm/csharp/utility/MakeSpec.cs +3 -1
- package/project/.sdk/tm/csharp/utility/PrepareMethod.cs +6 -1
- package/project/.sdk/tm/csharp/utility/struct/Struct.cs +21 -5
- package/project/.sdk/tm/dart/test/omni.dart +520 -0
- package/project/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
- package/project/.sdk/tm/dart/test/primary_test.dart +86 -28
- package/project/.sdk/tm/dart/test/struct_test.dart +438 -11
- package/project/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
- package/project/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
- package/project/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
- package/project/.sdk/tm/elixir/Makefile +11 -3
- package/project/.sdk/tm/elixir/test/omni_smoke_test.exs +117 -0
- package/project/.sdk/tm/elixir/test/primary_utility_test.exs +341 -16
- package/project/.sdk/tm/elixir/test/struct_corpus_test.exs +554 -9
- package/project/.sdk/tm/elixir/test/support/omni.ex +377 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/json.ex +122 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/runner.ex +623 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/util.ex +187 -0
- package/project/.sdk/tm/go/core/context.go +32 -16
- package/project/.sdk/tm/go/feature/secrets/plugin/capability.go +261 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/catalog.go +78 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/config.go +652 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/depend.go +250 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/env.go +194 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/export.go +80 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/graph.go +238 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/host.go +1575 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/order.go +248 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/point.go +184 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/ref.go +123 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/resolve.go +79 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/types.go +296 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/util.go +87 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/version.go +161 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/aws/aws.go +292 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/aws/sigv4.go +201 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/azuresecrets/azuresecrets.go +187 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/boru/boru.go +184 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/doppler/doppler.go +114 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/gcpsecrets/gcpsecrets.go +156 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/hashicorp/hashicorp.go +209 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/httpjson/httpjson.go +241 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/infisical/infisical.go +151 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/onepassword/onepassword.go +152 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/secretspec/secretspec.go +143 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/addr.go +120 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/providers.go +439 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/sekreto.go +685 -0
- package/project/.sdk/tm/go/feature/secrets_feature.go +675 -0
- package/project/.sdk/tm/go/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +799 -0
- package/project/.sdk/tm/go/test/omni/omni.go +897 -0
- package/project/.sdk/tm/go/test/omni/util.go +360 -0
- package/project/.sdk/tm/go/test/omniresolver_test.go +748 -0
- package/project/.sdk/tm/go/test/omnismoke_test.go +112 -0
- package/project/.sdk/tm/go/test/primary_utility_test.go +123 -191
- package/project/.sdk/tm/go/test/struct_utility_test.go +323 -16
- package/project/.sdk/tm/go/test/testsupport_test.go +294 -0
- package/project/.sdk/tm/go/utility/make_options.go +8 -1
- package/project/.sdk/tm/go/utility/prepare_method.go +5 -1
- package/project/.sdk/tm/go/utility/struct/voxgigstruct.go +2 -2
- package/project/.sdk/tm/java/test/OmniResolver.java +355 -0
- package/project/.sdk/tm/java/test/OmniSmokeTest.java +99 -0
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +254 -280
- package/project/.sdk/tm/java/test/RunnerSupport.java +9 -194
- package/project/.sdk/tm/java/test/StructCorpusTest.java +119 -42
- package/project/.sdk/tm/java/test/vendor/omni/Json.java +287 -0
- package/project/.sdk/tm/java/test/vendor/omni/Runner.java +851 -0
- package/project/.sdk/tm/java/test/vendor/omni/Util.java +322 -0
- package/project/.sdk/tm/java/utility/MakeSpec.java +3 -1
- package/project/.sdk/tm/java/utility/PrepareMethod.java +5 -5
- package/project/.sdk/tm/java/utility/struct/Struct.java +17 -4
- package/project/.sdk/tm/js/src/utility/StructUtility.js +3 -3
- package/project/.sdk/tm/js/test/omni.js +251 -0
- package/project/.sdk/tm/js/test/omni.test.js +105 -0
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +6 -2
- package/project/.sdk/tm/js/test/utility/StructUtility.test.js +27 -2
- package/project/.sdk/tm/js/test/vendor/omni/index.js +77 -0
- package/project/.sdk/tm/js/test/vendor/omni/runner.js +613 -0
- package/project/.sdk/tm/js/test/vendor/omni/util.js +212 -0
- package/project/.sdk/tm/kotlin/core/Utility.kt +1 -1
- package/project/.sdk/tm/kotlin/test/OmniResolver.kt +343 -0
- package/project/.sdk/tm/kotlin/test/OmniSmokeTest.kt +100 -0
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +244 -262
- package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +9 -178
- package/project/.sdk/tm/kotlin/test/StructCorpusTest.kt +121 -32
- package/project/.sdk/tm/kotlin/test/vendor/omni/Json.kt +264 -0
- package/project/.sdk/tm/kotlin/test/vendor/omni/Runner.kt +615 -0
- package/project/.sdk/tm/kotlin/test/vendor/omni/Util.kt +139 -0
- package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -3
- package/project/.sdk/tm/kotlin/utility/Prepare.kt +6 -6
- package/project/.sdk/tm/kotlin/utility/struct/Struct.kt +18 -2
- package/project/.sdk/tm/lean/Makefile +12 -5
- package/project/.sdk/tm/lean/src/SdkUtility.lean +14 -1
- package/project/.sdk/tm/lean/test/OmniResolver.lean +358 -0
- package/project/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
- package/project/.sdk/tm/lean/test/StructCorpus.lean +245 -574
- package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +155 -291
- package/project/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
- package/project/.sdk/tm/lua/test/omni.lua +456 -0
- package/project/.sdk/tm/lua/test/omni_smoke_test.lua +103 -0
- package/project/.sdk/tm/lua/test/primary_utility_test.lua +250 -509
- package/project/.sdk/tm/lua/test/struct_utility_test.lua +161 -70
- package/project/.sdk/tm/lua/test/vendor/omni/json.lua +268 -0
- package/project/.sdk/tm/lua/test/vendor/omni/regex.lua +385 -0
- package/project/.sdk/tm/lua/test/vendor/omni/runner.lua +641 -0
- package/project/.sdk/tm/lua/test/vendor/omni/util.lua +282 -0
- package/project/.sdk/tm/lua/utility/prepare_method.lua +5 -1
- package/project/.sdk/tm/lua/utility/struct/regex.lua +663 -0
- package/project/.sdk/tm/lua/utility/struct/struct.lua +660 -420
- package/project/.sdk/tm/ocaml/Makefile +37 -12
- package/project/.sdk/tm/ocaml/test/omni_resolver.ml +284 -0
- package/project/.sdk/tm/ocaml/test/omni_smoke_test.ml +169 -0
- package/project/.sdk/tm/ocaml/test/primary_utility_test.ml +84 -100
- package/project/.sdk/tm/ocaml/test/struct_corpus.ml +225 -201
- package/project/.sdk/tm/ocaml/test/vendor/omni/omni.ml +1157 -0
- package/project/.sdk/tm/perl/lib/Voxgig/Struct.pm +88 -12
- package/project/.sdk/tm/perl/t/omni.pm +647 -0
- package/project/.sdk/tm/perl/t/omni_smoke.t +87 -0
- package/project/.sdk/tm/perl/t/primary_utility.t +189 -487
- package/project/.sdk/tm/perl/t/struct_utility.t +455 -389
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Runner.pm +649 -0
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Util.pm +253 -0
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni.pm +24 -0
- package/project/.sdk/tm/perl/utility/prepare_method.pm +7 -2
- package/project/.sdk/tm/php/test/Omni.php +691 -0
- package/project/.sdk/tm/php/test/OmniSmokeTest.php +93 -0
- package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +210 -571
- package/project/.sdk/tm/php/test/StructUtilityTest.php +320 -342
- package/project/.sdk/tm/php/test/vendor/omni/Runner.php +644 -0
- package/project/.sdk/tm/php/test/vendor/omni/Util.php +283 -0
- package/project/.sdk/tm/php/utility/MakeSpec.php +10 -3
- package/project/.sdk/tm/php/utility/PrepareBody.php +7 -1
- package/project/.sdk/tm/php/utility/PrepareMethod.php +6 -2
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/__init__.py +36 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/capability.py +141 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/catalog.py +50 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/config.py +333 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/depend.py +198 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/env.py +147 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/export.py +52 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/graph.py +139 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/host.py +1053 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/order.py +171 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/point.py +95 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/ref.py +116 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/resolve.py +59 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/types.py +87 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/version.py +112 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/__init__.py +74 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/addr.py +116 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/aws.py +192 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/azuresecrets.py +120 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/boru.py +140 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/doppler.py +62 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/gcpsecrets.py +101 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/hashicorp.py +152 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/httpjson.py +115 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/infisical.py +92 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/onepassword.py +101 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/secretspec.py +119 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/sigv4.py +125 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/providers.py +211 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/sekreto.py +455 -0
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +467 -0
- package/project/.sdk/tm/py/pkg/utility/prepare_method.py +5 -1
- package/project/.sdk/tm/py/pkg/utility/voxgig_struct/__init__.py +0 -2
- package/project/.sdk/tm/py/pkg/utility/voxgig_struct/voxgig_struct.py +780 -529
- package/project/.sdk/tm/py/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/py/test/feature/__init__.py +0 -0
- package/project/.sdk/tm/py/test/feature/secrets/__init__.py +0 -0
- package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +337 -0
- package/project/.sdk/tm/py/test/omni.py +415 -0
- package/project/.sdk/tm/py/test/test_omni_smoke.py +74 -0
- package/project/.sdk/tm/py/test/test_primary_utility.py +144 -668
- package/project/.sdk/tm/py/test/test_struct_utility.py +74 -27
- package/project/.sdk/tm/py/test/voxgig_omni/__init__.py +62 -0
- package/project/.sdk/tm/py/test/voxgig_omni/runner.py +566 -0
- package/project/.sdk/tm/py/test/voxgig_omni/util.py +237 -0
- package/project/.sdk/tm/rb/test/omni.rb +505 -0
- package/project/.sdk/tm/rb/test/omni_smoke_test.rb +72 -0
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +174 -560
- package/project/.sdk/tm/rb/test/struct_utility_test.rb +13 -7
- package/project/.sdk/tm/rb/test/vendor/omni/runner.rb +493 -0
- package/project/.sdk/tm/rb/test/vendor/omni/util.rb +199 -0
- package/project/.sdk/tm/rb/test/vendor/omni/voxgig_omni.rb +15 -0
- package/project/.sdk/tm/rb/utility/prepare_method.rb +5 -1
- package/project/.sdk/tm/rust/tests/common/mod.rs +19 -242
- package/project/.sdk/tm/rust/tests/omni_resolver/mod.rs +888 -0
- package/project/.sdk/tm/rust/tests/omni_smoke_test.rs +286 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +318 -312
- package/project/.sdk/tm/rust/tests/struct_utility_test.rs +66 -28
- package/project/.sdk/tm/rust/tests/vendor/omni/json.rs +412 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/mod.rs +38 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/regex.rs +392 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/runner.rs +1001 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/util.rs +161 -0
- package/project/.sdk/tm/rust/utility/prepare_method.rs +5 -1
- package/project/.sdk/tm/scala/Makefile +16 -6
- package/project/.sdk/tm/scala/sdktest/OmniResolver.scala +497 -0
- package/project/.sdk/tm/scala/sdktest/OmniSmoke.scala +192 -0
- package/project/.sdk/tm/scala/sdktest/PrimaryCorpus.scala +47 -19
- package/project/.sdk/tm/scala/sdktest/StructCorpus.scala +0 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Json.scala +229 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Runner.scala +552 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Util.scala +104 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Constants.swift +10 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Inject.swift +28 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Injection.swift +5 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Minor.swift +4 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Validate.swift +15 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Prepare.swift +6 -1
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniResolver.swift +474 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniSmokeTest.swift +107 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +141 -178
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/Runner.swift +17 -113
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/StructUtilityTest.swift +295 -446
- package/project/.sdk/tm/swift/Tests/vendor/omni/Json.swift +364 -0
- package/project/.sdk/tm/swift/Tests/vendor/omni/Runner.swift +730 -0
- package/project/.sdk/tm/swift/Tests/vendor/omni/Util.swift +162 -0
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +7 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Capability.ts +148 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Catalog.ts +55 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Config.ts +344 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Depend.ts +205 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Env.ts +138 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Export.ts +46 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/FeatureHost.ts +349 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Graph.ts +181 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Host.ts +1132 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Order.ts +177 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Point.ts +119 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Ref.ts +102 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Resolve.ts +61 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Types.ts +112 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Version.ts +100 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/index.ts +37 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/Sekreto.ts +163 -30
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/index.ts +27 -22
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/aws.ts +26 -36
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/azuresecrets.ts +19 -21
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/boru.ts +36 -17
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/doppler.ts +14 -21
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/gcpsecrets.ts +27 -27
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/hashicorp.ts +25 -39
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/httpjson.ts +99 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/infisical.ts +14 -16
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/onepassword.ts +15 -22
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/secretspec.ts +98 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{Sigv4.ts → plugins/sigv4.ts} +7 -6
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/addr.ts +97 -23
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/builtin.ts +37 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/dotenv.ts +4 -17
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/env.ts +4 -16
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/file.ts +11 -25
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/memory.ts +6 -23
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/support.ts +106 -39
- package/project/.sdk/tm/ts/src/utility/StructUtility.ts +3 -3
- package/project/.sdk/tm/ts/test/omni.ts +104 -32
- package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +27 -0
- package/project/.sdk/tm/ts/test/vendor/omni/Runner.ts +32 -5
- package/project/.sdk/tm/ts/test/vendor/omni/Util.ts +2 -2
- package/project/.sdk/tm/ts/test/vendor/omni/index.ts +2 -2
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +1 -1
- package/project/.sdk/tm/zig/test/struct_runner.zig +5 -4
- package/project/sdkgen-package.json +1 -1
- package/src/action/doctor.ts +66 -2
- package/src/helpers/naming.ts +4 -2
- package/project/.sdk/tm/c/tests/runner.h +0 -274
- package/project/.sdk/tm/cpp/test/struct_runner.hpp +0 -314
- package/project/.sdk/tm/csharp/test/StructRunner.cs +0 -276
- package/project/.sdk/tm/dart/test/runner.dart +0 -406
- package/project/.sdk/tm/dart/test/struct_corpus.dart +0 -531
- package/project/.sdk/tm/elixir/test/support/struct_corpus.ex +0 -1088
- package/project/.sdk/tm/go/test/runner_test.go +0 -629
- package/project/.sdk/tm/go/test/struct_runner_test.go +0 -1094
- package/project/.sdk/tm/java/test/StructRunner.java +0 -281
- package/project/.sdk/tm/js/test/runner.js +0 -387
- package/project/.sdk/tm/kotlin/test/StructRunner.kt +0 -177
- package/project/.sdk/tm/lua/test/struct_runner.lua +0 -602
- package/project/.sdk/tm/ocaml/test/corpus_runner.ml +0 -185
- package/project/.sdk/tm/perl/t/struct_runner.pm +0 -275
- package/project/.sdk/tm/php/test/StructRunner.php +0 -275
- package/project/.sdk/tm/py/test/struct_runner.py +0 -411
- package/project/.sdk/tm/rb/test/struct_runner.rb +0 -309
- package/project/.sdk/tm/rust/tests/struct_runner/mod.rs +0 -424
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/Registry.ts +0 -90
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/http.ts +0 -66
- package/project/.sdk/tm/ts/test/vendor/omni/compat.ts +0 -188
|
@@ -0,0 +1,663 @@
|
|
|
1
|
+
-- VENDORED: @voxgig/struct 0.1.1 (lua/src/regex.lua)
|
|
2
|
+
-- Source: https://github.com/voxgig/struct @ 2caf7f448f265144c18dd6fab6ba270a7f3bca07 [tag: sdk-20260904-1610-0]
|
|
3
|
+
-- License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
-- Copyright (c) 2025-2026 Voxgig Ltd. MIT LICENSE.
|
|
5
|
+
--
|
|
6
|
+
-- Voxgig Struct — RE2-subset regex engine, pure Lua (no external deps).
|
|
7
|
+
--
|
|
8
|
+
-- Lua's built-in string.match uses Lua patterns, which are intentionally
|
|
9
|
+
-- not regex (different metacharacters, no alternation, no {n,m}). This
|
|
10
|
+
-- module provides a real regex engine implementing the RE2 subset
|
|
11
|
+
-- documented in /REGEX.md so every port can share the same dialect.
|
|
12
|
+
--
|
|
13
|
+
-- Approach: Thompson-NFA matcher (same as c/src/regex.c). Patterns are
|
|
14
|
+
-- compiled to a sequence of opcodes; the matcher advances two state sets
|
|
15
|
+
-- per input char. Quantifier bounds {n,m} are unrolled at compile time.
|
|
16
|
+
|
|
17
|
+
local M = {}
|
|
18
|
+
|
|
19
|
+
-- Opcodes
|
|
20
|
+
local OP_CHAR = 1
|
|
21
|
+
local OP_ANY = 2
|
|
22
|
+
local OP_CLASS = 3
|
|
23
|
+
local OP_MATCH = 4
|
|
24
|
+
local OP_JMP = 5
|
|
25
|
+
local OP_SPLIT = 6
|
|
26
|
+
local OP_SAVE = 7
|
|
27
|
+
local OP_BOL = 8
|
|
28
|
+
local OP_EOL = 9
|
|
29
|
+
local OP_WB = 10
|
|
30
|
+
local OP_NWB = 11
|
|
31
|
+
|
|
32
|
+
-- ---------------------------------------------------------------------
|
|
33
|
+
-- Character class helpers
|
|
34
|
+
-- ---------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
local function cc_new()
|
|
37
|
+
local t = {}
|
|
38
|
+
for i = 0, 255 do t[i] = false end
|
|
39
|
+
return t
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
local function cc_set(cc, c) cc[c & 0xFF] = true end
|
|
43
|
+
|
|
44
|
+
local function cc_range(cc, lo, hi)
|
|
45
|
+
if lo > hi then lo, hi = hi, lo end
|
|
46
|
+
for c = lo, hi do cc[c] = true end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
local function cc_negate(cc)
|
|
50
|
+
for i = 0, 255 do cc[i] = not cc[i] end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
local function cc_predef(cc, ch)
|
|
54
|
+
if ch == 'd' then
|
|
55
|
+
cc_range(cc, 0x30, 0x39)
|
|
56
|
+
elseif ch == 'D' then
|
|
57
|
+
for i = 0, 255 do cc[i] = true end
|
|
58
|
+
cc_range(cc, 0x30, 0x39); for i = 0x30, 0x39 do cc[i] = false end
|
|
59
|
+
elseif ch == 's' then
|
|
60
|
+
cc[0x20] = true; cc[0x09] = true; cc[0x0A] = true
|
|
61
|
+
cc[0x0D] = true; cc[0x0C] = true; cc[0x0B] = true
|
|
62
|
+
elseif ch == 'S' then
|
|
63
|
+
for i = 0, 255 do cc[i] = true end
|
|
64
|
+
cc[0x20] = false; cc[0x09] = false; cc[0x0A] = false
|
|
65
|
+
cc[0x0D] = false; cc[0x0C] = false; cc[0x0B] = false
|
|
66
|
+
elseif ch == 'w' then
|
|
67
|
+
cc_range(cc, 0x30, 0x39); cc_range(cc, 0x41, 0x5A); cc_range(cc, 0x61, 0x7A); cc[0x5F] = true
|
|
68
|
+
elseif ch == 'W' then
|
|
69
|
+
for i = 0, 255 do cc[i] = true end
|
|
70
|
+
cc_range(cc, 0x30, 0x39); for i = 0x30, 0x39 do cc[i] = false end
|
|
71
|
+
cc_range(cc, 0x41, 0x5A); for i = 0x41, 0x5A do cc[i] = false end
|
|
72
|
+
cc_range(cc, 0x61, 0x7A); for i = 0x61, 0x7A do cc[i] = false end
|
|
73
|
+
cc[0x5F] = false
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
-- ---------------------------------------------------------------------
|
|
78
|
+
-- Parser
|
|
79
|
+
-- ---------------------------------------------------------------------
|
|
80
|
+
|
|
81
|
+
local function parse_error(p, msg)
|
|
82
|
+
error("regex parse error at pos " .. p.pos .. ": " .. msg, 3)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
local ESC_CHAR_MAP = {
|
|
86
|
+
n = 10, t = 9, r = 13, f = 12, v = 11, a = 7, e = 27, ['0'] = 0,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
local function parse_escape(p)
|
|
90
|
+
if p.pos > #p.src then parse_error(p, "trailing backslash") end
|
|
91
|
+
local c = p.src:sub(p.pos, p.pos)
|
|
92
|
+
p.pos = p.pos + 1
|
|
93
|
+
if ESC_CHAR_MAP[c] then return ESC_CHAR_MAP[c], nil end
|
|
94
|
+
if c == 'x' then
|
|
95
|
+
if p.pos + 1 > #p.src then parse_error(p, "bad \\xNN") end
|
|
96
|
+
local h = p.src:sub(p.pos, p.pos + 1)
|
|
97
|
+
p.pos = p.pos + 2
|
|
98
|
+
local n = tonumber(h, 16)
|
|
99
|
+
if not n then parse_error(p, "bad \\xNN") end
|
|
100
|
+
return n, nil
|
|
101
|
+
end
|
|
102
|
+
if c == 'd' or c == 'D' or c == 's' or c == 'S' or c == 'w' or c == 'W' then
|
|
103
|
+
return nil, c -- predefined class
|
|
104
|
+
end
|
|
105
|
+
if c == 'b' or c == 'B' then
|
|
106
|
+
return nil, c -- word boundary marker
|
|
107
|
+
end
|
|
108
|
+
return c:byte(1), nil
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
local function parse_class(p)
|
|
112
|
+
local cc = cc_new()
|
|
113
|
+
local neg = false
|
|
114
|
+
if p.pos <= #p.src and p.src:sub(p.pos, p.pos) == '^' then
|
|
115
|
+
neg = true; p.pos = p.pos + 1
|
|
116
|
+
end
|
|
117
|
+
local first = true
|
|
118
|
+
while p.pos <= #p.src and (first or p.src:sub(p.pos, p.pos) ~= ']') do
|
|
119
|
+
first = false
|
|
120
|
+
local cval
|
|
121
|
+
if p.src:sub(p.pos, p.pos) == '\\' then
|
|
122
|
+
p.pos = p.pos + 1
|
|
123
|
+
local b, pre = parse_escape(p)
|
|
124
|
+
if pre then
|
|
125
|
+
if pre == 'b' or pre == 'B' then
|
|
126
|
+
cval = 8 -- literal backspace inside class
|
|
127
|
+
else
|
|
128
|
+
local sub = cc_new(); cc_predef(sub, pre)
|
|
129
|
+
for i = 0, 255 do if sub[i] then cc[i] = true end end
|
|
130
|
+
goto continue
|
|
131
|
+
end
|
|
132
|
+
else
|
|
133
|
+
cval = b
|
|
134
|
+
end
|
|
135
|
+
else
|
|
136
|
+
cval = p.src:byte(p.pos); p.pos = p.pos + 1
|
|
137
|
+
end
|
|
138
|
+
-- range?
|
|
139
|
+
if p.pos + 1 <= #p.src and p.src:sub(p.pos, p.pos) == '-' and p.src:sub(p.pos + 1, p.pos + 1) ~= ']' then
|
|
140
|
+
p.pos = p.pos + 1
|
|
141
|
+
local hi
|
|
142
|
+
if p.src:sub(p.pos, p.pos) == '\\' then
|
|
143
|
+
p.pos = p.pos + 1
|
|
144
|
+
local b = parse_escape(p)
|
|
145
|
+
hi = b or 45
|
|
146
|
+
else
|
|
147
|
+
hi = p.src:byte(p.pos); p.pos = p.pos + 1
|
|
148
|
+
end
|
|
149
|
+
cc_range(cc, cval, hi)
|
|
150
|
+
else
|
|
151
|
+
cc[cval] = true
|
|
152
|
+
end
|
|
153
|
+
::continue::
|
|
154
|
+
end
|
|
155
|
+
if p.pos > #p.src or p.src:sub(p.pos, p.pos) ~= ']' then parse_error(p, "unclosed [") end
|
|
156
|
+
p.pos = p.pos + 1
|
|
157
|
+
if neg then cc_negate(cc) end
|
|
158
|
+
return cc
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
-- Forward decls
|
|
162
|
+
local parse_alt
|
|
163
|
+
|
|
164
|
+
local function emit(p, op, data)
|
|
165
|
+
p.code[#p.code + 1] = { op = op, data = data or {} }
|
|
166
|
+
return #p.code
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
local function clone_range(p, from, to)
|
|
170
|
+
local delta = #p.code - from + 1
|
|
171
|
+
local start_ix = #p.code + 1
|
|
172
|
+
for i = from, to - 1 do
|
|
173
|
+
local insn = { op = p.code[i].op }
|
|
174
|
+
local d = p.code[i].data
|
|
175
|
+
insn.data = {}
|
|
176
|
+
for k, v in pairs(d) do insn.data[k] = v end
|
|
177
|
+
-- Patch jump targets that pointed within [from..to)
|
|
178
|
+
if insn.op == OP_JMP and d.jmp >= from and d.jmp < to then
|
|
179
|
+
insn.data.jmp = d.jmp + delta
|
|
180
|
+
elseif insn.op == OP_SPLIT then
|
|
181
|
+
if d.x >= from and d.x < to then insn.data.x = d.x + delta end
|
|
182
|
+
if d.y >= from and d.y < to then insn.data.y = d.y + delta end
|
|
183
|
+
end
|
|
184
|
+
p.code[#p.code + 1] = insn
|
|
185
|
+
end
|
|
186
|
+
return start_ix
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
local function shift_one(p, at)
|
|
190
|
+
-- Insert a placeholder at index `at` by shifting everything after it.
|
|
191
|
+
local last = #p.code
|
|
192
|
+
p.code[last + 1] = p.code[last]
|
|
193
|
+
for i = last, at + 1, -1 do
|
|
194
|
+
p.code[i] = p.code[i - 1]
|
|
195
|
+
end
|
|
196
|
+
p.code[at] = { op = OP_JMP, data = {} } -- placeholder
|
|
197
|
+
-- Patch jumps/splits inside the moved region.
|
|
198
|
+
for i = at + 1, #p.code do
|
|
199
|
+
local insn = p.code[i]
|
|
200
|
+
if insn.op == OP_JMP and insn.data.jmp >= at then
|
|
201
|
+
insn.data.jmp = insn.data.jmp + 1
|
|
202
|
+
elseif insn.op == OP_SPLIT then
|
|
203
|
+
if insn.data.x >= at then insn.data.x = insn.data.x + 1 end
|
|
204
|
+
if insn.data.y >= at then insn.data.y = insn.data.y + 1 end
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
local function parse_atom(p)
|
|
210
|
+
local start = #p.code + 1
|
|
211
|
+
if p.pos > #p.src then return start end
|
|
212
|
+
local c = p.src:sub(p.pos, p.pos)
|
|
213
|
+
if c == '(' then
|
|
214
|
+
p.pos = p.pos + 1
|
|
215
|
+
local capture = true
|
|
216
|
+
local group = 0
|
|
217
|
+
if p.pos + 1 <= #p.src and p.src:sub(p.pos, p.pos + 1) == '?:' then
|
|
218
|
+
capture = false; p.pos = p.pos + 2
|
|
219
|
+
elseif p.pos + 2 <= #p.src and p.src:sub(p.pos, p.pos + 2) == '?P<' then
|
|
220
|
+
p.pos = p.pos + 3
|
|
221
|
+
while p.pos <= #p.src and p.src:sub(p.pos, p.pos) ~= '>' do p.pos = p.pos + 1 end
|
|
222
|
+
if p.pos <= #p.src then p.pos = p.pos + 1 end
|
|
223
|
+
end
|
|
224
|
+
if capture then
|
|
225
|
+
group = p.next_group; p.next_group = p.next_group + 1
|
|
226
|
+
emit(p, OP_SAVE, { slot = group * 2 })
|
|
227
|
+
end
|
|
228
|
+
parse_alt(p)
|
|
229
|
+
if p.pos > #p.src or p.src:sub(p.pos, p.pos) ~= ')' then parse_error(p, "unclosed (") end
|
|
230
|
+
p.pos = p.pos + 1
|
|
231
|
+
if capture then
|
|
232
|
+
emit(p, OP_SAVE, { slot = group * 2 + 1 })
|
|
233
|
+
end
|
|
234
|
+
elseif c == '[' then
|
|
235
|
+
p.pos = p.pos + 1
|
|
236
|
+
emit(p, OP_CLASS, { cc = parse_class(p) })
|
|
237
|
+
elseif c == '.' then
|
|
238
|
+
p.pos = p.pos + 1; emit(p, OP_ANY)
|
|
239
|
+
elseif c == '^' then
|
|
240
|
+
p.pos = p.pos + 1; emit(p, OP_BOL)
|
|
241
|
+
elseif c == '$' then
|
|
242
|
+
p.pos = p.pos + 1; emit(p, OP_EOL)
|
|
243
|
+
elseif c == '\\' then
|
|
244
|
+
p.pos = p.pos + 1
|
|
245
|
+
local b, pre = parse_escape(p)
|
|
246
|
+
if pre == 'b' then emit(p, OP_WB)
|
|
247
|
+
elseif pre == 'B' then emit(p, OP_NWB)
|
|
248
|
+
elseif pre then
|
|
249
|
+
local cc = cc_new(); cc_predef(cc, pre); emit(p, OP_CLASS, { cc = cc })
|
|
250
|
+
else
|
|
251
|
+
emit(p, OP_CHAR, { c = b })
|
|
252
|
+
end
|
|
253
|
+
elseif c == ')' or c == '|' then
|
|
254
|
+
return start
|
|
255
|
+
else
|
|
256
|
+
p.pos = p.pos + 1
|
|
257
|
+
emit(p, OP_CHAR, { c = c:byte(1) })
|
|
258
|
+
end
|
|
259
|
+
return start
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
local function apply_quant(p, atom_start, q, n_lo, n_hi, lazy)
|
|
263
|
+
local atom_end = #p.code + 1
|
|
264
|
+
local alen = atom_end - atom_start
|
|
265
|
+
if alen <= 0 then return end
|
|
266
|
+
if q == '?' then
|
|
267
|
+
shift_one(p, atom_start)
|
|
268
|
+
local exit_ix = #p.code + 1
|
|
269
|
+
p.code[atom_start] = { op = OP_SPLIT, data = {
|
|
270
|
+
x = lazy and exit_ix or (atom_start + 1),
|
|
271
|
+
y = lazy and (atom_start + 1) or exit_ix,
|
|
272
|
+
} }
|
|
273
|
+
elseif q == '*' then
|
|
274
|
+
shift_one(p, atom_start)
|
|
275
|
+
emit(p, OP_JMP, { jmp = atom_start })
|
|
276
|
+
local exit_ix = #p.code + 1
|
|
277
|
+
p.code[atom_start] = { op = OP_SPLIT, data = {
|
|
278
|
+
x = lazy and exit_ix or (atom_start + 1),
|
|
279
|
+
y = lazy and (atom_start + 1) or exit_ix,
|
|
280
|
+
} }
|
|
281
|
+
elseif q == '+' then
|
|
282
|
+
-- After the atom, emit SPLIT pointing back to atom or forward to exit.
|
|
283
|
+
-- The "forward" target is the slot AFTER this SPLIT, i.e. #p.code + 2
|
|
284
|
+
-- at the time we compute it (one past the SPLIT we're about to add).
|
|
285
|
+
local sp_ix = emit(p, OP_SPLIT, {})
|
|
286
|
+
local exit_ix = sp_ix + 1
|
|
287
|
+
p.code[sp_ix].data = {
|
|
288
|
+
x = lazy and exit_ix or atom_start,
|
|
289
|
+
y = lazy and atom_start or exit_ix,
|
|
290
|
+
}
|
|
291
|
+
elseif q == '{' then
|
|
292
|
+
-- Mandatory n_lo copies (we have 1 already; clone n_lo-1 more)
|
|
293
|
+
for _ = 2, n_lo do
|
|
294
|
+
clone_range(p, atom_start, atom_end)
|
|
295
|
+
end
|
|
296
|
+
if n_hi == -1 then
|
|
297
|
+
-- After mandatory, emit Kleene star of the atom
|
|
298
|
+
local split_ix = emit(p, OP_SPLIT, {})
|
|
299
|
+
local clone_start = clone_range(p, atom_start, atom_end)
|
|
300
|
+
local jmp_ix = emit(p, OP_JMP, { jmp = split_ix })
|
|
301
|
+
local exit_ix = #p.code + 1
|
|
302
|
+
p.code[split_ix].data = {
|
|
303
|
+
x = lazy and exit_ix or clone_start,
|
|
304
|
+
y = lazy and clone_start or exit_ix,
|
|
305
|
+
}
|
|
306
|
+
elseif n_hi > n_lo then
|
|
307
|
+
for _ = 1, n_hi - n_lo do
|
|
308
|
+
local sp = emit(p, OP_SPLIT, {})
|
|
309
|
+
local clone_start = clone_range(p, atom_start, atom_end)
|
|
310
|
+
local exit_ix = #p.code + 1
|
|
311
|
+
p.code[sp].data = {
|
|
312
|
+
x = lazy and exit_ix or clone_start,
|
|
313
|
+
y = lazy and clone_start or exit_ix,
|
|
314
|
+
}
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
local function parse_concat(p)
|
|
321
|
+
local start = #p.code + 1
|
|
322
|
+
while p.pos <= #p.src do
|
|
323
|
+
local c = p.src:sub(p.pos, p.pos)
|
|
324
|
+
if c == ')' or c == '|' then break end
|
|
325
|
+
local atom_start = parse_atom(p)
|
|
326
|
+
if p.pos <= #p.src then
|
|
327
|
+
local q = p.src:sub(p.pos, p.pos)
|
|
328
|
+
if q == '*' or q == '+' or q == '?' then
|
|
329
|
+
p.pos = p.pos + 1
|
|
330
|
+
local lazy = false
|
|
331
|
+
if p.pos <= #p.src and p.src:sub(p.pos, p.pos) == '?' then
|
|
332
|
+
lazy = true; p.pos = p.pos + 1
|
|
333
|
+
end
|
|
334
|
+
apply_quant(p, atom_start, q, 0, 0, lazy)
|
|
335
|
+
elseif q == '{' then
|
|
336
|
+
local save = p.pos
|
|
337
|
+
p.pos = p.pos + 1
|
|
338
|
+
local n_lo = nil
|
|
339
|
+
while p.pos <= #p.src and p.src:sub(p.pos, p.pos):match("%d") do
|
|
340
|
+
n_lo = (n_lo or 0) * 10 + tonumber(p.src:sub(p.pos, p.pos))
|
|
341
|
+
p.pos = p.pos + 1
|
|
342
|
+
end
|
|
343
|
+
if n_lo == nil then
|
|
344
|
+
p.pos = save
|
|
345
|
+
else
|
|
346
|
+
local n_hi = n_lo
|
|
347
|
+
if p.pos <= #p.src and p.src:sub(p.pos, p.pos) == ',' then
|
|
348
|
+
p.pos = p.pos + 1
|
|
349
|
+
n_hi = -1
|
|
350
|
+
local hi = nil
|
|
351
|
+
while p.pos <= #p.src and p.src:sub(p.pos, p.pos):match("%d") do
|
|
352
|
+
hi = (hi or 0) * 10 + tonumber(p.src:sub(p.pos, p.pos))
|
|
353
|
+
p.pos = p.pos + 1
|
|
354
|
+
end
|
|
355
|
+
if hi then n_hi = hi end
|
|
356
|
+
end
|
|
357
|
+
if p.pos <= #p.src and p.src:sub(p.pos, p.pos) == '}' then
|
|
358
|
+
p.pos = p.pos + 1
|
|
359
|
+
local lazy = false
|
|
360
|
+
if p.pos <= #p.src and p.src:sub(p.pos, p.pos) == '?' then
|
|
361
|
+
lazy = true; p.pos = p.pos + 1
|
|
362
|
+
end
|
|
363
|
+
apply_quant(p, atom_start, '{', n_lo, n_hi, lazy)
|
|
364
|
+
else
|
|
365
|
+
parse_error(p, "bad {n,m}")
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
end
|
|
371
|
+
return start
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
parse_alt = function(p)
|
|
375
|
+
local start = parse_concat(p)
|
|
376
|
+
while p.pos <= #p.src and p.src:sub(p.pos, p.pos) == '|' do
|
|
377
|
+
local branch1_end = #p.code + 1
|
|
378
|
+
local jmp_ix = emit(p, OP_JMP, { jmp = -1 })
|
|
379
|
+
local branch2_start = #p.code + 1
|
|
380
|
+
shift_one(p, start)
|
|
381
|
+
p.code[start] = { op = OP_SPLIT, data = { x = start + 1, y = branch2_start + 1 } }
|
|
382
|
+
p.pos = p.pos + 1
|
|
383
|
+
parse_concat(p)
|
|
384
|
+
p.code[jmp_ix + 1].data.jmp = #p.code + 1
|
|
385
|
+
end
|
|
386
|
+
return start
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
-- ---------------------------------------------------------------------
|
|
390
|
+
-- Public compile
|
|
391
|
+
-- ---------------------------------------------------------------------
|
|
392
|
+
|
|
393
|
+
local Regex = {}
|
|
394
|
+
Regex.__index = Regex
|
|
395
|
+
|
|
396
|
+
function M.compile(pattern)
|
|
397
|
+
if type(pattern) == 'table' and pattern.__is_regex then return pattern end
|
|
398
|
+
if type(pattern) ~= 'string' then
|
|
399
|
+
error("regex.compile: pattern must be a string", 2)
|
|
400
|
+
end
|
|
401
|
+
local p = {
|
|
402
|
+
src = pattern,
|
|
403
|
+
pos = 1,
|
|
404
|
+
code = {},
|
|
405
|
+
next_group = 1,
|
|
406
|
+
anchored = pattern:sub(1, 1) == '^',
|
|
407
|
+
}
|
|
408
|
+
emit(p, OP_SAVE, { slot = 0 })
|
|
409
|
+
parse_alt(p)
|
|
410
|
+
if p.pos <= #p.src then
|
|
411
|
+
parse_error(p, "unexpected " .. p.src:sub(p.pos, p.pos))
|
|
412
|
+
end
|
|
413
|
+
emit(p, OP_SAVE, { slot = 1 })
|
|
414
|
+
emit(p, OP_MATCH)
|
|
415
|
+
local re = setmetatable({
|
|
416
|
+
code = p.code,
|
|
417
|
+
ngroups = p.next_group,
|
|
418
|
+
anchored = p.anchored,
|
|
419
|
+
__is_regex = true,
|
|
420
|
+
}, Regex)
|
|
421
|
+
return re
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
-- ---------------------------------------------------------------------
|
|
425
|
+
-- Matcher
|
|
426
|
+
-- ---------------------------------------------------------------------
|
|
427
|
+
|
|
428
|
+
local function is_word(b) return (b >= 0x30 and b <= 0x39) or (b >= 0x41 and b <= 0x5A) or (b >= 0x61 and b <= 0x7A) or b == 0x5F end
|
|
429
|
+
|
|
430
|
+
local function add_thread(re, list, pc, slots, sp, input, ilen, visited)
|
|
431
|
+
if pc < 1 or pc > #re.code then return end
|
|
432
|
+
if visited[pc] then return end
|
|
433
|
+
visited[pc] = true
|
|
434
|
+
local insn = re.code[pc]
|
|
435
|
+
local op = insn.op
|
|
436
|
+
if op == OP_JMP then
|
|
437
|
+
add_thread(re, list, insn.data.jmp, slots, sp, input, ilen, visited)
|
|
438
|
+
elseif op == OP_SPLIT then
|
|
439
|
+
add_thread(re, list, insn.data.x, slots, sp, input, ilen, visited)
|
|
440
|
+
add_thread(re, list, insn.data.y, slots, sp, input, ilen, visited)
|
|
441
|
+
elseif op == OP_SAVE then
|
|
442
|
+
local ns = {}
|
|
443
|
+
for i = 1, #slots do ns[i] = slots[i] end
|
|
444
|
+
ns[insn.data.slot + 1] = sp
|
|
445
|
+
add_thread(re, list, pc + 1, ns, sp, input, ilen, visited)
|
|
446
|
+
elseif op == OP_BOL then
|
|
447
|
+
if sp == 0 or input:byte(sp) == 10 then
|
|
448
|
+
add_thread(re, list, pc + 1, slots, sp, input, ilen, visited)
|
|
449
|
+
end
|
|
450
|
+
elseif op == OP_EOL then
|
|
451
|
+
if sp == ilen or input:byte(sp + 1) == 10 then
|
|
452
|
+
add_thread(re, list, pc + 1, slots, sp, input, ilen, visited)
|
|
453
|
+
end
|
|
454
|
+
elseif op == OP_WB or op == OP_NWB then
|
|
455
|
+
local left = sp > 0 and is_word(input:byte(sp))
|
|
456
|
+
local right = sp < ilen and is_word(input:byte(sp + 1))
|
|
457
|
+
local at_bd = left ~= right
|
|
458
|
+
if (op == OP_WB) == at_bd then
|
|
459
|
+
add_thread(re, list, pc + 1, slots, sp, input, ilen, visited)
|
|
460
|
+
end
|
|
461
|
+
else
|
|
462
|
+
list[#list + 1] = { pc = pc, slots = slots }
|
|
463
|
+
end
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
local function match_at(re, input, ilen, start)
|
|
467
|
+
local nslots = re.ngroups * 2
|
|
468
|
+
local init = {}
|
|
469
|
+
for i = 1, nslots do init[i] = -1 end
|
|
470
|
+
local cur = {}
|
|
471
|
+
local nxt = {}
|
|
472
|
+
add_thread(re, cur, 1, init, start, input, ilen, {})
|
|
473
|
+
local sp = start
|
|
474
|
+
local found = nil
|
|
475
|
+
while #cur > 0 do
|
|
476
|
+
local c = (sp < ilen) and input:byte(sp + 1) or -1
|
|
477
|
+
local visited = {}
|
|
478
|
+
for i = 1, #cur do
|
|
479
|
+
local th = cur[i]
|
|
480
|
+
local insn = re.code[th.pc]
|
|
481
|
+
local op = insn.op
|
|
482
|
+
if op == OP_CHAR then
|
|
483
|
+
if c == insn.data.c then add_thread(re, nxt, th.pc + 1, th.slots, sp + 1, input, ilen, visited) end
|
|
484
|
+
elseif op == OP_ANY then
|
|
485
|
+
if c >= 0 and c ~= 10 then add_thread(re, nxt, th.pc + 1, th.slots, sp + 1, input, ilen, visited) end
|
|
486
|
+
elseif op == OP_CLASS then
|
|
487
|
+
if c >= 0 and insn.data.cc[c] then add_thread(re, nxt, th.pc + 1, th.slots, sp + 1, input, ilen, visited) end
|
|
488
|
+
elseif op == OP_MATCH then
|
|
489
|
+
-- Always overwrite: priority ordering means later MATCHes from
|
|
490
|
+
-- surviving (higher-priority) descendants in nxt should override
|
|
491
|
+
-- earlier matches from lower-priority threads. `if not found` made
|
|
492
|
+
-- greedy quantifiers behave lazily (e.g. `a*` on "abc" matched "").
|
|
493
|
+
found = th.slots
|
|
494
|
+
break
|
|
495
|
+
end
|
|
496
|
+
end
|
|
497
|
+
cur, nxt = nxt, {}
|
|
498
|
+
sp = sp + 1
|
|
499
|
+
if #cur == 0 then break end
|
|
500
|
+
end
|
|
501
|
+
-- Drain remaining current threads for trailing MATCH (mirrors C engine).
|
|
502
|
+
for i = 1, #cur do
|
|
503
|
+
if re.code[cur[i].pc].op == OP_MATCH then
|
|
504
|
+
found = cur[i].slots
|
|
505
|
+
break
|
|
506
|
+
end
|
|
507
|
+
end
|
|
508
|
+
return found
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
function Regex:find(input)
|
|
512
|
+
input = input or ""
|
|
513
|
+
local ilen = #input
|
|
514
|
+
for start = 0, ilen do
|
|
515
|
+
local slots = match_at(self, input, ilen, start)
|
|
516
|
+
if slots then return slots end
|
|
517
|
+
if self.anchored then break end
|
|
518
|
+
end
|
|
519
|
+
return nil
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
function Regex:test(input)
|
|
523
|
+
return self:find(input) ~= nil
|
|
524
|
+
end
|
|
525
|
+
|
|
526
|
+
function Regex:find_all(input)
|
|
527
|
+
input = input or ""
|
|
528
|
+
local ilen = #input
|
|
529
|
+
local out = {}
|
|
530
|
+
local pos = 0
|
|
531
|
+
while pos <= ilen do
|
|
532
|
+
local slots = nil
|
|
533
|
+
local start
|
|
534
|
+
for s = pos, ilen do
|
|
535
|
+
slots = match_at(self, input, ilen, s)
|
|
536
|
+
if slots then start = s; break end
|
|
537
|
+
if self.anchored and s > pos then break end
|
|
538
|
+
end
|
|
539
|
+
if not slots then break end
|
|
540
|
+
out[#out + 1] = slots
|
|
541
|
+
local mend = slots[2]
|
|
542
|
+
if mend == slots[1] then pos = mend + 1 else pos = mend end
|
|
543
|
+
end
|
|
544
|
+
return out
|
|
545
|
+
end
|
|
546
|
+
|
|
547
|
+
local function caps_to_strs(slots, input, ngroups)
|
|
548
|
+
local out = {}
|
|
549
|
+
for g = 0, ngroups - 1 do
|
|
550
|
+
local s, e = slots[g * 2 + 1], slots[g * 2 + 2]
|
|
551
|
+
if s < 0 or e < s then
|
|
552
|
+
out[g + 1] = ""
|
|
553
|
+
else
|
|
554
|
+
out[g + 1] = input:sub(s + 1, e)
|
|
555
|
+
end
|
|
556
|
+
end
|
|
557
|
+
return out
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
local function expand_replacement(repl, slots, input)
|
|
561
|
+
local out = {}
|
|
562
|
+
local i = 1
|
|
563
|
+
while i <= #repl do
|
|
564
|
+
local c = repl:sub(i, i)
|
|
565
|
+
if c == '$' and i < #repl then
|
|
566
|
+
local nc = repl:sub(i + 1, i + 1)
|
|
567
|
+
if nc == '&' then
|
|
568
|
+
local s, e = slots[1], slots[2]
|
|
569
|
+
if s >= 0 and e >= s then out[#out + 1] = input:sub(s + 1, e) end
|
|
570
|
+
i = i + 2
|
|
571
|
+
elseif nc:match("[0-9]") then
|
|
572
|
+
local g = tonumber(nc)
|
|
573
|
+
local s, e = slots[g * 2 + 1], slots[g * 2 + 2]
|
|
574
|
+
if s and e and s >= 0 and e >= s then out[#out + 1] = input:sub(s + 1, e) end
|
|
575
|
+
i = i + 2
|
|
576
|
+
elseif nc == '$' then
|
|
577
|
+
out[#out + 1] = '$'
|
|
578
|
+
i = i + 2
|
|
579
|
+
else
|
|
580
|
+
out[#out + 1] = c
|
|
581
|
+
i = i + 1
|
|
582
|
+
end
|
|
583
|
+
else
|
|
584
|
+
out[#out + 1] = c
|
|
585
|
+
i = i + 1
|
|
586
|
+
end
|
|
587
|
+
end
|
|
588
|
+
return table.concat(out)
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
function Regex:replace(input, replacement)
|
|
592
|
+
input = input or ""
|
|
593
|
+
local ilen = #input
|
|
594
|
+
local parts = {}
|
|
595
|
+
local pos = 0
|
|
596
|
+
while pos <= ilen do
|
|
597
|
+
local slots = nil
|
|
598
|
+
local start
|
|
599
|
+
for s = pos, ilen do
|
|
600
|
+
slots = match_at(self, input, ilen, s)
|
|
601
|
+
if slots then start = s; break end
|
|
602
|
+
if self.anchored and s > pos then break end
|
|
603
|
+
end
|
|
604
|
+
if not slots then
|
|
605
|
+
parts[#parts + 1] = input:sub(pos + 1, ilen)
|
|
606
|
+
break
|
|
607
|
+
end
|
|
608
|
+
parts[#parts + 1] = input:sub(pos + 1, start)
|
|
609
|
+
if type(replacement) == 'function' then
|
|
610
|
+
local strs = caps_to_strs(slots, input, self.ngroups)
|
|
611
|
+
parts[#parts + 1] = replacement(strs)
|
|
612
|
+
else
|
|
613
|
+
parts[#parts + 1] = expand_replacement(replacement, slots, input)
|
|
614
|
+
end
|
|
615
|
+
local mend = slots[2]
|
|
616
|
+
if mend == slots[1] then
|
|
617
|
+
if mend < ilen then parts[#parts + 1] = input:sub(mend + 1, mend + 1) end
|
|
618
|
+
pos = mend + 1
|
|
619
|
+
else
|
|
620
|
+
pos = mend
|
|
621
|
+
end
|
|
622
|
+
end
|
|
623
|
+
return table.concat(parts)
|
|
624
|
+
end
|
|
625
|
+
|
|
626
|
+
-- ---------------------------------------------------------------------
|
|
627
|
+
-- Public uniform API (matches REGEX_API.md)
|
|
628
|
+
-- ---------------------------------------------------------------------
|
|
629
|
+
|
|
630
|
+
function M.re_compile(pattern) return M.compile(pattern) end
|
|
631
|
+
|
|
632
|
+
function M.re_test(pattern, input)
|
|
633
|
+
return M.compile(pattern):test(input)
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
function M.re_find(pattern, input)
|
|
637
|
+
local re = M.compile(pattern)
|
|
638
|
+
local slots = re:find(input)
|
|
639
|
+
if not slots then return nil end
|
|
640
|
+
return caps_to_strs(slots, input or "", re.ngroups)
|
|
641
|
+
end
|
|
642
|
+
|
|
643
|
+
function M.re_find_all(pattern, input)
|
|
644
|
+
local re = M.compile(pattern)
|
|
645
|
+
-- Marked: an unmarked empty table reads as a MAP under this port's rules
|
|
646
|
+
-- (see keysof), and no-matches must be [].
|
|
647
|
+
local out = setmetatable({}, { __jsontype = "array" })
|
|
648
|
+
for _, slots in ipairs(re:find_all(input)) do
|
|
649
|
+
out[#out + 1] = caps_to_strs(slots, input or "", re.ngroups)
|
|
650
|
+
end
|
|
651
|
+
return out
|
|
652
|
+
end
|
|
653
|
+
|
|
654
|
+
function M.re_replace(pattern, input, replacement)
|
|
655
|
+
return M.compile(pattern):replace(input, replacement)
|
|
656
|
+
end
|
|
657
|
+
|
|
658
|
+
function M.re_escape(literal)
|
|
659
|
+
local escaped = (literal or ""):gsub("[%.%*%+%?%^%$%{%}%(%)%|%[%]\\]", "\\%0")
|
|
660
|
+
return escaped
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
return M
|