/** * JSON Source Map * * Builds a lookup table from JSON-Pointer-style paths (e.g. `name/0/given/1`) * to line / character positions in the raw JSON source text. * * This is used by the diagnostic formatter to produce LSP-compatible ranges * so FHIR validation issues highlight the exact source location of the * offending element in IDE integrations. * * The implementation is a small single-pass JSON tokeniser. It intentionally * avoids third-party dependencies and handles the subset of JSON the FHIR * validator is given (objects, arrays, strings, numbers, booleans, null). */ export interface SourcePosition { /** Zero-based line number */ line: number; /** Zero-based character offset within the line */ character: number; } export interface SourceRange { start: SourcePosition; end: SourcePosition; } export declare class JsonSourceMap { private readonly ranges; set(path: string, range: SourceRange): void; /** * Resolve a JSON path (slash-separated, e.g. `name/0/given/1`) to its * source range. Returns `undefined` if the path is not present. * * Falls back to the closest ancestor range when an exact match is not * found — this makes LSP ranges still point to a useful region when the * validator reports on a synthetic sub-path (e.g. a computed constraint). */ lookup(path: string): SourceRange | undefined; /** Number of mapped paths (mainly for tests and diagnostics). */ get size(): number; } /** * Build a `JsonSourceMap` from a raw JSON source string. * * The returned map covers every object property and array element in the * document. Paths use slash separators; array indices are numeric, e.g. * `name/0/given/1`. The document root is mapped to the empty string key. * * Malformed input produces a best-effort map (partial coverage) instead of * throwing so the caller can still emit LSP diagnostics with line-0 ranges * for unresolved paths. */ export declare function buildJsonSourceMap(source: string): JsonSourceMap; //# sourceMappingURL=json-source-map.d.ts.map