UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

23 lines • 1.39 kB
import { IOResult } from '../../io/types.ts'; import { ParsedProgram } from './program.ts'; import type { ShellNode, TSNodeLike } from '../types.ts'; /** * Parse a line as bash reads it. The parser folds each heredoc body into its * line as a `<` redirect from a double-quoted word, whose node carries the * heredoc, and drops the line continuations, so a word's text is what bash * reads; each node's `offsets` map the text back to the line as typed. * `aliases` are the names the shell expands as aliases: one is a command * where a command starts. `extglob` says whether extglob's pattern groups are * on. A line the parser refuses ends in an `ERROR` node, and its `error` * holds bash's refusal. Mirrors Python's parse. */ export declare function parse(command: string, aliases?: ReadonlySet<string>, extglob?: boolean): ShellNode; /** Parse a line into a program its holders release when done with it. */ export declare function parseProgram(command: string, aliases?: ReadonlySet<string>, extglob?: boolean): ParsedProgram; /** * What a line bash refuses yields: its diagnostic and status, null when bash * reads it. Status 2 is a syntax error, 1 an array bash cannot read, 127 a * substitution whose body bash cannot parse. Mirrors Python's syntax_refusal. */ export declare function syntaxRefusal(root: TSNodeLike): IOResult | null; //# sourceMappingURL=parse.d.ts.map