|
|
@ -55,7 +55,7 @@ func verifyLastStates(start []*State) {
|
|
|
|
|
|
|
|
|
|
|
|
func concatenate(s1 *State, s2 *State) *State {
|
|
|
|
func concatenate(s1 *State, s2 *State) *State {
|
|
|
|
for i := range s1.output {
|
|
|
|
for i := range s1.output {
|
|
|
|
s1.output[i].transitions[s2.content] = unique_append(s1.output[i].transitions[s2.content], s2)
|
|
|
|
s1.output[i].transitions[s2.content], _ = unique_append(s1.output[i].transitions[s2.content], s2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
s1.output = s2.output
|
|
|
|
s1.output = s2.output
|
|
|
|
return s1
|
|
|
|
return s1
|
|
|
@ -69,9 +69,9 @@ func kleene(s1 State) *State {
|
|
|
|
toReturn.isKleene = true
|
|
|
|
toReturn.isKleene = true
|
|
|
|
toReturn.output = append(toReturn.output, toReturn)
|
|
|
|
toReturn.output = append(toReturn.output, toReturn)
|
|
|
|
for i := range s1.output {
|
|
|
|
for i := range s1.output {
|
|
|
|
s1.output[i].transitions[toReturn.content] = unique_append(s1.output[i].transitions[toReturn.content], toReturn)
|
|
|
|
s1.output[i].transitions[toReturn.content], _ = unique_append(s1.output[i].transitions[toReturn.content], toReturn)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
toReturn.transitions[s1.content] = unique_append(toReturn.transitions[s1.content], &s1)
|
|
|
|
toReturn.transitions[s1.content], _ = unique_append(toReturn.transitions[s1.content], &s1)
|
|
|
|
return toReturn
|
|
|
|
return toReturn
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -85,8 +85,8 @@ func alternate(s1 *State, s2 *State) *State {
|
|
|
|
// For example, given the transition 'a', the state 's1' can only be mentioned once.
|
|
|
|
// For example, given the transition 'a', the state 's1' can only be mentioned once.
|
|
|
|
// This would lead to multiple instances of the same set of match indices, since both
|
|
|
|
// This would lead to multiple instances of the same set of match indices, since both
|
|
|
|
// 's1' states would be considered to match.
|
|
|
|
// 's1' states would be considered to match.
|
|
|
|
toReturn.transitions[s1.content] = unique_append(toReturn.transitions[s1.content], s1)
|
|
|
|
toReturn.transitions[s1.content], _ = unique_append(toReturn.transitions[s1.content], s1)
|
|
|
|
toReturn.transitions[s2.content] = unique_append(toReturn.transitions[s2.content], s2)
|
|
|
|
toReturn.transitions[s2.content], _ = unique_append(toReturn.transitions[s2.content], s2)
|
|
|
|
toReturn.content = EPSILON
|
|
|
|
toReturn.content = EPSILON
|
|
|
|
toReturn.isEmpty = true
|
|
|
|
toReturn.isEmpty = true
|
|
|
|
|
|
|
|
|
|
|
|