import type { DiagnosticSink } from '../diagnostics/index.js'; import type { SourceFile } from '../source/index.js'; import type { Token, TokenKind } from '../tokens/index.js'; /** * What the shape of a file means: where a statement begins, where a block opens * and closes, and what a line's leading whitespace is worth. * * It is a separate thing from the scanner because it works in lines and * statements where the scanner works in characters, and because it is where the * two rules that a naive lexer gets wrong live: a line that carries no token is * never asked about its indentation, and a line indented past its siblings is * one error rather than a new block. * * It writes the layout tokens straight into the list the scanner is filling, so * an indent lands in front of the token that opened the block rather than being * threaded back in afterwards. */ export declare class Layout { #private; constructor(file: SourceFile, sink: DiagnosticSink, tokens: Token[]); /** Holds a line's leading whitespace, which may turn out to mean nothing at all. */ beginLine(line: number, offset: number, width: number, text: string, hasTab: boolean): void; /** The line is over. Whatever it was holding was never wanted. */ endLine(): void; /** * Turns the leading whitespace into block structure, at the moment the line * turns out to carry a token and not before. A line that produces no token * never reaches here, which is the whole of the rule that a blank line and a * comment-only line carry no indentation at all (3.10). */ admit(continuing: boolean): void; /** The first token of a statement decides whether a block may open under it. */ observe(kind: TokenKind): void; endStatement(): void; /** A second statement beginning on a line that already held one, after a `;`. */ beginStatement(line: number, indent: number): void; /** The end of the file closes every block still open. */ closeBlocks(at: number): void; } //# sourceMappingURL=layout.d.ts.map