/** * Result of extracting balanced content from a string. */ export interface ExtractedContent { /** The extracted content (without the delimiters) */ content: string; /** The index after the closing delimiter */ endIndex: number; } /** * Extract balanced content between delimiters, handling nesting and strings. * * This handles nested structures correctly (e.g., extracting `fetchData()` from * `(fetchData())`). * * @example * * ```ts * const result = extractBalancedContent('(foo(bar))', 0, '(', ')'); * // result = { content: 'foo(bar)', endIndex: 10 } * ``` * * @function * @param code - The code string to extract from * @param startIndex - The index of the opening delimiter (inclusive) * @param openChar - The opening delimiter character * @param closeChar - The closing delimiter character * @returns The extracted content and end index, or null if parsing fails */ export declare const extractBalancedContent: (code: string, startIndex: number, openChar?: string, closeChar?: string) => ExtractedContent | null; /** * Extract the subject from an expect() or similar call by finding the matching * closing parenthesis. * * This handles nested parentheses correctly (e.g., `expect(fetchData())`). * * @example * * ```ts * const result = extractCallSubject('expect(foo()).toBe(1)', 'expect('); * // result = { subject: 'foo()', rest: '.toBe(1)' } * ``` * * @function * @param code - The code string starting with the function call * @param prefix - The prefix to look for (e.g., 'expect(', 'assert(') * @returns The subject and the rest of the string, or null if parsing fails */ export declare const extractCallSubject: (code: string, prefix: string) => null | { rest: string; subject: string; }; /** * Parse function arguments, handling nested structures. * * This correctly handles: * * - String literals (single, double, template) * - Nested parentheses, brackets, and braces * - Escaped characters in strings * * @example * * ```ts * parseArguments('a, b, c'); // ['a', 'b', 'c'] * parseArguments('foo(1, 2), bar'); // ['foo(1, 2)', 'bar'] * parseArguments('"a, b", c'); // ['"a, b"', 'c'] * ``` * * @function * @param argsStr - The arguments string (content between parentheses) * @returns An array of argument strings */ export declare const parseArguments: (argsStr: string) => string[]; //# sourceMappingURL=parsing.d.ts.map