@cotal-ai/lang 0.22.0 → 0.24.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/README.md +57 -0
- package/dist/effects.d.ts +19 -0
- package/dist/effects.d.ts.map +1 -1
- package/dist/effects.js +23 -0
- package/dist/effects.js.map +1 -1
- package/dist/errors.d.ts +48 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +90 -2
- package/dist/errors.js.map +1 -1
- package/dist/grammar.d.ts.map +1 -1
- package/dist/grammar.js +561 -128
- package/dist/grammar.js.map +1 -1
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/interpret.d.ts +81 -3
- package/dist/interpret.d.ts.map +1 -1
- package/dist/interpret.js +1446 -270
- package/dist/interpret.js.map +1 -1
- package/dist/journal.d.ts +218 -9
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +232 -12
- package/dist/journal.js.map +1 -1
- package/dist/keys.d.ts +39 -1
- package/dist/keys.d.ts.map +1 -1
- package/dist/keys.js +61 -0
- package/dist/keys.js.map +1 -1
- package/dist/library.d.ts +65 -0
- package/dist/library.d.ts.map +1 -0
- package/dist/library.js +525 -0
- package/dist/library.js.map +1 -0
- package/dist/notify-fact.d.ts +8 -0
- package/dist/notify-fact.d.ts.map +1 -0
- package/dist/notify-fact.js +69 -0
- package/dist/notify-fact.js.map +1 -0
- package/dist/pins.d.ts +82 -0
- package/dist/pins.d.ts.map +1 -0
- package/dist/pins.js +87 -0
- package/dist/pins.js.map +1 -0
- package/dist/primitives.d.ts +14 -0
- package/dist/primitives.d.ts.map +1 -1
- package/dist/primitives.js +45 -5
- package/dist/primitives.js.map +1 -1
- package/dist/sim.d.ts +9 -1
- package/dist/sim.d.ts.map +1 -1
- package/dist/sim.js +9 -1
- package/dist/sim.js.map +1 -1
- package/dist/syntax.d.ts +34 -0
- package/dist/syntax.d.ts.map +1 -0
- package/dist/syntax.js +178 -0
- package/dist/syntax.js.map +1 -0
- package/dist/values.d.ts +20 -1
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +0 -0
- package/dist/values.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first way this fact breaks the bound, or `null` when it holds.
|
|
3
|
+
*
|
|
4
|
+
* Returns rather than throws so the interpreter raises in its own vocabulary (L3043 with the run's
|
|
5
|
+
* blame frame) and a test can ask the question without catching anything.
|
|
6
|
+
*/
|
|
7
|
+
export declare function notifyFactViolation(fact: unknown): string | null;
|
|
8
|
+
//# sourceMappingURL=notify-fact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify-fact.d.ts","sourceRoot":"","sources":["../src/notify-fact.ts"],"names":[],"mappings":"AAuBA;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAyChE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `notify` fact's bound, enforced where the VALUE exists.
|
|
3
|
+
*
|
|
4
|
+
* The validator checks a fact written as a literal, exactly, and its own comment has always said
|
|
5
|
+
* the other half out loud: *a computed one is checked at the effect boundary by the same rules*.
|
|
6
|
+
* This is that half. It matters because the computed case is the one the bound exists for —
|
|
7
|
+
* The rule is that no interpolation hook may launder a turn result's free text into another
|
|
8
|
+
* agent's prompt, and a static check cannot see a string that does not exist until the run
|
|
9
|
+
* produces it. Over-cap is an ERROR, never a truncation: silently shortening prose would make the
|
|
10
|
+
* program's intent unrecoverable while still delivering a message.
|
|
11
|
+
*
|
|
12
|
+
* **A length bound is not a shape bound**, which is the second half of the same rule and is easy to
|
|
13
|
+
* miss: 128 characters is ample room for a closing tag and an instruction after it. The render is a
|
|
14
|
+
* fixed table whose whole property is that it cannot be mistaken for an instruction, and a value
|
|
15
|
+
* carrying a newline is a value that can forge a row, a closing tag, or a line of prose below the
|
|
16
|
+
* table. So a detail string is a SINGLE LINE of printable text, checked here rather than in the
|
|
17
|
+
* renderer: the renderer must be unable to receive one, not merely careful with it.
|
|
18
|
+
*/
|
|
19
|
+
import { NOTIFY_BOUND } from "./primitives.js";
|
|
20
|
+
/** C0/C1 controls and the Unicode line separators — everything that can end a line. */
|
|
21
|
+
const CONTROL_RE = /[\u0000-\u001f\u007f-\u009f\u2028\u2029]/;
|
|
22
|
+
/**
|
|
23
|
+
* The first way this fact breaks the bound, or `null` when it holds.
|
|
24
|
+
*
|
|
25
|
+
* Returns rather than throws so the interpreter raises in its own vocabulary (L3043 with the run's
|
|
26
|
+
* blame frame) and a test can ask the question without catching anything.
|
|
27
|
+
*/
|
|
28
|
+
export function notifyFactViolation(fact) {
|
|
29
|
+
if (fact === null || typeof fact !== "object" || Array.isArray(fact))
|
|
30
|
+
return "a notify fact is a record with `decision`, `outcome`, and an optional `detail`";
|
|
31
|
+
const o = fact;
|
|
32
|
+
for (const key of Object.keys(o))
|
|
33
|
+
if (key !== "decision" && key !== "outcome" && key !== "detail")
|
|
34
|
+
return `a notify fact carries \`decision\`, \`outcome\`, and an optional \`detail\`, and nothing else; \`${key}\` would be an unbounded channel from the program into another agent's context`;
|
|
35
|
+
for (const field of ["decision", "outcome"]) {
|
|
36
|
+
const value = o[field];
|
|
37
|
+
if (typeof value !== "string")
|
|
38
|
+
return `a notify fact needs a \`${field}\`, named as a token`;
|
|
39
|
+
if (!NOTIFY_BOUND.tokenRe.test(value))
|
|
40
|
+
return `\`${field}\` names a decision, so it is a kebab-case token of 1 to 64 characters; ${JSON.stringify(value.slice(0, 64))} is not one`;
|
|
41
|
+
}
|
|
42
|
+
const detail = o.detail;
|
|
43
|
+
if (detail === undefined)
|
|
44
|
+
return null;
|
|
45
|
+
if (detail === null || typeof detail !== "object" || Array.isArray(detail))
|
|
46
|
+
return "`detail` is a record of short scalars";
|
|
47
|
+
const entries = Object.entries(detail);
|
|
48
|
+
if (entries.length > NOTIFY_BOUND.maxDetailKeys)
|
|
49
|
+
return `\`detail\` carries at most ${NOTIFY_BOUND.maxDetailKeys} keys; this one has ${entries.length}. The cap is what keeps a notice a decision rather than a message`;
|
|
50
|
+
for (const [key, value] of entries) {
|
|
51
|
+
if (!NOTIFY_BOUND.detailKeyRe.test(key))
|
|
52
|
+
return `\`${key}\` is not a detail key; they are kebab-case tokens of at most 32 characters`;
|
|
53
|
+
if (typeof value === "number") {
|
|
54
|
+
if (!Number.isFinite(value))
|
|
55
|
+
return `\`${key}\` is a number that is not finite; a notice records a decision, not a NaN`;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (typeof value === "boolean")
|
|
59
|
+
continue;
|
|
60
|
+
if (typeof value !== "string")
|
|
61
|
+
return `\`${key}\` is not a scalar; detail values are a short string, a number, or a boolean, because a nested structure is an unbounded pipe into another agent's context`;
|
|
62
|
+
if (value.length > NOTIFY_BOUND.maxDetailStringLength)
|
|
63
|
+
return `a detail string is at most ${NOTIFY_BOUND.maxDetailStringLength} characters; \`${key}\` is ${value.length}. Longer than that is prose, and prose belongs in the channel where the agent can answer it`;
|
|
64
|
+
if (CONTROL_RE.test(value))
|
|
65
|
+
return `\`${key}\` carries a line break or control character; a notice renders as one table row, and a value that can end a line can forge one`;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=notify-fact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify-fact.js","sourceRoot":"","sources":["../src/notify-fact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,uFAAuF;AACvF,MAAM,UAAU,GAAG,0CAA0C,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAa;IAC/C,IAAI,IAAI,KAAK,IAAI,IA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AAE,CAAC;QACnC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;YACrC,OAAO,KAAK,GAAG,6EAA6E,CAAC;QAC/F,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO,KAAK,GAAG,2EAA2E,CAAC;YACxH,SAAS;QACX,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,SAAS;YAAE,SAAS;QACzC,IAAI,OAAO,KAAK,KAAK,QAAQ;YAC3B,OAAO,KAAK,GAAG,4JAA4J,CAAC;QAC9K,IAAI,KAAK,CAAC,MAAM,GAAG,YAAY,CAAC,qBAAqB;YACnD,OAAO,8BAA8B,YAAY,CAAC,qBAAqB,kBAAkB,GAAG,SAAS,KAAK,CAAC,MAAM,6FAA6F,CAAC;QACjN,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;YACxB,OAAO,KAAK,GAAG,gIAAgI,CAAC;IACpJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/pins.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run's pins: the resolved values that select which effects a run performs.
|
|
3
|
+
*
|
|
4
|
+
* A run is not pinned by its source alone. The seed decides pure draws, the logical epoch decides
|
|
5
|
+
* what `now()` returns before the first effect, and the three limits decide whether a loop
|
|
6
|
+
* completes or raises. Two runs of one program under different pins are two different runs, so the
|
|
7
|
+
* pins are resolved once at start, recorded, and read back on every resume.
|
|
8
|
+
*
|
|
9
|
+
* The RESOLVED value is what is pinned. Defaulting the seed from the run id is fine; defaulting it
|
|
10
|
+
* again on the next host is not, because "the default" is a property of the interpreter and the
|
|
11
|
+
* interpreter is the thing that may have changed.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The interpreter's own semantic version, bumped when a release changes what a program MEANS: the
|
|
15
|
+
* PRNG, a builtin, numeric behaviour, or walker scheduling.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately NOT the package version. `@cotal-ai/lang` versions in lockstep with every other
|
|
18
|
+
* package in the repo, so a release of an unrelated package would otherwise invalidate every open
|
|
19
|
+
* run in the space — a loud failure with no cause behind it, which is worse than no check at all.
|
|
20
|
+
*
|
|
21
|
+
* It is here because source and seed are not sufficient across an upgrade: unchanged source can
|
|
22
|
+
* take a different branch BEFORE the first effect, where there is no input hash to compare against
|
|
23
|
+
* and nothing to diverge on.
|
|
24
|
+
*/
|
|
25
|
+
export declare const LANGUAGE_VERSION = "1";
|
|
26
|
+
export declare const PIN_DEFAULTS: Readonly<{
|
|
27
|
+
yieldEvery: 1024;
|
|
28
|
+
stepBudget: 1000000;
|
|
29
|
+
effectCeiling: 10000;
|
|
30
|
+
}>;
|
|
31
|
+
/** Every pin, resolved. This is what lands on the run record and what a resume reads back. */
|
|
32
|
+
export interface RunPins {
|
|
33
|
+
readonly seed: string;
|
|
34
|
+
/**
|
|
35
|
+
* The run's logical epoch. `now()` derives from THIS, never from the resuming host's clock; the
|
|
36
|
+
* host clock is used only to stamp effects performed live on this attempt.
|
|
37
|
+
*/
|
|
38
|
+
readonly startedAt: number;
|
|
39
|
+
readonly yieldEvery: number;
|
|
40
|
+
/**
|
|
41
|
+
* Interpreter dispatches allowed in ONE WALK — not in the run. Steps are not recorded, so a
|
|
42
|
+
* resume has nothing to recover a count from, and a replay re-walks the program anyway. This is
|
|
43
|
+
* deliberately unlike `effectCeiling`, which IS a run bound because the journal records every
|
|
44
|
+
* dispatch: the two are listed together and a lane fixing both for symmetry would invent a
|
|
45
|
+
* counter with no source of truth.
|
|
46
|
+
*/
|
|
47
|
+
readonly stepBudget: number;
|
|
48
|
+
readonly effectCeiling: number;
|
|
49
|
+
readonly languageVersion: string;
|
|
50
|
+
}
|
|
51
|
+
/** The loose per-run options a caller may supply. On a resume every one of them must agree. */
|
|
52
|
+
export interface PinnableOptions {
|
|
53
|
+
readonly runId: string;
|
|
54
|
+
readonly seed?: string;
|
|
55
|
+
readonly startedAt?: number;
|
|
56
|
+
readonly yieldEvery?: number;
|
|
57
|
+
readonly stepBudget?: number;
|
|
58
|
+
readonly effectCeiling?: number;
|
|
59
|
+
}
|
|
60
|
+
/** A pin the caller supplied disagrees with the one the run was started under (L5009 / L5008). */
|
|
61
|
+
export declare class PinMismatch extends Error {
|
|
62
|
+
readonly code: "L5008" | "L5009";
|
|
63
|
+
readonly pin: string;
|
|
64
|
+
readonly recorded: string | number;
|
|
65
|
+
readonly supplied: string | number;
|
|
66
|
+
constructor(code: "L5008" | "L5009", pin: string, recorded: string | number, supplied: string | number, message: string);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Resolve the pin set for a FRESH run. `now` is the host clock, read exactly once: the logical
|
|
70
|
+
* epoch is a recorded fact from here on, so a second read could not be the same run's epoch.
|
|
71
|
+
*/
|
|
72
|
+
export declare function resolvePins(options: PinnableOptions, now: number): RunPins;
|
|
73
|
+
/**
|
|
74
|
+
* Bind a RESUME to the recorded pins, refusing any caller value that disagrees.
|
|
75
|
+
*
|
|
76
|
+
* The direction matters and is the whole rule: an absent option takes the record, a present one
|
|
77
|
+
* that AGREES is harmless, and a present one that differs is refused rather than honoured. Honouring
|
|
78
|
+
* it would silently make this a different run against the same journal, which is the same failure
|
|
79
|
+
* an edited sleep duration causes and gets the same fail-loud treatment.
|
|
80
|
+
*/
|
|
81
|
+
export declare function bindPins(recorded: RunPins, options: PinnableOptions): RunPins;
|
|
82
|
+
//# sourceMappingURL=pins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pins.d.ts","sourceRoot":"","sources":["../src/pins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,eAAO,MAAM,YAAY;;;;EAIvB,CAAC;AAEH,8FAA8F;AA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,OAAO,EAAE,eAAe,GAAG,OAAO,CA6B7E"}
|
package/dist/pins.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run's pins: the resolved values that select which effects a run performs.
|
|
3
|
+
*
|
|
4
|
+
* A run is not pinned by its source alone. The seed decides pure draws, the logical epoch decides
|
|
5
|
+
* what `now()` returns before the first effect, and the three limits decide whether a loop
|
|
6
|
+
* completes or raises. Two runs of one program under different pins are two different runs, so the
|
|
7
|
+
* pins are resolved once at start, recorded, and read back on every resume.
|
|
8
|
+
*
|
|
9
|
+
* The RESOLVED value is what is pinned. Defaulting the seed from the run id is fine; defaulting it
|
|
10
|
+
* again on the next host is not, because "the default" is a property of the interpreter and the
|
|
11
|
+
* interpreter is the thing that may have changed.
|
|
12
|
+
*/
|
|
13
|
+
import { CATALOG } from "./errors.js";
|
|
14
|
+
/**
|
|
15
|
+
* The interpreter's own semantic version, bumped when a release changes what a program MEANS: the
|
|
16
|
+
* PRNG, a builtin, numeric behaviour, or walker scheduling.
|
|
17
|
+
*
|
|
18
|
+
* Deliberately NOT the package version. `@cotal-ai/lang` versions in lockstep with every other
|
|
19
|
+
* package in the repo, so a release of an unrelated package would otherwise invalidate every open
|
|
20
|
+
* run in the space — a loud failure with no cause behind it, which is worse than no check at all.
|
|
21
|
+
*
|
|
22
|
+
* It is here because source and seed are not sufficient across an upgrade: unchanged source can
|
|
23
|
+
* take a different branch BEFORE the first effect, where there is no input hash to compare against
|
|
24
|
+
* and nothing to diverge on.
|
|
25
|
+
*/
|
|
26
|
+
export const LANGUAGE_VERSION = "1";
|
|
27
|
+
export const PIN_DEFAULTS = Object.freeze({
|
|
28
|
+
yieldEvery: 1_024,
|
|
29
|
+
stepBudget: 1_000_000,
|
|
30
|
+
effectCeiling: 10_000,
|
|
31
|
+
});
|
|
32
|
+
/** A pin the caller supplied disagrees with the one the run was started under (L5009 / L5008). */
|
|
33
|
+
export class PinMismatch extends Error {
|
|
34
|
+
code;
|
|
35
|
+
pin;
|
|
36
|
+
recorded;
|
|
37
|
+
supplied;
|
|
38
|
+
constructor(code, pin, recorded, supplied, message) {
|
|
39
|
+
super(`${code} ${CATALOG[code]}\n\n${message}`);
|
|
40
|
+
this.code = code;
|
|
41
|
+
this.pin = pin;
|
|
42
|
+
this.recorded = recorded;
|
|
43
|
+
this.supplied = supplied;
|
|
44
|
+
this.name = "PinMismatch";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolve the pin set for a FRESH run. `now` is the host clock, read exactly once: the logical
|
|
49
|
+
* epoch is a recorded fact from here on, so a second read could not be the same run's epoch.
|
|
50
|
+
*/
|
|
51
|
+
export function resolvePins(options, now) {
|
|
52
|
+
return Object.freeze({
|
|
53
|
+
seed: options.seed ?? options.runId,
|
|
54
|
+
startedAt: options.startedAt ?? now,
|
|
55
|
+
yieldEvery: options.yieldEvery ?? PIN_DEFAULTS.yieldEvery,
|
|
56
|
+
stepBudget: options.stepBudget ?? PIN_DEFAULTS.stepBudget,
|
|
57
|
+
effectCeiling: options.effectCeiling ?? PIN_DEFAULTS.effectCeiling,
|
|
58
|
+
languageVersion: LANGUAGE_VERSION,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Bind a RESUME to the recorded pins, refusing any caller value that disagrees.
|
|
63
|
+
*
|
|
64
|
+
* The direction matters and is the whole rule: an absent option takes the record, a present one
|
|
65
|
+
* that AGREES is harmless, and a present one that differs is refused rather than honoured. Honouring
|
|
66
|
+
* it would silently make this a different run against the same journal, which is the same failure
|
|
67
|
+
* an edited sleep duration causes and gets the same fail-loud treatment.
|
|
68
|
+
*/
|
|
69
|
+
export function bindPins(recorded, options) {
|
|
70
|
+
if (recorded.languageVersion !== LANGUAGE_VERSION) {
|
|
71
|
+
throw new PinMismatch("L5008", "languageVersion", recorded.languageVersion, LANGUAGE_VERSION, `This run started under language version ${recorded.languageVersion} and this interpreter is version ${LANGUAGE_VERSION}. Source and seed do not pin behaviour across a semantics change: unchanged source can take a different branch before the first effect, where there is no input hash to diverge on.\n\nOptions\n resume on the recorded version\n fork(run, <step>) start a new run on this version, keeping the prefix`);
|
|
72
|
+
}
|
|
73
|
+
const checks = [
|
|
74
|
+
["seed", options.seed, recorded.seed],
|
|
75
|
+
["startedAt", options.startedAt, recorded.startedAt],
|
|
76
|
+
["yieldEvery", options.yieldEvery, recorded.yieldEvery],
|
|
77
|
+
["stepBudget", options.stepBudget, recorded.stepBudget],
|
|
78
|
+
["effectCeiling", options.effectCeiling, recorded.effectCeiling],
|
|
79
|
+
];
|
|
80
|
+
for (const [pin, supplied, value] of checks) {
|
|
81
|
+
if (supplied !== undefined && supplied !== value) {
|
|
82
|
+
throw new PinMismatch("L5009", pin, value, supplied, `This run is pinned to ${pin} ${JSON.stringify(value)} and the caller supplied ${JSON.stringify(supplied)}. Pins select which effects run, so a different value is a different run against a journal that was not written for it.\n\nOptions\n resume without the override\n fork(run, <step>) re-run from a step under the new ${pin}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return recorded;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=pins.js.map
|
package/dist/pins.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pins.js","sourceRoot":"","sources":["../src/pins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,SAAS;IACrB,aAAa,EAAE,MAAM;CACtB,CAAC,CAAC;AAiCH,kGAAkG;AAClG,MAAM,OAAO,WAAY,SAAQ,KAAK;IAEzB;IACA;IACA;IACA;IAJX,YACW,IAAuB,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AS,CAAC;QACpD,CAAC,YAAY,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC;QACvD,CAAC,YAAY,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC;QACvD,CAAC,eAAe,EAAE,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAC;KACjE,CAAC;IACF,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QAC5C,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;YACjD,MAAM,IAAI,WAAW,CACnB,OAAO,EACP,GAAG,EACH,KAAK,EACL,QAAQ,EACR,yBAAyB,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,4BAA4B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,6NAA6N,GAAG,EAAE,CAC5U,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/primitives.d.ts
CHANGED
|
@@ -56,8 +56,22 @@ export declare const EVENT_CONSTRUCTORS: Readonly<Record<string, CalleeDoc>>;
|
|
|
56
56
|
export declare const PURE_PRIMITIVES: Readonly<Record<string, CalleeDoc>>;
|
|
57
57
|
/** The builtin library. Small on purpose (design doc 4). */
|
|
58
58
|
export declare const BUILTINS: readonly string[];
|
|
59
|
+
/**
|
|
60
|
+
* Value names: identifiers that name a value rather than a function, and may not be shadowed.
|
|
61
|
+
*
|
|
62
|
+
* `undefined` is what a missing field, an out-of-range index, and a function without a `return`
|
|
63
|
+
* produce, so a program has to be able to name it to test for it. It stays a value that cannot
|
|
64
|
+
* cross an effect boundary (L3041): the journal records `null` for "no value", never `undefined`.
|
|
65
|
+
*/
|
|
66
|
+
export declare const VALUE_NAMES: readonly string[];
|
|
59
67
|
/** Every name the program may reference without defining it, and may never shadow. */
|
|
60
68
|
export declare const RESERVED_NAMES: ReadonlySet<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Host globals a program might reach for out of habit, each rejected by name (L2012) with the
|
|
71
|
+
* replacement this language offers, when it offers one. A name with no replacement carries the
|
|
72
|
+
* generic fix.
|
|
73
|
+
*/
|
|
74
|
+
export declare const HOST_GLOBAL_HINTS: Readonly<Record<string, string>>;
|
|
61
75
|
/** Host globals a program might reach for out of habit, each rejected by name (L2012). */
|
|
62
76
|
export declare const FORBIDDEN_GLOBALS: ReadonlySet<string>;
|
|
63
77
|
/** The Promise API, rejected separately so its error can point at the right replacement (L2011). */
|
package/dist/primitives.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,8EAA8E;AAC9E,eAAO,MAAM,YAAY,mGAUf,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,kGAAkG;AAClG,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACjC,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;2FAEuF;IACvF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;;;;;OAQG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC,CAAC,CAAC;IACrE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AM,GAAG,SAAS,GAAG,SAAS,CAEhE"}
|
package/dist/primitives.js
CHANGED
|
@@ -223,21 +223,61 @@ export const BUILTINS = Object.freeze([
|
|
|
223
223
|
// tamed nondeterminism
|
|
224
224
|
"random", "randomInt", "pick", "now", "duration",
|
|
225
225
|
]);
|
|
226
|
+
/**
|
|
227
|
+
* Value names: identifiers that name a value rather than a function, and may not be shadowed.
|
|
228
|
+
*
|
|
229
|
+
* `undefined` is what a missing field, an out-of-range index, and a function without a `return`
|
|
230
|
+
* produce, so a program has to be able to name it to test for it. It stays a value that cannot
|
|
231
|
+
* cross an effect boundary (L3041): the journal records `null` for "no value", never `undefined`.
|
|
232
|
+
*/
|
|
233
|
+
export const VALUE_NAMES = Object.freeze(["undefined"]);
|
|
226
234
|
/** Every name the program may reference without defining it, and may never shadow. */
|
|
227
235
|
export const RESERVED_NAMES = new Set([
|
|
228
236
|
...Object.keys(PRIMITIVES),
|
|
229
237
|
...Object.keys(EVENT_CONSTRUCTORS),
|
|
230
238
|
...Object.keys(PURE_PRIMITIVES),
|
|
231
239
|
...BUILTINS,
|
|
232
|
-
|
|
233
|
-
"all",
|
|
240
|
+
...VALUE_NAMES,
|
|
234
241
|
]);
|
|
242
|
+
/**
|
|
243
|
+
* Host globals a program might reach for out of habit, each rejected by name (L2012) with the
|
|
244
|
+
* replacement this language offers, when it offers one. A name with no replacement carries the
|
|
245
|
+
* generic fix.
|
|
246
|
+
*/
|
|
247
|
+
export const HOST_GLOBAL_HINTS = Object.freeze({
|
|
248
|
+
Math: "Use `min`, `max`, `abs`, `floor`, `ceil`, `round`, `random()` and `randomInt(n)`.",
|
|
249
|
+
JSON: "Use `json.parse(text)` and `json.stringify(value)`.",
|
|
250
|
+
Object: "Use `keys`, `values`, `entries`, `has` and `merge`.",
|
|
251
|
+
Array: "Write an array literal, or `range(n)`; `xs.length` and the array methods are available.",
|
|
252
|
+
Number: "Use `parseNumber(text)`; arithmetic needs no conversion.",
|
|
253
|
+
String: "Use a template literal: `${value}`.",
|
|
254
|
+
Boolean: "Use `!!value`, or compare explicitly.",
|
|
255
|
+
parseInt: "Use `floor(parseNumber(text))`.",
|
|
256
|
+
parseFloat: "Use `parseNumber(text)`.",
|
|
257
|
+
isNaN: "Use `parseNumber(text) !== parseNumber(text)`; a NaN cannot cross an effect boundary anyway.",
|
|
258
|
+
isFinite: "Check the input before parsing it; an infinite number cannot cross an effect boundary.",
|
|
259
|
+
Infinity: "There is no infinity here: it has no canonical form and cannot cross an effect boundary.",
|
|
260
|
+
NaN: "There is no NaN value to name here: it has no canonical form and cannot cross an effect boundary.",
|
|
261
|
+
Date: "Use `now()`, which reads the run clock, and `duration(text)` for spans.",
|
|
262
|
+
Map: "Use a record: `{}` with `has`, `keys` and `entries`.",
|
|
263
|
+
Set: "Use an array with `unique`, `contains` and `filter`.",
|
|
264
|
+
Error: "Throw a record: `throw { code: \"my-error\", message: \"...\" }`.",
|
|
265
|
+
console: "Use `log(...values)`.",
|
|
266
|
+
setTimeout: "Use `sleep(duration)`.",
|
|
267
|
+
setInterval: "Use a loop with `sleep(duration)` inside it.",
|
|
268
|
+
});
|
|
235
269
|
/** Host globals a program might reach for out of habit, each rejected by name (L2012). */
|
|
236
270
|
export const FORBIDDEN_GLOBALS = new Set([
|
|
237
|
-
|
|
238
|
-
"
|
|
239
|
-
"
|
|
271
|
+
...Object.keys(HOST_GLOBAL_HINTS),
|
|
272
|
+
"globalThis", "global", "window", "self", "process", "fetch",
|
|
273
|
+
"RegExp", "Reflect", "Proxy", "Symbol", "WeakMap", "WeakSet", "WeakRef", "Function",
|
|
274
|
+
"setImmediate", "queueMicrotask", "require", "module",
|
|
240
275
|
"exports", "__dirname", "__filename", "Buffer", "crypto", "performance", "structuredClone",
|
|
276
|
+
"eval", "arguments", "BigInt", "Intl", "Atomics", "SharedArrayBuffer", "ArrayBuffer",
|
|
277
|
+
"DataView", "TextEncoder", "TextDecoder", "URL", "URLSearchParams", "AbortController",
|
|
278
|
+
"encodeURIComponent", "decodeURIComponent", "encodeURI", "decodeURI", "escape", "unescape",
|
|
279
|
+
"Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array",
|
|
280
|
+
"Uint32Array", "Float32Array", "Float64Array", "BigInt64Array", "BigUint64Array",
|
|
241
281
|
]);
|
|
242
282
|
/** The Promise API, rejected separately so its error can point at the right replacement (L2011). */
|
|
243
283
|
export const PROMISE_NAMES = new Set(["Promise"]);
|
package/dist/primitives.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO;IACP,MAAM;IACN,KAAK;IACL,YAAY;IACZ,OAAO;IACP,MAAM;IACN,QAAQ;IACR,SAAS;IACT,UAAU;CACF,CAAC;AA2CX,MAAM,CAAC,MAAM,UAAU,GAA4C,MAAM,CAAC,MAAM,CAAC;IAC/E,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC;QAC/E,SAAS,EAAE,CAAC;QACZ,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC;QAC3C,aAAa,EAAE,IAAI;QACnB,UAAU,EAAE,KAAK;QACjB,SAAS,EACP,kGAAkG;QACpG,GAAG,EAAE,2HAA2H;QAChI,OAAO,EAAE,4EAA4E;KACtF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,YAAY,EAAE,IAAI;QAClB,OAAO,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;QAC7B,SAAS,EAAE,CAAC;QACZ,aAAa,EAAE,CAAC,UAAU,CAAC;QAC3B,aAAa,EAAE,I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mB,EAAE,aAAa;IACpF,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,iBAAiB,EAAE,iBAAiB;IACrF,oBAAoB,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU;IAC1F,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY;IACzF,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB;CACjF,CAAC,CAAC;AAEH,oGAAoG;AACpG,MAAM,CAAC,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAEvE,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,sCAAsC,CAAC;AAEnE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,sDAAsD;IACtD,OAAO,EAAE,YAAY;IACrB,WAAW,EAAE,sCAAsC;IACnD,aAAa,EAAE,CAAC;IAChB,qBAAqB,EAAE,GAAG;CAC3B,CAAC,CAAC;AAEH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AAC/E,CAAC"}
|
package/dist/sim.d.ts
CHANGED
|
@@ -52,6 +52,14 @@ interface Consumption {
|
|
|
52
52
|
* Every effect resolves from the script or fails loudly. Sleeps are instant and advance the
|
|
53
53
|
* virtual clock by the duration the program asked for, so a program that waits four hours is
|
|
54
54
|
* tested in microseconds without pretending the wait did not happen.
|
|
55
|
+
*
|
|
56
|
+
* ONE clock, advanced in ask order — deliberately, and worth saying here because this file is
|
|
57
|
+
* where a reader would conclude otherwise: concurrent branches do NOT get independent virtual
|
|
58
|
+
* time. Two racing sleeps advance the same clock as their requests arrive, so under simulation a
|
|
59
|
+
* race is decided by ask order (then declaration order), not by which duration is shorter. The
|
|
60
|
+
* run clocks (`RunClock`, per branch) sit above this and stay per-branch; it is the TIMEBASE the
|
|
61
|
+
* simulator feeds them that is shared. A live handler with real waiting behaves differently, and
|
|
62
|
+
* `scopes.smoke` section 1b is the cell that pins the difference.
|
|
55
63
|
*/
|
|
56
64
|
export declare class SimHandler implements EffectHandler {
|
|
57
65
|
readonly script: SimScript;
|
|
@@ -82,7 +90,7 @@ export declare class SimHandler implements EffectHandler {
|
|
|
82
90
|
* the disposition would bake it into the record exactly as a production handler would.
|
|
83
91
|
*/
|
|
84
92
|
checkpoint(_req: CheckpointRequest, ctx: EffectContext): Promise<CheckpointRaw>;
|
|
85
|
-
/** Instant
|
|
93
|
+
/** Instant: the SHARED virtual clock moves by what the program asked to wait (see the class note). */
|
|
86
94
|
sleep(req: SleepRequest, ctx: EffectContext): Promise<null>;
|
|
87
95
|
wait(req: WaitRequest, ctx: EffectContext): Promise<unknown | null>;
|
|
88
96
|
notify(_req: NotifyRequest, ctx: EffectContext): Promise<null>;
|
package/dist/sim.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim.d.ts","sourceRoot":"","sources":["../src/sim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,WAAW,EACZ,MAAM,cAAc,CAAC;AAKtB,+FAA+F;AAC/F,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,iGAAiG;IACjG,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC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every effect resolves from the script or fails loudly. Sleeps are instant and advance the
|
|
30
30
|
* virtual clock by the duration the program asked for, so a program that waits four hours is
|
|
31
31
|
* tested in microseconds without pretending the wait did not happen.
|
|
32
|
+
*
|
|
33
|
+
* ONE clock, advanced in ask order — deliberately, and worth saying here because this file is
|
|
34
|
+
* where a reader would conclude otherwise: concurrent branches do NOT get independent virtual
|
|
35
|
+
* time. Two racing sleeps advance the same clock as their requests arrive, so under simulation a
|
|
36
|
+
* race is decided by ask order (then declaration order), not by which duration is shorter. The
|
|
37
|
+
* run clocks (`RunClock`, per branch) sit above this and stay per-branch; it is the TIMEBASE the
|
|
38
|
+
* simulator feeds them that is shared. A live handler with real waiting behaves differently, and
|
|
39
|
+
* `scopes.smoke` section 1b is the cell that pins the difference.
|
|
32
40
|
*/
|
|
33
41
|
export class SimHandler {
|
|
34
42
|
script;
|
|
@@ -134,7 +142,7 @@ export class SimHandler {
|
|
|
134
142
|
at: this.virtualNow,
|
|
135
143
|
};
|
|
136
144
|
}
|
|
137
|
-
/** Instant
|
|
145
|
+
/** Instant: the SHARED virtual clock moves by what the program asked to wait (see the class note). */
|
|
138
146
|
async sleep(req, ctx) {
|
|
139
147
|
this.checkFault(ctx);
|
|
140
148
|
this.advance(parseDuration(req.duration));
|
package/dist/sim.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim.js","sourceRoot":"","sources":["../src/sim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAoBH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AA8B1C,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAEhC;IACA;IAFX,YACW,IAAY,EACZ,OAAe,EACxB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAJN,SAAI,GAAJ,IAAI,CAAQ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AG,CAAC,EAAE,EAAE,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAAqB,EAAE,GAAkB;QAC3D,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iGAAiG;IAEjG;;;OAGG;IACH,YAAY;QACV,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACvE,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,KAAK,MAAM,KAAK,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,CAAU,EAAE,CAAC;YACxE,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,CAAC,KAAK,SAAS;gBAAE,SAAS;YAC9B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,IAAI,IAAI,EAAE,CAAC;oBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,EAAE,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,wEAAwE;IACxE,SAAS;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
package/dist/syntax.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The syntax table: every node type acorn can produce, sorted into the sets the language is made of.
|
|
3
|
+
*
|
|
4
|
+
* ONE TABLE, READ BY BOTH HALVES. The validator admits exactly {@link ADMITTED_NODES} and
|
|
5
|
+
* {@link STRUCTURAL_NODES}, refuses each row of {@link FORBIDDEN_NODES} with its own code, and refuses
|
|
6
|
+
* everything else with L1029. The interpreter executes exactly the admitted set. `surface.smoke`
|
|
7
|
+
* holds the two halves to this file: every admitted node type is executed by a program, every
|
|
8
|
+
* `case` label in the interpreter's node switches is on this table, and every node type acorn knows
|
|
9
|
+
* lands in exactly one set. Before this table existed the two halves were two hand-kept lists, and
|
|
10
|
+
* `x++`, `?.`, rest parameters and `**` were admitted by one and refused by the other.
|
|
11
|
+
*/
|
|
12
|
+
import type { LangErrorCode } from "./errors.js";
|
|
13
|
+
/** Node types the interpreter executes. A validated program is made of these and nothing else. */
|
|
14
|
+
export declare const ADMITTED_NODES: ReadonlySet<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Node types that only occur INSIDE an admitted node and are executed as part of it: a `Property`
|
|
17
|
+
* inside an object literal, a `SwitchCase` inside a `switch`, a pattern inside a declaration.
|
|
18
|
+
*/
|
|
19
|
+
export declare const STRUCTURAL_NODES: ReadonlySet<string>;
|
|
20
|
+
/** Node types rejected outright, with the code and the repair to suggest. */
|
|
21
|
+
export declare const FORBIDDEN_NODES: Readonly<Record<string, {
|
|
22
|
+
readonly code: LangErrorCode;
|
|
23
|
+
readonly cause: string;
|
|
24
|
+
readonly fix: string;
|
|
25
|
+
}>>;
|
|
26
|
+
/** Node types that occur only inside a forbidden node and are reported through their parent's row. */
|
|
27
|
+
export declare const FORBIDDEN_CHILDREN: readonly string[];
|
|
28
|
+
/**
|
|
29
|
+
* Every node type acorn 8 emits for `ecmaVersion: 2023, sourceType: "module"`, whether or not it
|
|
30
|
+
* is in the language. `surface.smoke` asserts each one lands in exactly one of the sets above, so a
|
|
31
|
+
* node type acorn adds or one this file forgets is a red suite rather than a runtime surprise.
|
|
32
|
+
*/
|
|
33
|
+
export declare const KNOWN_NODES: readonly string[];
|
|
34
|
+
//# sourceMappingURL=syntax.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax.d.ts","sourceRoot":"","sources":["../src/syntax.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,kGAAkG;AAClG,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAoC7C,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAW/C,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,eAAe,EAAE,QAAQ,CACpC,MAAM,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAuF9F,CAAC;AAEH,sGAAsG;AACtG,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAW9C,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAKvC,CAAC"}
|