/** * Tokenizer, converts a raw shell command string into an ordered list * of CommandToken objects. * * Handles: * - Single- and double-quoted strings (preserves inner whitespace) * - Shell operators: &&, ||, ;, |, >, >>, <, 2> * - Variable expansions: $VAR, ${VAR} * - Subshell expressions: $(...) and `...` * - Flags (tokens starting with -) * - Path-like tokens (contain / or ~) * * Safety contracts: * - Inputs exceeding MAX_INPUT_LENGTH are truncated before processing * - Tokenization halts once MAX_TOKEN_COUNT tokens are produced * - Both guards ensure bounded runtime regardless of pathological input */ import type { CommandToken } from './types.js'; /** * Maximum number of characters accepted from a raw command string. * Inputs longer than this are hard-truncated before tokenization begins. * Emergency truncation ensures the tokenizer can never hang * on extremely long inputs even if other guards are bypassed. */ export declare const MAX_INPUT_LENGTH = 65536; /** * Maximum number of tokens the tokenizer will produce from a single input. * Once this limit is reached tokenization halts and the partial token list * is returned. Prevents pathological inputs with O(N) whitespace-separated * tokens from consuming unbounded memory or time. */ export declare const MAX_TOKEN_COUNT = 1024; /** * Tokenizes a raw shell command string into an ordered array of CommandTokens. * * @param command - The raw shell command string to tokenize. * @returns Ordered array of CommandToken objects. */ export declare function tokenize(command: string): CommandToken[]; //# sourceMappingURL=tokenizer.d.ts.map