public void compile(PsiElement @NotNull [] topLevelElements) {
    final CompileContext context = myCompilingVisitor.getContext();
    final CompiledPattern pattern = context.getPattern();
    if (pattern.getStrategy() == null) {
      final MatchOptions options = context.getOptions();
      pattern.setStrategy(new XmlMatchingStrategy(options.getDialect()));
    }
    for (PsiElement element : topLevelElements) {
      element.accept(this);
      optimize(element);
      pattern.setHandler(element, new TopLevelMatchingHandler(pattern.getHandler(element)));
    }
  }
public void compile(PsiElement @NotNull [] topLevelElements)