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

Method new

regex/src/dfa.rs:426–445  ·  view source on GitHub ↗

Create new empty cache for the DFA engine.

(prog: &Program)

Source from the content-addressed store, hash-verified

424impl 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
448impl CacheInner {

Callers 8

capture_namesMethod · 0.45
findMethod · 0.45
find_iterMethod · 0.45
capturesMethod · 0.45
captures_iterMethod · 0.45
shortest_matchMethod · 0.45
__init__Method · 0.45
matchesMethod · 0.45

Calls 2

reset_sizeMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected