File tree 4 files changed +12
-3
lines changed
src/tools/unicode-table-generator/src
4 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -927,7 +927,7 @@ impl char {
927
927
#[ must_use]
928
928
#[ inline]
929
929
pub ( crate ) fn is_grapheme_extended ( self ) -> bool {
930
- self > '\x7f' && unicode:: Grapheme_Extend ( self )
930
+ unicode:: Grapheme_Extend ( self )
931
931
}
932
932
933
933
/// Returns `true` if this `char` has one of the general categories for numbers.
Original file line number Diff line number Diff line change @@ -316,6 +316,7 @@ pub mod grapheme_extend {
316
316
128 , 240 , 0 ,
317
317
] ;
318
318
pub fn lookup ( c : char ) -> bool {
319
+ ( c as u32 ) >= 0x300 &&
319
320
super :: skip_search (
320
321
c as u32 ,
321
322
& SHORT_OFFSET_RUNS ,
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ impl RawEmitter {
23
23
}
24
24
25
25
fn emit_bitset ( & mut self , ranges : & [ Range < u32 > ] ) -> Result < ( ) , String > {
26
+ let first_code_point = ranges. first ( ) . unwrap ( ) . start ;
26
27
let last_code_point = ranges. last ( ) . unwrap ( ) . end ;
27
28
// bitset for every bit in the codepoint range
28
29
//
@@ -101,7 +102,10 @@ impl RawEmitter {
101
102
)
102
103
. unwrap ( ) ;
103
104
writeln ! ( & mut self . file, "pub const fn lookup(c: char) -> bool {{" ) . unwrap ( ) ;
104
- writeln ! ( & mut self . file, " super::bitset_search(" , ) . unwrap ( ) ;
105
+ if first_code_point > 0x7f {
106
+ writeln ! ( & mut self . file, " (c as u32) >= {first_code_point:#04x} &&" ) . unwrap ( ) ;
107
+ }
108
+ writeln ! ( & mut self . file, " super::bitset_search(" ) . unwrap ( ) ;
105
109
writeln ! ( & mut self . file, " c as u32," ) . unwrap ( ) ;
106
110
writeln ! ( & mut self . file, " &BITSET_CHUNKS_MAP," ) . unwrap ( ) ;
107
111
writeln ! ( & mut self . file, " &BITSET_INDEX_CHUNKS," ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -25,8 +25,9 @@ impl ShortOffsetRunHeader {
25
25
26
26
impl RawEmitter {
27
27
pub fn emit_skiplist ( & mut self , ranges : & [ Range < u32 > ] ) {
28
+ let first_code_point = ranges. first ( ) . unwrap ( ) . start ;
28
29
let mut offsets = Vec :: < u32 > :: new ( ) ;
29
- let points = ranges. iter ( ) . flat_map ( |r| vec ! [ r. start, r. end] ) . collect :: < Vec < u32 > > ( ) ;
30
+ let points = ranges. iter ( ) . flat_map ( |r| [ r. start , r. end ] ) . collect :: < Vec < u32 > > ( ) ;
30
31
let mut offset = 0 ;
31
32
for pt in points {
32
33
let delta = pt - offset;
@@ -87,6 +88,9 @@ impl RawEmitter {
87
88
self . bytes_used += coded_offsets. len ( ) ;
88
89
89
90
writeln ! ( & mut self . file, "pub fn lookup(c: char) -> bool {{" ) . unwrap ( ) ;
91
+ if first_code_point > 0x7f {
92
+ writeln ! ( & mut self . file, " (c as u32) >= {first_code_point:#04x} &&" ) . unwrap ( ) ;
93
+ }
90
94
writeln ! ( & mut self . file, " super::skip_search(" , ) . unwrap ( ) ;
91
95
writeln ! ( & mut self . file, " c as u32," ) . unwrap ( ) ;
92
96
writeln ! ( & mut self . file, " &SHORT_OFFSET_RUNS," ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments