@Test public void testCountUntilNextPrintableBeyondBlankLines() { DefaultJavadocScanner scanner = scanner("blank-lines.txt"); int offset = 0; assertEquals("a", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals("b", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals("c", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals("d", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals(EOF, scanner.lookahead(offset).getKind()); }
public static int countUntilNextPrintable(JavadocScanner scanner, int start) { int offset = 0; while (true) { offset += countWhile(S_WHITE_SPACES, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); JavadocTokenKind kind = token.getKind(); if (kind == JavadocTokenKind.EOF) { return offset; } else if (kind != JavadocTokenKind.LINE_BREAK) { return offset; } offset += countUntilNextLineStart(scanner, start + offset); } }
JavadocScannerUtil { public static int countUntilNextPrintable(JavadocScanner scanner, int start) { int offset = 0; while (true) { offset += countWhile(S_WHITE_SPACES, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); JavadocTokenKind kind = token.getKind(); if (kind == JavadocTokenKind.EOF) { return offset; } else if (kind != JavadocTokenKind.LINE_BREAK) { return offset; } offset += countUntilNextLineStart(scanner, start + offset); } } }
JavadocScannerUtil { public static int countUntilNextPrintable(JavadocScanner scanner, int start) { int offset = 0; while (true) { offset += countWhile(S_WHITE_SPACES, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); JavadocTokenKind kind = token.getKind(); if (kind == JavadocTokenKind.EOF) { return offset; } else if (kind != JavadocTokenKind.LINE_BREAK) { return offset; } offset += countUntilNextLineStart(scanner, start + offset); } } private  JavadocScannerUtil(); }
JavadocScannerUtil { public static int countUntilNextPrintable(JavadocScanner scanner, int start) { int offset = 0; while (true) { offset += countWhile(S_WHITE_SPACES, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); JavadocTokenKind kind = token.getKind(); if (kind == JavadocTokenKind.EOF) { return offset; } else if (kind != JavadocTokenKind.LINE_BREAK) { return offset; } offset += countUntilNextLineStart(scanner, start + offset); } } private  JavadocScannerUtil(); static List<JavadocToken> lookaheadTokens(JavadocScanner scanner, int start, int count); static int countWhile(Collection<JavadocTokenKind> kinds, JavadocScanner scanner, int start); static int countUntil(Collection<JavadocTokenKind> kinds, JavadocScanner scanner, int start); static int countUntilBlockEnd(JavadocScanner scanner, int start); static int countUntilCommentEnd(JavadocScanner scanner, boolean returnMinusIfMissing, int start); static int countUntilNextPrintable(JavadocScanner scanner, int start); static int countUntilNextLineStart(JavadocScanner scanner, int start); static int consumeLineEnd(JavadocScanner scanner, boolean multiline); }
JavadocScannerUtil { public static int countUntilNextPrintable(JavadocScanner scanner, int start) { int offset = 0; while (true) { offset += countWhile(S_WHITE_SPACES, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); JavadocTokenKind kind = token.getKind(); if (kind == JavadocTokenKind.EOF) { return offset; } else if (kind != JavadocTokenKind.LINE_BREAK) { return offset; } offset += countUntilNextLineStart(scanner, start + offset); } } private  JavadocScannerUtil(); static List<JavadocToken> lookaheadTokens(JavadocScanner scanner, int start, int count); static int countWhile(Collection<JavadocTokenKind> kinds, JavadocScanner scanner, int start); static int countUntil(Collection<JavadocTokenKind> kinds, JavadocScanner scanner, int start); static int countUntilBlockEnd(JavadocScanner scanner, int start); static int countUntilCommentEnd(JavadocScanner scanner, boolean returnMinusIfMissing, int start); static int countUntilNextPrintable(JavadocScanner scanner, int start); static int countUntilNextLineStart(JavadocScanner scanner, int start); static int consumeLineEnd(JavadocScanner scanner, boolean multiline);  }