encoding_index_singlebyte/
iso_8859_14.rs

1// AUTOGENERATED FROM index-iso-8859-14.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-iso-8859-14.txt see the Encoding Standard
7// https://encoding.spec.whatwg.org/
8//
9// Identifier: 2c8651cfc08b1f35b17919ee5379f2fa006af3ec809f11b3b7f470785580542b
10// Date: 2014-12-19
11
12static FORWARD_TABLE: &'static [u16] = &[
13    128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
14    143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
15    158, 159, 160, 7682, 7683, 163, 266, 267, 7690, 167, 7808, 169, 7810, 7691,
16    7922, 173, 174, 376, 7710, 7711, 288, 289, 7744, 7745, 182, 7766, 7809,
17    7767, 7811, 7776, 7923, 7812, 7813, 7777, 192, 193, 194, 195, 196, 197,
18    198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 372, 209, 210, 211, 212,
19    213, 214, 7786, 216, 217, 218, 219, 220, 221, 374, 223, 224, 225, 226, 227,
20    228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 373, 241, 242,
21    243, 244, 245, 246, 7787, 248, 249, 250, 251, 252, 253, 375, 255,
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, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
33    139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
34    154, 155, 156, 157, 158, 159, 160, 0, 0, 163, 0, 0, 0, 167, 0, 169, 0, 0,
35    0, 173, 174, 0, 0, 0, 0, 0, 0, 0, 182, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 193,
36    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 0,
37    209, 210, 211, 212, 213, 214, 0, 216, 217, 218, 219, 220, 221, 0, 223, 224,
38    225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
39    0, 241, 242, 243, 244, 245, 246, 0, 248, 249, 250, 251, 252, 253, 0, 255,
40    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
41    0, 0, 0, 0, 0, 0, 0, 0, 178, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
42    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,
43    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 208, 240, 222, 254, 175, 0, 0, 0, 0, 0, 0,
44    0, 0, 0, 161, 162, 0, 0, 0, 0, 0, 0, 166, 171, 0, 0, 0, 0, 0, 0, 0, 0, 0,
45    0, 0, 0, 0, 0, 0, 0, 0, 0, 176, 177, 180, 181, 0, 0, 0, 0, 0, 0, 0, 0, 0,
46    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 185, 0, 0, 0, 0, 0, 0, 0, 0, 187,
47    191, 0, 0, 0, 0, 0, 0, 0, 0, 215, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
48    0, 0, 0, 0, 0, 0, 0, 0, 168, 184, 170, 186, 189, 190, 0, 0, 0, 0, 0, 0, 0,
49    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,
50    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 188, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
51    0, 0,
52];
53
54static BACKWARD_TABLE_UPPER: &'static [u16] = &[
55    0, 0, 0, 0, 32, 64, 96, 128, 160, 192, 0, 224, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63    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,
64    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 256, 0, 288, 320,
65    352, 0, 0, 384,
66];
67
68/// Returns the index pointer for code point `code` in this index.
69#[inline]
70pub fn backward(code: u32) -> u8 {
71    let offset = (code >> 5) as usize;
72    let offset = if offset < 248 {BACKWARD_TABLE_UPPER[offset] as usize} else {0};
73    BACKWARD_TABLE_LOWER[offset + ((code & 31) as usize)]
74}
75
76#[cfg(test)]
77single_byte_tests!(
78    mod = iso_8859_14
79);