mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
regexp: reject bare ?
Minor cleanup:
- removed a duplicate test case
- added a function to remove repeated code
- for consistency, replaced "return nil" with a panic at an
unreachable point
Fixes #1428.
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/4057042
This commit is contained in:
parent
1d1f1192d9
commit
eb56a79e99
2 changed files with 24 additions and 29 deletions
|
|
@ -38,6 +38,8 @@ type stringError struct {
|
|||
|
||||
var bad_re = []stringError{
|
||||
{`*`, ErrBareClosure},
|
||||
{`+`, ErrBareClosure},
|
||||
{`?`, ErrBareClosure},
|
||||
{`(abc`, ErrUnmatchedLpar},
|
||||
{`abc)`, ErrUnmatchedRpar},
|
||||
{`x[a-z`, ErrUnmatchedLbkt},
|
||||
|
|
@ -47,7 +49,6 @@ var bad_re = []stringError{
|
|||
{`a**`, ErrBadClosure},
|
||||
{`a*+`, ErrBadClosure},
|
||||
{`a??`, ErrBadClosure},
|
||||
{`*`, ErrBareClosure},
|
||||
{`\x`, ErrBadBackslash},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue