@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
62 lines • 2.2 kB
TypeScript
import type { ShellTreeNode } from '../../rs/shell.ts';
import type { ShellNode, TSNodeLike } from '../types.ts';
/** One parse of a line: its tree, where each of its chars sits in the line as
* typed, and the references that keep it readable. Mirrors Python's
* ParsedProgram. */
export declare class ParsedProgram {
readonly original: string;
readonly root: ProgramNode;
references: number;
private released;
readonly offsets: Uint32Array;
constructor(original: string, root: ShellTreeNode);
check(): void;
retain(): () => void;
release(): void;
}
/** A node of a parsed program; every read checks the program is still held.
* The wrappers of a node's children are built once and kept, as in Python. */
export declare class ProgramNode implements ShellNode {
private readonly borrowed;
readonly program: ParsedProgram;
private kids;
private named;
constructor(borrowed: ShellNode, program: ParsedProgram);
private get node();
get heredoc(): import("../types.ts").Heredoc | undefined;
get warnings(): string;
get offsets(): Uint32Array<ArrayBufferLike>;
get error(): {
readonly index: number;
readonly message: string;
readonly status: number;
} | null;
get sourceText(): string;
get inlined(): string | undefined;
get type(): string;
get text(): string;
get id(): number;
get startIndex(): number;
get endIndex(): number;
get startPosition(): {
row: number;
column: number;
};
get endPosition(): {
row: number;
column: number;
};
get isNamed(): boolean;
get childCount(): number;
child(index: number): ProgramNode | null;
get children(): ProgramNode[];
get namedChildren(): ProgramNode[];
private wrap;
get parent(): ProgramNode | null;
get previousSibling(): ProgramNode | null;
get nextSibling(): ProgramNode | null;
childForFieldName(name: string): ProgramNode | null;
}
/** Retain each defining program once, including synthetic redirect wrappers. */
export declare function retainPrograms(nodes: readonly TSNodeLike[]): () => void;
//# sourceMappingURL=program.d.ts.map