import { Token } from '../lexer/token'; import { ASTBase, ASTChunk, ASTElseClause, ASTForGenericStatement, ASTFunctionStatement, ASTIfClause, ASTIfStatement, ASTType, ASTWhileStatement } from './ast'; import { LineRegistry } from './line-registry'; type PendingBlockCompleteCallback = (pendingBlock: PendingBlock) => void | null; export declare enum PendingBlockType { Chunk = 0, For = 1, Function = 2, If = 3, While = 4 } export interface PendingBlock { block: ASTBase; body: ASTBase[]; type: PendingBlockType; onComplete: PendingBlockCompleteCallback; complete(endToken: Token): void; } declare abstract class PendingBlockBase { protected lineRegistry: LineRegistry; block: ASTBase; body: ASTBase[]; type: PendingBlockType; onComplete: PendingBlockCompleteCallback; constructor(block: ASTBase, type: PendingBlockType, lineRegistry: LineRegistry); complete(_endToken: Token): void; } export declare function isPendingChunk(pendingBlock: PendingBlock): pendingBlock is PendingChunk; export declare class PendingChunk extends PendingBlockBase implements PendingBlock { block: ASTChunk; constructor(block: ASTChunk, lineRegistry: LineRegistry); complete(endToken: Token): void; } export declare function isPendingFor(pendingBlock: PendingBlock): pendingBlock is PendingFor; export declare class PendingFor extends PendingBlockBase implements PendingBlock { block: ASTForGenericStatement; constructor(block: ASTForGenericStatement, lineRegistry: LineRegistry); complete(endToken: Token): void; } export declare function isPendingFunction(pendingBlock: PendingBlock): pendingBlock is PendingFunction; export declare class PendingFunction extends PendingBlockBase implements PendingBlock { block: ASTFunctionStatement; private base; constructor(block: ASTFunctionStatement, base: ASTBase | null, lineRegistry: LineRegistry); complete(endToken: Token): void; } export declare function isPendingIf(pendingBlock: PendingBlock): pendingBlock is PendingIf; export type PendingClauseType = ASTType.ElseifClause | ASTType.ElseClause; export declare class PendingIf extends PendingBlockBase implements PendingBlock { block: ASTIfStatement; currentClause: ASTIfClause | ASTElseClause; onCompleteCallback: PendingBlockCompleteCallback; constructor(block: ASTIfStatement, current: ASTIfClause, lineRegistry: LineRegistry); next(endToken: Token): void; complete(endToken: Token): void; } export declare function isPendingWhile(pendingBlock: PendingBlock): pendingBlock is PendingWhile; export declare class PendingWhile extends PendingBlockBase implements PendingBlock { block: ASTWhileStatement; constructor(block: ASTWhileStatement, lineRegistry: LineRegistry); complete(endToken: Token): void; } export {};