Made zeroLengthMatchState() return a pointer; reduced the number of comparisons performd by nfaState.equals
This commit is contained in:
@@ -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 &&
|
||||
|
Reference in New Issue
Block a user