PureXML/Sources/Parsing/Big5Table.swift
Mihaela Mihaljevic 74acad4628 feat(parsing): Big5 (Traditional Chinese / HKSCS)
Add the WHATWG big5 decoder over the vendored index-big5 (18,590 entries),
for both the whole-buffer and streaming decoders. A lead in 0x81-0xFE plus
a trail in 0x40-0x7E or 0xA1-0xFE resolves through the index, covering
Traditional Chinese and the HKSCS extensions including the astral CJK
ideographs. Four pointers decode to a base letter plus a combining mark.
Selected by the big5 / big5-hkscs declaration names.

Closes #103
2026-06-09 08:30:57 +02:00

12 lines
599 B
Swift

extension PureXML.Parsing.ByteDecoder {
/// The Big5 index (Traditional Chinese plus the HKSCS extensions, including
/// the astral CJK ideographs), assembled from the vendored parts. Indexed by
/// `pointer - 942`, the first populated pointer; a `0` entry is an unmapped
/// slot. Vendored verbatim from the WHATWG `index-big5.txt`; reproduce from
/// that file rather than hand-editing.
static let big5: [UInt32] = big5Part1 + big5Part2 + big5Part3 + big5Part4 + big5Part5 + big5Part6
/// The first pointer populated in the Big5 index.
static let big5Base = 942
}