@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
19 lines • 968 B
TypeScript
import type { BacktickSegment } from './types.ts';
/**
* Split a backtick region into its commands and the text between them,
* each with its span in the region.
*
* The node's subtree is not what runs: bash removes the backslashes of a
* backtick body before it parses it, so the body is lexed again from the
* node's own text. The evaluator runs each command as a line of its own
* and the judging pass reads it the same way, so this is the one lexer
* both share, and the spans are what place each command on the line.
*
* Inside a command, POSIX keeps the backslash literal except before
* `$`, `` ` `` and `\\`, where it escapes. Consuming those pairs whole
* is what makes the parity right: `\\\\` is one escaped backslash, so a
* backtick straight after it still closes the region rather than
* reading as an escaped backtick.
*/
export declare function splitBacktickRegion(raw: string): BacktickSegment[];
//# sourceMappingURL=backticks.d.ts.map