ada
ada copied to clipboard
feat: adds urlpattern to ada
TL;DR
WIP!
So i started to implement https://wicg.github.io/urlpattern/ Seems that this is an work-in-progress spec, so maybe we'll have some freestyle stuff along the way of the implementation. I'm using https://github.com/kenchris/urlpattern-polyfill and https://github.com/denoland/rust-urlpattern as references.
Don't know if there is a "right way" to do this, but I get the unicode identifier start/part ranges using the script:
"use strict";
const fs = require("fs");
const regexIdentifierStart = /[$_\p{ID_Start}]/u;
function isValidIdStart(num) {
const c = String.fromCharCode(num);
return regexIdentifierStart.test(c);
}
const validRanges = [];
let start = null;
for (let c = 256; c < 0x10ffff; c++) {
const isValid = isValidIdStart(c);
if (isValid && start === null) {
start = c;
} else if (!isValid && start !== null) {
validRanges.push([start, c - 1]);
start = null;
}
}
const writeRangeInFile = (filename, ranges) => {
let file = "";
for (const [base, upper] of ranges) {
file += `\{${base}, ${upper}\},\n`;
}
fs.writeFile(filename, file, (err) => {});
};
console.log(validRanges.length);
writeRangeInFile("id_start_ranges.txt", validRanges);
++ something similar for the identifier-part with the regex /[$_\u200C\u200D\p{ID_Continue}]/u
I got those regexes in https://github.com/kenchris/urlpattern-polyfill/blob/main/src/path-to-regex-modified.ts#LL70C1-L70C50
Then I used the ranges to create bitwise masks in the unicode.cpp.
Nothing is tested yet
It will took some time to finish!
ref https://github.com/nodejs/node/issues/40844
Is there any way to crank 🔧 this up for https://github.com/nodejs/node/issues/51060 needs? 🤔
Houston, do you read me? 📡
@bricss Are you available to help push this forward?
Yes, with only one exception, I don't have big/deep experience with C++ coding 🤷♂️ atm 🙄
@bricss Lack of knowledge of C++ could be a problem.