/** * Quote- and bracket-aware string helpers shared by all diagram parsers. * Scanner-style implementations avoid regex backtracking on hostile input. * @module syntax/text */ /** * Remove one pair of surrounding double quotes (or single quotes). * @param {string} s * @returns {string} */ export declare function unquote(s: string): string; /** * Convert PlantUML label escapes into real text: `\n`, `\t`, `%n()`, * `
`, `\\` and `\"`. Leaves creole markup untouched. * @param {string} s * @returns {string} */ export declare function unescapeLabel(s: string): string; /** * Normalise a label: unquote then unescape. * @param {string | null | undefined} s * @returns {string} */ export declare function label(s: string | null | undefined): string; /** * Split on a separator outside of quotes and brackets. * @param {string} text * @param {string} sep Single character separator. * @returns {string[]} */ export declare function splitTopLevel(text: string, sep: string): string[]; /** * Index of the first unquoted occurrence of `needle`, or -1. * @param {string} text * @param {string} needle * @param {number} [from] * @returns {number} */ export declare function indexOfUnquoted(text: string, needle: string, from?: number): number; /** * Split `text : label` on the first unquoted colon that is not part of `::`. * @param {string} text * @returns {[string, string | null]} */ export declare function splitLabel(text: string): [string, string | null]; /** * Extract and remove `<>` groups. Returns the remaining text and * the list of stereotypes (a spot like `(C,#red)` is kept in the stereotype). * @param {string} text * @returns {{ rest: string, stereotypes: string[] }} */ export declare function takeStereotypes(text: string): { rest: string; stereotypes: string[]; }; /** * Take a trailing (or anywhere) colour token `#xxx` / `#a;line:b` outside quotes. * @param {string} text * @returns {{ rest: string, color: string | null }} */ export declare function takeColor(text: string): { rest: string; color: string | null; }; /** * Make a stable identifier from free text (used for implicit ids). * @param {string} text * @returns {string} */ export declare function slug(text: string): string; /** * Remove a trailing `{` (block opener) and report whether it was present. * @param {string} text * @returns {{ rest: string, opens: boolean }} */ export declare function takeBlockOpen(text: string): { rest: string; opens: boolean; }; /** * Truncate overly long labels to the configured limit. * @param {string} text * @param {number} max * @returns {string} */ export declare function clampText(text: string, max: number): string;