1 // NOTE: The following code was generated by "src/libcore/unicode/printable.py",
2 // do not edit directly!
4 fn check(x: u16, singletonuppers: &[(u8, u8)], singletonlowers: &[u8],
5 normal: &[u8]) -> bool {
6 let xupper = (x >> 8) as u8;
7 let mut lowerstart = 0;
8 for &(upper, lowercount) in singletonuppers {
9 let lowerend = lowerstart + lowercount as usize;
11 for &lower in &singletonlowers[lowerstart..lowerend] {
16 } else if xupper < upper {
19 lowerstart = lowerend;
23 let mut normal = normal.iter().cloned();
24 let mut current = true;
25 while let Some(v) = normal.next() {
26 let len = if v & 0x80 != 0 {
27 ((v & 0x7f) as i32) << 8 | normal.next().unwrap() as i32
40 pub(crate) fn is_printable(x: char) -> bool {
44 check(lower, SINGLETONS0U, SINGLETONS0L, NORMAL0)
45 } else if x < 0x20000 {
46 check(lower, SINGLETONS1U, SINGLETONS1L, NORMAL1)
48 if 0x2a6d7 <= x && x < 0x2a700 {
51 if 0x2b735 <= x && x < 0x2b740 {
54 if 0x2b81e <= x && x < 0x2b820 {
57 if 0x2cea2 <= x && x < 0x2ceb0 {
60 if 0x2ebe1 <= x && x < 0x2f800 {
63 if 0x2fa1e <= x && x < 0xe0100 {
66 if 0xe01f0 <= x && x < 0x110000 {
73 const SINGLETONS0U: &[(u8, u8)] = &[
116 const SINGLETONS0L: &[u8] = &[
117 0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57,
118 0x58, 0x8b, 0x8c, 0x90, 0x1c, 0x1d, 0xdd, 0x0e,
119 0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f,
120 0x5c, 0x5d, 0x5f, 0xb5, 0xe2, 0x84, 0x8d, 0x8e,
121 0x91, 0x92, 0xa9, 0xb1, 0xba, 0xbb, 0xc5, 0xc6,
122 0xc9, 0xca, 0xde, 0xe4, 0xe5, 0xff, 0x00, 0x04,
123 0x11, 0x12, 0x29, 0x31, 0x34, 0x37, 0x3a, 0x3b,
124 0x3d, 0x49, 0x4a, 0x5d, 0x84, 0x8e, 0x92, 0xa9,
125 0xb1, 0xb4, 0xba, 0xbb, 0xc6, 0xca, 0xce, 0xcf,
126 0xe4, 0xe5, 0x00, 0x04, 0x0d, 0x0e, 0x11, 0x12,
127 0x29, 0x31, 0x34, 0x3a, 0x3b, 0x45, 0x46, 0x49,
128 0x4a, 0x5e, 0x64, 0x65, 0x84, 0x91, 0x9b, 0x9d,
129 0xc9, 0xce, 0xcf, 0x0d, 0x11, 0x29, 0x45, 0x49,
130 0x57, 0x64, 0x65, 0x8d, 0x91, 0xa9, 0xb4, 0xba,
131 0xbb, 0xc5, 0xc9, 0xdf, 0xe4, 0xe5, 0xf0, 0x04,
132 0x0d, 0x11, 0x45, 0x49, 0x64, 0x65, 0x80, 0x81,
133 0x84, 0xb2, 0xbc, 0xbe, 0xbf, 0xd5, 0xd7, 0xf0,
134 0xf1, 0x83, 0x85, 0x8b, 0xa4, 0xa6, 0xbe, 0xbf,
135 0xc5, 0xc7, 0xce, 0xcf, 0xda, 0xdb, 0x48, 0x98,
136 0xbd, 0xcd, 0xc6, 0xce, 0xcf, 0x49, 0x4e, 0x4f,
137 0x57, 0x59, 0x5e, 0x5f, 0x89, 0x8e, 0x8f, 0xb1,
138 0xb6, 0xb7, 0xbf, 0xc1, 0xc6, 0xc7, 0xd7, 0x11,
139 0x16, 0x17, 0x5b, 0x5c, 0xf6, 0xf7, 0xfe, 0xff,
140 0x80, 0x0d, 0x6d, 0x71, 0xde, 0xdf, 0x0e, 0x0f,
141 0x1f, 0x6e, 0x6f, 0x1c, 0x1d, 0x5f, 0x7d, 0x7e,
142 0xae, 0xaf, 0xbb, 0xbc, 0xfa, 0x16, 0x17, 0x1e,
143 0x1f, 0x46, 0x47, 0x4e, 0x4f, 0x58, 0x5a, 0x5c,
144 0x5e, 0x7e, 0x7f, 0xb5, 0xc5, 0xd4, 0xd5, 0xdc,
145 0xf0, 0xf1, 0xf5, 0x72, 0x73, 0x8f, 0x74, 0x75,
146 0x96, 0x97, 0x2f, 0x5f, 0x26, 0x2e, 0x2f, 0xa7,
147 0xaf, 0xb7, 0xbf, 0xc7, 0xcf, 0xd7, 0xdf, 0x9a,
148 0x40, 0x97, 0x98, 0x30, 0x8f, 0x1f, 0xc0, 0xc1,
149 0xce, 0xff, 0x4e, 0x4f, 0x5a, 0x5b, 0x07, 0x08,
150 0x0f, 0x10, 0x27, 0x2f, 0xee, 0xef, 0x6e, 0x6f,
151 0x37, 0x3d, 0x3f, 0x42, 0x45, 0x90, 0x91, 0xfe,
152 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9, 0xd0, 0xd1,
153 0xd8, 0xd9, 0xe7, 0xfe, 0xff,
155 const SINGLETONS1U: &[(u8, u8)] = &[
192 const SINGLETONS1L: &[u8] = &[
193 0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e,
194 0x9e, 0x9f, 0x06, 0x07, 0x09, 0x36, 0x3d, 0x3e,
195 0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36,
196 0x37, 0x56, 0x57, 0xbd, 0x35, 0xce, 0xcf, 0xe0,
197 0x12, 0x87, 0x89, 0x8e, 0x9e, 0x04, 0x0d, 0x0e,
198 0x11, 0x12, 0x29, 0x31, 0x34, 0x3a, 0x45, 0x46,
199 0x49, 0x4a, 0x4e, 0x4f, 0x64, 0x65, 0x5a, 0x5c,
200 0xb6, 0xb7, 0x1b, 0x1c, 0xa8, 0xa9, 0xd8, 0xd9,
201 0x09, 0x37, 0x90, 0x91, 0xa8, 0x07, 0x0a, 0x3b,
202 0x3e, 0x66, 0x69, 0x8f, 0x92, 0x6f, 0x5f, 0xee,
203 0xef, 0x5a, 0x62, 0x9a, 0x9b, 0x27, 0x28, 0x55,
204 0x9d, 0xa0, 0xa1, 0xa3, 0xa4, 0xa7, 0xa8, 0xad,
205 0xba, 0xbc, 0xc4, 0x06, 0x0b, 0x0c, 0x15, 0x1d,
206 0x3a, 0x3f, 0x45, 0x51, 0xa6, 0xa7, 0xcc, 0xcd,
207 0xa0, 0x07, 0x19, 0x1a, 0x22, 0x25, 0x3e, 0x3f,
208 0xc5, 0xc6, 0x04, 0x20, 0x23, 0x25, 0x26, 0x28,
209 0x33, 0x38, 0x3a, 0x48, 0x4a, 0x4c, 0x50, 0x53,
210 0x55, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x63,
211 0x65, 0x66, 0x6b, 0x73, 0x78, 0x7d, 0x7f, 0x8a,
212 0xa4, 0xaa, 0xaf, 0xb0, 0xc0, 0xd0, 0x0c, 0x72,
213 0xa3, 0xa4, 0xcb, 0xcc, 0x6e, 0x6f,
215 const NORMAL0: &[u8] = &[
358 const NORMAL1: &[u8] = &[
458 0x80, 0xc4, 0x8a, 0xbc,
459 0x84, 0x2f, 0x8f, 0xd1,
460 0x82, 0x47, 0xa1, 0xb9,
474 0x82, 0xf3, 0xa5, 0x0d,
478 0x81, 0x8c, 0x89, 0x04,