MCPcopy Create free account
hub / github.com/davidblewett/rure-python / byte_classes

Method byte_classes

regex/src/compile.rs:1040–1059  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

1038 }
1039
1040 fn byte_classes(&self) -> Vec<u8> {
1041 // N.B. If you're debugging the DFA, it's useful to simply return
1042 // `(0..256).collect()`, which effectively removes the byte classes
1043 // and makes the transitions easier to read.
1044 // (0usize..256).map(|x| x as u8).collect()
1045 let mut byte_classes = vec![0; 256];
1046 let mut class = 0u8;
1047 let mut i = 0;
1048 loop {
1049 byte_classes[i] = class as u8;
1050 if i >= 255 {
1051 break;
1052 }
1053 if self.0[i] {
1054 class = class.checked_add(1).unwrap();
1055 }
1056 i += 1;
1057 }
1058 byte_classes
1059 }
1060}
1061
1062fn u32_to_usize(n: u32) -> usize {

Callers 3

buildMethod · 0.80
compile_finishMethod · 0.80
byte_classesFunction · 0.80

Calls 1

unwrapMethod · 0.80

Tested by 1

byte_classesFunction · 0.64