import { ParseError, ParseErrorCode } from 'jsonc-parser'; import { Node } from 'jsonc-parser'; import { UtamJsonValidationError } from '../utils/errors'; declare const UTAM_CUSTOM_PARSE_ERROR_CODE = 17; export interface UtamParseError extends Omit { /** parser error code extended with UTAM parser error code */ error: ParseErrorCode | typeof UTAM_CUSTOM_PARSE_ERROR_CODE; /** distinguish invalid JSON syntax error from invalid Page Structure ones */ isInvalidPageObjectError: boolean; /** parser error message */ message: string; } /** Configuration object for the custom parser */ interface UtamParserOptions { /** toggle duplicated keys parsing errors on and off */ disallowDuplicatedKeys: boolean; /** toggle inline comments parsing errors on and off */ disallowInlineComments: boolean; } /** * Wrap errors into UtamParseError to add context around parsing errors * @param err either an error coming from the jsonc-parser or an error throwed by the visitor function * @returns an error with context representing a UTAM parse error */ export declare function createUtamParseError(err: ParseError | Required): UtamParseError; /** * User defined type guard to narrow errors down to ParseError * @param err any error that needs some narrowing * @returns type predicate indicating if the error is a ParseError */ export declare function isParseError(err: any): err is ParseError; /** * User defined type guard to narrow errors down to UtamParseError * @param err any error that needs some narrowing * @returns type predicate indicating if the error is a UtamParseError */ export declare function isUtamParseError(err: any): err is UtamParseError; /** * Facade function that augment the parseTree function from jsonc-parser to invalidate JSON * objects with duplicated keys in the same scope. * * @param jsonSourceText json page object to validate * @param errors errors objects returned by the visitor or via the jsonc-parser parseTree function * @param options configuration object to configure the behavior of the facade function * @returns the root node object if the text has been successfully parsed */ export declare function parseTree(jsonSourceText: string, errors: Array, options?: UtamParserOptions): Node | undefined; export {}; //# sourceMappingURL=page-object-parser.d.ts.map