/**
 * Highlighting that cannot take the server down.
 *
 * The viewer's server answers every request on one thread, and a slice is
 * classified by handing it to a tree-sitter grammar — which can loop forever on
 * a fragment it was never written for: cobolcraft's free-format COBOL, cut to a
 * Flow card's window, kept the fixed-format grammar's scanner spinning inside
 * WebAssembly, and every request after it — the page's own `/api/stats`
 * included — waited behind it for good. A parse inside WebAssembly cannot be
 * interrupted from JavaScript, so the slice is classified in a worker the
 * server can terminate: past the deadline the worker is ended, the slice is
 * served plain, and the next slice gets a fresh worker.
 */
import { type TokenizeResult } from '../../extraction/syntax-tokens';
import type { Language } from '../../types';
/** Longest a slice may take to classify — far past any file the grammars can parse at all. */
export declare const TOKENIZE_DEADLINE_MS = 2000;
/** What a bounded classification came to: the result, or that it ran out of time. */
export type BoundedTokenize = {
    result: TokenizeResult | null;
} | {
    timedOut: true;
};
/** Classify `text` in the highlight worker, giving up after {@link TOKENIZE_DEADLINE_MS}. */
export declare function tokenizeBounded(text: string, language: Language, deadlineMs?: number): Promise<BoundedTokenize>;
/** End the highlight worker — for tests, and for a server that is shutting down. */
export declare function stopHighlightWorker(): void;
//# sourceMappingURL=bounded-tokenize.d.ts.map