]> Cypherpunks repositories - gostls13.git/commit
regexp/syntax: fix factoring of common prefixes in alternations
authorPaul Wankadia <junyer@google.com>
Thu, 7 Jan 2016 07:55:18 +0000 (18:55 +1100)
committerRuss Cox <rsc@golang.org>
Fri, 8 Jan 2016 16:41:46 +0000 (16:41 +0000)
commit5ccaf0255b75063a9c685009e77cee24e26a509e
treecac4bb9ee96af770689d6238dad378faab38a349
parent8ae584f21e32ab1a07d9d5d4d39cb5f7530c49df
regexp/syntax: fix factoring of common prefixes in alternations

In the past, `a.*?c|a.*?b` was factored to `a.*?[bc]`. Thus, given
"abc" as its input string, the automaton would consume "ab" and
then stop (when unanchored) whereas it should consume all of "abc"
as per leftmost semantics.

Fixes #13812.

Change-Id: I67ac0a353d7793b3d0c9c4aaf22d157621dfe784
Reviewed-on: https://go-review.googlesource.com/18357
Reviewed-by: Russ Cox <rsc@golang.org>
src/regexp/syntax/parse.go
src/regexp/syntax/parse_test.go
src/regexp/testdata/re2-search.txt