@mark1russell7/coeval 0.6.0 → 0.6.2
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/README.md +1 -1
- package/build/index.d.ts +30 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +129 -21
- package/build/index.js.map +1 -1
- package/package.json +2 -1
- package/src/agree.ts +1 -1
- package/src/deref.ts +3 -3
- package/src/evaluate.ts +6 -6
- package/src/formula.ts +2 -2
- package/src/index.ts +11 -1
- package/src/merge.ts +101 -2
- package/src/parts.ts +1 -1
- package/src/reference.ts +3 -3
- package/src/static.ts +1 -1
- package/src/stdlib.ts +6 -6
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ A plan evaluates many times without a trace. `evaluate(machine, doc)` gives the
|
|
|
27
27
|
| Documents | `isEnvelope`, `stored`, `typePath`, `docEquals` | The envelope, the keys of a store beside it, and the equality of documents. A host value, for example a date, is equal only to itself |
|
|
28
28
|
| Parts | `partsOf`, `splitParts` | The kind and the parts of one document, with the declared type for a bare value. The plan, the reference and the static kit use it |
|
|
29
29
|
| World | `lookupKind`, `Kind`, `Namespace`, `PartShape`, `ScopeRule`, `CapsRule` | The kinds, with their contracts: the shape of the parts, the type of the data, the kinds that a position permits, the names that a kind binds, the capabilities that it gives its parts, and its effects. A namespace can have a fallback kind |
|
|
30
|
-
| Merges | `mergeWorlds`, `mergeMachines`, `MergeError` | The one merge of worlds and machines. Equal entries merge, and namespaces merge key by key. Each other clash is a conflict, unless the later part names its path in `replaces` |
|
|
30
|
+
| Merges | `mergeWorlds`, `mergeMachines`, `MergeError`, `restrictWorld`, `restrictMachine` | The one merge of worlds and machines. Equal entries merge, and namespaces merge key by key. Each other clash is a conflict, unless the later part names its path in `replaces`. A restriction removes entries and their code. [`docs/COMPOSITION.md`](https://github.com/mark1russell7/coeval/blob/main/docs/COMPOSITION.md) shows each mode of composition |
|
|
31
31
|
| Ladder | `ask` | The evaluator of a verb: the own entry, then the kind, then the default |
|
|
32
32
|
| References | `resolve`, `HostThing`, `Navigator` | A path from a root of the context: `self`, `names`, `world`, `event` or `caps`. A step document can have computed parts, and a walker can give the code of its failure |
|
|
33
33
|
| Plans | `prepare`, `planner`, `evaluate`, `run` | A document compiles one time into code. An evaluator is a function or a compiler |
|
package/build/index.d.ts
CHANGED
|
@@ -1373,6 +1373,36 @@ export declare function mergeWorlds(...parts: readonly (WorldPart | ((prev: Worl
|
|
|
1373
1373
|
* @throws {MergeError} The merge has a conflict. The error lists each conflict.
|
|
1374
1374
|
*/
|
|
1375
1375
|
export declare function mergeMachines(...parts: readonly (MachinePart | ((prev: Machine) => MachinePart))[]): Machine;
|
|
1376
|
+
/**
|
|
1377
|
+
* This function removes entries from a world, for a language that restricts another language. A path names an entry
|
|
1378
|
+
* as `replaces` names it, for example `["kinds", "fn"]`, `["kinds", "ops", "kinds", "mul"]`,
|
|
1379
|
+
* `["kinds", "ops", "fallback"]`, `["defaults", "view"]` or `["fallback"]`. A path that names no entry changes
|
|
1380
|
+
* nothing. The function does not change the world.
|
|
1381
|
+
*
|
|
1382
|
+
* A removed kind gives `#KIND?`, also through an alias to it. A namespace without its fallback knows only its own keys.
|
|
1383
|
+
* A world without its fallback is closed.
|
|
1384
|
+
*
|
|
1385
|
+
* @param world - The world.
|
|
1386
|
+
* @param paths - The paths of the entries to remove.
|
|
1387
|
+
* @returns The world without the entries.
|
|
1388
|
+
*/
|
|
1389
|
+
export declare function restrictWorld(world: World, paths: readonly MergePath[]): World;
|
|
1390
|
+
/**
|
|
1391
|
+
* This function removes entries from a machine, for a language that restricts another language. A path names an
|
|
1392
|
+
* entry as `replaces` names it:
|
|
1393
|
+
*
|
|
1394
|
+
* - A path that starts with `"world"` removes an entry of the world, with the rules of `restrictWorld`.
|
|
1395
|
+
* - `["evaluators", name]` or `["runners", name]` removes the code of the name: its evaluator and its runner.
|
|
1396
|
+
* - `["derefs", name]` and `["walkers", name]` remove one entry of their tables.
|
|
1397
|
+
*
|
|
1398
|
+
* A path that names no entry changes nothing. The function does not change the machine. An own entry names an
|
|
1399
|
+
* evaluator directly, thus only a machine without the code of a name refuses each document that names it.
|
|
1400
|
+
*
|
|
1401
|
+
* @param machine - The machine.
|
|
1402
|
+
* @param paths - The paths of the entries to remove.
|
|
1403
|
+
* @returns The machine without the entries.
|
|
1404
|
+
*/
|
|
1405
|
+
export declare function restrictMachine(machine: Machine, paths: readonly MergePath[]): Machine;
|
|
1376
1406
|
//#endregion
|
|
1377
1407
|
//#region src/classify.d.ts
|
|
1378
1408
|
/** A shape proposes a kind for each document that has all of its fields. */
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["Part","Shape"],"sources":["../src/doc.ts","../src/errors.ts","../src/deref.ts","../src/world.ts","../src/ladder.ts","../src/evaluate.ts","../src/merge.ts","../src/classify.ts","../src/parts.ts","../src/stdlib.ts","../src/order.ts","../src/context.ts","../src/static.ts","../src/formula.ts","../src/reference.ts","../src/agree.ts","../src/generate.ts"],"mappings":";;KACY,mDAAmD;YAAmC,cAAA;;;KAGtF;YAAuC,cAAA;;;KAGvC;;;;;;;;;;;KAYA,4BAA4B;WAAmB;WAAsB,gBAAgB;;;;;;KAMrF;;WAED,MAAM;;WAEN,OAAO;;WAEP;;WAEA,MAAM,SAAS;;;qBAIb;;;;;;;;wBASG,SAAS,iBAAiB,SAAS;;;;;;;;wBAanC,MAAM,QAAQ,YAAY,cAAc;;;;;;;wBAUxC,MAAM,iBAAiB,SAAS;;;;;;;;wBAWhC,UAAU,iBAAiB,SAAS;;;;;;;wBAcpC,SAAS,MAAM,mBAAmB;;;;;;;wBAalC,SAAS,MAAM;;;;;;;;;wBAqBf,WAAW,iBAAiB,SAAS,aAAa;;UAUjD;WACN,UAAU;;WAEV,QAAQ,SAAS,eAAe;;;;;;;;;;wBAW3B,OAAO,gBAAgB,4BAA4B;;;;;;;;;wBAqBnD,MAAM,MAAM,SAAS,OAAO,MAA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O,OAAO,WAAW,eAAe,QAAQ;;;;;;;wBAqBhD,QAAQ,OAAO,qBAAqB;;;;;;;;wBAkBpC,SAAS,OAAO,qBAAqB;;;;KCvwCzC,qBAAqB;;;;;UAMhB;WACN,QAAQ,SAAS,eAAe;WAChC,WAAW,SAAS;WACpB,WAAW;WACX,oBAAoB;;;;;;UAOd,oBAAoB,KAAK,QAAQ;WACvC,QAAQ;WACR,oBAAoB;;;;;;UAOd;WACN,MAAM;WACN;WACA;;;qBAIE,mBAAmB;WACrB,oBAAoB;;;;;;EAO7B,YAAY,oBAAoB;;;;;;;;;;;;;;;;;;wBA6LlB,eAAe,iBAAiB,cAAc,MAAM,UAAU,gBAAgB;;;;;;;;;;;;;;;;;;;wBA2H9E,iBAAiB,iBAAiB,gBAAgB,MAAM,YAAY,kBAAkB;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["Part","Shape"],"sources":["../src/doc.ts","../src/errors.ts","../src/deref.ts","../src/world.ts","../src/ladder.ts","../src/evaluate.ts","../src/merge.ts","../src/classify.ts","../src/parts.ts","../src/stdlib.ts","../src/order.ts","../src/context.ts","../src/static.ts","../src/formula.ts","../src/reference.ts","../src/agree.ts","../src/generate.ts"],"mappings":";;KACY,mDAAmD;YAAmC,cAAA;;;KAGtF;YAAuC,cAAA;;;KAGvC;;;;;;;;;;;KAYA,4BAA4B;WAAmB;WAAsB,gBAAgB;;;;;;KAMrF;;WAED,MAAM;;WAEN,OAAO;;WAEP;;WAEA,MAAM,SAAS;;;qBAIb;;;;;;;;wBASG,SAAS,iBAAiB,SAAS;;;;;;;;wBAanC,MAAM,QAAQ,YAAY,cAAc;;;;;;;wBAUxC,MAAM,iBAAiB,SAAS;;;;;;;;wBAWhC,UAAU,iBAAiB,SAAS;;;;;;;wBAcpC,SAAS,MAAM,mBAAmB;;;;;;;wBAalC,SAAS,MAAM;;;;;;;;;wBAqBf,WAAW,iBAAiB,SAAS,aAAa;;UAUjD;WACN,UAAU;;WAEV,QAAQ,S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BAAsB;;;;;;;;;;;KC9etD;;UAGK;WACN,QAAQ;WACR,mBAAmB;;;UAIb;;WAEN;;WAEA,cAAc;;WAEd,iBAAiB,QAAQ;;;;;;;;WAQzB,SAAS,cAAc,SAAS,YAAY,SAAS;;;;;;;;WAQrD,SAAS,YAAY;;WAErB;;;;;;;;WAQA;;;KAIC;WACG;WAAmB,QAAQ;WAAiB,kBAAkB;;WAE9D;WACA,MAAM;;WAEN,MAAM;;WAEN,OAAO;;WAEP;;;;;;;;;;;;;;;;;;;wBAoBC,UAAU,YAAY,YAAY,SAAS,YAAY;;;;;;;;;;;;;wBAsGvD,MAAM,SAAS,SAAS,cAAc,UAAS,SAAyB,UAAS,eAAoB;;;;UC1LpG;;EAEf;;EAEA,IAAI;;EAEJ,OAAO;;EAEP,KAAK,GAAG,gBAAgB,MAAM;;;;;;;;wBAShB,OAAO,eAAe;;UAcrB;;WAEN;;WAEA,2BAA2B;;WAE3B;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;;;WAQA,QAAQ,eAAe,OAAO,QAAQ,WAAW;;;;;;;;WAQjD,SAAS,eAAe,OAAO,eAAe,6BAA6B;;WAE3E;;WAEA,gBAAgB;;WAEhB,iBAAiB;;WAEjB;;;;;;;;;wBAUK,QAAQ,OAAO,2BAA2B;;;;;;;;;;;;wBAsD1C,SAAS,OAAO,OAAO,SAAS"}
|
package/build/index.js
CHANGED
|
@@ -839,6 +839,114 @@ function mergeMachines(...parts) {
|
|
|
839
839
|
if (m.conflicts.length > 0) throw new MergeError(m.conflicts);
|
|
840
840
|
return machineOf(draft);
|
|
841
841
|
}
|
|
842
|
+
/** This function removes the entry at a path from a table of entries. It gives the same table when no entry is there. */
|
|
843
|
+
function removeEntry(entries, path) {
|
|
844
|
+
const [first, ...rest] = path;
|
|
845
|
+
if (first === void 0) return entries;
|
|
846
|
+
const key = String(first);
|
|
847
|
+
const entry = own$1(entries, key);
|
|
848
|
+
if (entry === void 0) return entries;
|
|
849
|
+
let next;
|
|
850
|
+
if (rest.length > 0) {
|
|
851
|
+
if (!isNamespace(entry)) return entries;
|
|
852
|
+
if (rest.length === 1 && String(rest[0]) === "fallback") {
|
|
853
|
+
if (entry.fallback === void 0) return entries;
|
|
854
|
+
next = { kinds: entry.kinds };
|
|
855
|
+
} else {
|
|
856
|
+
if (String(rest[0]) !== "kinds") return entries;
|
|
857
|
+
const kinds = removeEntry(entry.kinds, rest.slice(1));
|
|
858
|
+
if (kinds === entry.kinds) return entries;
|
|
859
|
+
next = entry.fallback === void 0 ? { kinds } : {
|
|
860
|
+
kinds,
|
|
861
|
+
fallback: entry.fallback
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
const out = { ...entries };
|
|
866
|
+
if (next === void 0) delete out[key];
|
|
867
|
+
else setOwn$2(out, key, next);
|
|
868
|
+
return out;
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* This function removes entries from a world, for a language that restricts another language. A path names an entry
|
|
872
|
+
* as `replaces` names it, for example `["kinds", "fn"]`, `["kinds", "ops", "kinds", "mul"]`,
|
|
873
|
+
* `["kinds", "ops", "fallback"]`, `["defaults", "view"]` or `["fallback"]`. A path that names no entry changes
|
|
874
|
+
* nothing. The function does not change the world.
|
|
875
|
+
*
|
|
876
|
+
* A removed kind gives `#KIND?`, also through an alias to it. A namespace without its fallback knows only its own keys.
|
|
877
|
+
* A world without its fallback is closed.
|
|
878
|
+
*
|
|
879
|
+
* @param world - The world.
|
|
880
|
+
* @param paths - The paths of the entries to remove.
|
|
881
|
+
* @returns The world without the entries.
|
|
882
|
+
*/
|
|
883
|
+
function restrictWorld(world, paths) {
|
|
884
|
+
let kinds = world.kinds;
|
|
885
|
+
const defaults = { ...world.defaults };
|
|
886
|
+
let fallback = world.fallback;
|
|
887
|
+
for (const path of paths) {
|
|
888
|
+
const [first, ...rest] = path.map(String);
|
|
889
|
+
if (first === "kinds") kinds = removeEntry(kinds, rest);
|
|
890
|
+
else if (first === "defaults" && rest.length === 1) delete defaults[rest[0]];
|
|
891
|
+
else if (first === "fallback" && rest.length === 0) fallback = void 0;
|
|
892
|
+
}
|
|
893
|
+
const out = {
|
|
894
|
+
kinds: { ...kinds },
|
|
895
|
+
defaults
|
|
896
|
+
};
|
|
897
|
+
return fallback === void 0 ? out : {
|
|
898
|
+
...out,
|
|
899
|
+
fallback
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
/** The tables of the code of a machine, as the paths of a restriction name them. */
|
|
903
|
+
const CODE_TABLES = [
|
|
904
|
+
"evaluators",
|
|
905
|
+
"runners",
|
|
906
|
+
"derefs",
|
|
907
|
+
"walkers"
|
|
908
|
+
];
|
|
909
|
+
/**
|
|
910
|
+
* This function removes entries from a machine, for a language that restricts another language. A path names an
|
|
911
|
+
* entry as `replaces` names it:
|
|
912
|
+
*
|
|
913
|
+
* - A path that starts with `"world"` removes an entry of the world, with the rules of `restrictWorld`.
|
|
914
|
+
* - `["evaluators", name]` or `["runners", name]` removes the code of the name: its evaluator and its runner.
|
|
915
|
+
* - `["derefs", name]` and `["walkers", name]` remove one entry of their tables.
|
|
916
|
+
*
|
|
917
|
+
* A path that names no entry changes nothing. The function does not change the machine. An own entry names an
|
|
918
|
+
* evaluator directly, thus only a machine without the code of a name refuses each document that names it.
|
|
919
|
+
*
|
|
920
|
+
* @param machine - The machine.
|
|
921
|
+
* @param paths - The paths of the entries to remove.
|
|
922
|
+
* @returns The machine without the entries.
|
|
923
|
+
*/
|
|
924
|
+
function restrictMachine(machine, paths) {
|
|
925
|
+
const world = paths.filter((path) => String(path[0]) === "world").map((path) => path.slice(1));
|
|
926
|
+
const tables = {
|
|
927
|
+
evaluators: { ...machine.evaluators },
|
|
928
|
+
runners: machine.runners === void 0 ? void 0 : { ...machine.runners },
|
|
929
|
+
derefs: machine.derefs === void 0 ? void 0 : { ...machine.derefs },
|
|
930
|
+
walkers: machine.walkers === void 0 ? void 0 : { ...machine.walkers }
|
|
931
|
+
};
|
|
932
|
+
for (const path of paths) {
|
|
933
|
+
const [table, name, ...rest] = path.map(String);
|
|
934
|
+
if (name === void 0 || rest.length > 0 || !CODE_TABLES.includes(table)) continue;
|
|
935
|
+
const from = table === "evaluators" || table === "runners" ? ["evaluators", "runners"] : [table];
|
|
936
|
+
for (const key of from) {
|
|
937
|
+
const entries = tables[key];
|
|
938
|
+
if (entries !== void 0) delete entries[name];
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
return {
|
|
942
|
+
...machine,
|
|
943
|
+
world: world.length === 0 ? machine.world : restrictWorld(machine.world, world),
|
|
944
|
+
evaluators: tables.evaluators,
|
|
945
|
+
...tables.runners === void 0 ? {} : { runners: tables.runners },
|
|
946
|
+
...tables.derefs === void 0 ? {} : { derefs: tables.derefs },
|
|
947
|
+
...tables.walkers === void 0 ? {} : { walkers: tables.walkers }
|
|
948
|
+
};
|
|
949
|
+
}
|
|
842
950
|
//#endregion
|
|
843
951
|
//#region src/ladder.ts
|
|
844
952
|
/** The rungs of the ladder, in the order that a question visits them. */
|
|
@@ -980,7 +1088,7 @@ function ask(world, doc, verb, options = {}) {
|
|
|
980
1088
|
* The brand of a host thing: an object of the host that answers the steps of a path itself. The brand is a
|
|
981
1089
|
* global symbol, thus two copies of the kernel in one program know the things of each other.
|
|
982
1090
|
*/
|
|
983
|
-
const THING = Symbol.for("coeval.thing");
|
|
1091
|
+
const THING = /* @__PURE__ */ Symbol.for("coeval.thing");
|
|
984
1092
|
/**
|
|
985
1093
|
* This function tells if a thing is a host thing.
|
|
986
1094
|
*
|
|
@@ -1118,7 +1226,7 @@ function context(parts = {}) {
|
|
|
1118
1226
|
};
|
|
1119
1227
|
}
|
|
1120
1228
|
const MAX_COLLAPSE = 64;
|
|
1121
|
-
const NO_HOPS = Object.freeze([]);
|
|
1229
|
+
const NO_HOPS = /* @__PURE__ */ Object.freeze([]);
|
|
1122
1230
|
/** A value that can be a reference document: a record with the type `ref`. The full check comes after. */
|
|
1123
1231
|
function mayBeRef(thing) {
|
|
1124
1232
|
return typeof thing === "object" && thing !== null && thing.type === "ref";
|
|
@@ -1384,7 +1492,7 @@ function setOwn$1(target, key, value) {
|
|
|
1384
1492
|
});
|
|
1385
1493
|
else target[key] = value;
|
|
1386
1494
|
}
|
|
1387
|
-
const NO_SLOTS = Object.freeze([]);
|
|
1495
|
+
const NO_SLOTS = /* @__PURE__ */ Object.freeze([]);
|
|
1388
1496
|
function hasSlots(template) {
|
|
1389
1497
|
return template.t !== "data";
|
|
1390
1498
|
}
|
|
@@ -1690,9 +1798,9 @@ function narrow(parent, next) {
|
|
|
1690
1798
|
};
|
|
1691
1799
|
}
|
|
1692
1800
|
/** No capabilities. One list serves each masked part. */
|
|
1693
|
-
const NO_CAPS = Object.freeze([]);
|
|
1801
|
+
const NO_CAPS = /* @__PURE__ */ Object.freeze([]);
|
|
1694
1802
|
/** No capability rules. One list serves each part that no rule narrows. */
|
|
1695
|
-
const NO_RULES = Object.freeze([]);
|
|
1803
|
+
const NO_RULES = /* @__PURE__ */ Object.freeze([]);
|
|
1696
1804
|
/**
|
|
1697
1805
|
* This function gives the capabilities that two lists both permit. An effect is permitted by the result when each
|
|
1698
1806
|
* list permits it. When the list `b` permits each capability of `a`, the result is the list `a` itself.
|
|
@@ -1750,8 +1858,8 @@ const NO_ANSWER = {
|
|
|
1750
1858
|
steps: []
|
|
1751
1859
|
};
|
|
1752
1860
|
/** The options of a resolution without a record of hops, and with one. One object of each serves each call. */
|
|
1753
|
-
const WITHOUT_HOPS = Object.freeze({ hops: false });
|
|
1754
|
-
const WITH_HOPS = Object.freeze({ hops: true });
|
|
1861
|
+
const WITHOUT_HOPS = /* @__PURE__ */ Object.freeze({ hops: false });
|
|
1862
|
+
const WITH_HOPS = /* @__PURE__ */ Object.freeze({ hops: true });
|
|
1755
1863
|
/** This class holds the state of one evaluation or run: the machine, the effects, the clock and the trace. */
|
|
1756
1864
|
var Session = class {
|
|
1757
1865
|
machine;
|
|
@@ -1958,7 +2066,7 @@ function drive$1(steps) {
|
|
|
1958
2066
|
steps.return(fail("#CALC!", "A part waited, and its parent cannot wait."));
|
|
1959
2067
|
return fail("#CALC!", "A part waited, and its parent cannot wait.");
|
|
1960
2068
|
}
|
|
1961
|
-
const ABORTED = Symbol("aborted");
|
|
2069
|
+
const ABORTED = /* @__PURE__ */ Symbol("aborted");
|
|
1962
2070
|
/** This function drives steps that can wait. The steps before the first wait happen at once, in the call. */
|
|
1963
2071
|
async function driveWaiting(steps, signal) {
|
|
1964
2072
|
const abort = () => {
|
|
@@ -2075,7 +2183,7 @@ function evaluatorOf(world, envelope, kind) {
|
|
|
2075
2183
|
};
|
|
2076
2184
|
}
|
|
2077
2185
|
/** The meta of a node of a compilation without a trace. Only a trace reads the meta of a node. */
|
|
2078
|
-
const NO_META = Object.freeze({
|
|
2186
|
+
const NO_META = /* @__PURE__ */ Object.freeze({
|
|
2079
2187
|
path: [],
|
|
2080
2188
|
doc: {
|
|
2081
2189
|
type: "?",
|
|
@@ -2695,9 +2803,9 @@ function dataOf(type) {
|
|
|
2695
2803
|
}
|
|
2696
2804
|
/** The code of the evaluators of the standard world, by name. */
|
|
2697
2805
|
const STD_EVALUATORS = {
|
|
2698
|
-
"data.number": dataOf("number"),
|
|
2699
|
-
"data.text": dataOf("string"),
|
|
2700
|
-
"data.bool": dataOf("boolean"),
|
|
2806
|
+
"data.number": /* @__PURE__ */ dataOf("number"),
|
|
2807
|
+
"data.text": /* @__PURE__ */ dataOf("string"),
|
|
2808
|
+
"data.bool": /* @__PURE__ */ dataOf("boolean"),
|
|
2701
2809
|
"math.add": ({ parts }) => {
|
|
2702
2810
|
const all = allValues(parts.map((part) => part.evaluate()));
|
|
2703
2811
|
if ("error" in all) return all.error;
|
|
@@ -2727,8 +2835,8 @@ const STD_EVALUATORS = {
|
|
|
2727
2835
|
"tree.node": (input) => treeNode(input)
|
|
2728
2836
|
};
|
|
2729
2837
|
/** The brand of a node of the decorated tree. Its value is the state that the kit reads. */
|
|
2730
|
-
const TREE_NODE = Symbol.for("coeval.tree.node");
|
|
2731
|
-
const BUSY = Object.freeze({ busy: true });
|
|
2838
|
+
const TREE_NODE = /* @__PURE__ */ Symbol.for("coeval.tree.node");
|
|
2839
|
+
const BUSY = /* @__PURE__ */ Object.freeze({ busy: true });
|
|
2732
2840
|
/** The attributes in evaluation, in the order of their demands. An evaluation does not wait, thus one list serves. */
|
|
2733
2841
|
const demands = [];
|
|
2734
2842
|
function attributeText(key, type, place) {
|
|
@@ -2923,7 +3031,7 @@ function nearestWalker(options = {}) {
|
|
|
2923
3031
|
};
|
|
2924
3032
|
}
|
|
2925
3033
|
/** The walkers of the standard world, by name. */
|
|
2926
|
-
const STD_WALKERS = { "walk.nearest": nearestWalker() };
|
|
3034
|
+
const STD_WALKERS = { "walk.nearest": /* @__PURE__ */ nearestWalker() };
|
|
2927
3035
|
/** This function evaluates parts one after the other, and stops at the first error. */
|
|
2928
3036
|
function* inOrder(parts) {
|
|
2929
3037
|
const values = [];
|
|
@@ -3827,7 +3935,7 @@ function check(machine, doc, options = {}) {
|
|
|
3827
3935
|
//#endregion
|
|
3828
3936
|
//#region src/formula.ts
|
|
3829
3937
|
/** The mark of a field that the profile leaves out of a record. */
|
|
3830
|
-
const SKIPPED = Symbol("skipped");
|
|
3938
|
+
const SKIPPED = /* @__PURE__ */ Symbol("skipped");
|
|
3831
3939
|
/** The value of a name whose binding failed. A reference to the name gives the error. */
|
|
3832
3940
|
var Held = class {
|
|
3833
3941
|
error;
|
|
@@ -3835,7 +3943,7 @@ var Held = class {
|
|
|
3835
3943
|
this.error = error;
|
|
3836
3944
|
}
|
|
3837
3945
|
};
|
|
3838
|
-
const CLOSURE$2 = Symbol.for("coeval.closure");
|
|
3946
|
+
const CLOSURE$2 = /* @__PURE__ */ Symbol.for("coeval.closure");
|
|
3839
3947
|
/**
|
|
3840
3948
|
* This function tells if a value is a function that the construct `fn` made.
|
|
3841
3949
|
*
|
|
@@ -4779,7 +4887,7 @@ const treeDefinition = ({ parts, context, kind, place }) => {
|
|
|
4779
4887
|
* reference uses them for the standard evaluators, also without the option `definitions`. It holds `tree.node`.
|
|
4780
4888
|
*/
|
|
4781
4889
|
const STD_DEFINITIONS = { evaluators: { "tree.node": treeDefinition } };
|
|
4782
|
-
const CLOSURE$1 = Symbol.for("coeval.closure");
|
|
4890
|
+
const CLOSURE$1 = /* @__PURE__ */ Symbol.for("coeval.closure");
|
|
4783
4891
|
/** This function sets an own field, also the field `__proto__` (SHAPE.PROTO). */
|
|
4784
4892
|
function setField(target, key, value) {
|
|
4785
4893
|
Object.defineProperty(target, key, {
|
|
@@ -4984,7 +5092,7 @@ function formulaDefinitions(profile = {}) {
|
|
|
4984
5092
|
} };
|
|
4985
5093
|
}
|
|
4986
5094
|
/** The mark of a field that the profile leaves out of a record (FORMULA.RECORD). */
|
|
4987
|
-
const SKIP = Symbol("skip");
|
|
5095
|
+
const SKIP = /* @__PURE__ */ Symbol("skip");
|
|
4988
5096
|
/** The values of parts in order. The first error stops them, also with `combine` (FORMULA.STEPS, FORMULA.FN). */
|
|
4989
5097
|
function valuesOfStrict(parts) {
|
|
4990
5098
|
const values = [];
|
|
@@ -5056,7 +5164,7 @@ function sameValue(a, b, equal) {
|
|
|
5056
5164
|
}
|
|
5057
5165
|
return true;
|
|
5058
5166
|
}
|
|
5059
|
-
const CLOSURE = Symbol.for("coeval.closure");
|
|
5167
|
+
const CLOSURE = /* @__PURE__ */ Symbol.for("coeval.closure");
|
|
5060
5168
|
function closureParams(fn) {
|
|
5061
5169
|
return fn[CLOSURE]?.params;
|
|
5062
5170
|
}
|
|
@@ -5564,6 +5672,6 @@ function generate(world, options) {
|
|
|
5564
5672
|
});
|
|
5565
5673
|
}
|
|
5566
5674
|
//#endregion
|
|
5567
|
-
export { CONSTRUCTS, ENVELOPE_KEYS, Failure, Held, MergeError, PARTS, PART_INFO, ROOTS, RUNGS, STD_CAPS, STD_DEFINITIONS, STD_EVALUATORS, STD_EXT, STD_MACHINE, STD_RUNNERS, STD_WALKERS, STD_WORLD, THING, agree, ask, capKeys, check, checkSteps, classify, context, dataEdges, derefStep, describe, docEquals, effectEdges, entriesAsJson, evaluate, fail, failures, field, flatten, formulaDefinitions, formulaEvaluators, formulaKinds, formulaKnown, formulaMachine, fromJson, generate, intersectCaps, isAlias, isAllowedOrder, isClosure, isEnvelope, isHostThing, isKey, isKind, isNamespace, isRecord, isRef, isStackOverflow, isTypeRef, jsTruthy, kindDocument, kindNamed, kindOf, layers, looksLikeKind, lookupKind, makeContext, mapRefs, mergeMachines, mergeWorlds, narrow, nearestWalker, nodeAt, ok, partCaps, partsOf, pathMatches, permits, placed, planner, prepare, random, ref, reference, refsOf, resolve, run, sameValue, splitParts, stored, tag, thrown, toJson, typeName, typePath, typed, typesOf, valueOfThing, walk, worldThing };
|
|
5675
|
+
export { CONSTRUCTS, ENVELOPE_KEYS, Failure, Held, MergeError, PARTS, PART_INFO, ROOTS, RUNGS, STD_CAPS, STD_DEFINITIONS, STD_EVALUATORS, STD_EXT, STD_MACHINE, STD_RUNNERS, STD_WALKERS, STD_WORLD, THING, agree, ask, capKeys, check, checkSteps, classify, context, dataEdges, derefStep, describe, docEquals, effectEdges, entriesAsJson, evaluate, fail, failures, field, flatten, formulaDefinitions, formulaEvaluators, formulaKinds, formulaKnown, formulaMachine, fromJson, generate, intersectCaps, isAlias, isAllowedOrder, isClosure, isEnvelope, isHostThing, isKey, isKind, isNamespace, isRecord, isRef, isStackOverflow, isTypeRef, jsTruthy, kindDocument, kindNamed, kindOf, layers, looksLikeKind, lookupKind, makeContext, mapRefs, mergeMachines, mergeWorlds, narrow, nearestWalker, nodeAt, ok, partCaps, partsOf, pathMatches, permits, placed, planner, prepare, random, ref, reference, refsOf, resolve, restrictMachine, restrictWorld, run, sameValue, splitParts, stored, tag, thrown, toJson, typeName, typePath, typed, typesOf, valueOfThing, walk, worldThing };
|
|
5568
5676
|
|
|
5569
5677
|
//# sourceMappingURL=index.js.map
|