encoding_index_singlebyte/
windows_1253.rs

1// AUTOGENERATED FROM index-windows-1253.txt, ORIGINAL COMMENT FOLLOWS:
2//
3// Any copyright is dedicated to the Public Domain.
4// https://creativecommons.org/publicdomain/zero/1.0/
5//
6// For details on index index-windows-1253.txt see the Encoding Standard
7// https://encoding.spec.whatwg.org/
8//
9// Identifier: 49fdc881a3488904dd1e8dfba9aef3258454249958b611bcded1d4c981ab5561
10// Date: 2014-12-19
11
12static FORWARD_TABLE: &'static [u16] = &[
13    8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 136, 8240, 138, 8249, 140,
14    141, 142, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 152, 8482,
15    154, 8250, 156, 157, 158, 159, 160, 901, 902, 163, 164, 165, 166, 167, 168,
16    169, 65535, 171, 172, 173, 174, 8213, 176, 177, 178, 179, 900, 181, 182,
17    183, 904, 905, 906, 187, 908, 189, 910, 911, 912, 913, 914, 915, 916, 917,
18    918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 65535, 931,
19    932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946,
20    947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961,
21    962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 65535,
22];
23
24/// Returns the index code point for pointer `code` in this index.
25#[inline]
26pub fn forward(code: u8) -> u16 {
27    FORWARD_TABLE[(code - 0x80) as usize]
28}
29
30static BACKWARD_TABLE_LOWER: &'static [u8] = &[
31    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
32    0, 0, 0, 0, 0, 0, 0, 0, 129, 0, 0, 0, 0, 0, 0, 136, 0, 138, 0, 140, 141,
33    142, 143, 144, 0, 0, 0, 0, 0, 0, 0, 152, 0, 154, 0, 156, 157, 158, 159,
34    160, 0, 0, 163, 164, 165, 166, 167, 168, 169, 0, 171, 172, 173, 174, 0,
35    176, 177, 178, 179, 0, 181, 182, 183, 0, 0, 0, 187, 0, 189, 0, 0, 0, 0, 0,
36    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 0, 0, 0, 0, 0, 0, 0, 0,
37    0, 0, 0, 0, 0, 0, 0, 0, 0, 180, 161, 162, 0, 184, 185, 186, 0, 188, 0, 190,
38    191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
39    206, 207, 208, 209, 0, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
40    221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235,
41    236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
42    251, 252, 253, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
43    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 151, 175, 0, 0,
44    145, 146, 130, 0, 147, 148, 132, 0, 134, 135, 149, 0, 0, 0, 133, 0, 0, 0,
45    0, 0, 0, 0, 0, 0, 137, 0, 0, 0, 0, 0, 0, 0, 0, 139, 155, 0, 0, 0, 0, 0, 0,
46    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
47    0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
48    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
49];
50
51static BACKWARD_TABLE_UPPER: &'static [u16] = &[
52    0, 0, 0, 0, 32, 64, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53    0, 0, 0, 0, 128, 160, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
54    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
55    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
58    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
59    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
60    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
61    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62    0, 0, 0, 0, 0, 0, 0, 0, 0, 224, 256, 0, 0, 0, 288, 0, 0, 0, 320,
63];
64
65/// Returns the index pointer for code point `code` in this index.
66#[inline]
67pub fn backward(code: u32) -> u8 {
68    let offset = (code >> 5) as usize;
69    let offset = if offset < 266 {BACKWARD_TABLE_UPPER[offset] as usize} else {0};
70    BACKWARD_TABLE_LOWER[offset + ((code & 31) as usize)]
71}
72
73#[cfg(test)]
74single_byte_tests!(
75    mod = windows_1253
76);