import type { TSNodeLike } from './types.ts'; import { ProcessSubDirection, Redirect } from './types.ts'; export declare function getText(node: TSNodeLike): string; export declare function getCommandName(node: TSNodeLike): string; export declare function getParts(node: TSNodeLike): TSNodeLike[]; /** * Whether unquoted text holds a brace expansion (`{a,b}`, `{1..3}`), * which the shell turns into several words. */ export declare function braceExpands(text: string): boolean; /** * The text a word names before any expansion, or null. * * A word is literal when nothing in it waits on the shell: a plain * word, a number, a quoted string with no expansion inside, or a * concatenation of those. Quotes are removed, escapes resolved and a * leading unquoted `~` expanded the way expansion would (`home` null * leaves it literal, as bash does with no `$HOME`). A word carrying a * parameter, command, arithmetic or process substitution, or a brace * expression, answers null: what it names is known only when it runs. */ export declare function literalWord(node: TSNodeLike, home?: string | null): string | null; /** * Split FOO=1 BAR=2 cmd parts into [assignments, remaining]. * * The single structural rule for env-prefixed commands, shared by the * executor (which expands and applies the assignments) and the * provision planner (which only needs the command parts). */ export declare function hasCommandSubstitution(node: TSNodeLike): boolean; export declare function splitEnvPrefix(parts: TSNodeLike[]): [TSNodeLike[], TSNodeLike[]]; export declare function getPipelineCommands(node: TSNodeLike): [TSNodeLike[], boolean[]]; export declare function getWhileParts(node: TSNodeLike): [TSNodeLike, TSNodeLike[]]; export declare function getForParts(node: TSNodeLike): [string, TSNodeLike[], TSNodeLike[]]; /** * Get ([init, cond, update], bodyCommands) from a C-style for. * * The expression slots are positional between the (( )) delimiters, * separated by `;` tokens, and any of them may be empty (null): * `for ((;;))`. */ export declare function getCforParts(node: TSNodeLike): [(TSNodeLike | null)[], TSNodeLike[]]; export declare function getSubshellBody(node: TSNodeLike): TSNodeLike[]; /** * Parse all redirects from a redirected_statement. * * Returns [command, redirects]; command is null for a bare redirect * like `> file` (bash runs the empty command and applies redirects, * creating/truncating the file). */ export declare function getRedirects(node: TSNodeLike): [TSNodeLike | null, Redirect[]]; export declare function getListParts(node: TSNodeLike): [TSNodeLike, string | null, TSNodeLike]; export declare function getIfBranches(node: TSNodeLike): [[TSNodeLike, TSNodeLike[]][], TSNodeLike[] | null]; export declare function getCaseWord(node: TSNodeLike): TSNodeLike; /** * Get (patternNodes, bodyStatements, terminator) triples from case. * * Patterns are every named child before the arm's `)`, kept as nodes so * quoting survives to the matcher: 'a'), "$x") and $'a\n') all mean literal * text where a bare word keeps its globs live. An arm's body is every * statement up to its terminator, so multi-statement arms * (x) cmd1; cmd2;;) keep all commands. */ export declare function getCaseItems(node: TSNodeLike): [TSNodeLike[], TSNodeLike[], string][]; export declare function getDeclarationAssignments(node: TSNodeLike): string[]; export declare function getDeclarationKeyword(node: TSNodeLike): string; /** * Get every operand word of an unset_command, keeping `-f`/`-v`/`-n` and * keeping a subscript target (`unset arr[1]`, quoted or not) as one word. * Mirrors Python's `get_unset_args`. */ export declare function getUnsetArgs(node: TSNodeLike): string[]; export declare function getTestArgv(node: TSNodeLike): string[]; export declare function getCommandAssignments(node: TSNodeLike): string[]; export declare function getNegatedCommand(node: TSNodeLike): TSNodeLike; export declare function getProcessSubDirection(node: TSNodeLike): ProcessSubDirection | null; export declare function getProcessSubBody(node: TSNodeLike): string; export declare function getFunctionName(node: TSNodeLike): string; export declare function getFunctionBody(node: TSNodeLike): TSNodeLike[] | null; //# sourceMappingURL=helpers.d.ts.map