@astrale-os/kernel-dsl 0.2.0-beta.8 → 0.2.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/dist/v1/addressing/class-key.js +5 -4
- package/dist/v1/addressing/method-key.js +3 -2
- package/dist/v1/addressing/patterns.d.ts +0 -5
- package/dist/v1/addressing/patterns.js +5 -5
- package/dist/v1/builder/callable/authoring.d.ts +87 -41
- package/dist/v1/builder/callable/authoring.js +29 -14
- package/dist/v1/builder/class/authoring.d.ts +311 -36
- package/dist/v1/builder/class/authoring.js +3 -4
- package/dist/v1/builder/class/property.d.ts +16 -8
- package/dist/v1/builder/class/property.js +21 -5
- package/dist/v1/builder/core/authoring.d.ts +28 -13
- package/dist/v1/builder/core/authoring.js +22 -2
- package/dist/v1/builder/index.d.ts +9 -8
- package/dist/v1/builder/index.js +2 -2
- package/dist/v1/builder/lowering/callable.d.ts +3 -1
- package/dist/v1/builder/lowering/callable.js +43 -51
- package/dist/v1/builder/lowering/class.d.ts +7 -0
- package/dist/v1/builder/lowering/class.js +79 -29
- package/dist/v1/builder/lowering/core.d.ts +3 -2
- package/dist/v1/builder/lowering/core.js +9 -6
- package/dist/v1/builder/lowering/policy.d.ts +8 -1
- package/dist/v1/builder/lowering/policy.js +35 -0
- package/dist/v1/builder/lowering/schema/capture.js +9 -4
- package/dist/v1/builder/lowering/schema/compile.d.ts +2 -2
- package/dist/v1/builder/lowering/schema/compile.js +15 -2
- package/dist/v1/builder/lowering/schema/context.d.ts +11 -8
- package/dist/v1/builder/lowering/schema/context.js +59 -29
- package/dist/v1/builder/lowering/schema/ownership.d.ts +3 -3
- package/dist/v1/builder/lowering/schema/ownership.js +2 -1
- package/dist/v1/builder/lowering/value/compile.js +14 -4
- package/dist/v1/builder/lowering/value/zod.d.ts +7 -6
- package/dist/v1/builder/lowering/value/zod.js +16 -7
- package/dist/v1/builder/lowering/view.d.ts +4 -3
- package/dist/v1/builder/lowering/view.js +2 -14
- package/dist/v1/builder/policy/authoring.d.ts +23 -6
- package/dist/v1/builder/policy/authoring.js +35 -8
- package/dist/v1/builder/schema/define.d.ts +8 -5
- package/dist/v1/builder/schema/diagnostic.d.ts +1 -1
- package/dist/v1/builder/schema/handle.d.ts +2 -1
- package/dist/v1/builder/schema/input.d.ts +9 -1
- package/dist/v1/builder/schema/projection/callable.d.ts +51 -0
- package/dist/v1/builder/schema/projection/callable.js +1 -0
- package/dist/v1/builder/schema/projection/class.d.ts +89 -0
- package/dist/v1/builder/schema/projection/class.js +1 -0
- package/dist/v1/builder/schema/projection/core-input.d.ts +32 -0
- package/dist/v1/builder/schema/projection/core-input.js +1 -0
- package/dist/v1/builder/schema/projection/domain.d.ts +59 -0
- package/dist/v1/builder/schema/projection/domain.js +1 -0
- package/dist/v1/builder/schema/projection/identity.d.ts +39 -0
- package/dist/v1/builder/schema/projection/identity.js +1 -0
- package/dist/v1/builder/schema/projection/model.d.ts +59 -0
- package/dist/v1/builder/schema/projection/model.js +1 -0
- package/dist/v1/builder/schema/projection/property.d.ts +32 -0
- package/dist/v1/builder/schema/projection/property.js +1 -0
- package/dist/v1/builder/schema/projection/resolved-class.d.ts +76 -0
- package/dist/v1/builder/schema/projection/resolved-class.js +1 -0
- package/dist/v1/builder/schema/projection.d.ts +4 -258
- package/dist/v1/builder/value/full-match.js +6 -3
- package/dist/v1/builder/value/path.d.ts +2 -2
- package/dist/v1/builder/value/path.js +2 -2
- package/dist/v1/builder/view/authoring.d.ts +6 -14
- package/dist/v1/builder/view/authoring.js +13 -5
- package/dist/v1/bundle/structure.d.ts +2 -1
- package/dist/v1/compiled/admission/accept.d.ts +1 -1
- package/dist/v1/compiled/admission/accept.js +11 -814
- package/dist/v1/compiled/admission/closure.d.ts +3 -0
- package/dist/v1/compiled/admission/closure.js +173 -0
- package/dist/v1/compiled/admission/diagnostic.d.ts +7 -0
- package/dist/v1/compiled/admission/diagnostic.js +13 -0
- package/dist/v1/compiled/admission/revision.js +9 -1
- package/dist/v1/compiled/admission/semantics/cardinality.d.ts +5 -0
- package/dist/v1/compiled/admission/semantics/cardinality.js +113 -0
- package/dist/v1/compiled/admission/semantics/class.d.ts +5 -0
- package/dist/v1/compiled/admission/semantics/class.js +125 -0
- package/dist/v1/compiled/admission/semantics/context.d.ts +60 -0
- package/dist/v1/compiled/admission/semantics/context.js +81 -0
- package/dist/v1/compiled/admission/semantics/core.d.ts +35 -0
- package/dist/v1/compiled/admission/semantics/core.js +123 -0
- package/dist/v1/compiled/admission/semantics/edge.d.ts +8 -0
- package/dist/v1/compiled/admission/semantics/edge.js +89 -0
- package/dist/v1/compiled/admission/semantics/policy/admit.d.ts +4 -0
- package/dist/v1/compiled/admission/semantics/policy/admit.js +63 -0
- package/dist/v1/compiled/admission/semantics/policy/callable.d.ts +5 -0
- package/dist/v1/compiled/admission/semantics/policy/callable.js +72 -0
- package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +24 -0
- package/dist/v1/compiled/admission/semantics/policy/contracts.js +45 -0
- package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +8 -0
- package/dist/v1/compiled/admission/semantics/policy/equality.js +27 -0
- package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +9 -0
- package/dist/v1/compiled/admission/semantics/policy/measure.js +81 -0
- package/dist/v1/compiled/admission/semantics/policy/parity.d.ts +4 -0
- package/dist/v1/compiled/admission/semantics/policy/parity.js +139 -0
- package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +8 -0
- package/dist/v1/compiled/admission/semantics/policy/pattern.js +78 -0
- package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +28 -0
- package/dist/v1/compiled/admission/semantics/policy/typing.js +206 -0
- package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +10 -0
- package/dist/v1/compiled/admission/semantics/policy/variants.js +65 -0
- package/dist/v1/compiled/admission/semantics.d.ts +1 -1
- package/dist/v1/compiled/admission/semantics.js +8 -1078
- package/dist/v1/compiled/admission/wire/callable.d.ts +6 -0
- package/dist/v1/compiled/admission/wire/callable.js +90 -0
- package/dist/v1/compiled/admission/wire/class.d.ts +4 -0
- package/dist/v1/compiled/admission/wire/class.js +133 -0
- package/dist/v1/compiled/admission/wire/core.d.ts +5 -0
- package/dist/v1/compiled/admission/wire/core.js +32 -0
- package/dist/v1/compiled/admission/wire/dependency.d.ts +14 -0
- package/dist/v1/compiled/admission/wire/dependency.js +43 -0
- package/dist/v1/compiled/admission/wire/entry.d.ts +5 -0
- package/dist/v1/compiled/admission/wire/entry.js +100 -0
- package/dist/v1/compiled/admission/wire/pattern.d.ts +12 -0
- package/dist/v1/compiled/admission/wire/pattern.js +111 -0
- package/dist/v1/compiled/admission/wire/policy.d.ts +10 -0
- package/dist/v1/compiled/admission/wire/policy.js +189 -0
- package/dist/v1/compiled/admission/wire/program.d.ts +4 -0
- package/dist/v1/compiled/admission/wire/program.js +52 -0
- package/dist/v1/compiled/admission/wire/property.d.ts +4 -0
- package/dist/v1/compiled/admission/wire/property.js +74 -0
- package/dist/v1/compiled/admission/wire/reference.d.ts +8 -0
- package/dist/v1/compiled/admission/wire/reference.js +33 -0
- package/dist/v1/compiled/admission/wire/value.d.ts +29 -0
- package/dist/v1/compiled/admission/wire/value.js +98 -0
- package/dist/v1/compiled/admission/wire/view.d.ts +3 -0
- package/dist/v1/compiled/admission/wire/view.js +17 -0
- package/dist/v1/compiled/compiler/compile.js +43 -11
- package/dist/v1/compiled/generated.d.ts +10 -0
- package/dist/v1/compiled/generated.js +15 -0
- package/dist/v1/compiled/loader/load.d.ts +5 -0
- package/dist/v1/compiled/loader/load.js +18 -4
- package/dist/v1/compiled/model/schema.d.ts +16 -7
- package/dist/v1/domain/create.js +18 -28
- package/dist/v1/domain/model/domain.d.ts +0 -1
- package/dist/v1/domain/model/input.d.ts +3 -0
- package/dist/v1/domain/projection/classes.js +13 -41
- package/dist/v1/domain/validation/create.d.ts +2 -0
- package/dist/v1/domain/validation/create.js +12 -0
- package/dist/v1/index.d.ts +5 -2
- package/dist/v1/index.js +3 -1
- package/dist/v1/language/callable/composition.d.ts +27 -0
- package/dist/v1/language/callable/composition.js +52 -0
- package/dist/v1/language/callable/executable.d.ts +6 -0
- package/dist/v1/language/callable/executable.js +4 -0
- package/dist/v1/language/callable/model/callable.d.ts +34 -9
- package/dist/v1/language/callable/model/callable.js +3 -1
- package/dist/v1/language/callable/resolved.d.ts +23 -8
- package/dist/v1/language/class/facets.d.ts +5 -2
- package/dist/v1/language/class/inheritance.d.ts +12 -0
- package/dist/v1/language/class/inheritance.js +25 -0
- package/dist/v1/language/class/lifetime.d.ts +17 -0
- package/dist/v1/language/class/lifetime.js +26 -0
- package/dist/v1/language/class/model/class.d.ts +8 -4
- package/dist/v1/language/class/model/property.d.ts +4 -2
- package/dist/v1/language/class/property-values.js +5 -2
- package/dist/v1/language/class/resolved.d.ts +25 -15
- package/dist/v1/language/core/model/core.d.ts +7 -1
- package/dist/v1/language/core/resolved.d.ts +6 -2
- package/dist/v1/language/definition/metadata.d.ts +8 -0
- package/dist/v1/language/definition/metadata.js +12 -0
- package/dist/v1/language/index.d.ts +9 -0
- package/dist/v1/language/index.js +6 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +4 -3
- package/dist/v1/language/policy/analysis/branches.js +54 -12
- package/dist/v1/language/policy/analysis/budgets.js +1 -1
- package/dist/v1/language/policy/analysis/checks.d.ts +28 -0
- package/dist/v1/language/policy/analysis/checks.js +80 -0
- package/dist/v1/language/policy/index.d.ts +1 -0
- package/dist/v1/language/policy/index.js +1 -0
- package/dist/v1/language/policy/model/policy.d.ts +71 -5
- package/dist/v1/language/policy/model/policy.js +52 -1
- package/dist/v1/language/policy/normalization/normalize.d.ts +12 -1
- package/dist/v1/language/policy/normalization/normalize.js +178 -44
- package/dist/v1/language/state/index.d.ts +3 -0
- package/dist/v1/language/state/index.js +1 -0
- package/dist/v1/language/state/machine.d.ts +28 -0
- package/dist/v1/language/state/machine.js +40 -0
- package/dist/v1/language/state/topology.d.ts +14 -0
- package/dist/v1/language/state/topology.js +69 -0
- package/dist/v1/language/value/compile/fields.d.ts +1 -1
- package/dist/v1/language/value/compile/load.d.ts +4 -2
- package/dist/v1/language/value/compile/load.js +22 -1
- package/dist/v1/language/value/compile/model.d.ts +16 -1
- package/dist/v1/language/value/evaluate/assertions.d.ts +2 -0
- package/dist/v1/language/value/evaluate/assertions.js +13 -0
- package/dist/v1/language/value/evaluate/evaluator.js +111 -28
- package/dist/v1/language/value/evaluate/preparation.d.ts +10 -1
- package/dist/v1/language/value/evaluate/preparation.js +17 -26
- package/dist/v1/language/value/evaluate/program.js +1 -1
- package/dist/v1/language/value/evaluate/validate.d.ts +6 -2
- package/dist/v1/language/value/evaluate/validate.js +18 -11
- package/dist/v1/language/value/inclusion/includes.d.ts +9 -0
- package/dist/v1/language/value/inclusion/includes.js +777 -0
- package/dist/v1/language/value/model/blob.d.ts +31 -0
- package/dist/v1/language/value/model/blob.js +90 -0
- package/dist/v1/language/value/model/instant.d.ts +0 -2
- package/dist/v1/language/value/model/instant.js +1 -1
- package/dist/v1/language/value/model/schema.d.ts +2 -1
- package/dist/v1/language/value/model/schema.js +1 -5
- package/dist/v1/language/value/ordering.d.ts +2 -0
- package/dist/v1/language/value/ordering.js +4 -8
- package/dist/v1/language/value/profile/json.validate.js +1 -1
- package/dist/v1/language/value/profile/rules.js +48 -12
- package/dist/v1/language/value/reference/registry.d.ts +2 -1
- package/dist/v1/language/value/regexp/ast.js +3 -64
- package/dist/v1/language/value/regexp/compile.d.ts +32 -3
- package/dist/v1/language/value/regexp/compile.js +117 -21
- package/dist/v1/language/value/regexp/matcher.d.ts +6 -3
- package/dist/v1/language/value/regexp/matcher.js +185 -28
- package/dist/v1/language/value/regexp/syntax.d.ts +12 -1
- package/dist/v1/language/value/regexp/syntax.js +14 -2
- package/dist/v1/language/value/regexp/unicode.d.ts +32 -0
- package/dist/v1/language/value/regexp/unicode.js +139 -0
- package/dist/v1/language/value/syntax/full-match.js +8 -5
- package/dist/v1/language/value/syntax/node-path/validate.js +4 -6
- package/dist/v1/language/view/model/view.d.ts +2 -4
- package/dist/v1/language/view/resolved.d.ts +2 -2
- package/dist/v1/schema/analysis/class.d.ts +36 -6
- package/dist/v1/schema/analysis/class.js +31 -66
- package/dist/v1/schema/canonical/revision.d.ts +2 -1
- package/dist/v1/schema/canonical/revision.js +4 -1
- package/dist/v1/schema/compatibility/api.d.ts +3 -0
- package/dist/v1/schema/compatibility/api.js +2 -0
- package/dist/v1/schema/compatibility/comparators/callables.d.ts +39 -0
- package/dist/v1/schema/compatibility/comparators/callables.js +101 -0
- package/dist/v1/schema/compatibility/comparators/classes.d.ts +47 -0
- package/dist/v1/schema/compatibility/comparators/classes.js +160 -0
- package/dist/v1/schema/compatibility/comparators/index.d.ts +12 -0
- package/dist/v1/schema/compatibility/comparators/index.js +53 -0
- package/dist/v1/schema/compatibility/comparators/members.d.ts +4 -0
- package/dist/v1/schema/compatibility/comparators/members.js +49 -0
- package/dist/v1/schema/compatibility/comparators/values.d.ts +5 -0
- package/dist/v1/schema/compatibility/comparators/values.js +37 -0
- package/dist/v1/schema/compatibility/compare.d.ts +5 -0
- package/dist/v1/schema/compatibility/compare.js +23 -0
- package/dist/v1/schema/compatibility/context.d.ts +19 -0
- package/dist/v1/schema/compatibility/context.js +49 -0
- package/dist/v1/schema/compatibility/coordinate.d.ts +40 -0
- package/dist/v1/schema/compatibility/coordinate.js +38 -0
- package/dist/v1/schema/compatibility/diff.d.ts +12 -0
- package/dist/v1/schema/compatibility/diff.js +39 -0
- package/dist/v1/schema/compatibility/evidence.d.ts +16 -0
- package/dist/v1/schema/compatibility/evidence.js +62 -0
- package/dist/v1/schema/compatibility/fields.d.ts +194 -0
- package/dist/v1/schema/compatibility/fields.js +94 -0
- package/dist/v1/schema/compatibility/index.d.ts +6 -0
- package/dist/v1/schema/compatibility/index.js +3 -0
- package/dist/v1/schema/compatibility/meaning/footprint.d.ts +7 -0
- package/dist/v1/schema/compatibility/meaning/footprint.js +59 -0
- package/dist/v1/schema/compatibility/meaning/index.d.ts +3 -0
- package/dist/v1/schema/compatibility/meaning/index.js +16 -0
- package/dist/v1/schema/compatibility/model.d.ts +131 -0
- package/dist/v1/schema/compatibility/model.js +1 -0
- package/dist/v1/schema/compatibility/references.d.ts +38 -0
- package/dist/v1/schema/compatibility/references.js +149 -0
- package/dist/v1/schema/compatibility/report.d.ts +27 -0
- package/dist/v1/schema/compatibility/report.js +100 -0
- package/dist/v1/schema/compatibility/scope.d.ts +36 -0
- package/dist/v1/schema/compatibility/scope.js +110 -0
- package/dist/v1/schema/compatibility/structure/index.d.ts +3 -0
- package/dist/v1/schema/compatibility/structure/index.js +40 -0
- package/dist/v1/schema/compatibility/structure/inheritance.d.ts +7 -0
- package/dist/v1/schema/compatibility/structure/inheritance.js +68 -0
- package/dist/v1/schema/compatibility/structure/requirements.d.ts +7 -0
- package/dist/v1/schema/compatibility/structure/requirements.js +97 -0
- package/dist/v1/schema/compatibility/subjects.d.ts +39 -0
- package/dist/v1/schema/compatibility/subjects.js +143 -0
- package/dist/v1/schema/compatibility/versioning/index.d.ts +8 -0
- package/dist/v1/schema/compatibility/versioning/index.js +50 -0
- package/dist/v1/schema/compatibility/versioning/members.d.ts +12 -0
- package/dist/v1/schema/compatibility/versioning/members.js +47 -0
- package/dist/v1/schema/compatibility/versioning/surface.d.ts +11 -0
- package/dist/v1/schema/compatibility/versioning/surface.js +61 -0
- package/dist/v1/schema/diagnostic.d.ts +1 -1
- package/dist/v1/schema/fingerprint.d.ts +2 -0
- package/dist/v1/schema/fingerprint.js +1 -0
- package/dist/v1/schema/index.d.ts +4 -3
- package/dist/v1/schema/index.js +2 -1
- package/dist/v1/schema/model/schema.d.ts +8 -11
- package/dist/v1/schema/normalization/domain.js +57 -13
- package/dist/v1/schema/resolution/definition.index.d.ts +1 -2
- package/dist/v1/schema/resolution/definition.index.js +0 -3
- package/dist/v1/schema/resolution/domain.d.ts +4 -1
- package/dist/v1/schema/resolution/domain.js +26 -18
- package/dist/v1/schema/resolution/origins.d.ts +28 -5
- package/dist/v1/schema/resolution/origins.js +68 -31
- package/dist/v1/schema/validation/callable.d.ts +4 -0
- package/dist/v1/schema/validation/callable.js +39 -0
- package/dist/v1/schema/validation/class.d.ts +10 -0
- package/dist/v1/schema/validation/class.js +79 -60
- package/dist/v1/schema/validation/core.js +83 -55
- package/dist/v1/schema/validation/domain.d.ts +2 -1
- package/dist/v1/schema/validation/domain.js +2 -0
- package/dist/v1/schema/validation/domain.structure.d.ts +0 -2
- package/dist/v1/schema/validation/domain.structure.js +214 -171
- package/dist/v1/schema/validation/policy/budgets.js +36 -6
- package/dist/v1/schema/validation/policy/context.js +5 -16
- package/dist/v1/schema/validation/policy/objects.d.ts +4 -0
- package/dist/v1/schema/validation/policy/objects.js +71 -0
- package/dist/v1/schema/validation/policy/references.js +16 -4
- package/dist/v1/schema/validation/policy/typing.d.ts +2 -0
- package/dist/v1/schema/validation/policy/typing.js +55 -7
- package/dist/v1/schema/validation/policy/uses.js +73 -99
- package/dist/v1/schema/validation/value-api.d.ts +2 -0
- package/dist/v1/schema/validation/value-api.js +1 -0
- package/dist/v1/schema/validation/value.js +7 -1
- package/dist/v1/schema/validation/view.js +14 -9
- package/dist/value/accept.d.ts +9 -0
- package/dist/value/accept.js +106 -7
- package/dist/value/canonical.d.ts +3 -0
- package/dist/value/canonical.js +22 -6
- package/dist/value/immutable.optimization.d.ts +15 -0
- package/dist/value/immutable.optimization.js +34 -0
- package/dist/value/index.d.ts +1 -1
- package/dist/value/index.js +1 -1
- package/dist/value/json.d.ts +1 -1
- package/dist/value/json.js +1 -1
- package/dist/value/limits.d.ts +1 -1
- package/dist/value/unicode.d.ts +4 -1
- package/dist/value/unicode.js +28 -0
- package/package.json +20 -5
- package/dist/v1/schema/compatibility/meaning.d.ts +0 -29
- package/dist/v1/schema/compatibility/meaning.js +0 -605
|
@@ -1,50 +1,207 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Load the portable counted-run or Thompson NFA executor for search and whole-string matching.
|
|
3
|
+
* Scratch belongs to one invocation: no match-result cache, shared mutable cursor or DFA expansion.
|
|
4
|
+
*/
|
|
2
5
|
export function loadPattern(pattern) {
|
|
3
|
-
|
|
6
|
+
if ('runs' in pattern)
|
|
7
|
+
return loadRuns(pattern);
|
|
8
|
+
const states = pattern.states;
|
|
9
|
+
const start = initialFrontier(pattern);
|
|
4
10
|
const run = (input, search) => {
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
if (input.length === 0)
|
|
12
|
+
return start.accepting;
|
|
13
|
+
if (search && start.accepting)
|
|
7
14
|
return true;
|
|
15
|
+
const resolve = executionStates(states);
|
|
16
|
+
// Initial frontier entries consume characters, so none can be a dead conduit cycle.
|
|
17
|
+
const initial = start.frontier.map((index) => resolve(index));
|
|
18
|
+
let active = [...initial];
|
|
19
|
+
let next = [];
|
|
20
|
+
const pending = [];
|
|
21
|
+
let activeCount = start.frontier.length;
|
|
22
|
+
let nextCount = 0;
|
|
23
|
+
let epoch = 0;
|
|
24
|
+
let accepting = false;
|
|
25
|
+
function add(destination) {
|
|
26
|
+
const seed = resolve(destination);
|
|
27
|
+
if (seed === null || seed.epoch === epoch)
|
|
28
|
+
return;
|
|
29
|
+
let count = 1;
|
|
30
|
+
pending[0] = seed;
|
|
31
|
+
seed.epoch = epoch;
|
|
32
|
+
while (count > 0) {
|
|
33
|
+
const entry = pending[--count];
|
|
34
|
+
const state = entry.state;
|
|
35
|
+
if (state.accepting === true)
|
|
36
|
+
accepting = true;
|
|
37
|
+
if (state.transitions.length > 0)
|
|
38
|
+
next[nextCount++] = entry;
|
|
39
|
+
for (const destination of state.epsilon) {
|
|
40
|
+
const target = resolve(destination);
|
|
41
|
+
if (target === null || target.epoch === epoch)
|
|
42
|
+
continue;
|
|
43
|
+
target.epoch = epoch;
|
|
44
|
+
pending[count++] = target;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
8
48
|
for (const character of input) {
|
|
49
|
+
if (!search && activeCount === 0)
|
|
50
|
+
return false;
|
|
51
|
+
epoch++;
|
|
52
|
+
nextCount = 0;
|
|
53
|
+
accepting = false;
|
|
9
54
|
const scalar = character.codePointAt(0);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
55
|
+
for (let index = 0; index < activeCount; index++) {
|
|
56
|
+
for (const transition of active[index].state.transitions) {
|
|
57
|
+
for (const range of transition.ranges) {
|
|
58
|
+
if (scalar < range[0] || scalar > range[1])
|
|
59
|
+
continue;
|
|
60
|
+
add(transition.to);
|
|
61
|
+
break;
|
|
15
62
|
}
|
|
16
63
|
}
|
|
17
64
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
65
|
+
if (search) {
|
|
66
|
+
if (accepting)
|
|
67
|
+
return true;
|
|
68
|
+
// The complete initial epsilon closure is already known; do not traverse it again.
|
|
69
|
+
for (const entry of initial) {
|
|
70
|
+
if (entry.epoch === epoch)
|
|
71
|
+
continue;
|
|
72
|
+
entry.epoch = epoch;
|
|
73
|
+
next[nextCount++] = entry;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const previous = active;
|
|
77
|
+
active = next;
|
|
78
|
+
next = previous;
|
|
79
|
+
activeCount = nextCount;
|
|
80
|
+
}
|
|
81
|
+
return accepting;
|
|
82
|
+
};
|
|
83
|
+
return Object.freeze({
|
|
84
|
+
test: (input) => run(input, true),
|
|
85
|
+
matches: (input) => run(input, false),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function loadRuns(pattern) {
|
|
89
|
+
const runs = pattern.runs;
|
|
90
|
+
const run = (input, search) => {
|
|
91
|
+
if (search && runs.length === 1) {
|
|
92
|
+
const scalarRun = runs[0];
|
|
93
|
+
if (scalarRun.minimum === 0)
|
|
23
94
|
return true;
|
|
95
|
+
let count = 0;
|
|
96
|
+
for (const character of input) {
|
|
97
|
+
count = includesScalar(scalarRun.ranges, character.codePointAt(0)) ? count + 1 : 0;
|
|
98
|
+
if (count >= scalarRun.minimum)
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
24
102
|
}
|
|
25
|
-
|
|
103
|
+
let start = 0;
|
|
104
|
+
do {
|
|
105
|
+
let offset = start;
|
|
106
|
+
let accepted = true;
|
|
107
|
+
for (let index = 0; index < runs.length; index++) {
|
|
108
|
+
const scalarRun = runs[index];
|
|
109
|
+
const maximum = search && index === runs.length - 1 ? scalarRun.minimum : (scalarRun.maximum ?? Infinity);
|
|
110
|
+
let count = 0;
|
|
111
|
+
while (count < maximum && offset < input.length) {
|
|
112
|
+
const scalar = input.codePointAt(offset);
|
|
113
|
+
if (!includesScalar(scalarRun.ranges, scalar))
|
|
114
|
+
break;
|
|
115
|
+
offset += scalar > 0xffff ? 2 : 1;
|
|
116
|
+
count++;
|
|
117
|
+
}
|
|
118
|
+
if (count < scalarRun.minimum) {
|
|
119
|
+
accepted = false;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (accepted && (search || offset === input.length))
|
|
124
|
+
return true;
|
|
125
|
+
if (!search || start === input.length)
|
|
126
|
+
return false;
|
|
127
|
+
start += input.codePointAt(start) > 0xffff ? 2 : 1;
|
|
128
|
+
} while (start <= input.length);
|
|
129
|
+
return false;
|
|
26
130
|
};
|
|
27
131
|
return Object.freeze({
|
|
28
132
|
test: (input) => run(input, true),
|
|
29
133
|
matches: (input) => run(input, false),
|
|
30
134
|
});
|
|
31
135
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
136
|
+
function includesScalar(ranges, scalar) {
|
|
137
|
+
if (ranges.length < 8) {
|
|
138
|
+
for (const range of ranges) {
|
|
139
|
+
if (scalar >= range[0] && scalar <= range[1])
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
let low = 0;
|
|
145
|
+
let high = ranges.length - 1;
|
|
146
|
+
while (low <= high) {
|
|
147
|
+
const middle = (low + high) >>> 1;
|
|
148
|
+
const range = ranges[middle];
|
|
149
|
+
if (scalar < range[0])
|
|
150
|
+
high = middle - 1;
|
|
151
|
+
else if (scalar > range[1])
|
|
152
|
+
low = middle + 1;
|
|
153
|
+
else
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
function initialFrontier(pattern) {
|
|
159
|
+
const start = pattern.start;
|
|
160
|
+
const seen = new Set([start]);
|
|
161
|
+
const pending = [start];
|
|
162
|
+
const frontier = [];
|
|
163
|
+
let accepting = false;
|
|
35
164
|
while (pending.length > 0) {
|
|
36
|
-
|
|
37
|
-
|
|
165
|
+
const index = pending.pop();
|
|
166
|
+
const state = pattern.states[index];
|
|
167
|
+
if (state.accepting === true)
|
|
168
|
+
accepting = true;
|
|
169
|
+
if (state.transitions.length > 0)
|
|
170
|
+
frontier.push(index);
|
|
171
|
+
for (const target of state.epsilon) {
|
|
172
|
+
if (seen.has(target))
|
|
38
173
|
continue;
|
|
39
|
-
|
|
40
|
-
pending.push(
|
|
174
|
+
seen.add(target);
|
|
175
|
+
pending.push(target);
|
|
41
176
|
}
|
|
42
177
|
}
|
|
43
|
-
return
|
|
178
|
+
return { frontier: Object.freeze(frontier), accepting };
|
|
44
179
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
180
|
+
/** Resolve only visited conduits, once within this invocation; never retain cross-call state. */
|
|
181
|
+
function executionStates(states) {
|
|
182
|
+
const destinations = new Map();
|
|
183
|
+
return (index) => {
|
|
184
|
+
const known = destinations.get(index);
|
|
185
|
+
if (known !== undefined)
|
|
186
|
+
return known;
|
|
187
|
+
const path = [];
|
|
188
|
+
let current = index;
|
|
189
|
+
let destination = destinations.get(current);
|
|
190
|
+
while (destination === undefined) {
|
|
191
|
+
const state = states[current];
|
|
192
|
+
if (state.accepting === true || state.transitions.length > 0 || state.epsilon.length !== 1) {
|
|
193
|
+
destination = { state, epoch: 0 };
|
|
194
|
+
destinations.set(current, destination);
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
// A revisit before resolving the path is a dead, epsilon-only cycle.
|
|
198
|
+
destinations.set(current, null);
|
|
199
|
+
path.push(current);
|
|
200
|
+
current = state.epsilon[0];
|
|
201
|
+
destination = destinations.get(current);
|
|
202
|
+
}
|
|
203
|
+
for (const member of path)
|
|
204
|
+
destinations.set(member, destination);
|
|
205
|
+
return destination;
|
|
206
|
+
};
|
|
50
207
|
}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Why a source is not an admitted I-Regexp: `syntax` when it is outside the RFC 9485 grammar or the
|
|
3
|
+
* parser's bounds on length, nesting and counts; `states` when its machine would exceed the state
|
|
4
|
+
* budget.
|
|
5
|
+
*/
|
|
6
|
+
type IRegexpRefusal = 'syntax' | 'states';
|
|
7
|
+
/** The refusal of one source, through the same AST and state count as compilation. */
|
|
8
|
+
export declare function refuseIRegexp(source: string): IRegexpRefusal | undefined;
|
|
9
|
+
/** Complete RFC 9485 syntax admission, within the implementation limits RFC 9485 §8 allows. */
|
|
2
10
|
export declare function isIRegexp(source: string): boolean;
|
|
11
|
+
/** The authoring explanation of a `states` refusal of `subject` (`pattern`, `fullMatch`, ...). */
|
|
12
|
+
export declare function stateBudgetMessage(subject: string): string;
|
|
13
|
+
export {};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { parseIRegexp } from './ast.js';
|
|
2
|
-
|
|
2
|
+
import { MAX_STATES, withinStateBudget } from './compile.js';
|
|
3
|
+
/** The refusal of one source, through the same AST and state count as compilation. */
|
|
4
|
+
export function refuseIRegexp(source) {
|
|
5
|
+
const expression = parseIRegexp(source);
|
|
6
|
+
if (expression === undefined)
|
|
7
|
+
return 'syntax';
|
|
8
|
+
return withinStateBudget(expression) ? undefined : 'states';
|
|
9
|
+
}
|
|
10
|
+
/** Complete RFC 9485 syntax admission, within the implementation limits RFC 9485 §8 allows. */
|
|
3
11
|
export function isIRegexp(source) {
|
|
4
|
-
return
|
|
12
|
+
return refuseIRegexp(source) === undefined;
|
|
13
|
+
}
|
|
14
|
+
/** The authoring explanation of a `states` refusal of `subject` (`pattern`, `fullMatch`, ...). */
|
|
15
|
+
export function stateBudgetMessage(subject) {
|
|
16
|
+
return `${subject} expands its counted repetitions into more than ${MAX_STATES} states, the I-Regexp implementation limit (RFC 9485 §8); nest fewer or smaller counts.`;
|
|
5
17
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unicode scalar sets for the I-Regexp compiler: the scalar space, unions and complements of ordered
|
|
3
|
+
* ranges, and the General_Category table that `\p{..}` and `\P{..}` denote.
|
|
4
|
+
*
|
|
5
|
+
* The table is pinned to Unicode 17.0, the version of the Node runtime the Kernel pins (26.7.0 in
|
|
6
|
+
* `.nvmrc`, ICU 78.3), so a category denotes the same scalars on every host whatever Unicode data
|
|
7
|
+
* its own `RegExp` engine carries (Node, Bun/JavaScriptCore, workerd). It was generated under that
|
|
8
|
+
* Node by testing every scalar against `new RegExp('^\\p{<name>}$', 'u')` and keeping the maximal
|
|
9
|
+
* runs. `__tests__/categories.test.ts` holds that generation: on a host whose
|
|
10
|
+
* `process.versions.unicode` is {@link UNICODE_VERSION} it requires this table to equal the encoding
|
|
11
|
+
* of the host's runs, and a deliberate Unicode upgrade replaces the table with the value that test
|
|
12
|
+
* then expects.
|
|
13
|
+
*
|
|
14
|
+
* Only the 28 assigned two-letter categories that RFC 9485 `IsCategory` can name are stored. A major
|
|
15
|
+
* category is the union of its subcategories, `Cn` holds every scalar that no stored category holds,
|
|
16
|
+
* and `Cs` (the surrogates) holds no scalar. An entry lists its runs in scalar order, each as two
|
|
17
|
+
* base-32 numbers: the gap from the end of the previous run (from U+0000 for the first), then the run
|
|
18
|
+
* length minus one. A number is written most significant digit first, and every digit but its last
|
|
19
|
+
* is taken from the upper half of `DIGITS`. A category is decoded on its first use only.
|
|
20
|
+
*/
|
|
21
|
+
import type { ScalarRange } from './ast.js';
|
|
22
|
+
/** The Unicode version whose General_Category values the table below records. */
|
|
23
|
+
export declare const UNICODE_VERSION = "17.0";
|
|
24
|
+
export declare const SCALAR_RANGES: readonly ScalarRange[];
|
|
25
|
+
/** The encoded runs of each stored General_Category, generated under Unicode 17.0. */
|
|
26
|
+
export declare const GENERAL_CATEGORIES: Readonly<Record<string, string>>;
|
|
27
|
+
/** The maximal runs of the scalars in one General_Category that the I-Regexp grammar admits. */
|
|
28
|
+
export declare function categoryRanges(category: string): readonly ScalarRange[];
|
|
29
|
+
/** Sorted, disjoint and non-adjacent runs covering exactly the scalars of `input`. */
|
|
30
|
+
export declare function mergeRanges(input: readonly ScalarRange[]): readonly ScalarRange[];
|
|
31
|
+
/** The runs of the scalars, surrogates excluded, outside the sorted, disjoint runs of `input`. */
|
|
32
|
+
export declare function complement(input: readonly ScalarRange[]): readonly ScalarRange[];
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unicode scalar sets for the I-Regexp compiler: the scalar space, unions and complements of ordered
|
|
3
|
+
* ranges, and the General_Category table that `\p{..}` and `\P{..}` denote.
|
|
4
|
+
*
|
|
5
|
+
* The table is pinned to Unicode 17.0, the version of the Node runtime the Kernel pins (26.7.0 in
|
|
6
|
+
* `.nvmrc`, ICU 78.3), so a category denotes the same scalars on every host whatever Unicode data
|
|
7
|
+
* its own `RegExp` engine carries (Node, Bun/JavaScriptCore, workerd). It was generated under that
|
|
8
|
+
* Node by testing every scalar against `new RegExp('^\\p{<name>}$', 'u')` and keeping the maximal
|
|
9
|
+
* runs. `__tests__/categories.test.ts` holds that generation: on a host whose
|
|
10
|
+
* `process.versions.unicode` is {@link UNICODE_VERSION} it requires this table to equal the encoding
|
|
11
|
+
* of the host's runs, and a deliberate Unicode upgrade replaces the table with the value that test
|
|
12
|
+
* then expects.
|
|
13
|
+
*
|
|
14
|
+
* Only the 28 assigned two-letter categories that RFC 9485 `IsCategory` can name are stored. A major
|
|
15
|
+
* category is the union of its subcategories, `Cn` holds every scalar that no stored category holds,
|
|
16
|
+
* and `Cs` (the surrogates) holds no scalar. An entry lists its runs in scalar order, each as two
|
|
17
|
+
* base-32 numbers: the gap from the end of the previous run (from U+0000 for the first), then the run
|
|
18
|
+
* length minus one. A number is written most significant digit first, and every digit but its last
|
|
19
|
+
* is taken from the upper half of `DIGITS`. A category is decoded on its first use only.
|
|
20
|
+
*/
|
|
21
|
+
/** The Unicode version whose General_Category values the table below records. */
|
|
22
|
+
export const UNICODE_VERSION = '17.0';
|
|
23
|
+
export const SCALAR_RANGES = [
|
|
24
|
+
[0, 0xd7ff],
|
|
25
|
+
[0xe000, 0x10ffff],
|
|
26
|
+
];
|
|
27
|
+
const DIGITS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
28
|
+
/** The encoded runs of each stored General_Category, generated under Unicode 17.0. */
|
|
29
|
+
export const GENERAL_CATEGORIES = {
|
|
30
|
+
Cc: 'AfifhA',
|
|
31
|
+
Cf: 'lNAhqSFWAmAAhRAsABiQAj5LAh/cEaEhREBJh30PAnZCkmBAPAo7CPhijADlmPH4r0GAeif',
|
|
32
|
+
Co: 'h4gAmnf8h4Ah//dCh//d',
|
|
33
|
+
Ll: 'jBZhaAhJXBHBABABABABABABABABABABABABABABABABABABABABABABABABABABABBBABABABABABABABBBABABABABABABABABABABABABABABABABABABABABABABACABABCCABACADBEACADCCACABABACABBBACADABACBCCGACACABABABABABABABABBBABABABABABABABABBCABADABABABABABABABABABABABABABABABABABABABABABABABABABABABABABGCACBBAEABABABABiECZmBABADADCSAbhCBBDCBABABABABABABABABABABABEBACACBhThPBABABABABABABABABABABABABABABABABAJABABABABABABABABABABABABABABABABABABABABABABABABABABACABABABABABABBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAhQhIi6HhKCC3YFikCIBAjVhLhfMBhBjGABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABIBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABIIFKHIHIFKHIHINCHIHIHIEBBGADCBBIDCBIHKCBBoSADBDAbAEAEACBIDEAhVAi1LhPBADBBABABAEABBBFFABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBHABAEAMhFBAFA+oTABABABABABABABABABABABABABABABABABABABABABABATABABABABABABABABABABABABABAkHABABABABABABCBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABHBABACABABABABAEABACABCBABABABABABABABABABAFAFABABABABABABABAEABACABABABABABABABAaADA5VhKFIHiPz6AGMEhhJZhmNhHkIhDkbKBOBGBBh4DhSjdVi5af1sAfhbY5qGZaGBRaZaDBABGBKaZaZaZaZaZaZaZaZabcYBFaYBFaYBFaYBFaYBFBAh5UJBTGFivXhB',
|
|
34
|
+
Lm: '1QRELOEHABAkFAFAueAnGAlEBoNBEAfAJADAlAAlHAhmUAjfAxVAh2aAjLAzDAuQFlOheNAhChE1RANAQMi+fBnRAlfAuVAhLEFAjBBidC74WAhnCFoOAjSAcBjZIiQAXAjIDDBuVAWAkJAjMAVBjHDJA1gGAhNBh/AFBhJBIhsTAhAAqVAj4TAzrGDvcChIBxGMiABBAOBv/cDBGBBshRhdmJG9NAwTAyLA',
|
|
35
|
+
Lo: 'lKAPAoAAEDmQB5aaEDhNfBJhDBBjCBAYBKCCAQABddiYLAYhAVVhKYHKFXBGQhIhbhVDASAHJQOEHCBCVBGBADDDAQANBBCOBKAIFEBCVBGBBBBBBfDBATCQIBCBVBGBBBEDASAPBXALHCBCVBGBBBEDAeBBCPARABFDCBDDBBABBDBDCDLWAhUHBCBWBPDAaCBBCBeAEHBCBWBJBEDAeCBBPBRIBCBhICAQAFCICYFF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nsVHIHIHMAPAhPA',
|
|
37
|
+
Lu: 'iBZjFWBGhBABABABABABABABABABABABABABABABABABABABABABABABABABABABACABABABABABABABACABABABABABABABABABABABABABABABABABABABABABABABBBABADBBABBBCCDBBBCDBBBBABABBBACABBBCBABBDAHACACACABABABABABABABACABABABABABABABABACACABCBABABABABABABABABABABABABABABABABABABABABABABABABABABABABAHBBBCABDBABABABApBABADAIAGABCBABBBQBIhDACCDABABABABABABABABABABABAFACABBChShQABABABABABABABABABABABABABABABABAJABABABABABABABABABABABABABABABABABABABABABABABABABABABBBABABABABABACABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAChFi6JhFBAFA2SiVikTAGhKCCqAABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAJABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAJHIFKHIHIFLABABABAIHiIDMDMDMELDoGAEADCCCCADEGABABABDCDKBFAhdAizchPhQABCCABABABDBACAICBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAIABAEA+qNABABABABABABABABABABABABABABABABABABABABABABATABABABABABABABABABABABABABAkHABABABABABABADABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAKABABBBABABABAEABACABADABABABABABABABABABABEBEBABABABABABABABDBABBBABABABABABABABAYA15LZhmFhHkIhDkcKBOBGBBh3KhSkdVi5af1sAfiAY5qHZaZaZaABBCACBCDBHaZaBBDCHBGbBBDBEBADGbZaZaZaZaZaZeYhBYhBYhBYhBYhBAkpVhB',
|
|
38
|
+
Mc: 'ioDAhXACCIDBBhSBhaCGBCBKAhLAhaCiCAhaCIABBhVBhaABAGBCBKAjGBBBDCBCKAhJChdDhdBhaABECBBBJBcAOBhaCFCBCKAhKBiLCGHSBqKBhfAlLBEAGACBZBKCCGVBCFCAKChzYAeAkBAHHBBqaDCCE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CABABBKBDBbAiEAFAOBHA1eAIAuSFhJAhWACACAhMBUBBBNABCiKDjGAhLNnJChWOfAoFBKAkMAjYAjZAsGAMArPAiaAKBlIOBAjQAiKEEBjPFlLAzEI4FAjcCiHBkdCBChFFBDpZBmYBkAGBFlABKGcCjcDhbEheBiAHLA6CBIHIICDCCDKBABJjkaDBBjQAkPBECCACIBBBACBKEBJCDBABMCCtMChZAldA9gCBoNCjDAKAjTFrcDiWBhICBAhRBhPAjBMQBjcDjeBQBnZA0xEGCAWAUBCDDCBDHCGABBkVCBCCABABBKBDBbAhEACBsaC0cAhQAseA3HAmHAfAoQIhGAjQGiCGiZD5TAkEEhMDldGjNBBDjeDhQBiPDEANABCiYFjLApKBBBjSEKBBAjIAnaWjJCcMiMAkCCncAoICkbAicHiTCBEidJmXAifEhKB0FBiKMlPAhjQEi7cBuzbBkFAiBEIAxICpHDqHAzlcAnvHEi7TA6eB',
|
|
50
|
+
Ps: 'hIAhSAfAj1eABAh6eAireADAhGAhXAPAzaABAeAhheABABABABABABAiQAhAABABABABAsUABABABABABABABABABABAiAABAhBAhhFABABABAZASABABABAtMABABABABADABABABACAhzpBAmXAdABABABABABABABADARABABAlKAhSAfADACA',
|
|
51
|
+
Sc: 'hEAjdDhnJAjbAvSBvSBHAnVAoHAyFAisbAimEhBhh7WA1uDAjMAkaAmbBDBn/WDhw4eAitQA',
|
|
52
|
+
Sk: 'ieABAiHAGAEADAwJDMNFGBABQjVAOBhoCAl5UABCLCNCNCNBkkcB9zDWJBjHB+QAOB0iGQ7bABAlCAh9gXE',
|
|
53
|
+
Sm: 'hLAQChdABAhNAEAhFAfA3eAwPCmxbANAhHCNCkLAhHEGAiEEFBEACACAHAfBCABAfoLhABiaAeYhIFuVAJAhWHjPAqQECeKPoAkCWheEfCoBhQUCFhz+cA5YABClEAQChdABAkDAGDjtBBhwrAAh+QAZAfAZAfAZAfAZAfAZAl5MBiueI',
|
|
54
|
+
So: 'lGACAEABA+RAoKBjfBmOAKATBnXAwDArVAkCFBAkEAmPAhJAsHCPABCCFUABABAkFHBFBBFDmFB3QJ2TA2SAkdhBrBJJIhsDBBDBBKABBGFBABABAEALBOABBBAhaBJECDBBBBBGBeCBBABeoMHETCGCiQBdZhHGiHWKiRiNWlWBIBhVIjOBnXhMhLiAnfwAhPVBGhGCkJnFFrFBhOZBiYMmVaPEANBMAVBGBqQBEJhAhFJAQeLdIAPfKhGPpfmuAhf10QhW7BDKBBAxdC0qJPrNPiABhWHhNCvEADAEBNBpZIhZQCCBMDAhPhMhzaByPAhgIHijGAikVHEQy6KDFA0qWAj7DnPKCDtTGWPPjAjThcnVKhGChbFCWBHdEhcViBDAlaiWhlJvfhXDhSHBNBBh2IAi6cAkBA2RhLEjDMOCOBOBhEXlAhYcNhLEIHBOFkanaF2YDQDMDmZGLEAPLEhXIJGhHIdCLEBheqXINCMDKDhYBAEPCLEJHkSBibKA',
|
|
55
|
+
Zl: 'ohIA',
|
|
56
|
+
Zp: 'ohJA',
|
|
57
|
+
Zs: 'hAAjfAlufAirfKhEAhPAj9AA',
|
|
58
|
+
};
|
|
59
|
+
const MAJOR_CATEGORIES = {
|
|
60
|
+
C: ['Cc', 'Cf', 'Cn', 'Co'],
|
|
61
|
+
L: ['Ll', 'Lm', 'Lo', 'Lt', 'Lu'],
|
|
62
|
+
M: ['Mc', 'Me', 'Mn'],
|
|
63
|
+
N: ['Nd', 'Nl', 'No'],
|
|
64
|
+
P: ['Pc', 'Pd', 'Pe', 'Pf', 'Pi', 'Po', 'Ps'],
|
|
65
|
+
S: ['Sc', 'Sk', 'Sm', 'So'],
|
|
66
|
+
Z: ['Zl', 'Zp', 'Zs'],
|
|
67
|
+
};
|
|
68
|
+
const categories = new Map();
|
|
69
|
+
/** The maximal runs of the scalars in one General_Category that the I-Regexp grammar admits. */
|
|
70
|
+
export function categoryRanges(category) {
|
|
71
|
+
const known = categories.get(category);
|
|
72
|
+
if (known !== undefined)
|
|
73
|
+
return known;
|
|
74
|
+
let ranges;
|
|
75
|
+
if (Object.hasOwn(GENERAL_CATEGORIES, category))
|
|
76
|
+
ranges = decode(GENERAL_CATEGORIES[category]);
|
|
77
|
+
else if (Object.hasOwn(MAJOR_CATEGORIES, category))
|
|
78
|
+
ranges = mergeRanges(MAJOR_CATEGORIES[category].flatMap(categoryRanges));
|
|
79
|
+
else if (category === 'Cn')
|
|
80
|
+
ranges = complement(mergeRanges(Object.keys(GENERAL_CATEGORIES).flatMap(categoryRanges)));
|
|
81
|
+
else
|
|
82
|
+
throw new TypeError(`The I-Regexp grammar admits no General_Category ${category}.`);
|
|
83
|
+
const frozen = Object.freeze(ranges.map((range) => Object.freeze(range)));
|
|
84
|
+
categories.set(category, frozen);
|
|
85
|
+
return frozen;
|
|
86
|
+
}
|
|
87
|
+
function decode(encoded) {
|
|
88
|
+
const output = [];
|
|
89
|
+
let next = 0;
|
|
90
|
+
let start;
|
|
91
|
+
let value = 0;
|
|
92
|
+
for (const character of encoded) {
|
|
93
|
+
const digit = DIGITS.indexOf(character);
|
|
94
|
+
value = value * 32 + (digit % 32);
|
|
95
|
+
if (digit >= 32)
|
|
96
|
+
continue;
|
|
97
|
+
if (start === undefined)
|
|
98
|
+
start = next + value;
|
|
99
|
+
else {
|
|
100
|
+
output.push([start, start + value]);
|
|
101
|
+
next = start + value + 1;
|
|
102
|
+
start = undefined;
|
|
103
|
+
}
|
|
104
|
+
value = 0;
|
|
105
|
+
}
|
|
106
|
+
return output;
|
|
107
|
+
}
|
|
108
|
+
/** Sorted, disjoint and non-adjacent runs covering exactly the scalars of `input`. */
|
|
109
|
+
export function mergeRanges(input) {
|
|
110
|
+
const sorted = [...input].sort((left, right) => left[0] - right[0] || left[1] - right[1]);
|
|
111
|
+
const output = [];
|
|
112
|
+
for (const range of sorted) {
|
|
113
|
+
const previous = output.at(-1);
|
|
114
|
+
if (previous === undefined || range[0] > previous[1] + 1)
|
|
115
|
+
output.push([range[0], range[1]]);
|
|
116
|
+
else
|
|
117
|
+
output[output.length - 1] = [previous[0], Math.max(previous[1], range[1])];
|
|
118
|
+
}
|
|
119
|
+
return output;
|
|
120
|
+
}
|
|
121
|
+
/** The runs of the scalars, surrogates excluded, outside the sorted, disjoint runs of `input`. */
|
|
122
|
+
export function complement(input) {
|
|
123
|
+
const output = [];
|
|
124
|
+
for (const [minimum, maximum] of SCALAR_RANGES) {
|
|
125
|
+
let cursor = minimum;
|
|
126
|
+
for (const [start, end] of input) {
|
|
127
|
+
if (end < minimum || start > maximum)
|
|
128
|
+
continue;
|
|
129
|
+
if (start > cursor)
|
|
130
|
+
output.push([cursor, Math.min(start - 1, maximum)]);
|
|
131
|
+
cursor = Math.max(cursor, end + 1);
|
|
132
|
+
if (cursor > maximum)
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
if (cursor <= maximum)
|
|
136
|
+
output.push([cursor, maximum]);
|
|
137
|
+
}
|
|
138
|
+
return output;
|
|
139
|
+
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { refine } from 'zod';
|
|
2
2
|
import { compilePattern } from '../regexp/compile.js';
|
|
3
3
|
import { loadPattern } from '../regexp/matcher.js';
|
|
4
|
-
import {
|
|
4
|
+
import { refuseIRegexp, stateBudgetMessage } from '../regexp/syntax.js';
|
|
5
5
|
const sources = new WeakMap();
|
|
6
6
|
export function fullMatch(source) {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const refusal = refuseIRegexp(source);
|
|
8
|
+
if (refusal !== undefined) {
|
|
9
|
+
throw new TypeError(refusal === 'syntax'
|
|
10
|
+
? 'fullMatch(...) requires a complete RFC 9485 I-Regexp source.'
|
|
11
|
+
: stateBudgetMessage('fullMatch(...)'));
|
|
9
12
|
}
|
|
10
13
|
const matcher = loadPattern(compilePattern(source));
|
|
11
|
-
const check =
|
|
14
|
+
const check = refine((value) => matcher.matches(value), {
|
|
12
15
|
error: `String must fully match I-Regexp ${JSON.stringify(source)}.`,
|
|
13
16
|
});
|
|
14
17
|
sources.set(check, source);
|
|
@@ -15,15 +15,13 @@ export function validateNodePathExtension(schema, context, pointer, definitionEx
|
|
|
15
15
|
const tokens = parseJsonPointerFragment(`#${location.pointer}`);
|
|
16
16
|
const fieldName = tokens?.length === 2 && tokens[0] === 'properties' ? tokens[1] : undefined;
|
|
17
17
|
const root = isJsonObject(schema) ? schema : undefined;
|
|
18
|
-
const
|
|
18
|
+
const directField = context === 'callable-input' &&
|
|
19
19
|
root?.type === 'object' &&
|
|
20
20
|
location.depth === 1 &&
|
|
21
21
|
location.parentKeyword === 'properties' &&
|
|
22
|
-
fieldName !== undefined
|
|
23
|
-
|
|
24
|
-
root.
|
|
25
|
-
if (!directRequiredField) {
|
|
26
|
-
diagnostics.push(diagnostic('VS_PATH_EXTENSION', extensionPointer, 'x-astrale-path is allowed only on a direct required property schema at a callable-input object root.'));
|
|
22
|
+
fieldName !== undefined;
|
|
23
|
+
if (!directField) {
|
|
24
|
+
diagnostics.push(diagnostic('VS_PATH_EXTENSION', extensionPointer, 'x-astrale-path is allowed only on a direct property schema at a callable-input object root.'));
|
|
27
25
|
}
|
|
28
26
|
const schemaKeys = Object.keys(location.schema);
|
|
29
27
|
if (schemaKeys.length !== 2 ||
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DefinitionBase, ViewRef } from '../../../addressing/index.js';
|
|
2
|
+
/** Every View targets its owning Domain. */
|
|
2
3
|
export type ViewTarget = {
|
|
3
4
|
readonly kind: 'domain';
|
|
4
|
-
} | {
|
|
5
|
-
readonly kind: 'definition';
|
|
6
|
-
readonly definitions: readonly [ClassRef, ...ClassRef[]];
|
|
7
5
|
};
|
|
8
6
|
export interface ViewDefinition extends DefinitionBase<ViewRef> {
|
|
9
7
|
readonly description?: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DefinitionKey, ViewRef } from '../../addressing/index.js';
|
|
2
|
-
import type { ViewDefinition
|
|
2
|
+
import type { ViewDefinition } from './model/view.js';
|
|
3
|
+
/** One resolved View of its owning Domain. A View has no Class or Node target. */
|
|
3
4
|
export interface ResolvedView {
|
|
4
5
|
readonly ref: ViewRef;
|
|
5
6
|
readonly key: DefinitionKey<string, 'view'>;
|
|
6
|
-
readonly target: ViewTarget;
|
|
7
7
|
readonly description?: ViewDefinition['description'];
|
|
8
8
|
readonly definition: ViewDefinition;
|
|
9
9
|
}
|
|
@@ -2,40 +2,70 @@ import type { ClassRef } from '../../addressing/index.js';
|
|
|
2
2
|
import type { MethodDefinition } from '../../language/callable/model/callable.js';
|
|
3
3
|
import type { ClassDefinition } from '../../language/class/model/class.js';
|
|
4
4
|
import type { DataDefinition } from '../../language/class/model/data.js';
|
|
5
|
-
import type { PropertyAuto } from '../../language/class/model/property.js';
|
|
5
|
+
import type { PropertyAuto, PropertyImmutability } from '../../language/class/model/property.js';
|
|
6
|
+
import type { StateTopology } from '../../language/state/index.js';
|
|
6
7
|
import type { JsonSchema } from '../../language/value/model/schema.js';
|
|
7
8
|
import type { SchemaDiagnostic } from '../diagnostic.js';
|
|
8
9
|
import type { DomainResolutionContext } from '../resolution/context.js';
|
|
9
10
|
import { PropertyKey } from '../../addressing/index.js';
|
|
11
|
+
import { type MethodComposition } from '../../language/callable/composition.js';
|
|
10
12
|
export interface EffectiveField {
|
|
11
13
|
readonly identity: PropertyKey;
|
|
12
14
|
readonly owner: ClassRef;
|
|
13
15
|
readonly name: string;
|
|
14
16
|
readonly schema: JsonSchema;
|
|
15
17
|
readonly required: boolean;
|
|
16
|
-
readonly visibility: 'public' | 'private';
|
|
17
18
|
readonly auto?: PropertyAuto;
|
|
19
|
+
readonly immutable?: PropertyImmutability;
|
|
20
|
+
readonly state?: StateTopology;
|
|
18
21
|
}
|
|
19
22
|
export interface EffectiveMethod {
|
|
20
|
-
readonly
|
|
23
|
+
readonly key: string;
|
|
21
24
|
readonly owner: ClassRef;
|
|
22
25
|
readonly name: string;
|
|
23
26
|
readonly declaration: MethodDefinition;
|
|
24
27
|
}
|
|
25
|
-
|
|
28
|
+
interface EffectiveData {
|
|
26
29
|
readonly identity: string;
|
|
27
30
|
readonly owner: ClassRef;
|
|
28
31
|
readonly declaration: DataDefinition;
|
|
29
32
|
}
|
|
30
|
-
export interface DefinitionAnalysis {
|
|
33
|
+
export interface DefinitionAnalysis extends MethodComposition<EffectiveMethod> {
|
|
31
34
|
readonly ref: ClassRef;
|
|
32
35
|
readonly declaration: ClassDefinition;
|
|
33
36
|
readonly properties: ReadonlyMap<PropertyKey, EffectiveField>;
|
|
34
37
|
readonly data?: EffectiveData;
|
|
35
|
-
readonly methods: ReadonlyMap<string, EffectiveMethod>;
|
|
36
38
|
}
|
|
37
39
|
export interface DefinitionAnalysisResult {
|
|
38
40
|
readonly definitions: ReadonlyMap<string, DefinitionAnalysis>;
|
|
39
41
|
readonly diagnostics: readonly SchemaDiagnostic[];
|
|
40
42
|
}
|
|
41
43
|
export declare function analyzeDefinitions(environment: DomainResolutionContext): DefinitionAnalysisResult;
|
|
44
|
+
/** The exact signature required by abstract Method composition. */
|
|
45
|
+
export declare function sameMethodSignature(left: MethodDefinition, right: MethodDefinition): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Shared canonical signature used by admission and compatibility explanations. The execution
|
|
48
|
+
* modifier appears only when durable, so absent and `durable: false` are the same signature.
|
|
49
|
+
*/
|
|
50
|
+
export declare function methodSignature(value: MethodDefinition): {
|
|
51
|
+
input: JsonSchema;
|
|
52
|
+
output: {
|
|
53
|
+
mode: string;
|
|
54
|
+
schema: JsonSchema;
|
|
55
|
+
item?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
schema?: undefined;
|
|
58
|
+
mode: string;
|
|
59
|
+
item: JsonSchema;
|
|
60
|
+
} | {
|
|
61
|
+
schema?: undefined;
|
|
62
|
+
item?: undefined;
|
|
63
|
+
mode: string;
|
|
64
|
+
};
|
|
65
|
+
auth: "anonymous" | "authenticated" | "authorized";
|
|
66
|
+
static: boolean;
|
|
67
|
+
execution?: {
|
|
68
|
+
durable: boolean;
|
|
69
|
+
} | undefined;
|
|
70
|
+
};
|
|
71
|
+
export {};
|