From 60b798d9049c4749d72a18761b2c333101c85470 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Wed, 23 Oct 2024 10:37:34 -0400 Subject: [PATCH] Working on multiple matching --- matching.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/matching.go b/matching.go index f9c7645..d2136a0 100644 --- a/matching.go +++ b/matching.go @@ -23,13 +23,15 @@ func match(start *State, str string) (startIdx int, endIdx int, matched bool) { currentStates := make([]*State, 0) tempStates := make([]*State, 0) // Used to store states that should be used in next loop iteration i := 0 // Index in string - // Increment until we hit a character matching the start state + // Increment until we hit a character matching the start state (assuming not 0-state) if start.isEmpty == false { for i < len(str) && int(str[i]) != start.content { i++ } i++ // Advance to next character (if we aren't at a 0-state, which doesn't match anything), so that we can check for transitions. If we advance at a 0-state, we will never get a chance to match the first character } + // TODO - If start state is kleene star, try to match the next state + currentStates = append(currentStates, start) startIdx = i