boolean (PsiElement node, PsiElement match, @NotNull MatchContext context) { String text1 = node.getText(); text1 = getTextFromNode(node, text1); Matcher m1 = p.matcher(text1); String text2 = match.getText(); text2 = getTextFromNode(match, text2); Matcher m2 = p.matcher(text2); if (m1.matches() && m2.matches()) { String name = m1.group(1); String name2 = m2.group(1); boolean isTypedName = context.getPattern().isTypedVar(name); if (name.equals(name2) || isTypedName) { String value = m1.group(2); String value2 = m2.group(2); if (value!=null) { if (value2 == null || !value2.matches(value)) return false; } if (isTypedName) { SubstitutionHandler handler = (SubstitutionHandler) context.getPattern().getHandler(name); return handler.handle(match,context); } return true; } } return text1.equals(text2); }