/** * Shell AST parser. * * Converts a flat CommandToken list into a ShellNode AST, preserving * operator relationships between segments (&&, ||, ;, |, subshells). * * Grammar (simplified, right-associative for simplicity): * * compound := sequence * sequence := pipe (('&&' | '||' | ';') pipe)* * pipe := atom ('|' atom)* * atom := subshell | command * * Obfuscation handling: * - Backtick subshells (`cmd`) are extracted and recursively parsed. * - $(...) subshells are extracted and recursively parsed. * - Base64-like argument tokens are flagged for upper-layer analysis. * * @module normalization/parser */ import type { CommandToken } from './types.js'; import type { ShellNode } from './ast.js'; /** * Parses a flat CommandToken list into a ShellNode AST. * * Handles compound commands (pipes, &&, ||, ;) and subshell expressions. * Falls back to a single CommandNode if parsing encounters errors. * * @param tokens - The flat token list from the tokenizer. * @returns The root ShellNode of the parsed AST. */ export declare function parseAST(tokens: CommandToken[]): ShellNode; /** * Parses a raw shell command string into a ShellNode AST. * * Convenience wrapper: tokenizes and parses in one step. * * @param command - The raw shell command string. * @returns The root ShellNode of the parsed AST. */ export declare function parseCommandAST(command: string): ShellNode; //# sourceMappingURL=parser.d.ts.map