Fix assertion or stack overflow error in some full-context parsing scenarios