From 54e02bdd5678c532c5cd53b0b37c5672b3802a81 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 1 Nov 2024 18:18:26 -0700 Subject: [PATCH] regexp-generator: Remove dead code These are unused parameters and variables, and all have no effect on the output. --- tools/regexp-generator/index.mjs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tools/regexp-generator/index.mjs b/tools/regexp-generator/index.mjs index 694e94a318..47a0aa20cd 100644 --- a/tools/regexp-generator/index.mjs +++ b/tools/regexp-generator/index.mjs @@ -77,10 +77,8 @@ function buildString(escapeChar, flags) { return prettyPrint([ loneCodePoints, ranges ]); } -function buildContent(desc, pattern, range, max, flags, skip180e) { +function buildContent(desc, pattern, flags) { let string = buildString(pattern[1], flags); - let method; - let features = []; let content = header(`Compare range for ${desc} ${pattern} with flags ${flags}`); @@ -118,7 +116,6 @@ function writeFile(desc, content, suffix = '') { // No additions for (const [desc, escape] of Object.entries(patterns)) { - const skip180e = escape.toLowerCase().includes('s'); [ { quantifier: '', @@ -127,23 +124,19 @@ for (const [desc, escape] of Object.entries(patterns)) { { quantifier: '+', flags: '', - posCb(u) { return [u, u+u]}, suffix: '-plus-quantifier', }, { quantifier: '', flags: 'u', - max: 0x10FFFF, suffix: '-flags-u', }, { quantifier: '+', flags: 'u', - posCb(u) { return [u, u+u]}, suffix: '-plus-quantifier-flags-u', - max: 0x10FFFF, }, - ].forEach(({quantifier, max = 0xFFFF, flags, suffix, posCb = u => [u], negCb = u => [u]}) => { + ].forEach(({quantifier, flags, suffix}) => { flags += 'g'; const pattern = `${escape}${quantifier}`; @@ -153,7 +146,7 @@ for (const [desc, escape] of Object.entries(patterns)) { console.log(`${pattern} => ${range}, flags: ${flags}`); - const content = buildContent(desc, pattern, range, max, flags, skip180e); + const content = buildContent(desc, pattern, flags); writeFile(desc, content, suffix); });