private static void reportNonAsciiRange(@NotNull PsiElement element,
                                          @NotNull String text,
                                          @NotNull ProblemsHolder holder,
                                          @Nullable("null means natural range") TextRange elementRange) {
    int errorCount = 0;
    int start = -1;
    int startOffset = elementRange == null ? 0 : elementRange.getStartOffset();
    int endOffset = elementRange == null ? text.length() : elementRange.getEndOffset();
    for (int i = startOffset; i <= endOffset; i++) {
      char c = i >= endOffset ? 0 : text.charAt(i);
      if (i == endOffset || c < 128) {
        if (start != -1) {
          TextRange range = new TextRange(start, i);
          holder.registerProblem(element, range, CodeInsightBundle.message("non.ascii.chars.inspection.message.non.ascii.characters"));
          start = -1;
          //do not report too many errors
          if (errorCount++ > 200) break;
        }
      }
      else if (start == -1) {
        start = i;
      }
    }
  }
private static void reportNonAsciiRange(@NotNull PsiElement element,
                                          @NotNull String text,
                                          @NotNull ProblemsHolder holder,
                                          @Nullable("null means natural range") TextRange elementRange)