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 <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
diff --git a/api/next/51684.txt b/api/next/51684.txt
index f35d13f..b8a0645 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 1462f4c..350f297 100644
--- a/src/regexp/syntax/parse.go
+++ b/src/regexp/syntax/parse.go
@@ -43,7 +43,7 @@
 	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 @@
 		}
 	}
 	if p.calcHeight(re, true) > maxHeight {
-		panic(ErrInvalidDepth)
+		panic(ErrNestingDepth)
 	}
 }
 
@@ -762,8 +762,8 @@
 			panic(r)
 		case nil:
 			// ok
-		case ErrInvalidDepth:
-			err = &Error{Code: ErrInvalidDepth, Expr: s}
+		case ErrNestingDepth:
+			err = &Error{Code: ErrNestingDepth, Expr: s}
 		}
 	}()