Use hex char codes and show code points for surrogate pairs (#7541)

This commit is contained in:
Erik De Bonte 2024-03-21 12:44:55 -07:00 committed by GitHub
parent 7f468b8c5b
commit a6e787fd4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3408 additions and 3154 deletions

View File

@ -126,9 +126,9 @@ def writeRangeTable(writer: TextIOWrapper, category: str, chars: list[Character]
if i + 1 >= len(chars) or chars[i + 1].code != char.code + 1:
if consecutiveRangeStartChar.code == char.code:
writer.write(f" {consecutiveRangeStartChar.code},\n")
writer.write(f" 0x{consecutiveRangeStartChar.code:04X},\n")
else:
writer.write(f" [{consecutiveRangeStartChar.code}, {char.code}],\n")
writer.write(f" [0x{consecutiveRangeStartChar.code:04X}, 0x{char.code:04X}],\n")
consecutiveRangeStartChar = None
@ -160,14 +160,14 @@ def writeSurrogateRangeTable(
previousCharRange = None
if not previousCharRange:
writer.write(f" {charRange.start.highSurrogate}: [\n")
writer.write(f" 0x{charRange.start.highSurrogate:04X}: [\n")
previousCharRange = charRange
if charRange.start.lowSurrogate == charRange.end.lowSurrogate:
writer.write(f" {charRange.start.lowSurrogate},\n")
writer.write(f" 0x{charRange.start.lowSurrogate:04X}, // 0x{charRange.start.code:04X}\n")
else:
writer.write(
f" [{charRange.start.lowSurrogate}, {charRange.end.lowSurrogate}],\n"
f" [0x{charRange.start.lowSurrogate:04X}, 0x{charRange.end.lowSurrogate:04X}], // 0x{charRange.start.code:04X}..0x{charRange.end.code:04X}\n"
)
writer.write(" ],\n")

File diff suppressed because it is too large Load Diff