import type { ImapAttributeList, ParserOptions } from './types.js'; /** * Parses a single IMAP response line into its structural components: tag, command, * and attributes. Handles status responses (OK, NO, BAD, PREAUTH, BYE) with their * human-readable text and response codes, as well as continuation responses ("+"). */ export declare class ParserInstance { input: string; options: ParserOptions; remainder: string; pos: number; tag?: string | undefined; command?: string | undefined; humanReadable?: string | undefined; /** The keys of the FETCH data items the token parser dropped for exceeding the nesting limit */ truncatedAttributes?: string[] | undefined; /** * Creates a new ParserInstance for parsing an IMAP response line. * * @param input - The raw IMAP response line to parse. * @param options - Parser options passed through to the TokenParser for attribute parsing. * @param options.literalPlus - Whether the LITERAL+ extension is in use. * @param options.literals - Pre-parsed literal values from the stream. */ constructor(input?: Buffer | string | null | undefined, options?: ParserOptions | undefined); /** * The context a parse error carries: a bounded prefix of the input (and of the element that * failed, when there is one) with their full lengths, and the position. * * @param element - The element that failed to parse * @returns The context to attach to the error */ errorContext(element?: string | undefined): { [key: string]: unknown; }; /** * Extracts and returns the IMAP tag from the beginning of the response. * The tag is typically "*" for untagged responses, "+" for continuation requests, * or a client-assigned command tag like "A1". * * @returns The parsed tag string. * @throws {Error} If the tag contains invalid characters. */ getTag(): Promise; /** * Extracts and returns the IMAP command or response name from the input. * For continuation responses (tag "+"), returns an empty string and stores * the remainder as human-readable text. For status responses (OK, NO, BAD, * PREAUTH, BYE), separates the optional response code from the human-readable text. * * @returns The parsed command string. * @throws {Error} If the command contains invalid characters or input ends unexpectedly. */ getCommand(): Promise; /** * Extracts the next whitespace-delimited element from the input and validates it * against the given syntax character set. Advances the parser position past the element. * * @param syntax - A string of allowed characters for the element (as returned by imap-formal-syntax methods). * @returns The extracted element string. * @throws {Error} If the element contains characters not in the syntax set, or if input ends unexpectedly. */ getElement(syntax: string): Promise; /** * Consumes a single space character from the current position in the input. * Advances the parser position by one. * * @throws {Error} If the current character is not a space, or if input has ended unexpectedly. */ getSpace(): Promise; /** * Parses the remaining input as IMAP attributes using the TokenParser. * This handles complex structures including nested lists, literals, strings, * atoms, sections, sequences, and partial ranges. * * @returns A promise that resolves to an array of parsed attribute objects. * @throws {Error} If the input contains unexpected whitespace, invalid characters, or ends unexpectedly. */ getAttributes(): Promise; }