* @return the matcher whose label is best for presentation in "expected" strings
*/
public static Matcher findProperLabelMatcher(@NotNull MatcherPath path, int errorIndex) {
Matcher found = path.parent != null ? findProperLabelMatcher(path.parent, errorIndex) : null;
if (found != null) return found;
if (path.element.startIndex == errorIndex && path.element.matcher.accept(new HasCustomLabelVisitor())) {
return path.element.matcher;
}
return null;
}