private static void addScriptConstraint(Project project, String name, MatchVariableConstraint constraint,
                                          SubstitutionHandler handler, Set<String> variableNames, MatchOptions matchOptions,
                                          boolean checkForErrors)
    throws MalformedPatternException {
    final String scriptCodeConstraint = constraint.getScriptCodeConstraint();
    if (scriptCodeConstraint.length() > 2) {
      final String scriptText = StringUtil.unquoteString(scriptCodeConstraint);
      try {
        final Script script = ScriptSupport.buildScript(name, scriptText, matchOptions);
        addPredicate(handler, new ScriptPredicate(project, name, script, variableNames));
      } catch (MalformedPatternException e) {
        if (checkForErrors) {
          throw new MalformedPatternException(
            SSRBundle.message("error.script.constraint.for.0.has.problem.1", constraint.getName(), e.getLocalizedMessage())
          );
        }
      }
    }
  }
private static void addScriptConstraint(Project project, String name, MatchVariableConstraint constraint,
                                          SubstitutionHandler handler, Set<String> variableNames, MatchOptions matchOptions,
                                          boolean checkForErrors)