/** * Block-boundary strategy primitives (phase 167, T1). * * Each strategy resolves the extent of a test "block" given where its * opener matched (`./engine.ts` finds opener matches and dispatches here). * A strategy returns `null` — never a partial or best-guess span — when it * cannot positively resolve a boundary (e.g. an unmatched paren, no opening * brace before EOF): unrecognized shapes yield zero spans, per the phase's * false-positive-averse invariant. * * All strategies consult the `CodeMask` so structural characters (parens, * braces, keywords) inside strings/comments are ignored. */ import type { CodeMask } from './mask.js'; import type { LanguageProfile } from './types.js'; export interface ResolvedBlock { /** Index where the block's code-only content begins (exclusive of the opener). */ start: number; /** Index of the block's closing boundary (inclusive). */ end: number; } /** * Depth-aware paren matcher, shared by `call-expression` and by the engine's * `openerRequiredLiteral` check (`./engine.ts`, phase 167 T3 review round 3): * given a position just past an already-open `(` (depth 1), tracks paren * depth over code-mode characters only and returns the index of the * matching `)`, or `null` if it's never closed. Never a partial/best-guess * result — the false-positive-averse invariant applies here too, since a * caller using this to bound a required-literal search must not silently * accept an unbalanced signature as if it were balanced. */ export declare function findMatchingParenIndex(text: string, mask: CodeMask, afterOpenParen: number): number | null; export interface TopLevelParenText { /** Only the depth-1 (top-level, non-nested) code-mode characters between * the parens — content inside any nested `(...)` sub-expression is * dropped entirely (a single space is inserted where it was, so two * top-level tokens straddling a dropped nested region can never * accidentally concatenate into a false match). */ text: string; /** Index of the matching top-level `)`. */ closeIdx: number; } /** * Like `findMatchingParenIndex`, but also extracts the top-level-only text * (phase 167, T3 review round 3): given a position just past an already-open * `(` (depth 1), tracks paren depth over code-mode characters and returns * both the matching `)` index and a string containing ONLY the characters * seen while at depth 1 — i.e. content belonging to a NESTED parenthesized * sub-expression (e.g. a function-type parameter that itself has its own * `(...)`) is excluded. This is what makes `openerRequiredLiteral` * (`./engine.ts`) safe: testing a literal against "everything between the * outer parens" would still let a nested sub-expression's own interior * satisfy the requirement even once the outer parens are correctly matched; * testing against top-level-only text means the literal must genuinely be * part of THIS parameter list's own, unnested parameter types. */ export declare function extractTopLevelParenText(text: string, mask: CodeMask, afterOpenParen: number): TopLevelParenText | null; export declare function resolveBlock(text: string, mask: CodeMask, profile: LanguageProfile, matchStart: number, matchEnd: number): ResolvedBlock | null; //# sourceMappingURL=strategies.d.ts.map