summaryrefslogtreecommitdiff
path: root/src/pkg/regexp/regexp.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-11-20 11:16:57 -0800
committerRob Pike <r@golang.org>2009-11-20 11:16:57 -0800
commit8e00a7329bea9607f59681e05ae74c3ade1e1938 (patch)
treefc401cc67c3d14e3e7be2f50842ab1cb32c17e43 /src/pkg/regexp/regexp.go
parent37c59fc0b9d3b46576fcd96a8c1420b09d599a13 (diff)
downloadgolang-8e00a7329bea9607f59681e05ae74c3ade1e1938.tar.gz
slight simplification made possible by the code now processing match states
in order of discovery. R=rsc http://codereview.appspot.com/157112
Diffstat (limited to 'src/pkg/regexp/regexp.go')
-rw-r--r--src/pkg/regexp/regexp.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/pkg/regexp/regexp.go b/src/pkg/regexp/regexp.go
index a58fbf44f..0b1d97d13 100644
--- a/src/pkg/regexp/regexp.go
+++ b/src/pkg/regexp/regexp.go
@@ -764,11 +764,10 @@ func (a *matchArena) addState(s []state, inst instr, match *matchVec, pos, end i
index := inst.index();
l := len(s);
begin := match.m[0];
- // TODO: If the state were a vector and we could do insert, have inputs always
- // go in order correctly and this "earlier" test is not necessary,
+ // States are inserted in order so it's sufficient to see if we have the same
+ // instruction; no need to see if existing match is earlier (it is).
for i := 0; i < l; i++ {
- if s[i].inst.index() == index && // same instruction
- s[i].match.m[0] <= begin { // earlier match already going; lefmost wins
+ if s[i].inst.index() == index {
return s
}
}