avoid wasm symbol conflicts

This commit is contained in:
nora 2023-07-31 13:49:43 +02:00
parent 6bdbf14ecb
commit e951cd5ee1
8 changed files with 188 additions and 99 deletions

View file

@ -272,6 +272,19 @@ export function tokenize(input: string): Token[] {
return tokens;
}
export function isValidIdent(ident: string): boolean {
if (!isIdentStart(ident[0])) {
return false;
}
for (let i = 1; i < ident.length; i++) {
const char = ident[i];
if (!isIdentContinue(char)) {
return false;
}
}
return true;
}
function isIdentStart(char: string): boolean {
return (
(char <= "Z" && char >= "A") || (char <= "z" && char >= "a") || char === "_"