/** * Parser Class - Core * * Defines the Parser class structure. Methods are added via prototype * extension from separate modules, using TypeScript declaration merging * for type safety. * * This architecture eliminates circular dependencies while keeping * the codebase modular and organized by concern. */ import type { ScriptNode, Token } from '../types.js'; import { ParseError } from '../types.js'; import { type ParserState } from './state.js'; /** * Parser class that converts tokens into an AST. * * Methods are organized across multiple files: * - parser-script.ts: Script, statement, annotation parsing * - parser-expr.ts: Expressions, precedence chain, pipe targets * - parser-literals.ts: Literals, strings, tuples, dicts, closures * - parser-variables.ts: Variables, access chains * - parser-control.ts: Conditionals, loops, blocks * - parser-functions.ts: Function calls, methods, type operations * - parser-extract.ts: Extraction operators (destructure, slice, spread) * * @example * ```typescript * const parser = new Parser(tokens, { recoveryMode: false }); * const ast = parser.parse(); * ``` */ export declare class Parser { /** Parser state including tokens, position, and error collection */ state: ParserState; /** Tracks closure nesting depth for yield validation */ closureDepth: number; constructor(tokens: Token[], options?: { recoveryMode?: boolean; source?: string; }); /** * Parse tokens into a complete AST. */ parse(): ScriptNode; /** * Get collected errors (for recovery mode). */ get errors(): ParseError[]; }