import type { ErrorMessage, Scanner, WhitespaceChar } from "@ark/util"; import type { Control, ReferenceNode, s, State } from "./state.ts"; export type parseEscape = unscanned extends Scanner.shift ? char extends NonZeroDigit ? parseNumericBackreference : char extends "k" ? parseNamedBackreference : char extends UnicodePropertyChar ? parseUnicodeProperty : parseSingleEscapedCharacter : s.error; type parseNumericBackreference = Scanner.shiftUntilNot extends (Scanner.shiftResult) ? s.shiftQuantifiable, remaining> : never; type parseNamedBackreference = unscanned extends `<${infer ref}>${infer following}` ? s.shiftQuantifiable, following> : s.error; type parseUnicodeProperty = unscanned extends `{${string}}${infer following}` ? s.shiftQuantifiable : s.error>; type parseSingleEscapedCharacter = parseEscapedChar extends infer result extends string ? result extends ErrorMessage ? s.error : s.shiftQuantifiable : never; export type parseEscapedChar = char extends RegexClassChar ? string : char extends "d" ? `${number}` : char extends "s" ? WhitespaceChar : char extends BoundaryChar ? "" : char extends Control ? char : char extends "c" ? ErrorMessage : char extends StringEscapableChar ? ErrorMessage> : ErrorMessage>; export declare const trailingBackslashMessage = "A regex cannot end with \\"; export type trailingBackslashMessage = typeof trailingBackslashMessage; export declare const writeUnresolvableBackreferenceMessage: (ref: ref) => writeUnresolvableBackreferenceMessage; export type writeUnresolvableBackreferenceMessage = `Group ${ref} does not exist`; export declare const missingBackreferenceNameMessage = "\\k must be followed by a named reference like "; export type missingBackreferenceNameMessage = typeof missingBackreferenceNameMessage; export declare const writeInvalidUnicodePropertyMessage: (char: char) => writeInvalidUnicodePropertyMessage; export type writeInvalidUnicodePropertyMessage = `\\${char} must be followed by a property like \\${char}{Emoji_Presentation}`; export declare const writeUnnecessaryEscapeMessage: (char: char) => writeUnnecessaryEscapeMessage; export type writeUnnecessaryEscapeMessage = `Escape preceding ${char} is unnecessary and should be removed.`; export declare const writeStringEscapableMessage: (char: StringEscapableChar) => "\\v should be specified with a single backslash like regex('\\n')" | "\\u should be specified with a single backslash like regex('\\n')" | "\\0 should be specified with a single backslash like regex('\\n')" | "\\t should be specified with a single backslash like regex('\\n')" | "\\n should be specified with a single backslash like regex('\\n')" | "\\r should be specified with a single backslash like regex('\\n')" | "\\f should be specified with a single backslash like regex('\\n')" | "\\x should be specified with a single backslash like regex('\\n')"; export type writeStringEscapableMessage = `\\${char} should be specified with a single backslash like regex('\n')`; export declare const caretNotationMessage = "\\\\cX notation is not supported. Use hex (\\\\x) or unicode (\\\\u) instead."; export type caretNotationMessage = "\\cX notation is not supported. Use hex (\\x) or unicode (\\u) instead."; export type StringEscapableChar = "t" | "n" | "r" | "f" | "v" | "0" | "x" | "u"; export type RegexClassChar = "w" | "W" | "D" | "S"; export type BoundaryChar = "b" | "B"; export type UnicodePropertyChar = "p" | "P"; export type NonZeroDigit = "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"; export type StringDigit = "0" | NonZeroDigit; export {};