Skip to content

Commit

Permalink
Bug fix: wrong upper case letter check
Browse files Browse the repository at this point in the history
The previous check did not consider non-letters. The current patch considers only latin letters (A..Z) for the check. The current spec does not allow other upper case Unicode letters anyway.

Signed-off-by: Mike Lischke <[email protected]>
  • Loading branch information
mike-lischke committed Dec 25, 2024
1 parent 4bbb636 commit c0a1771
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Vocabulary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ export class Vocabulary {
continue;
}

if (tokenName?.length > 0) {
const firstChar = tokenName.charAt(0);
if (firstChar === "'") {
if (tokenName.length > 0) {
const firstChar = tokenName.codePointAt(0)!;
if (firstChar === 0x27) { // single-quote
symbolicNames[i] = null;
continue;
} else if (firstChar.toUpperCase() === firstChar) {
} else if (firstChar >= 0x41 && firstChar <= 0x5A) { // 'A'..'Z'
literalNames[i] = null;
continue;
}
Expand Down

0 comments on commit c0a1771

Please sign in to comment.