From e819613d08a8562d204ca9204e7a743bd6e1514e Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 13 Jun 2012 16:24:55 -0400 Subject: [PATCH] [release-branch.go1] regexp/syntax: unexport ErrUnexpectedParen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ««« 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 »»» --- src/pkg/regexp/syntax/parse.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pkg/regexp/syntax/parse.go b/src/pkg/regexp/syntax/parse.go index 74a9d6c30ae..4924e94533d 100644 --- a/src/pkg/regexp/syntax/parse.go +++ b/src/pkg/regexp/syntax/parse.go @@ -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