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

Method c_class

regex/src/compile.rs:402–419  ·  view source on GitHub ↗
(&mut self, ranges: &[hir::ClassUnicodeRange])

Source from the content-addressed store, hash-verified

400 }
401
402 fn c_class(&mut self, ranges: &[hir::ClassUnicodeRange]) -> Result {
403 assert!(!ranges.is_empty());
404 if self.compiled.uses_bytes() {
405 CompileClass {
406 c: self,
407 ranges: ranges,
408 }.compile()
409 } else {
410 let ranges: Vec<(char, char)> =
411 ranges.iter().map(|r| (r.start(), r.end())).collect();
412 let hole = if ranges.len() == 1 && ranges[0].0 == ranges[0].1 {
413 self.push_hole(InstHole::Char { c: ranges[0].0 })
414 } else {
415 self.push_hole(InstHole::Ranges { ranges: ranges })
416 };
417 Ok(Patch { hole: hole, entry: self.insts.len() - 1 })
418 }
419 }
420
421 fn c_byte(&mut self, b: u8) -> Result {
422 self.c_class_bytes(&[hir::ClassBytesRange::new(b, b)])

Callers 2

cMethod · 0.80
c_charMethod · 0.80

Calls 8

uses_bytesMethod · 0.80
compileMethod · 0.80
mapMethod · 0.80
push_holeMethod · 0.80
iterMethod · 0.45
startMethod · 0.45
endMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected