1
0
mirror of https://github.com/golang/go synced 2024-11-26 08:07:57 -07:00

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>
This commit is contained in:
Ian Lance Taylor 2022-04-22 14:41:57 -07:00 committed by Gopher Robot
parent 8e1a9c34ab
commit 0bf545e51f
2 changed files with 6 additions and 6 deletions

View File

@ -1,2 +1,2 @@
pkg regexp/syntax, const ErrInvalidDepth = "expression nests too deeply" #51684 pkg regexp/syntax, const ErrNestingDepth = "expression nests too deeply" #51684
pkg regexp/syntax, const ErrInvalidDepth ErrorCode #51684 pkg regexp/syntax, const ErrNestingDepth ErrorCode #51684

View File

@ -43,7 +43,7 @@ const (
ErrMissingRepeatArgument ErrorCode = "missing argument to repetition operator" ErrMissingRepeatArgument ErrorCode = "missing argument to repetition operator"
ErrTrailingBackslash ErrorCode = "trailing backslash at end of expression" ErrTrailingBackslash ErrorCode = "trailing backslash at end of expression"
ErrUnexpectedParen ErrorCode = "unexpected )" ErrUnexpectedParen ErrorCode = "unexpected )"
ErrInvalidDepth ErrorCode = "expression nests too deeply" ErrNestingDepth ErrorCode = "expression nests too deeply"
) )
func (e ErrorCode) String() string { func (e ErrorCode) String() string {
@ -134,7 +134,7 @@ func (p *parser) checkHeight(re *Regexp) {
} }
} }
if p.calcHeight(re, true) > maxHeight { 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) panic(r)
case nil: case nil:
// ok // ok
case ErrInvalidDepth: case ErrNestingDepth:
err = &Error{Code: ErrInvalidDepth, Expr: s} err = &Error{Code: ErrNestingDepth, Expr: s}
} }
}() }()