Skip to content

Commit fe1bf47

Browse files
committed
Align identifiers with spec
1 parent fb43a34 commit fe1bf47

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/scanner.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -659,25 +659,28 @@ function getIdentifierStart(ch: number): Identifier | undefined {
659659
}
660660

661661
export function isIdentifierStart(ch: number): boolean {
662-
// TODO: Check Identifiers
662+
// Ref ID spec: https://www.graphviz.org/doc/info/lang.html
663663
return (
664664
(ch >= characterCodes.A && ch <= characterCodes.Z) ||
665665
(ch >= characterCodes.a && ch <= characterCodes.z) ||
666-
(ch >= characterCodes._0 && ch <= characterCodes._9) ||
666+
(ch >= 0x80 && ch <= 0xff) ||
667667
ch === characterCodes._ ||
668-
ch === characterCodes.lessThan ||
669-
ch === characterCodes.doubleQuote
668+
(ch >= characterCodes._0 && ch <= characterCodes._9) || // Numerals
669+
ch === characterCodes.minus ||
670+
ch === characterCodes.dot ||
671+
ch === characterCodes.doubleQuote ||
672+
ch === characterCodes.lessThan
670673
);
671674
}
672675

673676
function isIdentifierPart(ch: number): boolean {
677+
// Ref ID spec: https://www.graphviz.org/doc/info/lang.html
674678
return (
675679
(ch >= characterCodes.A && ch <= characterCodes.Z) ||
676680
(ch >= characterCodes.a && ch <= characterCodes.z) ||
677681
(ch >= characterCodes._0 && ch <= characterCodes._9) ||
678-
ch === characterCodes.$ ||
679682
ch === characterCodes._ ||
680-
ch > characterCodes.maxAsciiCharacter
683+
(ch >= 0x80 && ch <= 0xff) // Extended ASCII (\200-\377)
681684
);
682685
}
683686

0 commit comments

Comments
 (0)