@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
25 lines • 1.34 kB
TypeScript
/**
* Recognize a plain dollar reference, returning its name and end.
*
* Names use Bash's ASCII identifier grammar. Unbraced positionals
* consume one digit; braces permit multiple digits. Special parameters
* consume one character. The caller owns quoting and must only scan a
* live dollar. Complex braced operators remain the expansion parser's
* responsibility and return null here, as do non-reference dollars.
* `start` and the returned end are offsets into `text`.
*/
export declare function scanParameter(text: string, start: number): [string, number] | null;
/**
* Whether bash refuses a `${...}` for its spelling alone.
*
* bash reads the braces only when the word holding them expands, and then
* reports `bad substitution` for a name that is no identifier, positional or
* special parameter (`${a b}`, `${ a}`, `${}`), an element reference that is
* not one whole (`${a[1]x}`), a `#` measuring more than a name (`${#a-x}`),
* or a name followed by anything but an operator (`${a:}`, `${a*}`). The
* braces are read as bash reads them, so `${!a b*}`, which bash reads as a
* prefix, passes here as it does in bash. `text` runs from `${` through
* its closing `}`. Mirrors Python's bad_substitution.
*/
export declare function badSubstitution(text: string): boolean;
//# sourceMappingURL=parameter.d.ts.map