Parses a whole pattern string; whitespace may surround the pattern.
Optional
If the string is not a pattern, has trailing input, or nests deeper than a given maxDepth
maxDepth
If input is not a string
input
If maxDepth is not a positive integer
Parses a whole pattern string; whitespace may surround the pattern.