import { nat } from "things"; import { Span } from "./span.js"; import { TextLines, Text } from "./textlines.js"; export type Result = { type: T | null | undefined; startLine: nat; startColumnInclusive: nat; endLine: nat; endColumnExclusive: nat; children: Result[]; }; export type StrictResult = { type: T; startLine: nat; startColumnInclusive: nat; endLine: nat; endColumnExclusive: nat; children: Result[]; }; export type ParseResult = { state: State; result: Result; } | undefined; export type Parser = (state: State, lines: TextLines, line: nat, column: nat) => ParseResult; export declare function resultCoordinatesAreValid(startLine: nat, startColumn: nat, endLine: nat, endColumn: nat): boolean; export declare function joinResults(results: Result[], type?: T | null | undefined, start?: [nat, nat], end?: [nat, nat]): Result; export declare function startOfResult(result: Result): [nat, nat]; export declare function endOfResult(result: Result): [nat, nat]; export declare function textlinesOfResult(lines: TextLines, result: Result): TextLines; export declare function textOfResult(lines: TextLines, result: Result): Text; export declare function printRange(result: Result | Span): string; export declare function selectResults(result: Result, predicate: (r: StrictResult) => boolean): StrictResult[]; export declare function selectResult(result: Result, predicate: (r: StrictResult) => boolean): StrictResult; export declare function selectResultsIn(results: Result[], predicate: (r: StrictResult) => boolean): StrictResult[]; export declare function selectResultIn(results: Result[], predicate: (r: StrictResult) => boolean): StrictResult; export declare function collectResultsIn(results: Result[], filter: (r: StrictResult) => F | undefined): F[]; export declare function collectResultIn(results: Result[], filter: (r: StrictResult) => F | undefined): F | undefined; export declare function pruneResult(result: Result, pruned: Result[]): void; export declare function printResult(lines: TextLines, result: Result, nameOf?: (type: T) => string, isOpaque?: (type: T) => boolean, print?: (result: string) => void): void;