]> Cypherpunks repositories - gostls13.git/commit
regexp: fix LiteralPrefix for certain onepass progs
authorCaleb Spare <cespare@gmail.com>
Thu, 22 Oct 2015 06:03:54 +0000 (23:03 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 25 Nov 2015 17:28:33 +0000 (17:28 +0000)
commitd1eedfe1321eec4da1c68f711f8bf0de6b926ef1
tree80065b5aa376efbb63f81533f9ad2822ac5fce0f
parent937172b247b20ee5d3bbdf345f72748e42b7460d
regexp: fix LiteralPrefix for certain onepass progs

The prefix computation for onepass was incorrectly returning
complete=true when it encountered a beginning-of-text empty width match
(^) in the middle of an expression.

Fix by returning complete only when the prefix is followed by $ and then
an accepting state.

Fixes #11175.

Change-Id: Ie9c4cf5f76c1d2c904a6fb2f016cedb265c19fde
Reviewed-on: https://go-review.googlesource.com/16200
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/regexp/all_test.go
src/regexp/onepass.go