Implement PCRE Matching (prefer left-branch) #2

Merged
Rockingcool merged 48 commits from implementPCREMatchingRules into master 2025-02-09 15:24:29 -06:00
6 changed files with 635 additions and 387 deletions
Showing only changes of commit 62ca1a872a - Show all commits

View File

@@ -402,19 +402,20 @@ func newState() nfaState {
}
// Creates and returns a state that _always_ has a zero-length match.
func zeroLengthMatchState() nfaState {
start := newState()
func zeroLengthMatchState() *nfaState {
start := &nfaState{}
start.content = newContents(epsilon)
start.isEmpty = true
start.assert = alwaysTrueAssert
start.output = append([]*nfaState{}, start)
return start
}
func (s nfaState) equals(other nfaState) bool {
return slices.Equal(s.content, other.content) &&
s.isEmpty == other.isEmpty &&
return s.isEmpty == other.isEmpty &&
s.isLast == other.isLast &&
slices.Equal(s.output, other.output) &&
slices.Equal(s.content, other.content) &&
s.next == other.next &&
s.isKleene == other.isKleene &&
s.isQuestion == other.isQuestion &&