Create new empty cache for the DFA engine.
(prog: &Program)
| 424 | impl Cache { |
| 425 | /// Create new empty cache for the DFA engine. |
| 426 | pub fn new(prog: &Program) -> Self { |
| 427 | // We add 1 to account for the special EOF byte. |
| 428 | let num_byte_classes = (prog.byte_classes[255] as usize + 1) + 1; |
| 429 | let starts = vec![STATE_UNKNOWN; 256]; |
| 430 | let mut cache = Cache { |
| 431 | inner: CacheInner { |
| 432 | compiled: StateMap::new(num_byte_classes), |
| 433 | trans: Transitions::new(num_byte_classes), |
| 434 | start_states: starts, |
| 435 | stack: vec![], |
| 436 | flush_count: 0, |
| 437 | size: 0, |
| 438 | insts_scratch_space: vec![], |
| 439 | }, |
| 440 | qcur: SparseSet::new(prog.insts.len()), |
| 441 | qnext: SparseSet::new(prog.insts.len()), |
| 442 | }; |
| 443 | cache.inner.reset_size(); |
| 444 | cache |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | impl CacheInner { |
no test coverage detected