Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(38)

Unified Diff: src/pkg/regexp/syntax/parse.go

Issue 6201063: code review 6201063: regexp/syntax: replace internal error on unexpected ) w... (Closed)
Patch Set: diff -r 9182664c616f https://code.google.com/p/go Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « api/go1.txt ('k') | src/pkg/regexp/syntax/parse_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/regexp/syntax/parse.go
===================================================================
--- a/src/pkg/regexp/syntax/parse.go
+++ b/src/pkg/regexp/syntax/parse.go
@@ -46,6 +46,7 @@
ErrMissingParen ErrorCode = "missing closing )"
ErrMissingRepeatArgument ErrorCode = "missing argument to repetition operator"
ErrTrailingBackslash ErrorCode = "trailing backslash at end of expression"
+ ErrUnexpectedParen ErrorCode = "unexpected )"
)
func (e ErrorCode) String() string {
@@ -1168,13 +1169,13 @@
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
« no previous file with comments | « api/go1.txt ('k') | src/pkg/regexp/syntax/parse_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b