From 0bf545e51f5303ddedb0ea60f02ff221ac088fc7 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 22 Apr 2022 14:41:57 -0700 Subject: [PATCH] regexp/syntax: rename ErrInvalidDepth to ErrNestingDepth The proposal accepted the name ErrNestingDepth. For #51684 Change-Id: I702365f19e5e1889dbcc3c971eecff68e0b08727 Reviewed-on: https://go-review.googlesource.com/c/go/+/401854 Run-TryBot: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Auto-Submit: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Rob Pike Reviewed-by: Dmitri Shuralyov --- api/next/51684.txt | 4 ++-- src/regexp/syntax/parse.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/next/51684.txt b/api/next/51684.txt index f35d13f088..b8a0645256 100644 --- a/api/next/51684.txt +++ b/api/next/51684.txt @@ -1,2 +1,2 @@ -pkg regexp/syntax, const ErrInvalidDepth = "expression nests too deeply" #51684 -pkg regexp/syntax, const ErrInvalidDepth ErrorCode #51684 +pkg regexp/syntax, const ErrNestingDepth = "expression nests too deeply" #51684 +pkg regexp/syntax, const ErrNestingDepth ErrorCode #51684 diff --git a/src/regexp/syntax/parse.go b/src/regexp/syntax/parse.go index 1462f4c082..350f297e5b 100644 --- a/src/regexp/syntax/parse.go +++ b/src/regexp/syntax/parse.go @@ -43,7 +43,7 @@ const ( ErrMissingRepeatArgument ErrorCode = "missing argument to repetition operator" ErrTrailingBackslash ErrorCode = "trailing backslash at end of expression" ErrUnexpectedParen ErrorCode = "unexpected )" - ErrInvalidDepth ErrorCode = "expression nests too deeply" + ErrNestingDepth ErrorCode = "expression nests too deeply" ) func (e ErrorCode) String() string { @@ -134,7 +134,7 @@ func (p *parser) checkHeight(re *Regexp) { } } if p.calcHeight(re, true) > maxHeight { - panic(ErrInvalidDepth) + panic(ErrNestingDepth) } } @@ -762,8 +762,8 @@ func parse(s string, flags Flags) (_ *Regexp, err error) { panic(r) case nil: // ok - case ErrInvalidDepth: - err = &Error{Code: ErrInvalidDepth, Expr: s} + case ErrNestingDepth: + err = &Error{Code: ErrNestingDepth, Expr: s} } }() -- 2.50.0