@aftertext/compiler 0.1.0 → 0.3.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 +31 -1
- package/dist/ast/expression.d.ts +1 -1
- package/dist/ast/index.d.ts +2 -2
- package/dist/ast/index.d.ts.map +1 -1
- package/dist/ast/presentation.d.ts +18 -4
- package/dist/ast/presentation.d.ts.map +1 -1
- package/dist/ast/presentation.js +4 -3
- package/dist/ast/presentation.js.map +1 -1
- package/dist/ast/story.d.ts +30 -16
- package/dist/ast/story.d.ts.map +1 -1
- package/dist/diagnostics/codes.d.ts +6 -0
- package/dist/diagnostics/codes.d.ts.map +1 -1
- package/dist/diagnostics/codes.js +25 -1
- package/dist/diagnostics/codes.js.map +1 -1
- package/dist/diagnostics/types.d.ts +1 -1
- package/dist/diagnostics/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +16 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +16 -0
- package/dist/limits.js.map +1 -0
- package/dist/parser/blocks.d.ts +1 -1
- package/dist/parser/blocks.d.ts.map +1 -1
- package/dist/parser/blocks.js +425 -117
- package/dist/parser/blocks.js.map +1 -1
- package/dist/parser/directive-line.d.ts +8 -2
- package/dist/parser/directive-line.d.ts.map +1 -1
- package/dist/parser/directive-line.js +23 -6
- package/dist/parser/directive-line.js.map +1 -1
- package/dist/parser/expression-lexer.d.ts +19 -1
- package/dist/parser/expression-lexer.d.ts.map +1 -1
- package/dist/parser/expression-lexer.js +31 -2
- package/dist/parser/expression-lexer.js.map +1 -1
- package/dist/parser/expression-parser.d.ts.map +1 -1
- package/dist/parser/expression-parser.js +58 -16
- package/dist/parser/expression-parser.js.map +1 -1
- package/dist/parser/frontmatter.d.ts.map +1 -1
- package/dist/parser/frontmatter.js +65 -7
- package/dist/parser/frontmatter.js.map +1 -1
- package/dist/parser/lexical-primitives.d.ts +2 -2
- package/dist/parser/lexical-primitives.js +2 -2
- package/dist/parser/lines.d.ts.map +1 -1
- package/dist/parser/lines.js +9 -2
- package/dist/parser/lines.js.map +1 -1
- package/dist/parser/markdown.d.ts.map +1 -1
- package/dist/parser/markdown.js +39 -13
- package/dist/parser/markdown.js.map +1 -1
- package/dist/parser/serializer-safety.d.ts +4 -3
- package/dist/parser/serializer-safety.d.ts.map +1 -1
- package/dist/parser/serializer-safety.js +4 -3
- package/dist/parser/serializer-safety.js.map +1 -1
- package/dist/validation/validate.d.ts.map +1 -1
- package/dist/validation/validate.js +5 -4
- package/dist/validation/validate.js.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Compiles prose-first AfterText source into a validated `StoryDocument`.
|
|
4
4
|
|
|
5
|
-
> v0.
|
|
5
|
+
> v0.3.0: the language and public API are early and may change.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -34,6 +34,36 @@ console.log(result.document);
|
|
|
34
34
|
The compiler returns best-effort output plus structured diagnostics. AfterText
|
|
35
35
|
source is declarative and cannot execute arbitrary JavaScript.
|
|
36
36
|
|
|
37
|
+
## Source-generation helpers
|
|
38
|
+
|
|
39
|
+
Two small predicates are exported from the package root for tools that
|
|
40
|
+
**generate or edit AfterText source** (for example a structured editor or an
|
|
41
|
+
importer). They are source-editing/tooling helpers, not part of the narrative
|
|
42
|
+
runtime, and nothing in `@aftertext/runtime`, `@aftertext/player`, or
|
|
43
|
+
`@aftertext/web-renderer` uses them. They have been public since `0.1.0` and
|
|
44
|
+
remain part of the public API.
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import {
|
|
48
|
+
isChoiceTargetBoundarySafe,
|
|
49
|
+
isPresentationNamedArgumentValueBoundarySafe
|
|
50
|
+
} from "@aftertext/compiler";
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- `isChoiceTargetBoundarySafe(value: string): boolean` — `false` if `value`
|
|
54
|
+
contains separator whitespace or an unescaped `->`. Interpolated into a
|
|
55
|
+
`@choice` item, such a value could be re-read by the parser as an extra `if`
|
|
56
|
+
condition or as a different item/target split instead of a single
|
|
57
|
+
unconditional scene target.
|
|
58
|
+
- `isPresentationNamedArgumentValueBoundarySafe(value: string): boolean` —
|
|
59
|
+
`false` if `value` contains separator whitespace. Interpolated into a named
|
|
60
|
+
presentation argument (such as `volume=…`, `to=…`, or `duration=…`), such a
|
|
61
|
+
value could add or truncate a parameter.
|
|
62
|
+
|
|
63
|
+
Both checks are lexical and conservative. They are not validators: a value can
|
|
64
|
+
pass and still be rejected by the compiler (for example a non-numeric
|
|
65
|
+
`volume`), and the compiler's own diagnostics remain the source of truth.
|
|
66
|
+
|
|
37
67
|
## License
|
|
38
68
|
|
|
39
69
|
MIT
|
package/dist/ast/expression.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface BinaryExpression {
|
|
|
32
32
|
* library exist. `callee` is a plain name, never itself an expression (no
|
|
33
33
|
* member calls, no calling a computed value) — only a small, fixed set of
|
|
34
34
|
* compiler/runtime-approved builtin names may execute (see
|
|
35
|
-
* docs/
|
|
35
|
+
* docs/CORE_SPEC.md Section 17.14). `args` stays structurally general
|
|
36
36
|
* (ordinary comma-separated expressions) so a future builtin with a
|
|
37
37
|
* different argument contract does not require redesigning this node;
|
|
38
38
|
* individual builtins impose their own, narrower argument rules through
|
package/dist/ast/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { SourcePosition, SourceSpan } from "./span.js";
|
|
2
2
|
export type { LiteralValue, UnaryOperator, BinaryOperator, LiteralExpression, IdentifierExpression, UnaryExpression, BinaryExpression, CallExpression, ExpressionNode } from "./expression.js";
|
|
3
3
|
export type { TextInline, EmphasisInline, StrongInline, InlineCodeInline, LinkInline, LineBreakInline, InlineNode } from "./inline.js";
|
|
4
|
-
export type { BackgroundCommand, LayerCommand, CameraAction, CameraZoomCommand, CameraCommand, MusicCommand, SfxCommand, PauseCommand, PresentationCommand } from "./presentation.js";
|
|
5
|
-
export type { StateValue, StoryStateDefinition, StoryMetadata, ParagraphNode, HeadingNode, PresentationNode, SetNode, GotoNode, ChoiceItem, ChoiceNode, ConditionalBranchKind, ConditionalBranch, ConditionalNode, VariantBranchKind, VariantBranch, VariantNode, StoryBlock, SceneNode, StoryDocument } from "./story.js";
|
|
4
|
+
export type { BackgroundCommand, LayerCommand, CameraAction, CameraZoomCommand, CameraCommand, MusicCommand, SfxCommand, PauseCommand, SpritePosition, ShowSpriteCommand, HideSpriteCommand, SpriteCommand, PresentationCommand } from "./presentation.js";
|
|
5
|
+
export type { StateValue, StoryStateDefinition, StoryMetadata, ParagraphNode, HeadingNode, DialogueNode, PresentationNode, SetNode, GotoNode, ChoiceItem, ChoiceNode, ConditionalBranchKind, ConditionalBranch, ConditionalNode, VariantBranchKind, VariantBranch, VariantNode, StoryBlock, SceneNode, StoryDocument } from "./story.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ast/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ast/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5D,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,aAAa,EACd,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ast/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5D,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,aAAa,EACd,MAAM,YAAY,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Typed presentation commands for @background, @layer, @camera, @music,
|
|
3
|
-
* @sfx, and @
|
|
4
|
-
* `6s` / `1200ms` -> milliseconds), and validation of these
|
|
5
|
-
* runtime code consumes typed values and never re-parses
|
|
3
|
+
* @sfx, @pause, and @sprite. The compiler owns parsing, unit normalization
|
|
4
|
+
* (e.g. `6s` / `1200ms` -> milliseconds), and validation of these
|
|
5
|
+
* directives, so runtime code consumes typed values and never re-parses
|
|
6
|
+
* directive text.
|
|
6
7
|
*/
|
|
7
8
|
export interface BackgroundCommand {
|
|
8
9
|
readonly type: "Background";
|
|
@@ -37,5 +38,18 @@ export interface PauseCommand {
|
|
|
37
38
|
/** Milliseconds. */
|
|
38
39
|
readonly durationMs: number;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
/** v0.2.0 defines exactly three named stage positions (docs/CORE_SPEC.md Section 31.10). */
|
|
42
|
+
export type SpritePosition = "left" | "center" | "right";
|
|
43
|
+
export interface ShowSpriteCommand {
|
|
44
|
+
readonly type: "ShowSprite";
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly image: string;
|
|
47
|
+
readonly position: SpritePosition;
|
|
48
|
+
}
|
|
49
|
+
export interface HideSpriteCommand {
|
|
50
|
+
readonly type: "HideSprite";
|
|
51
|
+
readonly id: string;
|
|
52
|
+
}
|
|
53
|
+
export type SpriteCommand = ShowSpriteCommand | HideSpriteCommand;
|
|
54
|
+
export type PresentationCommand = BackgroundCommand | LayerCommand | CameraCommand | MusicCommand | SfxCommand | PauseCommand | SpriteCommand;
|
|
41
55
|
//# sourceMappingURL=presentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../src/ast/presentation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../src/ast/presentation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,iBAAiB;IAChC,QAAQ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QAAQ,EAAE,cAAc,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAC3B,iBAAiB,GACjB,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,aAAa,CAAC"}
|
package/dist/ast/presentation.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Typed presentation commands for @background, @layer, @camera, @music,
|
|
3
|
-
* @sfx, and @
|
|
4
|
-
* `6s` / `1200ms` -> milliseconds), and validation of these
|
|
5
|
-
* runtime code consumes typed values and never re-parses
|
|
3
|
+
* @sfx, @pause, and @sprite. The compiler owns parsing, unit normalization
|
|
4
|
+
* (e.g. `6s` / `1200ms` -> milliseconds), and validation of these
|
|
5
|
+
* directives, so runtime code consumes typed values and never re-parses
|
|
6
|
+
* directive text.
|
|
6
7
|
*/
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=presentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation.js","sourceRoot":"","sources":["../../src/ast/presentation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"presentation.js","sourceRoot":"","sources":["../../src/ast/presentation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/dist/ast/story.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface HeadingNode {
|
|
|
33
33
|
* trailing Heading syntax/whitespace, the Setext underline (and its
|
|
34
34
|
* indentation), and the line ending. Non-optional: an empty ATX Heading
|
|
35
35
|
* (e.g. `#`) still has a valid zero-width `contentSourceSpan` rather than
|
|
36
|
-
* `undefined` — see docs/
|
|
36
|
+
* `undefined` — see docs/CORE_SPEC.md Section 25.49. This is the sole
|
|
37
37
|
* patch target for Heading Structured Editing; never reconstruct source
|
|
38
38
|
* from `children`, which is not lossless (delimiter choice, escaping,
|
|
39
39
|
* spacing, and closing-hash/underline syntax are not AST-preserved).
|
|
@@ -50,16 +50,26 @@ export interface HeadingNode {
|
|
|
50
50
|
* Non-optional: every Heading has a valid, non-zero-width level span.
|
|
51
51
|
* This is the sole patch target for Heading Level Editing — changing only
|
|
52
52
|
* this span changes `depth` while preserving authored style and content
|
|
53
|
-
* exactly. docs/
|
|
53
|
+
* exactly. docs/CORE_SPEC.md Section 25.50.
|
|
54
54
|
*/
|
|
55
55
|
readonly levelSourceSpan: SourceSpan;
|
|
56
56
|
}
|
|
57
|
+
export interface DialogueNode {
|
|
58
|
+
readonly type: "Dialogue";
|
|
59
|
+
readonly speaker: string;
|
|
60
|
+
readonly content: readonly InlineNode[];
|
|
61
|
+
readonly span: SourceSpan;
|
|
62
|
+
/** Exact authored speaker value characters, excluding `speaker=` and surrounding whitespace. */
|
|
63
|
+
readonly speakerSourceSpan: SourceSpan;
|
|
64
|
+
/** Equal to the lifted body ParagraphNode's own span (docs/CORE_SPEC.md Section 32.14). */
|
|
65
|
+
readonly contentSourceSpan: SourceSpan;
|
|
66
|
+
}
|
|
57
67
|
export interface PresentationNode {
|
|
58
68
|
readonly type: "Presentation";
|
|
59
69
|
readonly command: PresentationCommand;
|
|
60
70
|
readonly span: SourceSpan;
|
|
61
71
|
/**
|
|
62
|
-
* Compiler/source-tooling metadata (docs/
|
|
72
|
+
* Compiler/source-tooling metadata (docs/CORE_SPEC.md Section 25.36):
|
|
63
73
|
* absolute source spans of each recognized `key=value` parameter's
|
|
64
74
|
* authored VALUE text (e.g. `to=1.20` maps `"to"` to the span slicing
|
|
65
75
|
* exactly `1.20`, never `to=` or surrounding whitespace). Optional on
|
|
@@ -73,7 +83,7 @@ export interface PresentationNode {
|
|
|
73
83
|
*/
|
|
74
84
|
readonly parameterValueSpans?: Readonly<Record<string, SourceSpan>>;
|
|
75
85
|
/**
|
|
76
|
-
* Compiler/source-tooling metadata (docs/
|
|
86
|
+
* Compiler/source-tooling metadata (docs/CORE_SPEC.md Section 25.36):
|
|
77
87
|
* the absolute source span of the directive's single authored positional
|
|
78
88
|
* (non-`key=value`) argument token — e.g. `@pause 0.50s` maps this to the
|
|
79
89
|
* span slicing exactly `0.50s`. Populated if and only if the directive's
|
|
@@ -89,7 +99,7 @@ export interface PresentationNode {
|
|
|
89
99
|
*/
|
|
90
100
|
readonly positionalValueSpan?: SourceSpan;
|
|
91
101
|
/**
|
|
92
|
-
* Compiler/source-tooling metadata (docs/
|
|
102
|
+
* Compiler/source-tooling metadata (docs/CORE_SPEC.md Section 14): the
|
|
93
103
|
* absolute source position immediately after the final non-whitespace
|
|
94
104
|
* character of the directive's authored argument text, before any
|
|
95
105
|
* trailing line whitespace and before the line terminator. Populated for
|
|
@@ -102,7 +112,7 @@ export interface PresentationNode {
|
|
|
102
112
|
*/
|
|
103
113
|
readonly argumentsEndPosition?: SourcePosition;
|
|
104
114
|
/**
|
|
105
|
-
* Compiler/source-tooling metadata (docs/
|
|
115
|
+
* Compiler/source-tooling metadata (docs/CORE_SPEC.md Section 14): for
|
|
106
116
|
* a recognized named (`key=value`) parameter, the absolute source span
|
|
107
117
|
* that, deleted via a single text replacement with `""`, removes exactly
|
|
108
118
|
* that parameter's complete authored `key=value` token plus exactly one
|
|
@@ -120,13 +130,13 @@ export interface PresentationNode {
|
|
|
120
130
|
* authored value) — the same availability-style principle already
|
|
121
131
|
* documented on `positionalValueSpan`. This is generic, directive-kind-
|
|
122
132
|
* agnostic metadata: it may be populated for any recognized named key,
|
|
123
|
-
* including one a particular
|
|
133
|
+
* including one a particular tool does not expose Remove support for.
|
|
124
134
|
* Optional on this public type for the same source-compatibility reason
|
|
125
135
|
* as the other metadata fields above.
|
|
126
136
|
*/
|
|
127
137
|
readonly parameterRemovalSpans?: Readonly<Record<string, SourceSpan>>;
|
|
128
138
|
/**
|
|
129
|
-
* Compiler/source-tooling metadata (docs/
|
|
139
|
+
* Compiler/source-tooling metadata (docs/CORE_SPEC.md Section 14): the
|
|
130
140
|
* absolute source span covering every positional (non-`key=value`) token
|
|
131
141
|
* in the directive's argument text, populated **if and only if** at
|
|
132
142
|
* least one positional token exists AND all positional tokens occupy one
|
|
@@ -149,7 +159,7 @@ export interface PresentationNode {
|
|
|
149
159
|
*/
|
|
150
160
|
readonly contiguousPositionalSpan?: SourceSpan;
|
|
151
161
|
/**
|
|
152
|
-
* Compiler/source-tooling metadata (docs/
|
|
162
|
+
* Compiler/source-tooling metadata (docs/CORE_SPEC.md Section 14): the
|
|
153
163
|
* absolute source span that, deleted via a single text replacement with
|
|
154
164
|
* `""`, removes this entire authored Presentation directive cleanly —
|
|
155
165
|
* `start` is always exactly `span.start` (never adjusted backward into
|
|
@@ -173,6 +183,8 @@ export interface SetNode {
|
|
|
173
183
|
readonly name: string;
|
|
174
184
|
readonly expression: ExpressionNode;
|
|
175
185
|
readonly span: SourceSpan;
|
|
186
|
+
readonly nameSourceSpan: SourceSpan;
|
|
187
|
+
readonly expressionSourceSpan: SourceSpan;
|
|
176
188
|
}
|
|
177
189
|
export interface GotoNode {
|
|
178
190
|
readonly type: "Goto";
|
|
@@ -192,8 +204,10 @@ export interface ChoiceItem {
|
|
|
192
204
|
* tail syntactically contains `target if <condition text>`, independently
|
|
193
205
|
* of whether that condition text later parses successfully — it is a
|
|
194
206
|
* source-tooling fact about the Choice grammar's own tail shape, not a
|
|
195
|
-
* semantic-success signal. `undefined` for an unconditional item
|
|
196
|
-
*
|
|
207
|
+
* semantic-success signal. `undefined` for an unconditional item. A
|
|
208
|
+
* malformed condition has `condition === undefined` while this span is
|
|
209
|
+
* still defined, so test this field (not `condition`) to learn whether a
|
|
210
|
+
* condition was authored.
|
|
197
211
|
*
|
|
198
212
|
* `condition.span` (an `ExpressionNode`'s own span) must NOT be used as a
|
|
199
213
|
* substitute for this field: the expression parser returns the inner node
|
|
@@ -218,7 +232,7 @@ export interface ConditionalBranch {
|
|
|
218
232
|
readonly blocks: readonly StoryBlock[];
|
|
219
233
|
readonly span: SourceSpan;
|
|
220
234
|
/**
|
|
221
|
-
* Compiler/source-tooling metadata (docs/
|
|
235
|
+
* Compiler/source-tooling metadata (docs/CORE_SPEC.md Section 25.36,
|
|
222
236
|
* "Expansion: Nested Presentation Command Insertion"): the exact line-
|
|
223
237
|
* terminator byte sequence immediately following `span.end`, if one
|
|
224
238
|
* exists — `"\n"`, `"\r\n"`, or `""` when `span.end` sits at true end-of-
|
|
@@ -256,7 +270,7 @@ export interface VariantBranch {
|
|
|
256
270
|
readonly blocks: readonly StoryBlock[];
|
|
257
271
|
readonly span: SourceSpan;
|
|
258
272
|
/**
|
|
259
|
-
* Compiler/source-tooling metadata (docs/
|
|
273
|
+
* Compiler/source-tooling metadata (docs/CORE_SPEC.md Section 25.36,
|
|
260
274
|
* "Expansion: Nested Presentation Command Insertion"): identical contract
|
|
261
275
|
* to `ConditionalBranch.followingLineEnding` above — the exact line-
|
|
262
276
|
* terminator byte sequence immediately following `span.end`, `""` only
|
|
@@ -302,21 +316,21 @@ export interface VariantNode {
|
|
|
302
316
|
* distinguish these two forms at the `args` level) — this is a
|
|
303
317
|
* zero-width span (`start.offset === end.offset`) at the parser-computed
|
|
304
318
|
* `argsStartColumn` position, giving source-tooling a coordinate to patch
|
|
305
|
-
* even when no ID text was authored at all. docs/
|
|
319
|
+
* even when no ID text was authored at all. docs/CORE_SPEC.md Section
|
|
306
320
|
* 25.46.
|
|
307
321
|
*/
|
|
308
322
|
readonly idSourceSpan: SourceSpan;
|
|
309
323
|
readonly branches: readonly VariantBranch[];
|
|
310
324
|
readonly span: SourceSpan;
|
|
311
325
|
}
|
|
312
|
-
export type StoryBlock = ParagraphNode | HeadingNode | PresentationNode | SetNode | GotoNode | ChoiceNode | ConditionalNode | VariantNode;
|
|
326
|
+
export type StoryBlock = ParagraphNode | HeadingNode | DialogueNode | PresentationNode | SetNode | GotoNode | ChoiceNode | ConditionalNode | VariantNode;
|
|
313
327
|
export interface SceneNode {
|
|
314
328
|
readonly type: "Scene";
|
|
315
329
|
readonly id: string;
|
|
316
330
|
readonly blocks: readonly StoryBlock[];
|
|
317
331
|
readonly span: SourceSpan;
|
|
318
332
|
/**
|
|
319
|
-
* Compiler/source-tooling metadata (docs/
|
|
333
|
+
* Compiler/source-tooling metadata (docs/CORE_SPEC.md Section 25.35):
|
|
320
334
|
* the exact line-terminator byte sequence immediately following
|
|
321
335
|
* `span.end`, if one exists — `"\n"`, `"\r\n"`, or `""` when `span.end`
|
|
322
336
|
* sits at true end-of-file with no authored terminator to reuse. Carries
|
package/dist/ast/story.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../src/ast/story.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5D,wEAAwE;AACxE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAExE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;CACvC;AAMD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI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AAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAMD,MAAM,MAAM,UAAU,GAClB,aAAa,GACb,WAAW,GACX,YAAY,GACZ,gBAAgB,GAChB,OAAO,GACP,QAAQ,GACR,UAAU,GACV,eAAe,GACf,WAAW,CAAC;AAEhB,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,EAAE,CAAC;CACnD;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC5C;;;;;;;;;OASG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;CACvC"}
|
|
@@ -7,6 +7,10 @@ export declare const Diagnostics: {
|
|
|
7
7
|
readonly unknownSceneReference: (id: string, span: SourceSpan) => Diagnostic;
|
|
8
8
|
readonly malformedChoiceItem: (reason: string, span: SourceSpan) => Diagnostic;
|
|
9
9
|
readonly conditionalBranchAfterElse: (span: SourceSpan) => Diagnostic;
|
|
10
|
+
readonly blocksNestedTooDeeply: (limit: number, span: SourceSpan) => Diagnostic;
|
|
11
|
+
readonly emptySceneId: (span: SourceSpan) => Diagnostic;
|
|
12
|
+
readonly misplacedDirective: (name: string, where: string, span: SourceSpan) => Diagnostic;
|
|
13
|
+
readonly variantContentBeforeBranch: (span: SourceSpan) => Diagnostic;
|
|
10
14
|
readonly duplicateVariantId: (id: string, span: SourceSpan) => Diagnostic;
|
|
11
15
|
readonly variantWithoutWhenBranch: (id: string, span: SourceSpan) => Diagnostic;
|
|
12
16
|
readonly unknownVariantReference: (id: string, span: SourceSpan) => Diagnostic;
|
|
@@ -17,8 +21,10 @@ export declare const Diagnostics: {
|
|
|
17
21
|
readonly wrongBuiltinArity: (name: string, expected: number, actual: number, span: SourceSpan) => Diagnostic;
|
|
18
22
|
readonly invalidBuiltinArgument: (name: string, span: SourceSpan) => Diagnostic;
|
|
19
23
|
readonly unsupportedStateValue: (key: string, span: SourceSpan) => Diagnostic;
|
|
24
|
+
readonly unsupportedStateKey: (key: string, reason: string, span: SourceSpan) => Diagnostic;
|
|
20
25
|
readonly invalidFrontmatter: (reason: string, span: SourceSpan) => Diagnostic;
|
|
21
26
|
readonly malformedPresentation: (reason: string, span: SourceSpan) => Diagnostic;
|
|
27
|
+
readonly malformedDialogue: (reason: string, span: SourceSpan) => Diagnostic;
|
|
22
28
|
readonly presentationNumericNotFinite: (span: SourceSpan) => Diagnostic;
|
|
23
29
|
readonly unsupportedMarkdown: (construct: string, span: SourceSpan) => Diagnostic;
|
|
24
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/diagnostics/codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,YAAY,CAAC;AAWjE,eAAO,MAAM,WAAW;sCACC,MAAM,QAAQ,UAAU,KAAG,UAAU;mCAGxC,MAAM,QAAQ,UAAU,KAAG,U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QtC,MAAM,QAAQ,UAAU,KAAG,UAAU;+CAGjC,MAAM,QAAQ,UAAU,KAAG,UAAU;2CAQzC,MAAM,QAAQ,UAAU,KAAG,UAAU;gDAGhC,UAAU,KAAG,UAAU;oCAQnC,MAAM,QAAQ,UAAU,KAAG,UAAU;uCAGlC,MAAM,YAAY,MAAM,UAAU,MAAM,QAAQ,UAAU,KAAG,UAAU;4CAQlE,MAAM,QAAQ,UAAU,KAAG,UAAU;0CAGvC,MAAM,QAAQ,UAAU,KAAG,UAAU;wCAQvC,MAAM,UAAU,MAAM,QAAQ,UAAU,KAAG,UAAU;0CAGnD,MAAM,QAAQ,UAAU,KAAG,UAAU;6CAGlC,MAAM,QAAQ,UAAU,KAAG,UAAU;yCAOzC,MAAM,QAAQ,UAAU,KAAG,UAAU;kDAG5B,UAAU,KAAG,UAAU;8CAQ3B,MAAM,QAAQ,UAAU,KAAG,UAAU;CAQ5D,CAAC"}
|
|
@@ -20,6 +20,20 @@ export const Diagnostics = {
|
|
|
20
20
|
conditionalBranchAfterElse(span) {
|
|
21
21
|
return diagnostic("error", "AT1006", `A conditional has a branch after "@else": "@else" must be the last branch.`, span);
|
|
22
22
|
},
|
|
23
|
+
blocksNestedTooDeeply(limit, span) {
|
|
24
|
+
return diagnostic("error", "AT1007", `Conditional and variant blocks are nested too deeply (limit ${limit}); the block is skipped.`, span);
|
|
25
|
+
},
|
|
26
|
+
emptySceneId(span) {
|
|
27
|
+
return diagnostic("error", "AT1008", `Scene declaration requires a non-empty id.`, span);
|
|
28
|
+
},
|
|
29
|
+
misplacedDirective(name, where, span) {
|
|
30
|
+
return diagnostic("error", "AT1009", where === "here" && name === "end"
|
|
31
|
+
? `"@end" has no open block to close; the line is ignored.`
|
|
32
|
+
: `"@${name}" is not valid ${where}; the line is ignored.`, span);
|
|
33
|
+
},
|
|
34
|
+
variantContentBeforeBranch(span) {
|
|
35
|
+
return diagnostic("error", "AT1105", `Content before the first "@when" or "@otherwise" belongs to no branch and is ignored.`, span);
|
|
36
|
+
},
|
|
23
37
|
duplicateVariantId(id, span) {
|
|
24
38
|
return diagnostic("error", "AT1101", `Duplicate variant id "${id}".`, span);
|
|
25
39
|
},
|
|
@@ -48,7 +62,10 @@ export const Diagnostics = {
|
|
|
48
62
|
return diagnostic("error", "AT2004", `"${name}" requires a string literal argument.`, span);
|
|
49
63
|
},
|
|
50
64
|
unsupportedStateValue(key, span) {
|
|
51
|
-
return diagnostic("error", "AT1201", `Unsupported initial state value for "${key}": only string, number, boolean, and null are allowed.`, span);
|
|
65
|
+
return diagnostic("error", "AT1201", `Unsupported initial state value for "${key}": only string, finite number, boolean, and null are allowed.`, span);
|
|
66
|
+
},
|
|
67
|
+
unsupportedStateKey(key, reason, span) {
|
|
68
|
+
return diagnostic("error", "AT1201", `Unsupported initial state key "${key}": ${reason}`, span);
|
|
52
69
|
},
|
|
53
70
|
invalidFrontmatter(reason, span) {
|
|
54
71
|
return diagnostic("error", "AT1202", `Invalid frontmatter: ${reason}`, span);
|
|
@@ -56,6 +73,13 @@ export const Diagnostics = {
|
|
|
56
73
|
malformedPresentation(reason, span) {
|
|
57
74
|
return diagnostic("error", "AT1301", `Malformed presentation directive: ${reason}`, span);
|
|
58
75
|
},
|
|
76
|
+
// Dialogue (`@say`) is not a Presentation directive (docs/CORE_SPEC.md
|
|
77
|
+
// Section 32.12) — this sibling helper reuses AT1301's existing
|
|
78
|
+
// one-code-many-reasons convention (Section 32.11) without borrowing
|
|
79
|
+
// malformedPresentation's Presentation-specific wording.
|
|
80
|
+
malformedDialogue(reason, span) {
|
|
81
|
+
return diagnostic("error", "AT1301", `Malformed dialogue directive: ${reason}`, span);
|
|
82
|
+
},
|
|
59
83
|
presentationNumericNotFinite(span) {
|
|
60
84
|
return diagnostic("error", "AT1302", "Numeric value is not representable as a finite number.", span);
|
|
61
85
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codes.js","sourceRoot":"","sources":["../../src/diagnostics/codes.ts"],"names":[],"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,QAAQ,EAAE,qCAAqC,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;IAC5F,CAAC;IACD,uEAAuE;IACvE,gEAAgE;IAChE,qEAAqE;IACrE,yDAAyD;IACzD,iBAAiB,CAAC,MAAc,EAAE,IAAgB;QAChD,OAAO,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,iCAAiC,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;IACxF,CAAC;IACD,4BAA4B,CAAC,IAAgB;QAC3C,OAAO,UAAU,CACf,OAAO,EACP,QAAQ,EACR,wDAAwD,EACxD,IAAI,CACL,CAAC;IACJ,CAAC;IACD,mBAAmB,CAAC,SAAiB,EAAE,IAAgB;QACrD,OAAO,UAAU,CACf,SAAS,EACT,QAAQ,EACR,mCAAmC,SAAS,gCAAgC,EAC5E,IAAI,CACL,CAAC;IACJ,CAAC;CACO,CAAC"}
|
|
@@ -9,7 +9,7 @@ export type DiagnosticSeverity = "error" | "warning";
|
|
|
9
9
|
* 2000s — expressions
|
|
10
10
|
* 3000s — Markdown (warnings for constructs outside the supported subset)
|
|
11
11
|
*/
|
|
12
|
-
export type DiagnosticCode = "AT1001" | "AT1002" | "AT1003" | "AT1004" | "AT1005" | "AT1006" | "AT1101" | "AT1102" | "AT1103" | "AT1104" | "AT1201" | "AT1202" | "AT1301" | "AT1302" | "AT2001" | "AT2002" | "AT2003" | "AT2004" | "AT2005" | "AT3001";
|
|
12
|
+
export type DiagnosticCode = "AT1001" | "AT1002" | "AT1003" | "AT1004" | "AT1005" | "AT1006" | "AT1007" | "AT1008" | "AT1009" | "AT1101" | "AT1102" | "AT1103" | "AT1104" | "AT1105" | "AT1201" | "AT1202" | "AT1301" | "AT1302" | "AT2001" | "AT2002" | "AT2003" | "AT2004" | "AT2005" | "AT3001";
|
|
13
13
|
export interface Diagnostic {
|
|
14
14
|
readonly severity: DiagnosticSeverity;
|
|
15
15
|
readonly code: DiagnosticCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/diagnostics/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/diagnostics/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { compile, type CompileResult } from "./compile.js";
|
|
2
|
-
export type { SourcePosition, SourceSpan, LiteralValue, UnaryOperator, BinaryOperator, LiteralExpression, IdentifierExpression, UnaryExpression, BinaryExpression, CallExpression, ExpressionNode, TextInline, EmphasisInline, StrongInline, InlineCodeInline, LinkInline, LineBreakInline, InlineNode, BackgroundCommand, LayerCommand, CameraAction, CameraZoomCommand, CameraCommand, MusicCommand, SfxCommand, PauseCommand, PresentationCommand, StateValue, StoryStateDefinition, StoryMetadata, ParagraphNode, HeadingNode, PresentationNode, SetNode, GotoNode, ChoiceItem, ChoiceNode, ConditionalBranchKind, ConditionalBranch, ConditionalNode, VariantBranchKind, VariantBranch, VariantNode, StoryBlock, SceneNode, StoryDocument } from "./ast/index.js";
|
|
2
|
+
export type { SourcePosition, SourceSpan, LiteralValue, UnaryOperator, BinaryOperator, LiteralExpression, IdentifierExpression, UnaryExpression, BinaryExpression, CallExpression, ExpressionNode, TextInline, EmphasisInline, StrongInline, InlineCodeInline, LinkInline, LineBreakInline, InlineNode, BackgroundCommand, LayerCommand, CameraAction, CameraZoomCommand, CameraCommand, MusicCommand, SfxCommand, PauseCommand, SpritePosition, ShowSpriteCommand, HideSpriteCommand, SpriteCommand, PresentationCommand, StateValue, StoryStateDefinition, StoryMetadata, ParagraphNode, HeadingNode, DialogueNode, PresentationNode, SetNode, GotoNode, ChoiceItem, ChoiceNode, ConditionalBranchKind, ConditionalBranch, ConditionalNode, VariantBranchKind, VariantBranch, VariantNode, StoryBlock, SceneNode, StoryDocument } from "./ast/index.js";
|
|
3
3
|
export type { Diagnostic, DiagnosticCode, DiagnosticSeverity } from "./diagnostics/index.js";
|
|
4
4
|
export { isChoiceTargetBoundarySafe, isPresentationNamedArgumentValueBoundarySafe } from "./parser/serializer-safety.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE3D,YAAY,EACV,cAAc,EACd,UAAU,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,aAAa,EACd,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAO7F,OAAO,EAAE,0BAA0B,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE3D,YAAY,EACV,cAAc,EACd,UAAU,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,aAAa,EACd,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAO7F,OAAO,EAAE,0BAA0B,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// touches remark/mdast/unified — runtime-facing code must depend only on
|
|
3
3
|
// the AfterText-owned AST types re-exported here.
|
|
4
4
|
export { compile } from "./compile.js";
|
|
5
|
-
// Serializer-boundary-safety predicates (docs/
|
|
6
|
-
// "
|
|
7
|
-
// helpers for
|
|
5
|
+
// Serializer-boundary-safety predicates (docs/CORE_SPEC.md Section 25.40,
|
|
6
|
+
// "Source-Generation Safety Helpers") — small, additive, lexical-only
|
|
7
|
+
// helpers for tools that generate AfterText source. Sourced from
|
|
8
8
|
// `parser/serializer-safety.ts`, which (like this whole module) has no
|
|
9
9
|
// `remark`/`mdast` dependency, unlike `parser/blocks.ts` itself.
|
|
10
10
|
export { isChoiceTargetBoundarySafe, isPresentationNamedArgumentValueBoundarySafe } from "./parser/serializer-safety.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yEAAyE;AACzE,kDAAkD;AAElD,OAAO,EAAE,OAAO,EAAsB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yEAAyE;AACzE,kDAAkD;AAElD,OAAO,EAAE,OAAO,EAAsB,MAAM,cAAc,CAAC;AA0D3D,0EAA0E;AAC1E,sEAAsE;AACtE,iEAAiE;AACjE,uEAAuE;AACvE,iEAAiE;AACjE,OAAO,EAAE,0BAA0B,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/limits.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource limits that keep the recursive parts of the compiler (and the
|
|
3
|
+
* runtime that walks its output) inside the call stack. Exceeding one is an
|
|
4
|
+
* ordinary source error reported as a diagnostic, never an exception.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Maximum height of an expression tree and of parser recursion. Each nested
|
|
8
|
+
* parenthesis consumes two levels of the recursion budget, so about half this
|
|
9
|
+
* many parentheses fit; binary chains, unary chains and calls reach the limit.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MAX_EXPRESSION_DEPTH = 256;
|
|
12
|
+
/** Maximum nesting of `@if` / `@variant` constructs inside one another. */
|
|
13
|
+
export declare const MAX_BLOCK_DEPTH = 64;
|
|
14
|
+
/** Maximum nesting of inline Markdown nodes (emphasis, strong, links). */
|
|
15
|
+
export declare const MAX_INLINE_DEPTH = 100;
|
|
16
|
+
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,2EAA2E;AAC3E,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,MAAM,CAAC"}
|
package/dist/limits.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource limits that keep the recursive parts of the compiler (and the
|
|
3
|
+
* runtime that walks its output) inside the call stack. Exceeding one is an
|
|
4
|
+
* ordinary source error reported as a diagnostic, never an exception.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Maximum height of an expression tree and of parser recursion. Each nested
|
|
8
|
+
* parenthesis consumes two levels of the recursion budget, so about half this
|
|
9
|
+
* many parentheses fit; binary chains, unary chains and calls reach the limit.
|
|
10
|
+
*/
|
|
11
|
+
export const MAX_EXPRESSION_DEPTH = 256;
|
|
12
|
+
/** Maximum nesting of `@if` / `@variant` constructs inside one another. */
|
|
13
|
+
export const MAX_BLOCK_DEPTH = 64;
|
|
14
|
+
/** Maximum nesting of inline Markdown nodes (emphasis, strong, links). */
|
|
15
|
+
export const MAX_INLINE_DEPTH = 100;
|
|
16
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC"}
|
package/dist/parser/blocks.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ interface BlockSequenceResult {
|
|
|
16
16
|
* conditional/variant branch bodies) — nesting falls out of recursive
|
|
17
17
|
* calls to parseConditional/parseVariant/parseChoice below.
|
|
18
18
|
*/
|
|
19
|
-
export declare function parseBlockSequence(lines: readonly SourceLine[], start: number, diagnostics: Diagnostic[], terminators: ReadonlySet<string
|
|
19
|
+
export declare function parseBlockSequence(lines: readonly SourceLine[], start: number, diagnostics: Diagnostic[], terminators: ReadonlySet<string>, depth?: number): BlockSequenceResult;
|
|
20
20
|
/**
|
|
21
21
|
* The deterministic id used for content appearing before the first explicit
|
|
22
22
|
* `@scene` directive — including an entire `@scene`-less prose-only
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/parser/blocks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/parser/blocks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EASV,SAAS,EAET,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAS1D,OAAO,EAAgD,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAiB3F,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAwrCD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,UAAU,EAAE,EACzB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,KAAK,SAAI,GACR,mBAAmB,CAqCrB;AA4FD;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,SAAS,CAAC;AAwBjD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,CAoDhG"}
|