yini-parser
Version:
Node.js parser for YINI — a clean, structured INI alternative with types, simple section nesting, comments, and strict mode.
61 lines (59 loc) • 2.14 kB
TypeScript
import { TIssueType, TPersistThreshold } from './types';
interface IIssuePayload {
type: TIssueType;
msgWhat: string;
start: {
line: number;
column: number;
};
end?: {
line?: number;
column?: number;
};
}
/**
* This class handles all error/notice reporting and processes exit/throwing.
*/
export declare class ErrorDataHandler {
private persistThreshold;
private numFatalErrors;
private numInternalErrors;
private numSyntaxErrors;
private numSyntaxWarnings;
private numNotices;
private numInfos;
/** '1-Abort-on-Errors' is the default.
Below is from the YINI spec:
**Abort Sensitivity Levels** while parsing a YINI document:
(AKA severity threshold)
- Level 0 = ignore errors and try parse anyway (may remap falty key/section names)
- Level 1 = abort on errors only
- Level 2 = abort even on warnings
*/
constructor(threshold?: TPersistThreshold);
makeIssuePayload: (type: TIssueType, msgWhat: string, lineNum: number, startCol: number, endCol: number) => IIssuePayload;
/**
* After pushing processing may continue or exit, depending on the error
* and/or the bail threshold (that can be optionally set my the user).
*
* @note This function MIGHT result in a return, throw, or exit depending
* on the bail policy (set my the user).
*
* @param ctx
* @param type
* @param msgWhat Name of the specific error or what failed. E.g. "Key already exists in this section scope".
* @param msgWhy More details and more specific info about the issue/error.
* @param msgHint Hint or HUMBLE description on how to fix the issue.
*/
pushOrBail: (ctx: any, type: TIssueType, msgWhat: string, msgWhy?: string, msgHint?: string) => void;
private emitFatalError;
private emitInternalError;
private emitSyntaxError;
private emitSyntaxWarning;
private emitNotice;
private emitInfo;
getNumOfErrors(): number;
getNumOfWarnings(): number;
getNumOfInfoAndNotices(): number;
}
export {};