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

Method next_state

regex/src/dfa.rs:1368–1384  ·  view source on GitHub ↗

Returns the next state given the current state si and current byte b. {qcur,qnext} are used as scratch space for storing ordered NFA states. This tries to fetch the next state from the cache, but if that fails, it computes the next state, caches it and returns a pointer to it. The pointer can be to a real state, or it can be STATE_DEAD. STATE_UNKNOWN cannot be returned. None is returned if a ne

(
        &mut self,
        qcur: &mut SparseSet,
        qnext: &mut SparseSet,
        si: StatePtr,
        b: Byte,
    )

Source from the content-addressed store, hash-verified

1366 /// None is returned if a new state could not be allocated (i.e., the DFA
1367 /// ran out of space and thinks it's running too slowly).
1368 fn next_state(
1369 &mut self,
1370 qcur: &mut SparseSet,
1371 qnext: &mut SparseSet,
1372 si: StatePtr,
1373 b: Byte,
1374 ) -> Option<StatePtr> {
1375 if si == STATE_DEAD {
1376 return Some(STATE_DEAD);
1377 }
1378 match self.cache.trans.next(si, self.byte_class(b)) {
1379 STATE_UNKNOWN => self.exec_byte(qcur, qnext, si, b),
1380 STATE_QUIT => None,
1381 STATE_DEAD => Some(STATE_DEAD),
1382 nsi => Some(nsi),
1383 }
1384 }
1385
1386 /// Computes and returns the start state, where searching begins at
1387 /// position `at` in `text`. If the state has already been computed,

Callers 2

exec_atMethod · 0.80
exec_at_reverseMethod · 0.80

Calls 3

byte_classMethod · 0.80
exec_byteMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected