export declare type RegExpMap = Record; export declare type RegExpMapped = RegExp & { map: RegExpMap; keys: Set; }; export interface SyntaxDefinition { [k: string]: RegExp | [RegExp, SyntaxDefinition]; } export declare type SyntaxOrImport = SyntaxDefinition | Promise<{ default: SyntaxDefinition; }>; /** * Compiles a syntax definition. * * ```js * const r = await compile({ * foo: /[a-z]/, * bar: /[0-9]/, * }) * ``` * * @param def The syntax definition to compile. Can be a promise returned by `import()`. */ export declare const compile: (def: SyntaxOrImport, keys?: Set) => Promise; /** * Syntax highlights a string as html with the given syntax. * * ```js * const regexp = await compile({ * foo: /[a-z]+/, * bar: [ * /[0-9]+/, * { * bar: /[0-5]+/, * }, * ], * }) * const html = syntax(regexp, 'hello 123 789 world') * ``` * * @param regexp The syntax definition returned by `compile()` * @param s The string to highlight. */ export declare const syntax: (regexp: RegExpMapped | RegExp, s: string) => string;