import { TokenStream } from '../classes/TokenStream'; import { Token } from '../classes/Lexer'; import { CommandCall, Arg, ScopeBlock, CodePosition } from '../types/Ast.type'; export interface CommandParserContext { /** * Parse a statement from the stream (for callback blocks) */ parseStatement?: (stream: TokenStream) => any; /** * Parse a scope block (do/enddo) */ parseScope?: (stream: TokenStream) => ScopeBlock; /** * Create code position from tokens */ createCodePosition?: (startToken: Token, endToken: Token) => CodePosition; } export declare class CommandParser { /** * Parse a command call from TokenStream * Expects stream to be positioned at the command name (identifier or keyword) * * @param stream - TokenStream positioned at the command name * @param context - Optional context for parsing callbacks and creating code positions * @returns Parsed CommandCall */ static parse(stream: TokenStream, context?: CommandParserContext): CommandCall; /** * Parse command name (handles module.function syntax) */ private static parseCommandName; /** * Parse parenthesized function call: command(...) */ private static parseParenthesizedCall; /** * Parse space-separated function call: command arg1 arg2 */ private static parseSpaceSeparatedCall; /** * Parse a single argument (positional or named) */ private static parseArgument; /** * Parse an argument value (handles literals, variables, subexpressions, objects, arrays) */ static parseArgumentValue(stream: TokenStream, context?: CommandParserContext): Arg | null; /** * Parse "into $var" syntax */ private static parseInto; /** * Parse callback block (with only) */ private static parseCallback; }