/** * The module boundary: `import`, `export … from`, `extern module` and its * contract, and the two embedded-JavaScript forms (`extern js`, `unsafe js`) * with their captures. The Python and TypeScript import habits are answered * here as well, because each of them is a shape only this parser can see. */ import type { Expression, EmbeddedJavaScriptDeclaration, ExternClassDeclaration, ExternModuleDeclaration, ImportDeclaration, Parameter, ReExportDeclaration, TypeParameterDeclaration, TypeReference } from "../../ast.ts"; import { type Diagnostic } from "../../diagnostic.ts"; import { type Token, type TokenKind } from "../../token.ts"; export interface ModuleParserHost { advance(): Token; check(kind: TokenKind): boolean; checkWord(value: string): boolean; consumeNewlines(): void; current(): Token; readonly diagnostics: Diagnostic[]; expect(kind: TokenKind, message: string): Token; expectBindingName(message: string, noun: string): Token; expectStatementEnd(): void; expectWord(value: string, message: string): Token; index: number; match(kind: TokenKind): boolean; matchWord(value: string): boolean; parseExpression(minimumPrecedence?: number): Expression; parseExternClass(start: number): ExternClassDeclaration | null; parseParameters(): readonly Parameter[]; parseTypeParameters(): readonly TypeParameterDeclaration[] | null; parseTypeReference(allowTrailingOptional?: boolean, initialized?: boolean): TypeReference; peekKind(distance: number): TokenKind; previous(): Token; recoveredImportDelimiterBoundary: boolean; reportExternDeclarationBody(): boolean; reportUntypedExternParameters(parameters: readonly Parameter[]): void; synchronize(): void; readonly tokens: Token[]; } export declare class ModuleParser { private readonly host; constructor(host: ModuleParserHost); parseImport(start: number): ImportDeclaration | null; /** D53 rule 117: only an export-exact data URL has a semantics-preserving block rewrite. */ private reportInlineDataJavaScriptMigration; /** * D50 rule 99: the effects of a module have to be visible at the place they * happen. There is no mechanical rewrite here — naming the function to * export and call is the author's decision, not a spelling change. */ private reportSideEffectImport; parseReExport(start: number): ReExportDeclaration | null; parseExternModule(start: number): ExternModuleDeclaration; parseEmbeddedJavaScript(start: number, unsafe: boolean): EmbeddedJavaScriptDeclaration; private parseEmbeddedJavaScriptCaptures; private reportEmbeddedJavaScriptContract; private parseExternContract; /** * D50 rule 100: `type` is a contextual keyword, so `import type {User} from` * is the TypeScript habit while `import type from "./x.vel"` still reads as a * default import named `type`. The habit is recognized by what follows the * word — a brace list, a namespace star, or a name that is not `from` — so * that it can be taught rather than met with a generic parse error. */ private typeImportMarkerAhead; /** * D50 rule 100 (retiring D38 rule 49): TypeScript needs `import type` because * TypeScript erases types, so a type import can carry no module edge. * VelarScript does not erase: every named type carries its runtime validator, * an enum is a runtime value, and a class is a runtime value — so a type * import is an ordinary import and the marker has nothing left to mean. * Dropping the word is the whole rewrite, which is why `velar fix` applies it. */ private rejectTypeImportMarker; } //# sourceMappingURL=modules.d.ts.map