Skip to content

Commit

Permalink
regexp-generator: Remove dead code
Browse files Browse the repository at this point in the history
These are unused parameters and variables, and all have no effect on the
output.
  • Loading branch information
ptomato committed Nov 12, 2024
1 parent 07ddc3b commit 54e02bd
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions tools/regexp-generator/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down Expand Up @@ -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: '',
Expand All @@ -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}`;
Expand All @@ -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);
});
Expand Down

0 comments on commit 54e02bd

Please sign in to comment.