@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
66 lines • 2.29 kB
TypeScript
/**
* Statement kinds the executor dispatches on.
*
* `nodeKind` owns every node-type check, including the
* lookahead that distinguishes `select` from `for`, `until` from `while`
* and a `(( ))` command from a `{ }` group.
*/
export declare const NodeKind: Readonly<{
readonly COMMENT: "comment";
readonly PROGRAM: "program";
readonly TIMED: "timed";
readonly COMMAND: "command";
readonly PIPELINE: "pipeline";
readonly LIST: "list";
readonly REDIRECT: "redirect";
readonly SUBSHELL: "subshell";
readonly COMPOUND: "compound";
readonly ARITH: "arith";
readonly IF: "if";
readonly FOR: "for";
readonly CFOR: "cfor";
readonly SELECT: "select";
readonly WHILE: "while";
readonly UNTIL: "until";
readonly CASE: "case";
readonly FUNCTION_DEF: "function_def";
readonly DECLARATION: "declaration";
readonly UNSET: "unset";
readonly TEST: "test";
readonly NEGATED: "negated";
readonly VAR_ASSIGN: "var_assign";
readonly VAR_ASSIGNS: "var_assigns";
readonly UNSUPPORTED: "unsupported";
}>;
export type NodeKind = (typeof NodeKind)[keyof typeof NodeKind];
interface KindNodeLike {
type: string;
children?: readonly {
type: string;
}[] | {
type: string;
}[];
namedChildren?: readonly KindNodeLike[] | KindNodeLike[];
}
/**
* Whether a statement leaves `PIPESTATUS` to the pipelines inside it
* rather than stamping its own exit status.
*/
export declare function pipelineTransparent(node: KindNodeLike): boolean;
/**
* Whether a statement is a simple command: a command word, a function call
* or a declaration, not a compound command. A child shell forked to run one
* (a pipeline stage, a `&` job) is that command, so an error that ends it
* reports the status the shell itself would exit with (`: ${U?} &` is 127);
* a compound command forked the same way reports a subshell's
* (`{ : ${U?}; } &` is 1).
*/
export declare function simpleCommand(node: KindNodeLike): boolean;
/**
* Classify a parsed node into the shared statement kind, or
* UNSUPPORTED for node types neither walker implements (future grammar
* additions).
*/
export declare function nodeKind(node: KindNodeLike): NodeKind;
export {};
//# sourceMappingURL=node_kind.d.ts.map