@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
34 lines • 1.57 kB
TypeScript
/**
* The text a `\u` or `\U` escape writes for its value.
*
* bash UTF-8-encodes every value under a UTF-8 locale: a
* valid scalar is its character, while surrogate halves and values past
* Unicode become raw UTF-8-shaped bytes, and 0x80000000 and past produce
* nothing. Pinned: `\uD800` is ed a0 80, `\U00110000` is f4 90 80 80,
* `\UFFFFFFFF` is empty.
*/
export declare function codePointText(value: number): string;
/**
* Decode the body of a $'...' word to the text it names.
*
* Follows bash 5.2 (under a UTF-8 locale): simple
* escapes, 1-3 octal digits with the value masked to a byte, \xHH
* bytes, \u and \U values UTF-8-encoded (surrogates and
* values past Unicode come out as raw UTF-8-shaped bytes), \cX control
* characters (X of `?` is DEL, an escaped backslash counts as one
* operand), and any other or incomplete escape kept verbatim, backslash
* included. A NUL truncates the rest of this word segment, the C-string
* behavior; the segment alone is cut, so `x$'a\0b'y` still expands to
* `xay`.
*/
export declare function decodeAnsiC(content: string): string;
export declare function unescapeUnquoted(text: string): string;
export declare function unescapeDquoted(text: string): string;
/**
* Whether an odd run of backslashes ends `text`, so its last backslash
* escapes what follows: the newline it continues, or the end of the input it
* quotes. An even run is escaped backslashes only. Mirrors Python's
* ends_escaped.
*/
export declare function endsEscaped(text: string): boolean;
//# sourceMappingURL=escapes.d.ts.map