import { LazyPattern, PatternFound } from "./lazyPattern"; import { BasicRule } from "./lazyRule"; /** * A representation of the result of a pattern. */ export interface PatternResult { /** * If the pattern is an ending pattern. */ isPatternEnd: boolean; /** * The pattern founded. */ result: PatternFound[]; /** * The last index of the pattern. */ lastIndex: number; } /** * A more natural way to parse datas with custom rules set in specific testing order. */ export declare class LazyParsing { private rules; /** * The constructor of the parser. * @param {BasicRule[]} rules The rules to implement into the parser. */ constructor(...rules: BasicRule[]); /** * Add rules to the parser. * @param {BasicRule[]} rules The rules to implement into the parser. */ addRules(...rules: BasicRule[]): void; /** * Remove rules from the parser. * @param {string[]} rulesName The name of the rules to remove from the parser. */ removeRules(...rulesName: string[]): void; /** * Convert a string to an object representation following specific rules. * @param {string} text The text to parse. * @returns {PatternFound[]} The parsed content. */ parse(text: string): PatternFound[]; /** * Create a set of patterns from a set of rules. * @param {BasicRule[]} rules The set of rules to use. * @returns {LazyPattern[]} An array of all patterns. */ static createSet(...rules: BasicRule[]): LazyPattern[]; /** * Search every pattern to parse it into an object. * @param {string} txtContent The string we're currently parsing. * @param {LazyPattern[]} patternSet A list of different pattern to compute. * @param {number} i The index with default value to 0. Can be modified for nested searching. * @param {(index: number, c: string, text: string) => boolean} endPattern A function to check if a pattern ended. * @return {{isPatternEnd: boolean, result: PatternFound[], lastIndex: number}} Return an object representing the value parsed. */ static parse(txtContent: string, patternSet: LazyPattern[], i?: number, endPattern?: (i: number, c: string, t: string) => boolean): PatternResult; /** * Convert the result of a pattern to a string representation. * @param {PatternResult | PatternFound[]} content The parsed content. * @param {boolean} spacing If true, the result will be written while taking into account the spacing of every elements. * @returns {string} The stringified content of the pattern. */ static toString(content: PatternResult | PatternFound[], spacing?: boolean): string; /** * Convert the result of a pattern to a string representation with some datas represented. * @param {PatternResult | PatternFound[]} content The parsed content. * @param spacing If true, the result will be written while taking into account the spacing of every elements. * @returns {string} The stringified content of the pattern. */ static toStringDebug(content: PatternResult | PatternFound[], spacing?: boolean): string; private static generateSpace; private static extractString; private static stringifyParse; } //# sourceMappingURL=lazyParsing.d.ts.map