/** * Shared Helper Functions * Common utilities used across validation rules. */ import type { ExpressionNode } from '@rcrsr/rill'; /** * Extract source line at location for context display. * Splits source by newlines, retrieves the specified line (1-indexed), and trims it. */ export declare function extractContextLine(line: number, source: string): string; /** * Detect if expression is a bare $ (pipe variable) reference. * Used by IMPLICIT_DOLLAR_* rules to detect replaceable patterns. * * Returns true only for single bare $, not $var or $.field or $[0]. * O(1) depth traversal (max 3 node levels): PipeChain -> ArithHead -> PostfixExpr -> Variable. * * Distinct from containsBareReference() in closures.ts: * - isBareReference(): O(1) single-node check, answers "is this exact node a bare $?" * - containsBareReference(): Recursive AST walker, answers "does this subtree contain any bare $?" * * @param expr - Expression node to check * @returns true if expr is a bare $ reference, false otherwise */ export declare function isBareReference(expr: ExpressionNode | null | undefined): boolean;