You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/lib.rs
+24-19Lines changed: 24 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,21 @@ struct DFAState {
18
18
state_id:StateID
19
19
}
20
20
21
+
22
+
implDFAState{
23
+
/// Encapsulate the kluge necessary to set up the DFA correctly for Syncode's use case.
24
+
fnnew(
25
+
regex:&str
26
+
) -> DFAState{
27
+
let dfa = dense::DFA::new(regex).unwrap();
28
+
// We always want the DFA to match starting from the beginning of the string.
29
+
let config = start::Config::new().anchored(Anchored::Yes);
30
+
let state_id = dfa.start_state(&config).unwrap();
31
+
DFAState{dfa: dfa.into(), state_id}
32
+
}
33
+
}
34
+
35
+
21
36
/// Compute whether the string could match a sequence of terminals starting at a certain state in the first DFA.
22
37
///
23
38
/// Given a DFA D(Q, Σ, δ, q0, F ), a string w ∈ Σ∗, a DFA state q ∈ Q and any sequence of terminals Λ = {τf +1, τf +2 . . . τf +d}, dmatch(w, q, Λ) = true, if either of the following conditions hold:
0 commit comments