mirror of
https://github.com/golang/go
synced 2024-11-15 11:10:22 -07:00
[release-branch.go1] regexp/syntax: unexport ErrUnexpectedParen
««« backport b4cdcec897fb regexp/syntax: unexport ErrUnexpectedParen This new error is the only API change in the current draft of Go 1.0.2 CLs. I'd like to include the CL that introduced it, because it replaces a mysterious 'internal error' with a useful error message, but I don't want any API changes, so unexport the error constant for now. It can be re-exported for Go 1.1. R=golang-dev, r CC=golang-dev https://golang.org/cl/6294055 »»»
This commit is contained in:
parent
ef902f8c8e
commit
e819613d08
@ -46,9 +46,11 @@ const (
|
||||
ErrMissingParen ErrorCode = "missing closing )"
|
||||
ErrMissingRepeatArgument ErrorCode = "missing argument to repetition operator"
|
||||
ErrTrailingBackslash ErrorCode = "trailing backslash at end of expression"
|
||||
ErrUnexpectedParen ErrorCode = "unexpected )"
|
||||
)
|
||||
|
||||
// TODO: Export for Go 1.1.
|
||||
const errUnexpectedParen ErrorCode = "unexpected )"
|
||||
|
||||
func (e ErrorCode) String() string {
|
||||
return string(e)
|
||||
}
|
||||
@ -1169,13 +1171,13 @@ func (p *parser) parseRightParen() error {
|
||||
|
||||
n := len(p.stack)
|
||||
if n < 2 {
|
||||
return &Error{ErrUnexpectedParen, p.wholeRegexp}
|
||||
return &Error{errUnexpectedParen, p.wholeRegexp}
|
||||
}
|
||||
re1 := p.stack[n-1]
|
||||
re2 := p.stack[n-2]
|
||||
p.stack = p.stack[:n-2]
|
||||
if re2.Op != opLeftParen {
|
||||
return &Error{ErrUnexpectedParen, p.wholeRegexp}
|
||||
return &Error{errUnexpectedParen, p.wholeRegexp}
|
||||
}
|
||||
// Restore flags at time of paren.
|
||||
p.flags = re2.Flags
|
||||
|
Loading…
Reference in New Issue
Block a user