ingraph 0.1.0

A declaration-driven indexing framework: records and nodes are written as Rust types, and the storage rows, the dataflow between them and the GraphQL query surface are emitted from the declaration.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
//! THE RANGE TABLE — which codepoints are written in which of the rostered scripts.
//!
//! # WHY IT IS HAND-CARVED and not a dependency
//!
//! A full Unicode character database answers this question for all 160-odd scripts, and this crate
//! needs it for THIRTY-FIVE — the thirty-two whose segmentation habits a routing story has to tell
//! apart, plus the standard's three non-script answers.
//!
//! **THE ROSTER'S CRITERION IS THE HABIT, NOT THE ALPHABET.** A script earns a row here when an
//! existing member's analyzer would get its SEGMENTATION wrong — no inter-word spaces (Thai, Lao,
//! Khmer, Myanmar, Han), syllable rather than word delimiters (Tibetan, Ethiopic), obligatory
//! grapheme clusters (the nine Brahmic members), casing no other bicameral script shares (Armenian,
//! Georgian), or a joining behaviour of its own (Syriac, Mongolian). A living script whose words are
//! whitespace-separated like Latin's — Cherokee, Vai, Yi, Tifinagh — is deliberately NOT here: its
//! alphabet is distinct and its habit is not, so it rides the fallback and costs no ranges. The rest is weight a query road would carry for nothing: the segmenter runs
//! on the READ side, in a build that may have no index backend compiled at all, so a table that
//! arrives with a UCD crate would put a dependency on the question road to answer a question the
//! question road has already narrowed.
//!
//! What replaces the dependency is not trust. `tests/script_table` runs the real thing —
//! `unicode-script`, a DEV-dependency, present in no shipped build — over every codepoint from
//! `U+0000` to `U+10FFFF` and holds this table to four properties. Two of them are what the routing
//! story actually rests on:
//!
//! | property | what a violation would do |
//! |---|---|
//! | a named script here is that script there | text routed to the wrong analyzer |
//! | **contextual here is never a real script there** | **a whole script silently swallowed by its neighbour** |
//! | a rostered script there is named here | text falling to the fallback bucket that had a home |
//! | Common or Inherited there is contextual here | a run cut where no writer would cut one |
//!
//! The second is the one the shape of this table is built around, and it is why an unrecognised
//! codepoint answers [`Zzzz`](WritingSystem::Zzzz) rather than [`Zyyy`](WritingSystem::Zyyy). *Not in the table*
//! and *belongs to every script* are different facts, and a table that conflated them would let a
//! Cherokee or Armenian word be absorbed into the Latin run beside it and tokenised as Latin.
//!
//! **UNASSIGNED CODEPOINTS ARE NOT HELD TO THE FIRST TWO**, and the exemption is measured rather
//! than convenient: no text contains one, so a range that reaches over a hole inside a block it
//! otherwise owns costs nothing and reads as the block it is. Holding them would make every range
//! below end at a boundary that moves with each Unicode release, and the two properties would then
//! be tracking the calendar instead of the failure. What is still forbidden is the failure itself —
//! claiming a stretch that is really some OTHER script.
//!
//! # THE RANGES ARE SORTED, DISJOINT AND SEARCHED
//!
//! One `static` of `(first, last, script)` in ascending order with no overlap — pinned by a test, so
//! the binary search below is answering a question the data can actually support. ASCII is answered
//! before the search runs, which is the case most text is made of.
//!
//! # ITS HOLES ARE ITS ANSWER
//!
//! Every codepoint outside every range is [`Zzzz`](WritingSystem::Zzzz), and that covers three different
//! things on purpose: an unassigned codepoint, a private-use one, and a character from a script this
//! roster does not carry. All three want the same treatment from a router — a bucket it can see —
//! and none of them wants to be attached to whatever happened to precede it.

use super::WritingSystem;

#[cfg(test)]
mod tests;

