diff --git a/regex/nfa.go b/regex/nfa.go index d7ac1af..8bd1d74 100644 --- a/regex/nfa.go +++ b/regex/nfa.go @@ -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 &&