Working on multiple matching
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user