@sharpee/chord 3.0.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/analyzer.d.ts +31 -0
- package/analyzer.d.ts.map +1 -0
- package/analyzer.js +1656 -0
- package/analyzer.js.map +1 -0
- package/ast.d.ts +684 -0
- package/ast.d.ts.map +1 -0
- package/ast.js +3 -0
- package/ast.js.map +1 -0
- package/catalog.d.ts +43 -0
- package/catalog.d.ts.map +1 -0
- package/catalog.js +77 -0
- package/catalog.js.map +1 -0
- package/diagnostics.d.ts +38 -0
- package/diagnostics.d.ts.map +1 -0
- package/diagnostics.js +29 -0
- package/diagnostics.js.map +1 -0
- package/index.d.ts +39 -0
- package/index.d.ts.map +1 -0
- package/index.js +77 -0
- package/index.js.map +1 -0
- package/ir.d.ts +511 -0
- package/ir.d.ts.map +1 -0
- package/ir.js +6 -0
- package/ir.js.map +1 -0
- package/lexer.d.ts +49 -0
- package/lexer.d.ts.map +1 -0
- package/lexer.js +88 -0
- package/lexer.js.map +1 -0
- package/package.json +40 -0
- package/parser.d.ts +29 -0
- package/parser.d.ts.map +1 -0
- package/parser.js +2303 -0
- package/parser.js.map +1 -0
- package/span.d.ts +30 -0
- package/span.d.ts.map +1 -0
- package/span.js +34 -0
- package/span.js.map +1 -0
package/analyzer.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* analyzer.ts — Chord semantic analysis: two-pass resolution, the load-time
|
|
3
|
+
* gates, and Story IR construction (design.md §5.2/§5.3).
|
|
4
|
+
*
|
|
5
|
+
* Pass 1 collects declarations (entities + aliases + states, phrases per
|
|
6
|
+
* locale, named conditions, hatches, flags). Pass 2 resolves every
|
|
7
|
+
* reference with article stripping and builds the IR, reporting the AC-3
|
|
8
|
+
* gate classes as errors with `.story` spans:
|
|
9
|
+
* missing phrase key · unknown predicate value (nearest-valid suggestion)
|
|
10
|
+
* · undeclared state · ambiguous entity reference (rename suggestion)
|
|
11
|
+
* · refusal after mutation (phase-order rule) · unbound `{…}` marker.
|
|
12
|
+
*
|
|
13
|
+
* Public interface: analyze().
|
|
14
|
+
* Owner context: @sharpee/chord (language frontend; browser-safe).
|
|
15
|
+
*
|
|
16
|
+
* Invariants:
|
|
17
|
+
* - Ambiguity is an error with a suggestion, never a guess.
|
|
18
|
+
* - The returned IR is pure JSON data (round-trips through JSON.stringify).
|
|
19
|
+
* - Diagnostics gate the load (atomic): callers must check hasErrors().
|
|
20
|
+
*/
|
|
21
|
+
import { StoryFile } from './ast';
|
|
22
|
+
import { DiagnosticBag } from './diagnostics';
|
|
23
|
+
import { StoryIR } from './ir';
|
|
24
|
+
/**
|
|
25
|
+
* Analyze a parsed story and build its IR.
|
|
26
|
+
* @param ast parser output (may be partial when parse errors occurred)
|
|
27
|
+
* @param diagnostics receives load-time gate errors
|
|
28
|
+
* @returns the IR — meaningful only when diagnostics has no errors (atomic load)
|
|
29
|
+
*/
|
|
30
|
+
export declare function analyze(ast: StoryFile, diagnostics: DiagnosticBag): StoryIR;
|
|
31
|
+
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../../repos/sharpee_v2/packages/chord/src/analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAYL,SAAS,EAIV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAWL,OAAO,EACR,MAAM,MAAM,CAAC;AAsMd;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,GAAG,OAAO,CAE3E"}
|