import { type TokenKind } from "./token.ts"; export interface ForbiddenSourceIdentifierRule { readonly guidance: string; /** Tokens used only to recover after reporting the source spelling. */ readonly recovery: readonly { readonly kind: TokenKind; readonly value: string; }[] | null; /** * D38 §48: the source text that replaces this spelling, registered only where * the guidance names exactly one successor. `null` keeps the rule advice — * 'var' offers 'let' or 'const', which is the author's choice to make. */ readonly fix: string | null; /** * D90 (compiler-front-9): the spelling is refused as a binding, a parameter * and a type, but is an ordinary member name and record key. The charter's * reserved-spelling paragraph already promises this of the words JavaScript * reserves — external data and Web APIs do not need renamed fields — and * `int` (velar/random owns `Random.int(...)`) and `with` * (`Array.prototype.with`, `Temporal.PlainDate.prototype.with`, and every * builder API spelled that way) are the two rules here that answer to it. * Execution-capability spellings such as `eval` deliberately do not: the * charter keeps them unavailable through direct member syntax. */ readonly memberLegal: boolean; } /** * Source spellings rejected before they can acquire ordinary VelarScript * semantics. Some rules emit recovery tokens for additional diagnostics. * Keep this compiler-owned so editor refactors cannot create rejected source. */ export declare const forbiddenSourceIdentifiers: ReadonlyMap; export type BindingNameRestriction = "invalid" | "keyword" | "source" | "javascript" | "compiler" | "core" | "extension"; export type MemberNameRestriction = "invalid" | "source" | "prototype" | "constructor" | "enum-runtime"; export declare function isValidSourceIdentifier(name: string): boolean; export declare function isSourceIdentifierStart(character: string): boolean; export declare function isSourceIdentifierPart(character: string): boolean; export declare function bindingNameRestriction(name: string, extensionReservedBindings?: ReadonlySet): BindingNameRestriction | null; export declare function memberNameRestriction(name: string, owner: "class" | "enum" | "data"): MemberNameRestriction | null; export declare function isCoreReservedBinding(name: string): boolean; export declare function isJavaScriptReservedBinding(name: string): boolean; export declare function isForbiddenPrototypeMember(name: string): boolean; /** * D90 (compiler-front-15): whether a name standing between `<` and `>` is * evidence that the pair is a type argument list rather than a comparison. * `<` and `>` are comparison operators everywhere the grammar can tell, so the * only names that tip the reading are the ones a type argument list is made of: * a builtin type spelling, or a capitalized name, which is how VelarScript * writes every type it declares. * * Two readers ask this question and both must answer it identically — the * parser, deciding which grammar `Map()` is, and the formatter, * deciding whether to space those brackets as operators. When they disagreed, * `velar format` rewrote the line into the spelling of the *other* reading. */ export declare function isTypeEvidenceName(value: string): boolean; //# sourceMappingURL=source-names.d.ts.map