Commit 1b46e4cd authored by Brian Ketelsen's avatar Brian Ketelsen Committed by Russ Cox

regexp/syntax: export ErrUnexpectedParen

Fixes #3712

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6902069
parent b979b192
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment