Seems that you need to use err("Invalid rule") instead of failure, as it guarantees that no backtracking will be performed.
Seems that you need to use err("Invalid rule") instead of failure, as it guarantees that no backtracking will be performed.