/** * The construct rosters: every statement form and every expression form Core's * grammar produces, each with the spelling a reader recognises it by. * * Both are mapped types over the unions in `nodes/base.ts`, so a node kind the * parser can return cannot be missing from them — `tsc` refuses the object * until its spelling is written. `scripts/check-tour-coverage.mjs` and * `scripts/surface-inventory.mjs` read them from `ast.ts`. */ import type { CoreStatement } from "./nodes/base.ts"; import type { ClassDeclaration, EmbeddedJavaScriptDeclaration, ForStatement, FunctionDeclaration, TypeDeclaration, VariableDeclaration } from "./nodes/statements.ts"; /** * D56 rule 129 — every statement form Core's grammar produces, keyed by the * node kind the parser returns for it. The string is prose for a failure * message; the *keys* are the data. * * The mapped type is both the derivation and the enforcement: a member added * to `CoreStatement` above makes this object stop typechecking until its * spelling is written here, so the roster cannot fall behind the union the * parser returns. That is the whole reason it lives beside the union instead * of in a gate script — D57 rule 134's failure family is the hand-kept copy, * and a copy that `tsc` refuses to accept as incomplete is not one. * * The tour-coverage gate requires every key to be parsed out of * `examples/tour/`, and this is the one category of that gate that names a * *construct* rather than a *name*. It exists because names were not enough: * `extern`, `js`, and `unsafe` were already covered as keywords by chapter 13's * `extern module` and `import js unsafe`, so D53 rule 117's two inline blocks — * spelled entirely out of keywords the tour already exercised — landed with no * tour example at all and the gate stayed green. * * A node kind that deliberately carries multiple grammar forms contributes a * projected key for each form. The AST keeps its semantic fields instead of * acquiring redundant tags solely for coverage; this function is the one * compiler-owned projection the tour gate reads. */ export type CoreStatementConstructKey = Exclude["kind"] | "EmbeddedJavaScriptDeclaration:checked" | "EmbeddedJavaScriptDeclaration:unsafe" | `TypeDeclaration:${"type" | "readonly-type"}` | `VariableDeclaration:${VariableDeclaration["binding"]}` | `FunctionDeclaration:${"def" | "async-def"}` | `ClassDeclaration:${"class" | "abstract-class"}` | `ForStatement:${"for" | "async-for"}`; export declare const CORE_STATEMENT_CONSTRUCTS: Readonly<{ ImportDeclaration: string; ReExportDeclaration: string; ExternModuleDeclaration: string; "EmbeddedJavaScriptDeclaration:checked": string; "EmbeddedJavaScriptDeclaration:unsafe": string; "TypeDeclaration:type": string; "TypeDeclaration:readonly-type": string; TypeAliasDeclaration: string; EnumDeclaration: string; "ClassDeclaration:class": string; "ClassDeclaration:abstract-class": string; "VariableDeclaration:const": string; "VariableDeclaration:let": string; UsingDeclaration: string; TestDeclaration: string; MainBlock: string; "FunctionDeclaration:def": string; "FunctionDeclaration:async-def": string; ReturnStatement: string; ThrowStatement: string; AssertStatement: string; IfStatement: string; MatchStatement: string; "ForStatement:for": string; "ForStatement:async-for": string; WhileStatement: string; BreakStatement: string; ContinueStatement: string; TryStatement: string; PassStatement: string; AssignmentStatement: string; ExpressionStatement: string; DetachStatement: string; }>; /** The tour key for one Core statement, including every multi-form projection. */ export declare function coreStatementConstructKey(statement: CoreStatement): CoreStatementConstructKey; /** D82 rule 203: a mapped roster makes every Core expression kind explicit. */ export declare const CORE_EXPRESSION_CONSTRUCTS: Readonly<{ LiteralExpression: string; FStringExpression: string; IdentifierExpression: string; SuperExpression: string; DynamicImportExpression: string; ListExpression: string; ObjectExpression: string; SpreadExpression: string; UnaryExpression: string; TryExpression: string; BinaryExpression: string; AssignmentExpression: string; ComparisonChainExpression: string; ConditionalExpression: string; IsExpression: string; RequiredExpression: string; ArrowFunctionExpression: string; CallExpression: string; MemberExpression: string; IndexExpression: string; "ExtensionExpression:core:duration": string; }>; //# sourceMappingURL=constructs.d.ts.map