1. Find all relevant boundaries (^, $, \A, \Z, \z) in the regex using a visitation of the AST.
2. For each boundary check whether it can reach the end-of-the-regex state without consuming input using the linked helper method.
3. If it can't, report an issue.
Compared to the current implementation of S5840 this will avoid false positives if the boundary is nested inside other syntactic constructs (like in a look around).