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