@Test public void testCountUntilNextLineStart() { DefaultJavadocScanner scanner = scanner("3lines-formatted.txt"); int offset = 0; assertEquals("a", scanner.lookahead(offset).getText()); offset++; assertEquals(LINE_BREAK, scanner.lookahead(offset).getKind()); offset += JavadocScannerUtil.countUntilNextLineStart(scanner, offset); assertEquals(WHITE_SPACES, scanner.lookahead(offset).getKind()); assertEquals("b", scanner.lookahead(offset + 1).getText()); offset += 2; assertEquals(LINE_BREAK, scanner.lookahead(offset).getKind()); offset += JavadocScannerUtil.countUntilNextLineStart(scanner, offset); assertEquals(WHITE_SPACES, scanner.lookahead(offset).getKind()); assertEquals("c", scanner.lookahead(offset + 1).getText()); offset += 2; assertEquals(EOF, scanner.lookahead(offset).getKind()); }
public static int countUntilNextLineStart(JavadocScanner scanner, int start) { int offset = 0; offset += countUntil(S_LINE_BREAK, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); if (token.getKind() == JavadocTokenKind.EOF) { return offset; } else { offset++; } offset += countWhile(S_WHITE_SPACES, scanner, start + offset); offset += countWhile(S_ASTERISK, scanner, start + offset); return offset; }
JavadocScannerUtil { public static int countUntilNextLineStart(JavadocScanner scanner, int start) { int offset = 0; offset += countUntil(S_LINE_BREAK, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); if (token.getKind() == JavadocTokenKind.EOF) { return offset; } else { offset++; } offset += countWhile(S_WHITE_SPACES, scanner, start + offset); offset += countWhile(S_ASTERISK, scanner, start + offset); return offset; } }
JavadocScannerUtil { public static int countUntilNextLineStart(JavadocScanner scanner, int start) { int offset = 0; offset += countUntil(S_LINE_BREAK, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); if (token.getKind() == JavadocTokenKind.EOF) { return offset; } else { offset++; } offset += countWhile(S_WHITE_SPACES, scanner, start + offset); offset += countWhile(S_ASTERISK, scanner, start + offset); return offset; } private  JavadocScannerUtil(); }
JavadocScannerUtil { public static int countUntilNextLineStart(JavadocScanner scanner, int start) { int offset = 0; offset += countUntil(S_LINE_BREAK, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); if (token.getKind() == JavadocTokenKind.EOF) { return offset; } else { offset++; } offset += countWhile(S_WHITE_SPACES, scanner, start + offset); offset += countWhile(S_ASTERISK, scanner, start + offset); return 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 countUntilNextLineStart(JavadocScanner scanner, int start) { int offset = 0; offset += countUntil(S_LINE_BREAK, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); if (token.getKind() == JavadocTokenKind.EOF) { return offset; } else { offset++; } offset += countWhile(S_WHITE_SPACES, scanner, start + offset); offset += countWhile(S_ASTERISK, scanner, start + offset); return 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);  }