mirror of
https://github.com/Noratrieb/riverdelta.git
synced 2026-01-15 00:45:04 +01:00
avoid wasm symbol conflicts
This commit is contained in:
parent
6bdbf14ecb
commit
e951cd5ee1
8 changed files with 188 additions and 99 deletions
13
src/lexer.ts
13
src/lexer.ts
|
|
@ -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 === "_"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue