зеркало из https://github.com/mozilla/gecko-dev.git
63 строки
2.8 KiB
Rust
63 строки
2.8 KiB
Rust
// AUTOGENERATED FROM index-iso-8859-6.txt, ORIGINAL COMMENT FOLLOWS:
|
|
//
|
|
// Any copyright is dedicated to the Public Domain.
|
|
// https://creativecommons.org/publicdomain/zero/1.0/
|
|
//
|
|
// For details on index index-iso-8859-6.txt see the Encoding Standard
|
|
// https://encoding.spec.whatwg.org/
|
|
//
|
|
// Identifier: 85bb7b5c2dc75975afebe5743935ba4ed5a09c1e9e34e9bfb2ff80293f5d8bbc
|
|
// Date: 2014-12-19
|
|
|
|
static FORWARD_TABLE: &'static [u16] = &[
|
|
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, 65535, 65535, 65535, 164, 65535, 65535, 65535, 65535, 65535,
|
|
65535, 65535, 1548, 173, 65535, 65535, 65535, 65535, 65535, 65535, 65535,
|
|
65535, 65535, 65535, 65535, 65535, 65535, 1563, 65535, 65535, 65535, 1567,
|
|
65535, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579,
|
|
1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591,
|
|
1592, 1593, 1594, 65535, 65535, 65535, 65535, 65535, 1600, 1601, 1602,
|
|
1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614,
|
|
1615, 1616, 1617, 1618, 65535, 65535, 65535, 65535, 65535, 65535, 65535,
|
|
65535, 65535, 65535, 65535, 65535, 65535,
|
|
];
|
|
|
|
/// Returns the index code point for pointer `code` in this index.
|
|
#[inline]
|
|
pub fn forward(code: u8) -> u16 {
|
|
FORWARD_TABLE[(code - 0x80) as usize]
|
|
}
|
|
|
|
static BACKWARD_TABLE_LOWER: &'static [u8] = &[
|
|
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,
|
|
0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 164, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
173, 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, 0, 0, 0, 0, 0, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 187, 0,
|
|
0, 0, 191, 0, 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, 0, 0,
|
|
0, 0, 0, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236,
|
|
237, 238, 239, 240, 241, 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
];
|
|
|
|
static BACKWARD_TABLE_UPPER: &'static [u16] = &[
|
|
0, 0, 0, 0, 32, 64, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
|
|
128, 160,
|
|
];
|
|
|
|
/// Returns the index pointer for code point `code` in this index.
|
|
#[inline]
|
|
pub fn backward(code: u32) -> u8 {
|
|
let offset = (code >> 5) as usize;
|
|
let offset = if offset < 51 {BACKWARD_TABLE_UPPER[offset] as usize} else {0};
|
|
BACKWARD_TABLE_LOWER[offset + ((code & 31) as usize)]
|
|
}
|
|
|
|
#[cfg(test)]
|
|
single_byte_tests!(
|
|
mod = iso_8859_6
|
|
);
|