1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:24:41 -07:00

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:
Russ Cox 2012-06-08 13:05:01 -04:00
parent 6c204982e0
commit 50452720ba

View File

@ -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