import { type LangiumDocument } from 'langium'; import type { Model } from '../language/generated/ast.js'; import type { ParseError } from './semantic.js'; /** A parsed document with its source file path */ export interface ParsedDocument { /** Langium document with AST */ document: LangiumDocument; /** Relative file path */ filePath: string; } /** Result of parsing multiple files */ export interface ParseResult { /** Successfully parsed documents */ documents: ParsedDocument[]; /** Parse errors from all files */ errors: ParseError[]; } /** Drop a document from the shared store when it leaves an incremental project. */ export declare function forgetDocument(filePath: string): void; /** * Parse multiple SysML files and return their ASTs. * Each file is parsed independently (no cross-file resolution for MVP). */ export declare function parseFiles(filePaths: string[], basePath?: string): Promise; /** * Coherent project document cache for the live runtime. * * The first build parses the complete project. Later builds parse only files * reported by the watcher, discard deleted files, and return the complete * cached document/error set to the semantic builder. This keeps snapshot * semantics identical to a cold build while removing unchanged parser work * from the project-save hot path. */ export declare class IncrementalProjectParser { private readonly basePath; private readonly documents; private readonly errors; constructor(basePath: string); parse(allFiles: string[], changedFiles?: readonly string[]): Promise; } /** * Parse a single SysML source string, keeping the CST so callers can edit the * original text by offset. Source-preserving editors use this to validate a * candidate edit before it replaces the file on disk. */ export declare function parseText(source: string): Promise<{ document: LangiumDocument; errors: ParseError[]; }>; /** * Parse one SysML file to an AST synchronously. * * `parseFiles`/`parseText` go through Langium's async document builder, which * several callers cannot use: the ontology-browser metadata path is synchronous * all the way up through `buildLayers` and `getPackageMetadata`. Langium's * parser itself is synchronous, so those callers can have a real AST without * the surrounding pipeline going async — which is what let the regex scanner * survive as long as it did. * * Returns undefined when the file cannot be read or produces no root node. * Parse errors are not surfaced: callers here are building a catalog view, and * a partially-parsed file should contribute what it has rather than vanish. */ export declare function parseFileToAstSync(filePath: string): Model | undefined; //# sourceMappingURL=parser-utils.d.ts.map