@voxgig/sdkgen-langpack 0.0.1
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/.sdk/model/target/dart.aon +63 -0
- package/.sdk/model/target/haskell.aon +72 -0
- package/.sdk/model/target/lean.aon +91 -0
- package/.sdk/src/cmp/dart/Config_dart.ts +248 -0
- package/.sdk/src/cmp/dart/EntityBase_dart.ts +34 -0
- package/.sdk/src/cmp/dart/EntityOperation_dart.ts +43 -0
- package/.sdk/src/cmp/dart/EntityTypes_dart.ts +207 -0
- package/.sdk/src/cmp/dart/Entity_dart.ts +87 -0
- package/.sdk/src/cmp/dart/Gitignore_dart.ts +34 -0
- package/.sdk/src/cmp/dart/MainEntity_dart.ts +33 -0
- package/.sdk/src/cmp/dart/Main_dart.ts +178 -0
- package/.sdk/src/cmp/dart/Package_dart.ts +82 -0
- package/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +177 -0
- package/.sdk/src/cmp/dart/ReadmeExamplesTest_dart.ts +238 -0
- package/.sdk/src/cmp/dart/ReadmeExplanation_dart.ts +53 -0
- package/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +152 -0
- package/.sdk/src/cmp/dart/ReadmeInstall_dart.ts +59 -0
- package/.sdk/src/cmp/dart/ReadmeIntro_dart.ts +65 -0
- package/.sdk/src/cmp/dart/ReadmeModel_dart.ts +151 -0
- package/.sdk/src/cmp/dart/ReadmeOptions_dart.ts +63 -0
- package/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +225 -0
- package/.sdk/src/cmp/dart/ReadmeRef_dart.ts +397 -0
- package/.sdk/src/cmp/dart/ReadmeTopHowto_dart.ts +24 -0
- package/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +106 -0
- package/.sdk/src/cmp/dart/ReadmeTopTest_dart.ts +78 -0
- package/.sdk/src/cmp/dart/SdkError_dart.ts +42 -0
- package/.sdk/src/cmp/dart/TestDirect_dart.ts +516 -0
- package/.sdk/src/cmp/dart/TestEntity_dart.ts +628 -0
- package/.sdk/src/cmp/dart/Test_dart.ts +138 -0
- package/.sdk/src/cmp/dart/fragment/Config.data.fragment.dart +98 -0
- package/.sdk/src/cmp/dart/fragment/Config.fragment.dart +70 -0
- package/.sdk/src/cmp/dart/fragment/Direct.test.fragment.dart +25 -0
- package/.sdk/src/cmp/dart/fragment/Entity.fragment.dart +29 -0
- package/.sdk/src/cmp/dart/fragment/Entity.test.fragment.dart +28 -0
- package/.sdk/src/cmp/dart/fragment/EntityBase.fragment.dart +302 -0
- package/.sdk/src/cmp/dart/fragment/EntityCreateOp.fragment.dart +98 -0
- package/.sdk/src/cmp/dart/fragment/EntityListOp.fragment.dart +90 -0
- package/.sdk/src/cmp/dart/fragment/EntityLoadOp.fragment.dart +102 -0
- package/.sdk/src/cmp/dart/fragment/EntityRemoveOp.fragment.dart +108 -0
- package/.sdk/src/cmp/dart/fragment/EntityUpdateOp.fragment.dart +102 -0
- package/.sdk/src/cmp/dart/fragment/Main.fragment.dart +339 -0
- package/.sdk/src/cmp/dart/fragment/SdkError.fragment.dart +26 -0
- package/.sdk/src/cmp/dart/tsconfig.json +15 -0
- package/.sdk/src/cmp/dart/utility_dart.ts +155 -0
- package/.sdk/src/cmp/haskell/Config_haskell.ts +98 -0
- package/.sdk/src/cmp/haskell/Entity_haskell.ts +13 -0
- package/.sdk/src/cmp/haskell/Gitignore_haskell.ts +27 -0
- package/.sdk/src/cmp/haskell/Main_haskell.ts +123 -0
- package/.sdk/src/cmp/haskell/Package_haskell.ts +60 -0
- package/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +186 -0
- package/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +135 -0
- package/.sdk/src/cmp/haskell/ReadmeExplanation_haskell.ts +48 -0
- package/.sdk/src/cmp/haskell/ReadmeHowto_haskell.ts +168 -0
- package/.sdk/src/cmp/haskell/ReadmeInstall_haskell.ts +51 -0
- package/.sdk/src/cmp/haskell/ReadmeIntro_haskell.ts +67 -0
- package/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +162 -0
- package/.sdk/src/cmp/haskell/ReadmeOptions_haskell.ts +74 -0
- package/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +241 -0
- package/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +408 -0
- package/.sdk/src/cmp/haskell/ReadmeTopHowto_haskell.ts +31 -0
- package/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +104 -0
- package/.sdk/src/cmp/haskell/ReadmeTopTest_haskell.ts +80 -0
- package/.sdk/src/cmp/haskell/Test_haskell.ts +297 -0
- package/.sdk/src/cmp/haskell/tsconfig.json +15 -0
- package/.sdk/src/cmp/haskell/utility_haskell.ts +166 -0
- package/.sdk/src/cmp/lean/Config_lean.ts +93 -0
- package/.sdk/src/cmp/lean/Entity_lean.ts +9 -0
- package/.sdk/src/cmp/lean/Gitignore_lean.ts +18 -0
- package/.sdk/src/cmp/lean/Main_lean.ts +120 -0
- package/.sdk/src/cmp/lean/Package_lean.ts +93 -0
- package/.sdk/src/cmp/lean/ReadmeEntity_lean.ts +29 -0
- package/.sdk/src/cmp/lean/ReadmeExplanation_lean.ts +19 -0
- package/.sdk/src/cmp/lean/ReadmeHowto_lean.ts +25 -0
- package/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +39 -0
- package/.sdk/src/cmp/lean/ReadmeIntro_lean.ts +25 -0
- package/.sdk/src/cmp/lean/ReadmeModel_lean.ts +24 -0
- package/.sdk/src/cmp/lean/ReadmeOptions_lean.ts +22 -0
- package/.sdk/src/cmp/lean/ReadmeQuick_lean.ts +50 -0
- package/.sdk/src/cmp/lean/ReadmeRef_lean.ts +40 -0
- package/.sdk/src/cmp/lean/ReadmeTopHowto_lean.ts +16 -0
- package/.sdk/src/cmp/lean/ReadmeTopQuick_lean.ts +23 -0
- package/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +19 -0
- package/.sdk/src/cmp/lean/Test_lean.ts +261 -0
- package/.sdk/src/cmp/lean/utility_lean.ts +129 -0
- package/.sdk/tm/dart/LICENSE +22 -0
- package/.sdk/tm/dart/Makefile +50 -0
- package/.sdk/tm/dart/lib/Context.dart +150 -0
- package/.sdk/tm/dart/lib/Control.dart +15 -0
- package/.sdk/tm/dart/lib/Operation.dart +31 -0
- package/.sdk/tm/dart/lib/Point.dart +51 -0
- package/.sdk/tm/dart/lib/Response.dart +32 -0
- package/.sdk/tm/dart/lib/Result.dart +39 -0
- package/.sdk/tm/dart/lib/Spec.dart +49 -0
- package/.sdk/tm/dart/lib/feature/audit/AuditFeature.dart +103 -0
- package/.sdk/tm/dart/lib/feature/base/BaseFeature.dart +76 -0
- package/.sdk/tm/dart/lib/feature/cache/CacheFeature.dart +152 -0
- package/.sdk/tm/dart/lib/feature/clienttrack/ClienttrackFeature.dart +104 -0
- package/.sdk/tm/dart/lib/feature/cost/CostFeature.dart +446 -0
- package/.sdk/tm/dart/lib/feature/debug/DebugFeature.dart +153 -0
- package/.sdk/tm/dart/lib/feature/idempotency/IdempotencyFeature.dart +92 -0
- package/.sdk/tm/dart/lib/feature/log/LogFeature.dart +85 -0
- package/.sdk/tm/dart/lib/feature/metrics/MetricsFeature.dart +103 -0
- package/.sdk/tm/dart/lib/feature/netsim/NetsimFeature.dart +186 -0
- package/.sdk/tm/dart/lib/feature/paging/PagingFeature.dart +240 -0
- package/.sdk/tm/dart/lib/feature/proxy/ProxyFeature.dart +118 -0
- package/.sdk/tm/dart/lib/feature/ratelimit/RatelimitFeature.dart +103 -0
- package/.sdk/tm/dart/lib/feature/rbac/RbacFeature.dart +121 -0
- package/.sdk/tm/dart/lib/feature/retry/RetryFeature.dart +155 -0
- package/.sdk/tm/dart/lib/feature/secrets/SecretsFeature.dart +649 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/capability.dart +105 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/catalog.dart +46 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/config.dart +297 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/depend.dart +198 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/env.dart +144 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/export.dart +58 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/graph.dart +160 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/host.dart +1067 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/order.dart +172 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/plugin.dart +23 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/point.dart +117 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/ref.dart +105 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/resolve.dart +58 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/types.dart +201 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/version.dart +116 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/aws.dart +285 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/azuresecrets.dart +178 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/boru.dart +145 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/crypto.dart +194 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/doppler.dart +101 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/gcpsecrets.dart +143 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/hashicorp.dart +190 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/httpjson.dart +363 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/infisical.dart +149 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/onepassword.dart +146 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/secretspec.dart +116 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/sigv4.dart +237 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/addr.dart +138 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/json.dart +276 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/provider.dart +31 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/providers.dart +243 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/sekreto.dart +730 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/spec.dart +200 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/support.dart +217 -0
- package/.sdk/tm/dart/lib/feature/streaming/StreamingFeature.dart +97 -0
- package/.sdk/tm/dart/lib/feature/telemetry/TelemetryFeature.dart +136 -0
- package/.sdk/tm/dart/lib/feature/test/TestFeature.dart +328 -0
- package/.sdk/tm/dart/lib/feature/timeout/TimeoutFeature.dart +104 -0
- package/.sdk/tm/dart/lib/utility/CleanUtility.dart +12 -0
- package/.sdk/tm/dart/lib/utility/DoneUtility.dart +18 -0
- package/.sdk/tm/dart/lib/utility/ErrUtility.dart +46 -0
- package/.sdk/tm/dart/lib/utility/FeatureAddUtility.dart +35 -0
- package/.sdk/tm/dart/lib/utility/FeatureHookUtility.dart +20 -0
- package/.sdk/tm/dart/lib/utility/FeatureInitUtility.dart +9 -0
- package/.sdk/tm/dart/lib/utility/FetcherUtility.dart +104 -0
- package/.sdk/tm/dart/lib/utility/GraphqlUtility.dart +162 -0
- package/.sdk/tm/dart/lib/utility/MakeContextUtility.dart +6 -0
- package/.sdk/tm/dart/lib/utility/MakeErrorUtility.dart +71 -0
- package/.sdk/tm/dart/lib/utility/MakeFetchDefUtility.dart +42 -0
- package/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +233 -0
- package/.sdk/tm/dart/lib/utility/MakePointUtility.dart +130 -0
- package/.sdk/tm/dart/lib/utility/MakeRequestUtility.dart +66 -0
- package/.sdk/tm/dart/lib/utility/MakeResponseUtility.dart +59 -0
- package/.sdk/tm/dart/lib/utility/MakeResultUtility.dart +49 -0
- package/.sdk/tm/dart/lib/utility/MakeSpecUtility.dart +77 -0
- package/.sdk/tm/dart/lib/utility/MakeUrlUtility.dart +51 -0
- package/.sdk/tm/dart/lib/utility/ParamUtility.dart +56 -0
- package/.sdk/tm/dart/lib/utility/PrepareAuthUtility.dart +46 -0
- package/.sdk/tm/dart/lib/utility/PrepareBodyUtility.dart +19 -0
- package/.sdk/tm/dart/lib/utility/PrepareHeadersUtility.dart +11 -0
- package/.sdk/tm/dart/lib/utility/PrepareMethodUtility.dart +30 -0
- package/.sdk/tm/dart/lib/utility/PrepareParamsUtility.dart +23 -0
- package/.sdk/tm/dart/lib/utility/PreparePathUtility.dart +9 -0
- package/.sdk/tm/dart/lib/utility/PrepareQueryUtility.dart +18 -0
- package/.sdk/tm/dart/lib/utility/ResultBasicUtility.dart +29 -0
- package/.sdk/tm/dart/lib/utility/ResultBodyUtility.dart +15 -0
- package/.sdk/tm/dart/lib/utility/ResultHeadersUtility.dart +18 -0
- package/.sdk/tm/dart/lib/utility/StructUtility.dart +127 -0
- package/.sdk/tm/dart/lib/utility/TransformRequestUtility.dart +28 -0
- package/.sdk/tm/dart/lib/utility/TransformResponseUtility.dart +44 -0
- package/.sdk/tm/dart/lib/utility/Utility.dart +239 -0
- package/.sdk/tm/dart/lib/utility/voxgig_struct.dart +2462 -0
- package/.sdk/tm/dart/src/feature/README.md +3 -0
- package/.sdk/tm/dart/src/feature/audit/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/base/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/cache/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/clienttrack/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/cost/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/debug/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/idempotency/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/log/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/metrics/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/netsim/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/paging/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/proxy/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/ratelimit/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/rbac/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/retry/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/secrets/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/streaming/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/telemetry/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/test/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/timeout/.gitkeep +0 -0
- package/.sdk/tm/dart/test/custom_test.dart +65 -0
- package/.sdk/tm/dart/test/exists_test.dart +12 -0
- package/.sdk/tm/dart/test/feature/harness.dart +347 -0
- package/.sdk/tm/dart/test/feature/secrets/secrets_test.dart +1107 -0
- package/.sdk/tm/dart/test/feature_test.dart +1193 -0
- package/.sdk/tm/dart/test/harness.dart +153 -0
- package/.sdk/tm/dart/test/netsim_test.dart +48 -0
- package/.sdk/tm/dart/test/omni.dart +520 -0
- package/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
- package/.sdk/tm/dart/test/pipeline_test.dart +608 -0
- package/.sdk/tm/dart/test/primary_test.dart +476 -0
- package/.sdk/tm/dart/test/sdk-test-control.json +19 -0
- package/.sdk/tm/dart/test/struct_test.dart +468 -0
- package/.sdk/tm/dart/test/utility.dart +198 -0
- package/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
- package/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
- package/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
- package/.sdk/tm/haskell/LICENSE +21 -0
- package/.sdk/tm/haskell/Makefile +22 -0
- package/.sdk/tm/haskell/VERSION +1 -0
- package/.sdk/tm/haskell/src/SdkFeatures.hs +1440 -0
- package/.sdk/tm/haskell/src/SdkHelpers.hs +337 -0
- package/.sdk/tm/haskell/src/SdkJson.hs +111 -0
- package/.sdk/tm/haskell/src/SdkRuntime.hs +1279 -0
- package/.sdk/tm/haskell/src/SdkTypes.hs +195 -0
- package/.sdk/tm/haskell/src/VoxgigStruct.hs +2299 -0
- package/.sdk/tm/haskell/src/Vregex.hs +237 -0
- package/.sdk/tm/haskell/src/feature/README.md +5 -0
- package/.sdk/tm/haskell/src/feature/audit/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/base/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/cache/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/clienttrack/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/debug/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/idempotency/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/log/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/metrics/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/netsim/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/paging/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/proxy/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/ratelimit/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/rbac/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/retry/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/streaming/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/telemetry/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/test/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/timeout/.gitkeep +0 -0
- package/.sdk/tm/haskell/test/Harness.hs +281 -0
- package/.sdk/tm/haskell/test/OmniResolver.hs +252 -0
- package/.sdk/tm/haskell/test/Runner.hs +49 -0
- package/.sdk/tm/haskell/test/StructCorpus.hs +449 -0
- package/.sdk/tm/haskell/test/TCustomUtility.hs +38 -0
- package/.sdk/tm/haskell/test/TFeature.hs +794 -0
- package/.sdk/tm/haskell/test/TNetsim.hs +50 -0
- package/.sdk/tm/haskell/test/TPipeline.hs +334 -0
- package/.sdk/tm/haskell/test/TPrimaryCorpus.hs +263 -0
- package/.sdk/tm/haskell/test/TPrimaryUtility.hs +386 -0
- package/.sdk/tm/haskell/test/Testutil.hs +59 -0
- package/.sdk/tm/haskell/test/vendor/omni/Omni.hs +1147 -0
- package/.sdk/tm/lean/LICENSE +21 -0
- package/.sdk/tm/lean/Makefile +32 -0
- package/.sdk/tm/lean/VERSION +1 -0
- package/.sdk/tm/lean/src/SdkFeature.lean +171 -0
- package/.sdk/tm/lean/src/SdkFeatures.lean +787 -0
- package/.sdk/tm/lean/src/SdkJson.lean +134 -0
- package/.sdk/tm/lean/src/SdkRuntime.lean +374 -0
- package/.sdk/tm/lean/src/SdkUtility.lean +809 -0
- package/.sdk/tm/lean/src/VoxgigStruct.lean +2880 -0
- package/.sdk/tm/lean/src/Vregex.lean +412 -0
- package/.sdk/tm/lean/src/feature/README.md +5 -0
- package/.sdk/tm/lean/src/feature/audit/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/base/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/cache/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/clienttrack/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/cost/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/debug/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/idempotency/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/log/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/metrics/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/netsim/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/paging/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/proxy/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/ratelimit/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/rbac/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/retry/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/streaming/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/telemetry/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/test/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/timeout/.gitkeep +0 -0
- package/.sdk/tm/lean/test/OmniResolver.lean +358 -0
- package/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
- package/.sdk/tm/lean/test/StructCorpus.lean +368 -0
- package/.sdk/tm/lean/test/TFeature.lean +281 -0
- package/.sdk/tm/lean/test/TPrimaryUtility.lean +227 -0
- package/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
- package/LICENSE +21 -0
- package/README.md +104 -0
- package/package.json +78 -0
- package/sdkgen-package.json +22 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
-- ProjectName SDK value helpers — thin wrappers over the vendored voxgig
|
|
2
|
+
-- struct `Value` type used throughout the pipeline, plus the pipeline-object
|
|
3
|
+
-- constructors (spec/response/result/operation/control are struct maps).
|
|
4
|
+
|
|
5
|
+
module SdkHelpers where
|
|
6
|
+
|
|
7
|
+
import Data.Char (toLower, toUpper)
|
|
8
|
+
import Data.IORef
|
|
9
|
+
import Data.List (isPrefixOf)
|
|
10
|
+
|
|
11
|
+
import VoxgigStruct
|
|
12
|
+
( Value (..), InjArg (..), dummyInj, emptyList, emptyMap, mkList, mkMap
|
|
13
|
+
, getprop, getpropAlt, setprop, delprop, getpath, getelem, keysof, listItems
|
|
14
|
+
, clone, isnode, ismap, islist, isfunc, iskey, isNoval, isNullish, vint
|
|
15
|
+
, vIsTrue, vStrEq, jsonEncode )
|
|
16
|
+
|
|
17
|
+
import SdkTypes
|
|
18
|
+
|
|
19
|
+
-- ----- map / list construction & access -----
|
|
20
|
+
|
|
21
|
+
jo :: [(String, Value)] -> IO Value
|
|
22
|
+
jo = mkMap
|
|
23
|
+
|
|
24
|
+
ja :: [Value] -> IO Value
|
|
25
|
+
ja = mkList
|
|
26
|
+
|
|
27
|
+
getp :: Value -> String -> IO Value
|
|
28
|
+
getp v k = getprop v (VStr k)
|
|
29
|
+
|
|
30
|
+
setp :: Value -> String -> Value -> IO ()
|
|
31
|
+
setp v k nv = () <$ setprop v (VStr k) nv
|
|
32
|
+
|
|
33
|
+
delp :: Value -> String -> IO ()
|
|
34
|
+
delp v k = () <$ delprop v (VStr k)
|
|
35
|
+
|
|
36
|
+
getpathS :: Value -> String -> IO Value
|
|
37
|
+
getpathS store p = getpath INone store (VStr p)
|
|
38
|
+
|
|
39
|
+
toMap :: Value -> Value
|
|
40
|
+
toMap v = case v of VMap _ -> v; _ -> VNoval
|
|
41
|
+
|
|
42
|
+
toInt :: Value -> Int
|
|
43
|
+
toInt v = case v of VNum n -> truncate n; _ -> -1
|
|
44
|
+
|
|
45
|
+
getStr :: Value -> String -> IO (Maybe String)
|
|
46
|
+
getStr m k = (\v -> case v of VStr s -> Just s; _ -> Nothing) <$> getp m k
|
|
47
|
+
|
|
48
|
+
getStrD :: Value -> String -> String -> IO String
|
|
49
|
+
getStrD m k d = maybe d id <$> getStr m k
|
|
50
|
+
|
|
51
|
+
getBool :: Value -> String -> IO (Maybe Bool)
|
|
52
|
+
getBool m k = (\v -> case v of VBool b -> Just b; _ -> Nothing) <$> getp m k
|
|
53
|
+
|
|
54
|
+
getNum :: Value -> String -> IO (Maybe Double)
|
|
55
|
+
getNum m k = (\v -> case v of VNum n -> Just n; _ -> Nothing) <$> getp m k
|
|
56
|
+
|
|
57
|
+
isTrueV :: Value -> Bool
|
|
58
|
+
isTrueV = vIsTrue
|
|
59
|
+
|
|
60
|
+
vlistItems :: Value -> IO [Value]
|
|
61
|
+
vlistItems = listItems
|
|
62
|
+
|
|
63
|
+
-- ----- string form of a value (JS String(v)) -----
|
|
64
|
+
|
|
65
|
+
vstring :: Value -> String
|
|
66
|
+
vstring v = case v of
|
|
67
|
+
VStr s -> s
|
|
68
|
+
VNoval -> ""
|
|
69
|
+
VNull -> ""
|
|
70
|
+
VBool b -> if b then "true" else "false"
|
|
71
|
+
VNum n -> numToStr n
|
|
72
|
+
_ -> ""
|
|
73
|
+
|
|
74
|
+
numToStr :: Double -> String
|
|
75
|
+
numToStr n = if fromIntegral (truncate n :: Integer) == n
|
|
76
|
+
then show (truncate n :: Integer)
|
|
77
|
+
else show n
|
|
78
|
+
|
|
79
|
+
lower :: String -> String
|
|
80
|
+
lower = map toLower
|
|
81
|
+
|
|
82
|
+
upper :: String -> String
|
|
83
|
+
upper = map toUpper
|
|
84
|
+
|
|
85
|
+
-- ----- callables (struct Func) -----
|
|
86
|
+
|
|
87
|
+
callVfn :: Value -> Value -> IO Value
|
|
88
|
+
callVfn fn arg = case fn of VFunc f -> f dummyInj arg "" VNoval; _ -> pure VNoval
|
|
89
|
+
|
|
90
|
+
callJson :: Value -> IO Value
|
|
91
|
+
callJson j = callVfn j VNoval
|
|
92
|
+
|
|
93
|
+
jsonThunk :: Value -> Value
|
|
94
|
+
jsonThunk d = VFunc (\_ _ _ _ -> pure d)
|
|
95
|
+
|
|
96
|
+
vfunc0 :: IO Value -> Value
|
|
97
|
+
vfunc0 f = VFunc (\_ _ _ _ -> f)
|
|
98
|
+
|
|
99
|
+
vfunc1 :: (Value -> IO Value) -> Value
|
|
100
|
+
vfunc1 f = VFunc (\_ v _ _ -> f v)
|
|
101
|
+
|
|
102
|
+
isCallable :: Value -> Bool
|
|
103
|
+
isCallable = isfunc
|
|
104
|
+
|
|
105
|
+
-- ----- errors (Value maps tagged __sdkerr__) -----
|
|
106
|
+
|
|
107
|
+
mkErr :: String -> String -> IO Value
|
|
108
|
+
mkErr code msg = jo
|
|
109
|
+
[ ("__sdkerr__", VBool True)
|
|
110
|
+
, ("code", VStr code)
|
|
111
|
+
, ("message", VStr msg)
|
|
112
|
+
, ("result", VNoval)
|
|
113
|
+
, ("spec", VNoval) ]
|
|
114
|
+
|
|
115
|
+
ctxMakeError :: Context -> String -> String -> IO Value
|
|
116
|
+
ctxMakeError _ = mkErr
|
|
117
|
+
|
|
118
|
+
isErr :: Value -> IO Bool
|
|
119
|
+
isErr v = case v of
|
|
120
|
+
VMap _ -> (\t -> case t of VBool True -> True; _ -> False) <$> getp v "__sdkerr__"
|
|
121
|
+
_ -> pure False
|
|
122
|
+
|
|
123
|
+
errMsg :: Value -> IO String
|
|
124
|
+
errMsg e = getStrD e "message" ""
|
|
125
|
+
|
|
126
|
+
errCode :: Value -> IO String
|
|
127
|
+
errCode e = getStrD e "code" ""
|
|
128
|
+
|
|
129
|
+
errToValue :: Value -> IO Value
|
|
130
|
+
errToValue e = do
|
|
131
|
+
c <- errCode e; m <- errMsg e
|
|
132
|
+
jo [("code", VStr c), ("message", VStr m)]
|
|
133
|
+
|
|
134
|
+
-- ----- ctx utility / client unwrap -----
|
|
135
|
+
|
|
136
|
+
cu :: Context -> IO Utility
|
|
137
|
+
cu ctx = do
|
|
138
|
+
m <- readIORef (cUtility ctx)
|
|
139
|
+
case m of Just u -> pure u; Nothing -> error "context utility not set"
|
|
140
|
+
|
|
141
|
+
cc :: Context -> IO Client
|
|
142
|
+
cc ctx = do
|
|
143
|
+
m <- readIORef (cClient ctx)
|
|
144
|
+
case m of Just c -> pure c; Nothing -> error "context client not set"
|
|
145
|
+
|
|
146
|
+
-- ----- per-op feature scratch (cScratch map) -----
|
|
147
|
+
|
|
148
|
+
scratchGet :: Context -> String -> IO Value
|
|
149
|
+
scratchGet ctx k = do s <- readIORef (cScratch ctx); getp s k
|
|
150
|
+
|
|
151
|
+
scratchSet :: Context -> String -> Value -> IO ()
|
|
152
|
+
scratchSet ctx k v = do s <- readIORef (cScratch ctx); setp s k v
|
|
153
|
+
|
|
154
|
+
scratchDel :: Context -> String -> IO ()
|
|
155
|
+
scratchDel ctx k = do s <- readIORef (cScratch ctx); delp s k
|
|
156
|
+
|
|
157
|
+
-- ----- client feature-tracking sink (client._retry / _cache / ...) -----
|
|
158
|
+
|
|
159
|
+
trackGet :: Client -> String -> IO Value
|
|
160
|
+
trackGet cl name = do t <- readIORef (clTrack cl); getp t name
|
|
161
|
+
|
|
162
|
+
trackSet :: Client -> String -> Value -> IO ()
|
|
163
|
+
trackSet cl name v = do t <- readIORef (clTrack cl); setp t name v
|
|
164
|
+
|
|
165
|
+
trackBucket :: Client -> String -> IO Value -> IO Value
|
|
166
|
+
trackBucket cl name mk = do
|
|
167
|
+
b <- trackGet cl name
|
|
168
|
+
case b of
|
|
169
|
+
VMap _ -> pure b
|
|
170
|
+
_ -> do nb <- mk; trackSet cl name nb; pure nb
|
|
171
|
+
|
|
172
|
+
bumpNum :: Value -> String -> Double -> IO ()
|
|
173
|
+
bumpNum m k by = do
|
|
174
|
+
cur <- getp m k
|
|
175
|
+
let c = case cur of VNum n -> n; _ -> 0
|
|
176
|
+
setp m k (VNum (c + by))
|
|
177
|
+
|
|
178
|
+
-- ----- header lookup (case-insensitive) over a struct map -----
|
|
179
|
+
|
|
180
|
+
headerCI :: Value -> String -> IO Value
|
|
181
|
+
headerCI headers name = do
|
|
182
|
+
ks <- keysof headers
|
|
183
|
+
let ln = lower name
|
|
184
|
+
go [] = pure VNoval
|
|
185
|
+
go (k : rest) = if lower k == ln then getp headers k else go rest
|
|
186
|
+
go ks
|
|
187
|
+
|
|
188
|
+
-- ----- JSON compact encode (for request bodies) -----
|
|
189
|
+
|
|
190
|
+
jsonifyCompact :: Value -> IO String
|
|
191
|
+
jsonifyCompact v = jsonEncode False Nothing v
|
|
192
|
+
|
|
193
|
+
-- ----- pipeline-object constructors (Value maps) -----
|
|
194
|
+
|
|
195
|
+
newControl :: IO Value
|
|
196
|
+
newControl = jo
|
|
197
|
+
[ ("throw", VNoval), ("err", VNoval), ("explain", VNoval)
|
|
198
|
+
, ("actor", VNoval), ("paging", VNoval) ]
|
|
199
|
+
|
|
200
|
+
newOperation :: Value -> IO Operation
|
|
201
|
+
newOperation m = do
|
|
202
|
+
ent <- gstr "entity"; nm <- gstr "name"; inp <- gstr "input"
|
|
203
|
+
ptsV <- getp m "points"
|
|
204
|
+
pts <- case ptsV of VList _ -> filterMaps ptsV; _ -> emptyList
|
|
205
|
+
aliasV <- getp m "alias"
|
|
206
|
+
let alias = case aliasV of VMap _ -> aliasV; _ -> VNoval
|
|
207
|
+
pure (Operation ent nm inp pts alias)
|
|
208
|
+
where
|
|
209
|
+
gstr k = do
|
|
210
|
+
v <- getp m k
|
|
211
|
+
pure (case v of VStr s | s /= "" -> s; _ -> "_")
|
|
212
|
+
filterMaps l = do its <- listItems l; mkList [x | x <- its, ismap x]
|
|
213
|
+
|
|
214
|
+
newSpec :: Value -> IO Value
|
|
215
|
+
newSpec m = do
|
|
216
|
+
parts <- gv "parts" emptyList
|
|
217
|
+
headers <- gv "headers" emptyMap
|
|
218
|
+
alias <- gv "alias" emptyMap
|
|
219
|
+
params <- gv "params" emptyMap
|
|
220
|
+
query <- gv "query" emptyMap
|
|
221
|
+
base <- gs "base"; prefix <- gs "prefix"; suffix <- gs "suffix"; step <- gs "step"
|
|
222
|
+
method <- gsD "method" "GET"; path <- gs "path"; url <- gs "url"
|
|
223
|
+
body <- getp m "body"
|
|
224
|
+
jo [ ("parts", parts), ("headers", headers), ("alias", alias)
|
|
225
|
+
, ("base", VStr base), ("prefix", VStr prefix), ("suffix", VStr suffix)
|
|
226
|
+
, ("params", params), ("query", query), ("step", VStr step)
|
|
227
|
+
, ("method", VStr method), ("body", body), ("url", VStr url), ("path", VStr path) ]
|
|
228
|
+
where
|
|
229
|
+
gs k = do v <- getp m k; pure (case v of VStr s -> s; _ -> "")
|
|
230
|
+
gsD k d = do v <- getp m k; pure (case v of VStr s -> s; _ -> d)
|
|
231
|
+
gv k dfl = do v <- getp m k; case v of VNoval -> dfl; _ -> pure v
|
|
232
|
+
|
|
233
|
+
newResponse :: Value -> IO Value
|
|
234
|
+
newResponse m = do
|
|
235
|
+
sv <- getp m "status"
|
|
236
|
+
let status = case sv of VNum n -> truncate n :: Int; _ -> -1
|
|
237
|
+
st <- getStrD m "statusText" ""
|
|
238
|
+
headers <- getp m "headers"
|
|
239
|
+
jv <- getp m "json"
|
|
240
|
+
let jsn = case jv of VFunc _ -> jv; _ -> VNoval
|
|
241
|
+
body <- getp m "body"
|
|
242
|
+
jo [ ("status", vint status), ("statusText", VStr st), ("headers", headers)
|
|
243
|
+
, ("json", jsn), ("body", body), ("err", VNoval) ]
|
|
244
|
+
|
|
245
|
+
newResult :: Value -> IO Value
|
|
246
|
+
newResult m = do
|
|
247
|
+
okv <- getp m "ok"
|
|
248
|
+
let ok = case okv of VBool True -> True; _ -> False
|
|
249
|
+
sv <- getp m "status"
|
|
250
|
+
let status = case sv of VNum n -> truncate n :: Int; _ -> -1
|
|
251
|
+
st <- getStrD m "statusText" ""
|
|
252
|
+
hv <- getp m "headers"
|
|
253
|
+
headers <- case hv of VMap _ -> pure hv; _ -> emptyMap
|
|
254
|
+
body <- getp m "body"
|
|
255
|
+
resdata <- getp m "resdata"
|
|
256
|
+
rmv <- getp m "resmatch"
|
|
257
|
+
let resmatch = case rmv of VMap _ -> rmv; _ -> VNoval
|
|
258
|
+
jo [ ("ok", VBool ok), ("status", vint status), ("statusText", VStr st)
|
|
259
|
+
, ("headers", headers), ("body", body), ("err", VNoval)
|
|
260
|
+
, ("resdata", resdata), ("resmatch", resmatch), ("paging", VNoval)
|
|
261
|
+
, ("streaming", VBool False), ("stream", VNoval) ]
|
|
262
|
+
|
|
263
|
+
-- Match-map snapshots for explain records / attached error payloads.
|
|
264
|
+
specToValue :: Value -> IO Value
|
|
265
|
+
specToValue = clone
|
|
266
|
+
|
|
267
|
+
resultToValue :: Value -> IO Value
|
|
268
|
+
resultToValue rt = do
|
|
269
|
+
out <- emptyMap
|
|
270
|
+
ok <- getp rt "ok"; setp out "ok" ok
|
|
271
|
+
status <- getp rt "status"; setp out "status" status
|
|
272
|
+
st <- getp rt "statusText"; setp out "statusText" st
|
|
273
|
+
hdr <- getp rt "headers"; setp out "headers" hdr
|
|
274
|
+
body <- getp rt "body"
|
|
275
|
+
case body of VNoval -> pure (); _ -> setp out "body" body
|
|
276
|
+
err <- getp rt "err"
|
|
277
|
+
isE <- isErr err
|
|
278
|
+
if isE then do em <- getp err "message"; emap <- jo [("message", em)]; setp out "err" emap else pure ()
|
|
279
|
+
resdata <- getp rt "resdata"
|
|
280
|
+
case resdata of VNoval -> pure (); _ -> setp out "resdata" resdata
|
|
281
|
+
resmatch <- getp rt "resmatch"
|
|
282
|
+
case resmatch of VNoval -> pure (); _ -> setp out "resmatch" resmatch
|
|
283
|
+
paging <- getp rt "paging"
|
|
284
|
+
case paging of VNoval -> pure (); _ -> setp out "paging" paging
|
|
285
|
+
pure out
|
|
286
|
+
|
|
287
|
+
-- Operation resolution key
|
|
288
|
+
opCacheKey :: String -> String -> String
|
|
289
|
+
opCacheKey ent op = ent ++ ":" ++ op
|
|
290
|
+
|
|
291
|
+
-- Small local string helpers
|
|
292
|
+
substrContains :: String -> String -> Bool
|
|
293
|
+
substrContains hay needle
|
|
294
|
+
| null needle = True
|
|
295
|
+
| otherwise = go hay
|
|
296
|
+
where
|
|
297
|
+
go [] = False
|
|
298
|
+
go s@(_ : rest) = needle `isPrefixOf` s || go rest
|
|
299
|
+
|
|
300
|
+
strReplaceAll :: String -> String -> String -> String
|
|
301
|
+
strReplaceAll s find repl
|
|
302
|
+
| null find = s
|
|
303
|
+
| otherwise = go s
|
|
304
|
+
where
|
|
305
|
+
fl = length find
|
|
306
|
+
go [] = []
|
|
307
|
+
go xs@(c : cs)
|
|
308
|
+
| take fl xs == find = repl ++ go (drop fl xs)
|
|
309
|
+
| otherwise = c : go cs
|
|
310
|
+
|
|
311
|
+
splitOnChar :: Char -> String -> [String]
|
|
312
|
+
splitOnChar c s = case break (== c) s of
|
|
313
|
+
(a, []) -> [a]
|
|
314
|
+
(a, _ : rest) -> a : splitOnChar c rest
|
|
315
|
+
|
|
316
|
+
strip :: String -> String
|
|
317
|
+
strip = f . f where f = reverse . dropWhile (== ' ')
|
|
318
|
+
|
|
319
|
+
-- ----- config literal builder (used by the generated SdkConfig) -----
|
|
320
|
+
|
|
321
|
+
-- | A pure config literal the generator emits; `buildCV` realises it as a
|
|
322
|
+
-- struct 'Value' (the config is JSON-shaped API model data).
|
|
323
|
+
data CV
|
|
324
|
+
= CVNull
|
|
325
|
+
| CVStr String
|
|
326
|
+
| CVNum Double
|
|
327
|
+
| CVBool Bool
|
|
328
|
+
| CVList [CV]
|
|
329
|
+
| CVMap [(String, CV)]
|
|
330
|
+
|
|
331
|
+
buildCV :: CV -> IO Value
|
|
332
|
+
buildCV CVNull = pure VNull
|
|
333
|
+
buildCV (CVStr s) = pure (VStr s)
|
|
334
|
+
buildCV (CVNum n) = pure (VNum n)
|
|
335
|
+
buildCV (CVBool b) = pure (VBool b)
|
|
336
|
+
buildCV (CVList xs) = mapM buildCV xs >>= mkList
|
|
337
|
+
buildCV (CVMap kvs) = mapM (\(k, v) -> (,) k <$> buildCV v) kvs >>= mkMap
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
-- Self-contained JSON reader building struct `Value` nodes directly (no
|
|
2
|
+
-- third-party dependency beyond the `array` boot library). Uses O(1) array
|
|
3
|
+
-- indexing so large corpora parse in linear time.
|
|
4
|
+
--
|
|
5
|
+
-- Lives in src/ rather than test/ because SdkConfig needs it: above a size
|
|
6
|
+
-- threshold the API model is embedded as a JSON string constant and parsed
|
|
7
|
+
-- once at load (sdkgen rung L1) instead of being built as a CV literal. It is
|
|
8
|
+
-- still what the struct corpus runner and the entity-fixture tests use.
|
|
9
|
+
|
|
10
|
+
{-# LANGUAGE LambdaCase #-}
|
|
11
|
+
|
|
12
|
+
module SdkJson (jsonRead) where
|
|
13
|
+
|
|
14
|
+
import Data.Array (Array, listArray, (!))
|
|
15
|
+
import Data.Char (chr)
|
|
16
|
+
import Data.IORef
|
|
17
|
+
import Numeric (readHex)
|
|
18
|
+
|
|
19
|
+
import VoxgigStruct
|
|
20
|
+
|
|
21
|
+
jsonRead :: String -> IO Value
|
|
22
|
+
jsonRead s0 = do
|
|
23
|
+
posRef <- newIORef 0
|
|
24
|
+
let n = length s0
|
|
25
|
+
a = listArray (0, max 0 (n - 1)) s0 :: Array Int Char
|
|
26
|
+
at i = a ! i
|
|
27
|
+
peek = do p <- readIORef posRef; return (if p < n then Just (at p) else Nothing)
|
|
28
|
+
adv = modifyIORef' posRef (+ 1)
|
|
29
|
+
skipWs = do
|
|
30
|
+
p <- readIORef posRef
|
|
31
|
+
if p < n && (at p `elem` " \t\n\r") then adv >> skipWs else return ()
|
|
32
|
+
pval = do
|
|
33
|
+
skipWs
|
|
34
|
+
mc <- peek
|
|
35
|
+
case mc of
|
|
36
|
+
Just '{' -> pobj
|
|
37
|
+
Just '[' -> parr
|
|
38
|
+
Just '"' -> VStr <$> pstr
|
|
39
|
+
Just 't' -> modifyIORef' posRef (+ 4) >> return (VBool True)
|
|
40
|
+
Just 'f' -> modifyIORef' posRef (+ 5) >> return (VBool False)
|
|
41
|
+
Just 'n' -> modifyIORef' posRef (+ 4) >> return VNull
|
|
42
|
+
_ -> pnum
|
|
43
|
+
pobj = do
|
|
44
|
+
adv; skipWs
|
|
45
|
+
mc <- peek
|
|
46
|
+
if mc == Just '}' then adv >> emptyMap
|
|
47
|
+
else do
|
|
48
|
+
m <- emptyMap
|
|
49
|
+
let loop = do
|
|
50
|
+
skipWs
|
|
51
|
+
k <- pstr
|
|
52
|
+
skipWs; adv -- ':'
|
|
53
|
+
v <- pval
|
|
54
|
+
_ <- setprop m (VStr k) v
|
|
55
|
+
skipWs
|
|
56
|
+
c <- peek >>= \case Just ch -> adv >> return ch; Nothing -> return '}'
|
|
57
|
+
if c == ',' then loop else return m
|
|
58
|
+
loop
|
|
59
|
+
parr = do
|
|
60
|
+
adv; skipWs
|
|
61
|
+
mc <- peek
|
|
62
|
+
if mc == Just ']' then adv >> emptyList
|
|
63
|
+
else do
|
|
64
|
+
accRef <- newIORef []
|
|
65
|
+
let loop = do
|
|
66
|
+
v <- pval
|
|
67
|
+
modifyIORef' accRef (v :)
|
|
68
|
+
skipWs
|
|
69
|
+
c <- peek >>= \case Just ch -> adv >> return ch; Nothing -> return ']'
|
|
70
|
+
if c == ',' then loop else do acc <- readIORef accRef; mkList (reverse acc)
|
|
71
|
+
loop
|
|
72
|
+
pstr = do
|
|
73
|
+
adv -- opening quote
|
|
74
|
+
bRef <- newIORef []
|
|
75
|
+
let loop = do
|
|
76
|
+
p <- readIORef posRef
|
|
77
|
+
let c = at p
|
|
78
|
+
adv
|
|
79
|
+
if c == '"' then do b <- readIORef bRef; return (reverse b)
|
|
80
|
+
else if c == '\\' then do
|
|
81
|
+
p2 <- readIORef posRef
|
|
82
|
+
let e = at p2
|
|
83
|
+
adv
|
|
84
|
+
case e of
|
|
85
|
+
'"' -> push '"' >> loop
|
|
86
|
+
'\\' -> push '\\' >> loop
|
|
87
|
+
'/' -> push '/' >> loop
|
|
88
|
+
'n' -> push '\n' >> loop
|
|
89
|
+
't' -> push '\t' >> loop
|
|
90
|
+
'r' -> push '\r' >> loop
|
|
91
|
+
'b' -> push '\b' >> loop
|
|
92
|
+
'f' -> push '\f' >> loop
|
|
93
|
+
'u' -> do
|
|
94
|
+
pp <- readIORef posRef
|
|
95
|
+
let hex = [at (pp + k) | k <- [0 .. 3], pp + k < n]
|
|
96
|
+
modifyIORef' posRef (+ 4)
|
|
97
|
+
case readHex hex of { [(code, _)] -> push (chr code) >> loop; _ -> loop }
|
|
98
|
+
_ -> push e >> loop
|
|
99
|
+
else push c >> loop
|
|
100
|
+
push c = modifyIORef' bRef (c :)
|
|
101
|
+
loop
|
|
102
|
+
pnum = do
|
|
103
|
+
start <- readIORef posRef
|
|
104
|
+
let go = do
|
|
105
|
+
p <- readIORef posRef
|
|
106
|
+
if p < n && (at p `elem` "0123456789-+.eE") then adv >> go else return ()
|
|
107
|
+
go
|
|
108
|
+
end <- readIORef posRef
|
|
109
|
+
let tok = [at j | j <- [start .. end - 1]]
|
|
110
|
+
return (VNum (read tok))
|
|
111
|
+
pval
|