| 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)]) |