full site update

This commit is contained in:
2025-07-24 18:46:24 +02:00
parent bfe2b90d8d
commit 37a6e0ab31
6912 changed files with 540482 additions and 361712 deletions

View File

@@ -2,15 +2,15 @@
Apply transformations for atomic groups: `(?>…)`.
@param {string} expression
@param {import('./regex.js').PluginData} [data]
@returns {string}
@returns {Required<import('./regex.js').PluginResult>}
*/
export function atomic(expression: string, data?: import("./regex.js").PluginData): string;
export function atomic(expression: string, data?: import("./regex.js").PluginData): Required<import("./regex.js").PluginResult>;
/**
Transform posessive quantifiers into atomic groups. The posessessive quantifiers are:
`?+`, `*+`, `++`, `{N}+`, `{N,}+`, `{N,N}+`.
This follows Java, PCRE, Perl, and Python.
Possessive quantifiers in Oniguruma and Onigmo are only: `?+`, `*+`, `++`.
@param {string} expression
@returns {string}
@returns {import('./regex.js').PluginResult}
*/
export function possessive(expression: string): string;
export function possessive(expression: string): import("./regex.js").PluginResult;

View File

@@ -2,6 +2,6 @@
Applies flag v rules when using flag u, for forward compatibility.
Assumes flag u and doesn't worry about syntax errors that are caught by it.
@param {string} expression
@returns {string}
@returns {import('./regex.js').PluginResult}
*/
export function backcompatPlugin(expression: string): string;
export function backcompatPlugin(expression: string): import("./regex.js").PluginResult;

View File

@@ -1,9 +1,9 @@
/**
Remove `(?:)` token separators (most likely added by flag x) in cases where it's safe to do so.
@param {string} expression
@returns {string}
@returns {import('./regex.js').PluginResult}
*/
export function clean(expression: string): string;
export function clean(expression: string): import("./regex.js").PluginResult;
export function flagXPreprocessor(value: import("./utils.js").InterpolatedValue, runningContext: import("./utils.js").RunningContext, options: Required<import("./utils.js").RegexTagOptions>): {
transformed: string;
runningContext: import("./utils.js").RunningContext;

View File

@@ -1,2 +1,2 @@
export { RegExpSubclass } from "./subclass.js";
export { atomic, possessive } from "./atomic.js";
export { emulationGroupMarker, RegExpSubclass } from "./subclass.js";

View File

@@ -1,7 +1,13 @@
export type InterpolatedValue = string | RegExp | Pattern | number;
export type PluginData = {
flags?: string;
useEmulationGroups?: boolean;
captureTransfers?: Map<number, Array<number>>;
hiddenCaptures?: Array<number>;
};
export type PluginResult = {
pattern: string;
captureTransfers?: Map<number, Array<number>>;
hiddenCaptures?: Array<number>;
};
export type RawTemplate = TemplateStringsArray | {
raw: Array<string>;
@@ -9,8 +15,8 @@ export type RawTemplate = TemplateStringsArray | {
export type RegexTagOptions = {
flags?: string;
subclass?: boolean;
plugins?: Array<(expression: string, data: PluginData) => string>;
unicodeSetsPlugin?: ((expression: string, data: PluginData) => string) | null;
plugins?: Array<(expression: string, data: PluginData) => PluginResult>;
unicodeSetsPlugin?: ((expression: string, data: PluginData) => PluginResult) | null;
disable?: {
x?: boolean;
n?: boolean;
@@ -40,14 +46,20 @@ import { pattern } from './pattern.js';
@typedef {string | RegExp | Pattern | number} InterpolatedValue
@typedef {{
flags?: string;
useEmulationGroups?: boolean;
captureTransfers?: Map<number, Array<number>>;
hiddenCaptures?: Array<number>;
}} PluginData
@typedef {{
pattern: string;
captureTransfers?: Map<number, Array<number>>;
hiddenCaptures?: Array<number>;
}} PluginResult
@typedef {TemplateStringsArray | {raw: Array<string>}} RawTemplate
@typedef {{
flags?: string;
subclass?: boolean;
plugins?: Array<(expression: string, data: PluginData) => string>;
unicodeSetsPlugin?: ((expression: string, data: PluginData) => string) | null;
plugins?: Array<(expression: string, data: PluginData) => PluginResult>;
unicodeSetsPlugin?: ((expression: string, data: PluginData) => PluginResult) | null;
disable?: {
x?: boolean;
n?: boolean;
@@ -85,10 +97,13 @@ export const regex: RegexTag<RegExp>;
Returns the processed expression and flags as strings.
@param {string} expression
@param {RegexTagOptions} [options]
@returns {{expression: string; flags: string;}}
@returns {{
pattern: string;
flags: string;
}}
*/
export function rewrite(expression?: string, options?: RegexTagOptions): {
expression: string;
pattern: string;
flags: string;
};
import { Pattern } from './pattern.js';

350
node_modules/regex/dist/cjs/regex.js generated vendored
View File

@@ -25,6 +25,19 @@ __export(regex_exports, {
});
module.exports = __toCommonJS(regex_exports);
// src/utils-internals.js
var noncapturingDelim = String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;
function incrementIfAtLeast(arr, threshold) {
for (let i = 0; i < arr.length; i++) {
if (arr[i] >= threshold) {
arr[i]++;
}
}
}
function spliceStr(str, pos, oldValue, newValue) {
return str.slice(0, pos) + newValue + str.slice(pos + oldValue.length);
}
// node_modules/.pnpm/regex-utilities@2.3.0/node_modules/regex-utilities/src/index.js
var Context = Object.freeze({
DEFAULT: "DEFAULT",
@@ -117,134 +130,22 @@ function getGroupContents(expression, contentsStartPos) {
return expression.slice(contentsStartPos, contentsEndPos);
}
// src/subclass.js
var emulationGroupMarker = "$E$";
var RegExpSubclass = class _RegExpSubclass extends RegExp {
// Avoid `#private` to allow for subclassing
/**
@private
@type {Array<{
exclude: boolean;
transfer?: number;
}> | undefined}
*/
_captureMap;
/**
@private
@type {Record<number, string> | undefined}
*/
_namesByIndex;
/**
@param {string | RegExpSubclass} expression
@param {string} [flags]
@param {{useEmulationGroups: boolean;}} [options]
*/
constructor(expression, flags, options) {
if (expression instanceof RegExp && options) {
throw new Error("Cannot provide options when copying a regexp");
}
const useEmulationGroups = !!options?.useEmulationGroups;
const unmarked = useEmulationGroups ? unmarkEmulationGroups(expression) : null;
super(unmarked?.expression || expression, flags);
const src = useEmulationGroups ? unmarked : expression instanceof _RegExpSubclass ? expression : null;
if (src) {
this._captureMap = src._captureMap;
this._namesByIndex = src._namesByIndex;
}
}
/**
Called internally by all String/RegExp methods that use regexes.
@override
@param {string} str
@returns {RegExpExecArray | null}
*/
exec(str) {
const match = RegExp.prototype.exec.call(this, str);
if (!match || !this._captureMap) {
return match;
}
const matchCopy = [...match];
match.length = 1;
let indicesCopy;
if (this.hasIndices) {
indicesCopy = [...match.indices];
match.indices.length = 1;
}
for (let i = 1; i < matchCopy.length; i++) {
if (this._captureMap[i].exclude) {
const transfer = this._captureMap[i].transfer;
if (transfer && match.length > transfer) {
match[transfer] = matchCopy[i];
const transferName = this._namesByIndex[transfer];
if (transferName) {
match.groups[transferName] = matchCopy[i];
if (this.hasIndices) {
match.indices.groups[transferName] = indicesCopy[i];
}
}
if (this.hasIndices) {
match.indices[transfer] = indicesCopy[i];
}
}
} else {
match.push(matchCopy[i]);
if (this.hasIndices) {
match.indices.push(indicesCopy[i]);
}
}
}
return match;
}
};
function unmarkEmulationGroups(expression) {
const marker = emulationGroupMarker.replace(/\$/g, "\\$");
const _captureMap = [{ exclude: false }];
const _namesByIndex = { 0: "" };
let realCaptureNum = 0;
expression = replaceUnescaped(
expression,
String.raw`\((?:(?!\?)|\?<(?![=!])(?<name>[^>]+)>)(?<mark>(?:\$(?<transfer>[1-9]\d*))?${marker})?`,
({ 0: m, groups: { name, mark, transfer } }) => {
if (mark) {
_captureMap.push({
exclude: true,
transfer: transfer && +transfer
});
return m.slice(0, -mark.length);
}
realCaptureNum++;
if (name) {
_namesByIndex[realCaptureNum] = name;
}
_captureMap.push({
exclude: false
});
return m;
},
Context.DEFAULT
);
return {
_captureMap,
_namesByIndex,
expression
};
}
// src/utils-internals.js
var noncapturingDelim = String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;
function spliceStr(str, pos, oldValue, newValue) {
return str.slice(0, pos) + newValue + str.slice(pos + oldValue.length);
}
// src/atomic.js
var atomicPluginToken = new RegExp(String.raw`(?<noncapturingStart>${noncapturingDelim})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`, "gsu");
function atomic(expression, data) {
const hiddenCaptures = data?.hiddenCaptures ?? [];
let captureTransfers = data?.captureTransfers ?? /* @__PURE__ */ new Map();
if (!/\(\?>/.test(expression)) {
return expression;
return {
pattern: expression,
captureTransfers,
hiddenCaptures
};
}
const aGDelim = "(?>";
const emulatedAGDelim = `(?:(?=(${data?.useEmulationGroups ? emulationGroupMarker : ""}`;
const emulatedAGDelim = "(?:(?=(";
const captureNumMap = [0];
const addedHiddenCaptures = [];
let numCapturesBeforeAG = 0;
let numAGs = 0;
let aGPos = NaN;
@@ -276,8 +177,21 @@ function atomic(expression, data) {
} else if (m === ")" && inAG) {
if (!numGroupsOpenInAG) {
numAGs++;
expression = `${expression.slice(0, aGPos)}${emulatedAGDelim}${expression.slice(aGPos + aGDelim.length, index)}))<$$${numAGs + numCapturesBeforeAG}>)${expression.slice(index + 1)}`;
const addedCaptureNum = numCapturesBeforeAG + numAGs;
expression = `${expression.slice(0, aGPos)}${emulatedAGDelim}${expression.slice(aGPos + aGDelim.length, index)}))<$$${addedCaptureNum}>)${expression.slice(index + 1)}`;
hasProcessedAG = true;
addedHiddenCaptures.push(addedCaptureNum);
incrementIfAtLeast(hiddenCaptures, addedCaptureNum);
if (captureTransfers.size) {
const newCaptureTransfers = /* @__PURE__ */ new Map();
captureTransfers.forEach((from, to) => {
newCaptureTransfers.set(
to >= addedCaptureNum ? to + 1 : to,
from.map((f) => f >= addedCaptureNum ? f + 1 : f)
);
});
captureTransfers = newCaptureTransfers;
}
break;
}
numGroupsOpenInAG--;
@@ -287,6 +201,7 @@ function atomic(expression, data) {
}
}
} while (hasProcessedAG);
hiddenCaptures.push(...addedHiddenCaptures);
expression = replaceUnescaped(
expression,
String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,
@@ -302,7 +217,11 @@ function atomic(expression, data) {
},
Context.DEFAULT
);
return expression;
return {
pattern: expression,
captureTransfers,
hiddenCaptures
};
}
var baseQuantifier = String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`;
var possessivePluginToken = new RegExp(String.raw`
@@ -323,7 +242,9 @@ var possessivePluginToken = new RegExp(String.raw`
`.replace(/\s+/g, ""), "gsu");
function possessive(expression) {
if (!new RegExp(`${baseQuantifier}\\+`).test(expression)) {
return expression;
return {
pattern: expression
};
}
const openGroupIndices = [];
let lastGroupIndex = null;
@@ -374,7 +295,9 @@ function possessive(expression) {
}
lastToken = m;
}
return expression;
return {
pattern: expression
};
}
// src/pattern.js
@@ -695,7 +618,9 @@ function backcompatPlugin(expression) {
}
result += m;
}
return result;
return {
pattern: result
};
}
// src/flag-n.js
@@ -848,21 +773,104 @@ function flagXPreprocessor(value, runningContext, options) {
function clean(expression) {
const sep = String.raw`\(\?:\)`;
expression = replaceUnescaped(expression, `(?:${sep}){2,}`, "(?:)", Context.DEFAULT);
const marker = emulationGroupMarker.replace(/\$/g, "\\$");
expression = replaceUnescaped(
expression,
String.raw`(?:${sep}(?=[)|.[$\\]|\((?!DEFINE)|$)|(?<=[()|.\]^>]|\\[bBdDfnrsStvwW]|\(\?(?:[:=!]|<[=!])|^)${sep}(?![?*+{]))(?!${marker})`,
String.raw`${sep}(?=[)|.[$\\]|\((?!DEFINE)|$)|(?<=[()|.\]^>]|\\[bBdDfnrsStvwW]|\(\?(?:[:=!]|<[=!])|^)${sep}(?![?*+{])`,
"",
Context.DEFAULT
);
return expression;
return {
pattern: expression
};
}
// src/subclass.js
var RegExpSubclass = class _RegExpSubclass extends RegExp {
// Avoid `#private` to allow for subclassing
/**
@private
@type {Map<number, {
hidden: true;
}>}
*/
_captureMap;
/**
@overload
@param {string} expression
@param {string} [flags]
@param {{
hiddenCaptures?: Array<number>;
}} [options]
*/
/**
@overload
@param {RegExpSubclass} expression
@param {string} [flags]
*/
constructor(expression, flags, options) {
if (expression instanceof RegExp) {
if (options) {
throw new Error("Cannot provide options when copying a regexp");
}
super(expression, flags);
if (expression instanceof _RegExpSubclass) {
this._captureMap = expression._captureMap;
} else {
this._captureMap = /* @__PURE__ */ new Map();
}
} else {
super(expression, flags);
const hiddenCaptures = options?.hiddenCaptures ?? [];
this._captureMap = createCaptureMap(hiddenCaptures);
}
}
/**
Called internally by all String/RegExp methods that use regexes.
@override
@param {string} str
@returns {RegExpExecArray | null}
*/
exec(str) {
const match = super.exec(str);
if (!match || !this._captureMap.size) {
return match;
}
const matchCopy = [...match];
match.length = 1;
let indicesCopy;
if (this.hasIndices) {
indicesCopy = [...match.indices];
match.indices.length = 1;
}
for (let i = 1; i < matchCopy.length; i++) {
if (!this._captureMap.get(i)?.hidden) {
match.push(matchCopy[i]);
if (this.hasIndices) {
match.indices.push(indicesCopy[i]);
}
}
}
return match;
}
};
function createCaptureMap(hiddenCaptures) {
const captureMap = /* @__PURE__ */ new Map();
for (const num of hiddenCaptures) {
captureMap.set(num, {
hidden: true
});
}
return captureMap;
}
// src/subroutines.js
function subroutines(expression, data) {
const namedGroups = getNamedCapturingGroups(expression, { includeContents: true });
const transformed = processSubroutines(expression, namedGroups, !!data?.useEmulationGroups);
return processDefinitionGroup(transformed, namedGroups);
const transformed = processSubroutines(expression, namedGroups, data?.hiddenCaptures ?? []);
return {
pattern: processDefinitionGroup(transformed.pattern, namedGroups),
hiddenCaptures: transformed.hiddenCaptures
};
}
var subroutinePattern = String.raw`\\g<(?<subroutineName>[^>&]+)>`;
var token4 = new RegExp(String.raw`
@@ -872,24 +880,27 @@ ${subroutinePattern}
| \\k<(?<backrefName>[^>]+)>
| \\?.
`.replace(/\s+/g, ""), "gsu");
function processSubroutines(expression, namedGroups, useEmulationGroups) {
function processSubroutines(expression, namedGroups, hiddenCaptures) {
if (!/\\g</.test(expression)) {
return expression;
return {
pattern: expression,
hiddenCaptures
};
}
const hasBackrefs = hasUnescaped(expression, "\\\\(?:[1-9]|k<[^>]+>)", Context.DEFAULT);
const subroutineWrapper = hasBackrefs ? `(${useEmulationGroups ? emulationGroupMarker : ""}` : "(?:";
const subroutineWrapper = hasBackrefs ? "(" : "(?:";
const openSubroutines = /* @__PURE__ */ new Map();
const openSubroutinesStack = [];
const captureNumMap = [0];
const addedHiddenCaptures = [];
let numCapturesPassedOutsideSubroutines = 0;
let numCapturesPassedInsideSubroutines = 0;
let numCapturesPassedInsideThisSubroutine = 0;
let numSubroutineCapturesTrackedInRemap = 0;
let numCharClassesOpen = 0;
let result = expression;
let match;
token4.lastIndex = 0;
while (match = token4.exec(result)) {
while (match = token4.exec(expression)) {
const { 0: m, index, groups: { subroutineName, capturingStart, backrefNum, backrefName } } = match;
if (m === "[") {
numCharClassesOpen++;
@@ -906,22 +917,32 @@ function processSubroutines(expression, namedGroups, useEmulationGroups) {
if (hasBackrefs) {
numCapturesPassedInsideThisSubroutine = 0;
numCapturesPassedInsideSubroutines++;
updateHiddenCaptureTracking(
hiddenCaptures,
addedHiddenCaptures,
numCapturesPassedOutsideSubroutines + numCapturesPassedInsideSubroutines
);
}
openSubroutines.set(subroutineName, {
// Incrementally decremented to track when we've left the group
unclosedGroupCount: countOpenParens(subroutineValue)
});
openSubroutinesStack.push(subroutineName);
result = spliceStr(result, index, m, subroutineValue);
expression = spliceStr(expression, index, m, subroutineValue);
token4.lastIndex -= m.length - subroutineWrapper.length;
} else if (capturingStart) {
if (openSubroutines.size) {
if (hasBackrefs) {
numCapturesPassedInsideThisSubroutine++;
numCapturesPassedInsideSubroutines++;
updateHiddenCaptureTracking(
hiddenCaptures,
addedHiddenCaptures,
numCapturesPassedOutsideSubroutines + numCapturesPassedInsideSubroutines
);
}
if (m !== "(") {
result = spliceStr(result, index, m, subroutineWrapper);
expression = spliceStr(expression, index, m, subroutineWrapper);
token4.lastIndex -= m.length - subroutineWrapper.length;
}
} else if (hasBackrefs) {
@@ -945,7 +966,7 @@ function processSubroutines(expression, namedGroups, useEmulationGroups) {
const group = namedGroups.get(lastOf(openSubroutinesStack));
const subroutineNum = numCapturesPassedOutsideSubroutines + numCapturesPassedInsideSubroutines - numCapturesPassedInsideThisSubroutine;
const metadata = `\\k<$$b${num}s${subroutineNum}r${group.groupNum}c${group.numCaptures}>`;
result = spliceStr(result, index, m, metadata);
expression = spliceStr(expression, index, m, metadata);
token4.lastIndex += metadata.length - m.length;
}
} else if (m === ")") {
@@ -961,9 +982,10 @@ function processSubroutines(expression, namedGroups, useEmulationGroups) {
numCharClassesOpen--;
}
}
hiddenCaptures.push(...addedHiddenCaptures);
if (hasBackrefs) {
result = replaceUnescaped(
result,
expression = replaceUnescaped(
expression,
String.raw`\\(?:(?<bNum>[1-9]\d*)|k<\$\$b(?<bNumSub>\d+)s(?<subNum>\d+)r(?<refNum>\d+)c(?<refCaps>\d+)>)`,
({ 0: m, groups: { bNum, bNumSub, subNum, refNum, refCaps } }) => {
if (bNum) {
@@ -985,7 +1007,10 @@ function processSubroutines(expression, namedGroups, useEmulationGroups) {
Context.DEFAULT
);
}
return result;
return {
pattern: expression,
hiddenCaptures
};
}
var defineGroupToken = new RegExp(String.raw`${namedCapturingDelim}|\(\?:\)|(?<invalid>\\?.)`, "gsu");
function processDefinitionGroup(expression, namedGroups) {
@@ -1083,6 +1108,10 @@ function getNamedCapturingGroups(expression, { includeContents }) {
function lastOf(arr) {
return arr[arr.length - 1];
}
function updateHiddenCaptureTracking(hiddenCaptures, addedHiddenCaptures, addedCaptureNum) {
addedHiddenCaptures.push(addedCaptureNum);
incrementIfAtLeast(hiddenCaptures, addedCaptureNum);
}
// src/regex.js
var regex = (first, ...substitutions) => {
@@ -1097,7 +1126,7 @@ var regex = (first, ...substitutions) => {
};
var regexFromTemplate = (options, template, ...substitutions) => {
const opts = getOptions(options);
const prepped = handlePreprocessors(template, substitutions, opts);
const prepped = runPreprocessors(template, substitutions, opts);
let precedingCaptures = 0;
let expression = "";
let runningContext;
@@ -1117,9 +1146,10 @@ var regexFromTemplate = (options, template, ...substitutions) => {
}
}
});
expression = handlePlugins(expression, opts);
const plugged = runPlugins(expression, opts);
expression = plugged.pattern;
try {
return opts.subclass ? new RegExpSubclass(expression, opts.flags, { useEmulationGroups: true }) : new RegExp(expression, opts.flags);
return opts.subclass ? new RegExpSubclass(expression, opts.flags, { hiddenCaptures: plugged.hiddenCaptures }) : new RegExp(expression, opts.flags);
} catch (err) {
const stripped = err.message.replace(/ \/.+\/[a-z]*:/, "");
err.message = `${stripped}: /${expression}/${opts.flags}`;
@@ -1132,10 +1162,12 @@ function rewrite(expression = "", options) {
throw new Error("Cannot use option subclass");
}
return {
expression: handlePlugins(
handlePreprocessors({ raw: [expression] }, [], opts).template.raw[0],
// NOTE: Since `pattern` is a Regex+ export with special meaning, the term `expression` is used
// in code to refer to regex source strings, except in the public API
pattern: runPlugins(
runPreprocessors({ raw: [expression] }, [], opts).template.raw[0],
opts
),
).pattern,
flags: opts.flags
};
}
@@ -1163,7 +1195,7 @@ function getOptions(options) {
}
return opts;
}
function handlePreprocessors(template, substitutions, options) {
function runPreprocessors(template, substitutions, options) {
const preprocessors = [];
if (!options.disable.x) {
preprocessors.push(flagXPreprocessor);
@@ -1179,8 +1211,8 @@ function handlePreprocessors(template, substitutions, options) {
substitutions
};
}
function handlePlugins(expression, options) {
const { flags, plugins, unicodeSetsPlugin, disable, subclass } = options;
function runPlugins(expression, { flags, plugins, unicodeSetsPlugin, disable }) {
let hiddenCaptures = [];
[
...plugins,
// Run first, so provided plugins can output extended syntax
@@ -1189,8 +1221,20 @@ function handlePlugins(expression, options) {
...disable.x ? [] : [clean],
// Run last, so it doesn't have to worry about parsing extended syntax
...!unicodeSetsPlugin ? [] : [unicodeSetsPlugin]
].forEach((p) => expression = p(expression, { flags, useEmulationGroups: subclass }));
return expression;
].forEach((plugin) => {
const result = plugin(expression, { flags, hiddenCaptures });
if (typeof result?.pattern !== "string") {
throw new Error('Plugin must return an object with a string property "pattern"');
}
expression = result.pattern;
if (result.hiddenCaptures) {
hiddenCaptures = result.hiddenCaptures;
}
});
return {
pattern: expression,
hiddenCaptures
};
}
function interpolate(value, flags, regexContext, charClassContext, wrapEscapedStr, precedingCaptures) {
if (value instanceof RegExp && regexContext !== RegexContext.DEFAULT) {

File diff suppressed because one or more lines are too long

View File

@@ -1,28 +1,31 @@
export const emulationGroupMarker: "$E$";
/**
Works the same as JavaScript's native `RegExp` constructor in all contexts, but automatically
adjusts matches and subpattern indices (with flag `d`) to account for injected emulation groups.
adjusts subpattern matches and indices (with flag `d`) to account for captures added as part of
emulating extended syntax.
*/
export class RegExpSubclass extends RegExp {
/**
@param {string | RegExpSubclass} expression
@param {string} [flags]
@param {{useEmulationGroups: boolean;}} [options]
*/
constructor(expression: string | RegExpSubclass, flags?: string, options?: {
useEmulationGroups: boolean;
@overload
@param {string} expression
@param {string} [flags]
@param {{
hiddenCaptures?: Array<number>;
}} [options]
*/
constructor(expression: string, flags?: string, options?: {
hiddenCaptures?: Array<number>;
});
/**
@private
@type {Array<{
exclude: boolean;
transfer?: number;
}> | undefined}
*/
private _captureMap;
@overload
@param {RegExpSubclass} expression
@param {string} [flags]
*/
constructor(expression: RegExpSubclass, flags?: string);
/**
@private
@type {Record<number, string> | undefined}
@type {Map<number, {
hidden: true;
}>}
*/
private _namesByIndex;
private _captureMap;
}

View File

@@ -7,6 +7,6 @@ export type NamedCapturingGroupsMap = Map<string, {
/**
@param {string} expression
@param {import('./regex.js').PluginData} [data]
@returns {string}
@returns {import('./regex.js').PluginResult}
*/
export function subroutines(expression: string, data?: import("./regex.js").PluginData): string;
export function subroutines(expression: string, data?: import("./regex.js").PluginData): import("./regex.js").PluginResult;

View File

@@ -1,3 +1,9 @@
/**
Updates the array in place by incrementing each value greater than or equal to the threshold.
@param {Array<number>} arr
@param {number} threshold
*/
export function incrementIfAtLeast(arr: Array<number>, threshold: number): void;
export const noncapturingDelim: any;
/**
@param {string} str