import type { KeySet } from "./records.ts"; import { Backslash, type WhitespaceChar } from "./strings.ts"; export declare class Scanner { chars: string[]; i: number; def: string; constructor(def: string); /** Get lookahead and advance scanner by one */ shift(): this["lookahead"]; get lookahead(): lookahead; get nextLookahead(): string; get length(): number; shiftUntil(condition: Scanner.UntilCondition): string; shiftUntilEscapable(condition: Scanner.UntilCondition): string; shiftUntilLookahead(charOrSet: string | KeySet): string; shiftUntilNonWhitespace(): string; jumpToIndex(i: number): void; jumpForward(count: number): void; get location(): number; get unscanned(): string; get scanned(): string; sliceChars(start: number, end?: number): string; lookaheadIs(char: char): this is Scanner; lookaheadIsIn(tokens: keySet): this is Scanner>; } export declare namespace Scanner { type UntilCondition = (scanner: Scanner, shifted: string) => boolean; type shift = `${lookahead}${unscanned}`; type shiftUntil = unscanned extends shift ? lookahead extends terminator ? [ appendTo, unscanned ] : shiftUntil : [appendTo, ""]; type shiftUntilEscapable = unscanned extends shift ? lookahead extends terminator ? [appendTo, unscanned] : lookahead extends Backslash ? nextUnscanned extends (shift) ? shiftUntilEscapable : [`${appendTo}${Backslash}`, ""] : shiftUntilEscapable : [appendTo, ""]; type shiftUntilNot = unscanned extends shift ? lookahead extends nonTerminator ? shiftUntilNot : [appendTo, unscanned] : [appendTo, ""]; type skipWhitespace = shiftUntilNot[1]; type shiftResult = [ scanned, unscanned ]; } export declare const writeUnmatchedGroupCloseMessage: (char: char, unscanned: unscanned) => writeUnmatchedGroupCloseMessage; export type writeUnmatchedGroupCloseMessage = `Unmatched ${char}${unscanned extends "" ? "" : ` before ${unscanned}`}`; export declare const writeUnclosedGroupMessage: (missingChar: missingChar) => writeUnclosedGroupMessage; export type writeUnclosedGroupMessage = `Missing ${missingChar}`;