void (@Nullable String text, @NotNull JDComment comment) { if (text == null) return; List<Boolean> markers = new ArrayList<>(); List<String> l = toArray(text, markers); //if it is - we are dealing with multiline comment: // /** // * comment // */ //which shouldn't be wrapped into one line comment like /** comment */ if (text.indexOf('\n') >= 0) { comment.setMultiLine(true); } if (l == null) return; int size = l.size(); if (size == 0) return; // preprocess strings - removes first '*' for (int i = 0; i < size; i++) { String line = l.get(i); line = line.trim(); if (!line.isEmpty()) { if (line.charAt(0) == '*') { if ((markers.get(i)).booleanValue()) { if (line.length() > 1 && line.charAt(1) == ' ') { line = line.substring(2); } else { line = line.substring(1); } } else { line = line.substring(1).trim(); } } } l.set(i, line); } StringBuilder sb = new StringBuilder(); String tag = null; boolean isInsidePreTag = false; for (int i = 0; i <= size; i++) { String line = i == size ? null : l.get(i); if (i == size || !line.isEmpty()) { if (i == size || line.charAt(0) == '@' && !isInsidePreTag) { if (tag == null) { comment.setDescription(sb.toString()); } else { int j = 0; String myline = sb.toString(); for (; j < tagParsers.length; j++) { TagParser parser = tagParsers[j]; if (parser.parse(tag, myline, comment)) break; } if (j == tagParsers.length) { comment.addUnknownTag("@" + tag + " " + myline); } } if (i < size) { int last_idx = line.indexOf(' '); if (last_idx == -1) { tag = line.substring(1); line = ""; } else { tag = line.substring(1, last_idx); line = line.substring(last_idx).trim(); } sb.setLength(0); sb.append(line); } } else { if (sb.length() > 0) { sb.append('\n'); } sb.append(line); } } else { if (sb.length() > 0) { sb.append('\n'); } } if (line != null) { isInsidePreTag = isInsidePreTag ? !lineHasClosingPreTag(line) : lineHasUnclosedPreTag(line); } } }