diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-06-25 16:20:03 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-06-25 16:20:03 +0000 |
commit | 08a680a8879ce9da16d808644730f7cfacaf667f (patch) | |
tree | 5dfe28c3f573ae57b971ed4d9a1c99a76f0a70c4 /libgo/go/regexp/syntax | |
parent | 72de8622ae2d5aaeb58173f454aed87640a989b5 (diff) | |
download | gcc-08a680a8879ce9da16d808644730f7cfacaf667f.zip gcc-08a680a8879ce9da16d808644730f7cfacaf667f.tar.gz gcc-08a680a8879ce9da16d808644730f7cfacaf667f.tar.bz2 |
libgo: Update to Go 1.0.2 release.
From-SVN: r188943
Diffstat (limited to 'libgo/go/regexp/syntax')
-rw-r--r-- | libgo/go/regexp/syntax/parse.go | 7 | ||||
-rw-r--r-- | libgo/go/regexp/syntax/parse_test.go | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/libgo/go/regexp/syntax/parse.go b/libgo/go/regexp/syntax/parse.go index 71b07b9..4c61cb3 100644 --- a/libgo/go/regexp/syntax/parse.go +++ b/libgo/go/regexp/syntax/parse.go @@ -48,6 +48,9 @@ const ( ErrTrailingBackslash ErrorCode = "trailing backslash at end of expression" ) +// TODO: Export for Go 1.1. +const errUnexpectedParen ErrorCode = "unexpected )" + func (e ErrorCode) String() string { return string(e) } @@ -1168,13 +1171,13 @@ func (p *parser) parseRightParen() error { n := len(p.stack) if n < 2 { - return &Error{ErrInternalError, ""} + 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{ErrMissingParen, p.wholeRegexp} + return &Error{errUnexpectedParen, p.wholeRegexp} } // Restore flags at time of paren. p.flags = re2.Flags diff --git a/libgo/go/regexp/syntax/parse_test.go b/libgo/go/regexp/syntax/parse_test.go index 88f65ec..e247cf2 100644 --- a/libgo/go/regexp/syntax/parse_test.go +++ b/libgo/go/regexp/syntax/parse_test.go @@ -442,10 +442,18 @@ var invalidRegexps = []string{ `(`, `)`, `(a`, + `a)`, + `(a))`, `(a|b|`, + `a|b|)`, + `(a|b|))`, `(a|b`, + `a|b)`, + `(a|b))`, `[a-z`, `([a-z)`, + `[a-z)`, + `([a-z]))`, `x{1001}`, `x{9876543210}`, `x{2,1}`, |