|
|
|
@ -147,8 +147,13 @@ func thompson(re string) *State {
|
|
|
|
|
s3.transitions = make(map[int][]*State)
|
|
|
|
|
s3.output = append(s3.output, s1.output...)
|
|
|
|
|
s3.output = append(s3.output, s2.output...)
|
|
|
|
|
s3.transitions[s1.content] = append(s3.transitions[s1.content], s1)
|
|
|
|
|
s3.transitions[s2.content] = append(s3.transitions[s2.content], s2)
|
|
|
|
|
// Unique append is used here (and elsewhere) to ensure that,
|
|
|
|
|
// for any given transition, a state 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
|
|
|
|
|
// 's1' states would be considered to match.
|
|
|
|
|
s3.transitions[s1.content] = unique_append(s3.transitions[s1.content], s1)
|
|
|
|
|
s3.transitions[s2.content] = unique_append(s3.transitions[s2.content], s2)
|
|
|
|
|
s3.content = EPSILON
|
|
|
|
|
s3.isEmpty = true
|
|
|
|
|
|
|
|
|
|