/// The classification of one character, off the table below.
pub(super) fn of(character: char) -> WritingSystem {
  let codepoint = character as u32;

  // ASCII FIRST, because most text is, and because it is the one stretch where a branch beats a
  // search: the whole range is three ranges, and a search would spend four probes to say so.
  if codepoint < 0x80 {
    return match codepoint {
      0x41..=0x5A | 0x61..=0x7A => WritingSystem::Latn,
      _ => WritingSystem::Zyyy,
    };
  }

  match RANGES.binary_search_by(|(first, last, _)| {
    if *last < codepoint {
      core::cmp::Ordering::Less
    } else if *first > codepoint {
      core::cmp::Ordering::Greater
    } else {
      core::cmp::Ordering::Equal
    }
  }) {
    Ok(at) => RANGES[at].2.clone(),
    Err(_) => WritingSystem::Zzzz,
  }
}

/// **THE TABLE** — `(first, last, script)`, ascending and disjoint.
///
/// Read block by block through the Basic Multilingual Plane and then the supplementary ones. A
/// stretch that belongs to a script this roster does not carry is simply absent, which is what the
/// module note means by its holes being its answer.
static RANGES: &[(u32, u32, WritingSystem)] = &[
  // Latin-1 Supplement and the Latin extensions, with Common's two islands cut out of them.
  (0x0080, 0x00A9, WritingSystem::Zyyy),
  (0x00AA, 0x00AA, WritingSystem::Latn),
  (0x00AB, 0x00B9, WritingSystem::Zyyy),
  (0x00BA, 0x00BA, WritingSystem::Latn),
  (0x00BB, 0x00BF, WritingSystem::Zyyy),
  (0x00C0, 0x00D6, WritingSystem::Latn),
  (0x00D7, 0x00D7, WritingSystem::Zyyy),
  (0x00D8, 0x00F6, WritingSystem::Latn),
  (0x00F7, 0x00F7, WritingSystem::Zyyy),
  (0x00F8, 0x02B8, WritingSystem::Latn),
  (0x02B9, 0x02DF, WritingSystem::Zyyy),
  (0x02E0, 0x02E4, WritingSystem::Latn),
  (0x02E5, 0x02E9, WritingSystem::Zyyy),
  // Bopomofo's two modifier tones, which sit inside the spacing-modifier block.
  (0x02EA, 0x02EB, WritingSystem::Bopo),
  // 02EA..02EB is Bopomofo — unrostered, so it is a hole rather than Common.
  (0x02EC, 0x02FF, WritingSystem::Zyyy),
  // Combining Diacritical Marks: the archetypal inherited stretch.
  (0x0300, 0x036F, WritingSystem::Zinh),
  // Greek and Coptic. Coptic (03E2..03EF) is unrostered and left out.
  (0x0370, 0x0373, WritingSystem::Grek),
  (0x0374, 0x0374, WritingSystem::Zyyy),
  (0x0375, 0x0377, WritingSystem::Grek),
  (0x037A, 0x037D, WritingSystem::Grek),
  (0x037E, 0x037E, WritingSystem::Zyyy),
  (0x037F, 0x037F, WritingSystem::Grek),
  (0x0384, 0x0384, WritingSystem::Grek),
  (0x0385, 0x0385, WritingSystem::Zyyy),
  (0x0386, 0x0386, WritingSystem::Grek),
  (0x0387, 0x0387, WritingSystem::Zyyy),
  (0x0388, 0x038A, WritingSystem::Grek),
  (0x038C, 0x038C, WritingSystem::Grek),
  (0x038E, 0x03A1, WritingSystem::Grek),
  (0x03A3, 0x03E1, WritingSystem::Grek),
  (0x03F0, 0x03FF, WritingSystem::Grek),
  // Cyrillic, with its two inherited combining marks.
  (0x0400, 0x0484, WritingSystem::Cyrl),
  (0x0485, 0x0486, WritingSystem::Zinh),
  (0x0487, 0x052F, WritingSystem::Cyrl),
  // Armenian, and its ligatures live at FB13 below.
  (0x0531, 0x058F, WritingSystem::Armn),
  // Hebrew.
  (0x0591, 0x05C7, WritingSystem::Hebr),
  (0x05D0, 0x05EA, WritingSystem::Hebr),
  (0x05EF, 0x05F4, WritingSystem::Hebr),
  // Arabic, whose Common islands are the marks every script may use.
  (0x0600, 0x0604, WritingSystem::Arab),
  (0x0605, 0x0605, WritingSystem::Zyyy),
  (0x0606, 0x060B, WritingSystem::Arab),
  (0x060C, 0x060C, WritingSystem::Zyyy),
  (0x060D, 0x061A, WritingSystem::Arab),
  (0x061B, 0x061B, WritingSystem::Zyyy),
  (0x061C, 0x061E, WritingSystem::Arab),
  (0x061F, 0x061F, WritingSystem::Zyyy),
  (0x0620, 0x063F, WritingSystem::Arab),
  (0x0640, 0x0640, WritingSystem::Zyyy),
  (0x0641, 0x064A, WritingSystem::Arab),
  (0x064B, 0x0655, WritingSystem::Zinh),
  (0x0656, 0x066F, WritingSystem::Arab),
  (0x0670, 0x0670, WritingSystem::Zinh),
  (0x0671, 0x06DC, WritingSystem::Arab),
  (0x06DD, 0x06DD, WritingSystem::Zyyy),
  (0x06DE, 0x06FF, WritingSystem::Arab),
  (0x0700, 0x074F, WritingSystem::Syrc),
  (0x0750, 0x077F, WritingSystem::Arab),
  (0x0780, 0x07B1, WritingSystem::Thaa),
  // Syriac Supplement.
  (0x0860, 0x086F, WritingSystem::Syrc),
  (0x0870, 0x08E1, WritingSystem::Arab),
  (0x08E2, 0x08E2, WritingSystem::Zyyy),
  (0x08E3, 0x08FF, WritingSystem::Arab),
  // Devanagari, whose two inherited marks and two Common danda are cut out of it.
  (0x0900, 0x0950, WritingSystem::Deva),
  (0x0951, 0x0954, WritingSystem::Zinh),
  (0x0955, 0x0963, WritingSystem::Deva),
  (0x0964, 0x0965, WritingSystem::Zyyy),
  (0x0966, 0x097F, WritingSystem::Deva),
  // The Brahmic block run: one script per block, each with its own cluster rules.
  (0x0980, 0x09FE, WritingSystem::Beng),
  (0x0A01, 0x0A76, WritingSystem::Guru),
  (0x0A81, 0x0AFF, WritingSystem::Gujr),
  (0x0B01, 0x0B77, WritingSystem::Orya),
  (0x0B82, 0x0BFA, WritingSystem::Taml),
  (0x0C00, 0x0C7F, WritingSystem::Telu),
  (0x0C80, 0x0CF3, WritingSystem::Knda),
  (0x0D00, 0x0D7F, WritingSystem::Mlym),
  (0x0D81, 0x0DF4, WritingSystem::Sinh),
  // Thai, and the baht sign every script may spend.
  (0x0E01, 0x0E3A, WritingSystem::Thai),
  (0x0E3F, 0x0E3F, WritingSystem::Zyyy),
  (0x0E40, 0x0E5B, WritingSystem::Thai),
  // Lao, whose segmentation class is Thai's.
  (0x0E81, 0x0EDF, WritingSystem::Laoo),
  // Tibetan, cut around the Common astrological signs at 0FD5.
  (0x0F00, 0x0FD4, WritingSystem::Tibt),
  (0x0FD5, 0x0FD8, WritingSystem::Zyyy),
  (0x0FD9, 0x0FDA, WritingSystem::Tibt),
  // Myanmar, then Georgian cut around its own Common paragraph separator at 10FB.
  (0x1000, 0x109F, WritingSystem::Mymr),
  (0x10A0, 0x10FA, WritingSystem::Geor),
  (0x10FB, 0x10FB, WritingSystem::Zyyy),
  (0x10FC, 0x10FF, WritingSystem::Geor),
  // Hangul Jamo.
  (0x1100, 0x11FF, WritingSystem::Hang),
  // Ethiopic.
  (0x1200, 0x1399, WritingSystem::Ethi),
  // Canadian Aboriginal Syllabics.
  (0x1400, 0x167F, WritingSystem::Cans),
  // Punctuation that unrostered scripts share with everybody.
  (0x16EB, 0x16ED, WritingSystem::Zyyy),
  (0x1735, 0x1736, WritingSystem::Zyyy),
  // Khmer, then Mongolian cut around the two Common punctuation islands it shares.
  (0x1780, 0x17F9, WritingSystem::Khmr),
  (0x1800, 0x1801, WritingSystem::Mong),
  (0x1802, 0x1803, WritingSystem::Zyyy),
  (0x1804, 0x1804, WritingSystem::Mong),
  (0x1805, 0x1805, WritingSystem::Zyyy),
  (0x1806, 0x18AA, WritingSystem::Mong),
  // Unified Canadian Aboriginal Syllabics Extended.
  (0x18B0, 0x18F5, WritingSystem::Cans),
  // Khmer Symbols.
  (0x19E0, 0x19FF, WritingSystem::Khmr),
  (0x1AB0, 0x1AFF, WritingSystem::Zinh),
  (0x1C80, 0x1C8A, WritingSystem::Cyrl),
  // Georgian Extended — the Mtavruli case.
  (0x1C90, 0x1CBF, WritingSystem::Geor),
  // Vedic Extensions: inherited marks with Common islands.
  (0x1CD0, 0x1CD2, WritingSystem::Zinh),
  (0x1CD3, 0x1CD3, WritingSystem::Zyyy),
  (0x1CD4, 0x1CE0, WritingSystem::Zinh),
  (0x1CE1, 0x1CE1, WritingSystem::Zyyy),
  (0x1CE2, 0x1CE8, WritingSystem::Zinh),
  (0x1CE9, 0x1CEC, WritingSystem::Zyyy),
  (0x1CED, 0x1CED, WritingSystem::Zinh),
  (0x1CEE, 0x1CF3, WritingSystem::Zyyy),
  (0x1CF4, 0x1CF4, WritingSystem::Zinh),
  (0x1CF5, 0x1CF7, WritingSystem::Zyyy),
  (0x1CF8, 0x1CF9, WritingSystem::Zinh),
  (0x1CFA, 0x1CFA, WritingSystem::Zyyy),
  // Phonetic Extensions: three scripts interleaved one stretch at a time.
  (0x1D00, 0x1D25, WritingSystem::Latn),
  (0x1D26, 0x1D2A, WritingSystem::Grek),
  (0x1D2B, 0x1D2B, WritingSystem::Cyrl),
  (0x1D2C, 0x1D5C, WritingSystem::Latn),
  (0x1D5D, 0x1D61, WritingSystem::Grek),
  (0x1D62, 0x1D65, WritingSystem::Latn),
  (0x1D66, 0x1D6A, WritingSystem::Grek),
  (0x1D6B, 0x1D77, WritingSystem::Latn),
  (0x1D78, 0x1D78, WritingSystem::Cyrl),
  (0x1D79, 0x1DBE, WritingSystem::Latn),
  (0x1DBF, 0x1DBF, WritingSystem::Grek),
  (0x1DC0, 0x1DFF, WritingSystem::Zinh),
  (0x1E00, 0x1EFF, WritingSystem::Latn),
  // Greek Extended.
  (0x1F00, 0x1F15, WritingSystem::Grek),
  (0x1F18, 0x1F1D, WritingSystem::Grek),
  (0x1F20, 0x1F45, WritingSystem::Grek),
  (0x1F48, 0x1F4D, WritingSystem::Grek),
  (0x1F50, 0x1F57, WritingSystem::Grek),
  (0x1F59, 0x1F59, WritingSystem::Grek),
  (0x1F5B, 0x1F5B, WritingSystem::Grek),
  (0x1F5D, 0x1F5D, WritingSystem::Grek),
  (0x1F5F, 0x1F7D, WritingSystem::Grek),
  (0x1F80, 0x1FB4, WritingSystem::Grek),
  (0x1FB6, 0x1FC4, WritingSystem::Grek),
  (0x1FC6, 0x1FD3, WritingSystem::Grek),
  (0x1FD6, 0x1FDB, WritingSystem::Grek),
  (0x1FDD, 0x1FEF, WritingSystem::Grek),
  (0x1FF2, 0x1FF4, WritingSystem::Grek),
  (0x1FF6, 0x1FFE, WritingSystem::Grek),
  // General Punctuation through the symbol blocks: Common, with the letterlike islands cut out.
  (0x2000, 0x200B, WritingSystem::Zyyy),
  (0x200C, 0x200D, WritingSystem::Zinh),
  (0x200E, 0x2070, WritingSystem::Zyyy),
  (0x2071, 0x2071, WritingSystem::Latn),
  (0x2072, 0x207E, WritingSystem::Zyyy),
  (0x207F, 0x207F, WritingSystem::Latn),
  (0x2080, 0x208F, WritingSystem::Zyyy),
  (0x2090, 0x209C, WritingSystem::Latn),
  (0x209D, 0x20CF, WritingSystem::Zyyy),
  (0x20D0, 0x20F0, WritingSystem::Zinh),
  (0x20F1, 0x2125, WritingSystem::Zyyy),
  (0x2126, 0x2126, WritingSystem::Grek),
  (0x2127, 0x2129, WritingSystem::Zyyy),
  (0x212A, 0x212B, WritingSystem::Latn),
  (0x212C, 0x2131, WritingSystem::Zyyy),
  (0x2132, 0x2132, WritingSystem::Latn),
  (0x2133, 0x214D, WritingSystem::Zyyy),
  (0x214E, 0x214E, WritingSystem::Latn),
  (0x214F, 0x215F, WritingSystem::Zyyy),
  (0x2160, 0x2188, WritingSystem::Latn),
  (0x2189, 0x27FF, WritingSystem::Zyyy),
  // 2800..28FF is Braille — a real script, so the Common blanket stops short of it.
  (0x2900, 0x2BFF, WritingSystem::Zyyy),
  (0x2C60, 0x2C7F, WritingSystem::Latn),
  // Georgian Supplement — the Nuskhuri case, and it stops short of Tifinagh at 2D30.
  (0x2D00, 0x2D2D, WritingSystem::Geor),
  // Ethiopic Extended.
  (0x2D80, 0x2DDE, WritingSystem::Ethi),
  (0x2DE0, 0x2DFF, WritingSystem::Cyrl),
  (0x2E00, 0x2E7F, WritingSystem::Zyyy),
  // CJK Radicals and Kangxi Radicals.
  (0x2E80, 0x2E99, WritingSystem::Hani),
  (0x2E9B, 0x2EF3, WritingSystem::Hani),
  (0x2F00, 0x2FD5, WritingSystem::Hani),
  (0x2FF0, 0x2FFF, WritingSystem::Zyyy),
  // CJK Symbols and Punctuation: the block four scripts share.
  (0x3000, 0x3004, WritingSystem::Zyyy),
  (0x3005, 0x3005, WritingSystem::Hani),
  (0x3006, 0x3006, WritingSystem::Zyyy),
  (0x3007, 0x3007, WritingSystem::Hani),
  (0x3008, 0x3020, WritingSystem::Zyyy),
  (0x3021, 0x3029, WritingSystem::Hani),
  (0x302A, 0x302D, WritingSystem::Zinh),
  (0x302E, 0x302F, WritingSystem::Hang),
  (0x3030, 0x3037, WritingSystem::Zyyy),
  (0x3038, 0x303B, WritingSystem::Hani),
  (0x303C, 0x303F, WritingSystem::Zyyy),
  // The two Japanese syllabaries, and the marks and the middle dot they share.
  (0x3041, 0x3096, WritingSystem::Hira),
  (0x3099, 0x309A, WritingSystem::Zinh),
  (0x309B, 0x309C, WritingSystem::Zyyy),
  (0x309D, 0x309F, WritingSystem::Hira),
  (0x30A0, 0x30A0, WritingSystem::Zyyy),
  (0x30A1, 0x30FA, WritingSystem::Kana),
  (0x30FB, 0x30FC, WritingSystem::Zyyy),
  (0x30FD, 0x30FF, WritingSystem::Kana),
  // Bopomofo, between the kana and the compatibility jamo.
  (0x3105, 0x312F, WritingSystem::Bopo),
  // Hangul Compatibility Jamo and the enclosed forms. Bopomofo is unrostered.
  (0x3131, 0x318E, WritingSystem::Hang),
  (0x3190, 0x319F, WritingSystem::Zyyy),
  // Bopomofo Extended.
  (0x31A0, 0x31BF, WritingSystem::Bopo),
  (0x31C0, 0x31EF, WritingSystem::Zyyy),
  (0x31F0, 0x31FF, WritingSystem::Kana),
  (0x3200, 0x321E, WritingSystem::Hang),
  (0x3220, 0x325F, WritingSystem::Zyyy),
  (0x3260, 0x327E, WritingSystem::Hang),
  (0x327F, 0x32CF, WritingSystem::Zyyy),
  (0x32D0, 0x32FE, WritingSystem::Kana),
  (0x32FF, 0x32FF, WritingSystem::Zyyy),
  (0x3300, 0x3357, WritingSystem::Kana),
  (0x3358, 0x33FF, WritingSystem::Zyyy),
  // The two big Han blocks, with the hexagrams between them.
  (0x3400, 0x4DBF, WritingSystem::Hani),
  (0x4DC0, 0x4DFF, WritingSystem::Zyyy),
  (0x4E00, 0x9FFF, WritingSystem::Hani),
  // Cyrillic Extended-B, the modifier letters, and Latin Extended-D.
  (0xA640, 0xA69F, WritingSystem::Cyrl),
  (0xA700, 0xA721, WritingSystem::Zyyy),
  (0xA722, 0xA787, WritingSystem::Latn),
  (0xA788, 0xA78A, WritingSystem::Zyyy),
  (0xA78B, 0xA7FF, WritingSystem::Latn),
  (0xA830, 0xA839, WritingSystem::Zyyy),
  (0xA8E0, 0xA8FF, WritingSystem::Deva),
  (0xA92E, 0xA92E, WritingSystem::Zyyy),
  (0xA960, 0xA97C, WritingSystem::Hang),
  (0xA9CF, 0xA9CF, WritingSystem::Zyyy),
  // Myanmar Extended-A, Extended-B, and Ethiopic Extended-A.
  (0xA9E0, 0xA9FE, WritingSystem::Mymr),
  (0xAA60, 0xAA7F, WritingSystem::Mymr),
  (0xAB01, 0xAB2E, WritingSystem::Ethi),
  // Latin Extended-E, with Greek's one island in it.
  (0xAB30, 0xAB5A, WritingSystem::Latn),
  (0xAB5B, 0xAB5B, WritingSystem::Zyyy),
  (0xAB5C, 0xAB64, WritingSystem::Latn),
  (0xAB65, 0xAB65, WritingSystem::Grek),
  (0xAB66, 0xAB69, WritingSystem::Latn),
  (0xAB6A, 0xAB6B, WritingSystem::Zyyy),
  // Hangul syllables, and the two extended jamo blocks.
  (0xAC00, 0xD7A3, WritingSystem::Hang),
  (0xD7B0, 0xD7C6, WritingSystem::Hang),
  (0xD7CB, 0xD7FB, WritingSystem::Hang),
  // CJK Compatibility Ideographs.
  (0xF900, 0xFA6D, WritingSystem::Hani),
  (0xFA70, 0xFAD9, WritingSystem::Hani),
  // Alphabetic Presentation Forms.
  (0xFB00, 0xFB06, WritingSystem::Latn),
  // Armenian ligatures, in the alphabetic presentation forms.
  (0xFB13, 0xFB17, WritingSystem::Armn),
  (0xFB1D, 0xFB36, WritingSystem::Hebr),
  (0xFB38, 0xFB3C, WritingSystem::Hebr),
  (0xFB3E, 0xFB3E, WritingSystem::Hebr),
  (0xFB40, 0xFB41, WritingSystem::Hebr),
  (0xFB43, 0xFB44, WritingSystem::Hebr),
  (0xFB46, 0xFB4F, WritingSystem::Hebr),
  // Arabic Presentation Forms.
  (0xFB50, 0xFD3D, WritingSystem::Arab),
  (0xFD3E, 0xFD3F, WritingSystem::Zyyy),
  (0xFD40, 0xFDCF, WritingSystem::Arab),
  (0xFDF0, 0xFDFF, WritingSystem::Arab),
  // Variation selectors and the vertical forms.
  (0xFE00, 0xFE0F, WritingSystem::Zinh),
  (0xFE10, 0xFE19, WritingSystem::Zyyy),
  (0xFE20, 0xFE2D, WritingSystem::Zinh),
  (0xFE2E, 0xFE2F, WritingSystem::Cyrl),
  (0xFE30, 0xFE52, WritingSystem::Zyyy),
  (0xFE54, 0xFE66, WritingSystem::Zyyy),
  (0xFE68, 0xFE6B, WritingSystem::Zyyy),
  (0xFE70, 0xFE74, WritingSystem::Arab),
  (0xFE76, 0xFEFC, WritingSystem::Arab),
  (0xFEFF, 0xFEFF, WritingSystem::Zyyy),
  // Halfwidth and Fullwidth Forms: three scripts and Common, one stretch at a time.
  (0xFF01, 0xFF20, WritingSystem::Zyyy),
  (0xFF21, 0xFF3A, WritingSystem::Latn),
  (0xFF3B, 0xFF40, WritingSystem::Zyyy),
  (0xFF41, 0xFF5A, WritingSystem::Latn),
  (0xFF5B, 0xFF65, WritingSystem::Zyyy),
  (0xFF66, 0xFF6F, WritingSystem::Kana),
  (0xFF70, 0xFF70, WritingSystem::Zyyy),
  (0xFF71, 0xFF9D, WritingSystem::Kana),
  (0xFF9E, 0xFF9F, WritingSystem::Zyyy),
  (0xFFA0, 0xFFBE, WritingSystem::Hang),
  (0xFFC2, 0xFFC7, WritingSystem::Hang),
  (0xFFCA, 0xFFCF, WritingSystem::Hang),
  (0xFFD2, 0xFFD7, WritingSystem::Hang),
  (0xFFDA, 0xFFDC, WritingSystem::Hang),
  (0xFFE0, 0xFFE6, WritingSystem::Zyyy),
  (0xFFE8, 0xFFEE, WritingSystem::Zyyy),
  (0xFFF9, 0xFFFD, WritingSystem::Zyyy),
  // Ancient numerals and the Greek musical notation.
  (0x10100, 0x10102, WritingSystem::Zyyy),
  (0x10107, 0x10133, WritingSystem::Zyyy),
  (0x10137, 0x1013F, WritingSystem::Zyyy),
  (0x10140, 0x1018E, WritingSystem::Grek),
  (0x10190, 0x1019C, WritingSystem::Zyyy),
  (0x101A0, 0x101A0, WritingSystem::Grek),
  (0x101D0, 0x101FC, WritingSystem::Zyyy),
  (0x101FD, 0x101FD, WritingSystem::Zinh),
  (0x102E0, 0x102E0, WritingSystem::Zinh),
  (0x102E1, 0x102FB, WritingSystem::Zyyy),
  // Latin Extended-F and -G.
  (0x10780, 0x10785, WritingSystem::Latn),
  (0x10787, 0x107B0, WritingSystem::Latn),
  (0x107B2, 0x107BA, WritingSystem::Latn),
  (0x10E60, 0x10E7E, WritingSystem::Arab),
  (0x10EC2, 0x10EC7, WritingSystem::Arab),
  (0x10ED0, 0x10ED8, WritingSystem::Arab),
  (0x10EFA, 0x10EFF, WritingSystem::Arab),
  // Sinhala Archaic Numbers.
  (0x111E1, 0x111F4, WritingSystem::Sinh),
  (0x1133B, 0x1133B, WritingSystem::Zinh),
  // Mongolian Supplement, Myanmar Extended-C and the Canadian syllabics extension.
  (0x11660, 0x1166C, WritingSystem::Mong),
  (0x116D0, 0x116E3, WritingSystem::Mymr),
  (0x11AB0, 0x11ABF, WritingSystem::Cans),
  (0x11B00, 0x11B09, WritingSystem::Deva),
  // Tamil Supplement.
  (0x11FC0, 0x11FFF, WritingSystem::Taml),
  // Ideographic symbols, and the kana extensions.
  (0x16FE2, 0x16FE3, WritingSystem::Hani),
  (0x16FF0, 0x16FF6, WritingSystem::Hani),
  (0x1AFF0, 0x1AFF3, WritingSystem::Kana),
  (0x1AFF5, 0x1AFFB, WritingSystem::Kana),
  (0x1AFFD, 0x1AFFE, WritingSystem::Kana),
  (0x1B000, 0x1B000, WritingSystem::Kana),
  (0x1B001, 0x1B11F, WritingSystem::Hira),
  (0x1B120, 0x1B122, WritingSystem::Kana),
  (0x1B132, 0x1B132, WritingSystem::Hira),
  (0x1B150, 0x1B152, WritingSystem::Hira),
  (0x1B155, 0x1B155, WritingSystem::Kana),
  (0x1B164, 0x1B167, WritingSystem::Kana),
  (0x1BCA0, 0x1BCA3, WritingSystem::Zyyy),
  (0x1CC00, 0x1CEFF, WritingSystem::Zyyy),
  (0x1CF00, 0x1CF2D, WritingSystem::Zinh),
  (0x1CF30, 0x1CF46, WritingSystem::Zinh),
  (0x1CF50, 0x1CFC3, WritingSystem::Zyyy),
  // Musical notation, whose performance marks are inherited.
  (0x1D000, 0x1D0F5, WritingSystem::Zyyy),
  (0x1D100, 0x1D126, WritingSystem::Zyyy),
  (0x1D129, 0x1D166, WritingSystem::Zyyy),
  (0x1D167, 0x1D169, WritingSystem::Zinh),
  (0x1D16A, 0x1D17A, WritingSystem::Zyyy),
  (0x1D17B, 0x1D182, WritingSystem::Zinh),
  (0x1D183, 0x1D184, WritingSystem::Zyyy),
  (0x1D185, 0x1D18B, WritingSystem::Zinh),
  (0x1D18C, 0x1D1A9, WritingSystem::Zyyy),
  (0x1D1AA, 0x1D1AD, WritingSystem::Zinh),
  (0x1D1AE, 0x1D1EA, WritingSystem::Zyyy),
  (0x1D200, 0x1D245, WritingSystem::Grek),
  (0x1D2C0, 0x1D2D3, WritingSystem::Zyyy),
  (0x1D2E0, 0x1D2F3, WritingSystem::Zyyy),
  (0x1D300, 0x1D356, WritingSystem::Zyyy),
  (0x1D360, 0x1D378, WritingSystem::Zyyy),
  // Mathematical Alphanumeric Symbols: Latin and Greek letterforms, and Common every one of them.
  (0x1D400, 0x1D7FF, WritingSystem::Zyyy),
  // Latin Extended-G and Cyrillic Extended-D.
  (0x1DF00, 0x1DF2A, WritingSystem::Latn),
  (0x1E030, 0x1E08F, WritingSystem::Cyrl),
  // Ethiopic Extended-B.
  (0x1E7E0, 0x1E7FE, WritingSystem::Ethi),
  (0x1EC71, 0x1ECB4, WritingSystem::Zyyy),
  (0x1ED01, 0x1ED3D, WritingSystem::Zyyy),
  (0x1EE00, 0x1EEFF, WritingSystem::Arab),
  // The emoji and symbol planes, with the one squared kana cut out of them.
  (0x1F000, 0x1F1FF, WritingSystem::Zyyy),
  (0x1F200, 0x1F200, WritingSystem::Hira),
  (0x1F201, 0x1FBFF, WritingSystem::Zyyy),
  // Tags and the variation selectors supplement.
  (0x20000, 0x2A6DF, WritingSystem::Hani),
  (0x2A700, 0x2EE5D, WritingSystem::Hani),
  (0x2F800, 0x2FA1D, WritingSystem::Hani),
  (0x30000, 0x33479, WritingSystem::Hani),
  (0xE0001, 0xE0001, WritingSystem::Zyyy),
  (0xE0020, 0xE007F, WritingSystem::Zyyy),
  (0xE0100, 0xE01EF, WritingSystem::Zinh),
];