/** * The two name questions the parser answers before the analyzer sees a * declaration: which words a declaring position cannot spell as themselves, and * which names in a type reference the author did not write. * * D115 §一.1: these live beside `parser.ts` rather than in it, whose recorded * ceiling the file budget holds at what it measured. */ import { type TypeSyntax } from "./ast.ts"; import { type Token } from "./token.ts"; /** * Why a word cannot name a `type`, `class`, or `enum`, when it cannot; `null` * when it can. The three reasons are one rule: a type position cannot spell the * name as itself, so a declaration under it would be unreachable from every * annotation. * * A reserved word reads as its keyword or literal everywhere. `readonly` reads * as the read-only view modifier, which `parseSingleTypeReference` takes before * it reads a name at all. A guided spelling with a replacement is rewritten to * that replacement in every type position, so the declaration and its uses * would name two different types. */ export declare function refusedDeclarationName(token: Token): { readonly because: string; readonly instead: string; } | null; /** * RE-I4: flags every name in one type reference that the author did not * write. A guided spelling is reported where it stands and then recovered as * the name it is guided to, so `const value: Array` leaves a node spelled * `List` over a span spelling `Array`. The token that opened the span is the * evidence, and this is the one funnel every type reference passes through — * an argument list, a union member and a function type all reach their parts * through `parseTypeReference` or through the body it calls. * * Only names are flagged: an application (`Array`) already recovers * as a complete `List`, and its own arity question is answered where * it is written. */ export declare function markGuidedTypeNames(syntax: TypeSyntax, tokens: readonly Token[]): void; /** * RE-C2 / RE-I6: why a word cannot name a type parameter, when it cannot. * * A type parameter is a name only an annotation can reach, which is exactly * charter §5's criterion for a spelling a declaring position must refuse. * `def identity` used to declare a parameter every annotation then rewrote * to `string`, `type Box:` one every annotation answered with * "Expected a type name", and `` answered with two parse errors that * never named the rule — the "declaration writable, every use refused" shape * the refusal exists to prevent. The Core type names and the three bounds are * the analyzer's half of this position; this is the same sentence over the two * rosters the parser owns, under the same code. */ export declare function refusedTypeParameterName(token: Token): string | null; //# sourceMappingURL=parser-names.d.ts.map