void (PsiElement literal) { final PsiElement l2 = myGlobalVisitor.getElement(); final MatchingHandler handler = literal.getUserData(CompiledPattern.HANDLER_KEY); if (handler instanceof SubstitutionHandler) { int offset = 0; int length = l2.getTextLength(); final String text = l2.getText(); if (length > 2) { final char c = text.charAt(0); if ((c == '"' || c == '\'') && text.charAt(length - 1) == c) { final boolean looseMatching = myGlobalVisitor.getMatchContext().getOptions().isLooseMatching(); if (!looseMatching && c != literal.getText().charAt(0)) { myGlobalVisitor.setResult(false); return; } length--; offset++; } } myGlobalVisitor.setResult(((SubstitutionHandler)handler).handle(l2, offset, length, myGlobalVisitor.getMatchContext())); } else if (handler != null) { myGlobalVisitor.setResult(handler.match(literal, l2, myGlobalVisitor.getMatchContext())); } else { myGlobalVisitor.setResult(literal.textMatches(l2)); } }