1
0
mirror of https://github.com/golang/go synced 2024-11-20 04:54:44 -07:00

regexp/syntax: export ErrUnexpectedParen

Fixes #3712

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6902069
This commit is contained in:
Brian Ketelsen 2012-12-11 12:02:14 -05:00 committed by Russ Cox
parent b979b192b2
commit 1b46e4cd9a

View File

@ -42,11 +42,9 @@ 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)
}
@ -1167,13 +1165,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