|
|
|
@ -816,7 +816,7 @@ func thompson(re []postfixNode) (Reg, error) {
|
|
|
|
|
// In these cases, we will return an NFA with 1 state, with an assertion that is always true.
|
|
|
|
|
if len(re) == 0 {
|
|
|
|
|
start := zeroLengthMatchState()
|
|
|
|
|
nfa = append(nfa, &start)
|
|
|
|
|
nfa = append(nfa, start)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, c := range re {
|
|
|
|
@ -1068,14 +1068,14 @@ func thompson(re []postfixNode) (Reg, error) {
|
|
|
|
|
nfa = append(nfa, s2)
|
|
|
|
|
}
|
|
|
|
|
tmp := zeroLengthMatchState()
|
|
|
|
|
s2 = &tmp
|
|
|
|
|
s2 = tmp
|
|
|
|
|
}
|
|
|
|
|
if err1 != nil || (s1.groupBegin && s1.numTransitions() == 0) { // Doesn't exist, or its just an LPAREN
|
|
|
|
|
if err1 == nil { // See above for explanation
|
|
|
|
|
nfa = append(nfa, s1)
|
|
|
|
|
}
|
|
|
|
|
tmp := zeroLengthMatchState()
|
|
|
|
|
s1 = &tmp
|
|
|
|
|
s1 = tmp
|
|
|
|
|
}
|
|
|
|
|
s3 := alternate(s1, s2)
|
|
|
|
|
nfa = append(nfa, s3)
|
|
|
|
|