<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'subex/main.go')
-rw-r--r--subex/main.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/subex/main.go b/subex/main.go
index 638e0f5..ebd87cb 100644
--- a/subex/main.go
+++ b/subex/main.go
@@ -131,12 +131,15 @@ func RunTransducer(transducer Transducer, input []walk.Atom) (output []walk.Atom
},
store: make([][]walk.Atom, transducer.storeSize),
}}
+ var tmp []SubexBranch
+ newStates := make([]SubexBranch, 0, 2)
for _, piece := range input {
- var newStates []SubexBranch
for _, state := range states {
newStates = append(newStates, state.eat(piece)...)
}
+ tmp = states
states = pruneStates(newStates)
+ newStates = tmp[:0]
if len(states) == 0 {
return nil, true
}