@informalsystems/quint
Version:
Core tool for the Quint specification language
33 lines (32 loc) • 1.41 kB
TypeScript
/**
* Human-friendly error reporting for Quint errors. From the read text and an error
* message containing localization errors, fetch offending lines and highlights
* offending sections with ^^^ strings.
*
* @author Gabriela Moreira
*
* @module
*/
import { Maybe } from '@sweet-monads/maybe';
import { ErrorMessage } from './ErrorMessage';
/** Generate a string with formatted error reporting for a given error message
*
* @param code a map from all possible loc sources to their file contents
* @param finders a map of from all possible loc sources to a line-column lib
* finder object created from the text for that source, used as cached maps of indexes
* @param message the error message to be reported
* @param lineOffset a maybe number to add to line numbers in error messages,
* the default value is `just(1)`.
* No source info is printed if `lineOffset == none()`.
*
* @returns a formatted string with error information
* */
export declare function formatError(code: Map<string, string>, finders: Map<string, any>, message: ErrorMessage, lineOffset?: Maybe<number>): string;
/**
* Create line column finders (from the line-column lib) for each file in a map.
*
* @param sourceCode - a map of file names to their contents
*
* @returns a map of file names to their finders
*/
export declare function createFinders(sourceCode: Map<string, string>): Map<string, any>;