From 180572c70477e78c43c745d2331ebf4d39d9ff10 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Sun, 10 Dec 2023 20:50:35 +0200 Subject: Fixed a bug where it wouldn't match spaces --- src/nfa.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/nfa.rs') diff --git a/src/nfa.rs b/src/nfa.rs index c92a6d5..692b07d 100644 --- a/src/nfa.rs +++ b/src/nfa.rs @@ -130,8 +130,13 @@ impl NFA { // TODO: chars.nth() Work at O(n) consider using bytes instead of losing UTF-8 support Trans::Symbol(ch) => match input.chars().nth(idx) { Some(nxt) if nxt == *ch => { + // choose idx += 1; + + //explore result |= self.matches_helper(self.states.get(id).unwrap(), input, idx); + + // unchoose idx -= 1; } None => {} -- cgit v1.2.3