@Test public void testLookaheadTokens() { DefaultJavadocScanner scanner = scanner("alphabets.txt"); { List<JavadocToken> tokens = JavadocScannerUtil.lookaheadTokens(scanner, 0, 0); assertTextSequence(tokens); } { List<JavadocToken> tokens = JavadocScannerUtil.lookaheadTokens(scanner, 0, 1); assertTextSequence(tokens, "a"); } { List<JavadocToken> tokens = JavadocScannerUtil.lookaheadTokens(scanner, 0, 3); assertTextSequence(tokens, "a", " ", "b"); } { List<JavadocToken> tokens = JavadocScannerUtil.lookaheadTokens(scanner, 4, 3); assertTextSequence(tokens, "c", " ", "d"); } { List<JavadocToken> tokens = JavadocScannerUtil.lookaheadTokens(scanner, 46, 100); assertTextSequence(tokens, "x", " ", "y", " ", "z"); } }
public static List<JavadocToken> lookaheadTokens(JavadocScanner scanner, int start, int count) { if (count < 0) { throw new IllegalArgumentException(); } List<JavadocToken> tokens = new ArrayList<>(count); for (int i = 0; i < count; i++) { JavadocToken token = scanner.lookahead(start + i); if (token.getKind() == JavadocTokenKind.EOF) { break; } tokens.add(token); } return tokens; }
JavadocScannerUtil { public static List<JavadocToken> lookaheadTokens(JavadocScanner scanner, int start, int count) { if (count < 0) { throw new IllegalArgumentException(); } List<JavadocToken> tokens = new ArrayList<>(count); for (int i = 0; i < count; i++) { JavadocToken token = scanner.lookahead(start + i); if (token.getKind() == JavadocTokenKind.EOF) { break; } tokens.add(token); } return tokens; } }
JavadocScannerUtil { public static List<JavadocToken> lookaheadTokens(JavadocScanner scanner, int start, int count) { if (count < 0) { throw new IllegalArgumentException(); } List<JavadocToken> tokens = new ArrayList<>(count); for (int i = 0; i < count; i++) { JavadocToken token = scanner.lookahead(start + i); if (token.getKind() == JavadocTokenKind.EOF) { break; } tokens.add(token); } return tokens; } private  JavadocScannerUtil(); }
JavadocScannerUtil { public static List<JavadocToken> lookaheadTokens(JavadocScanner scanner, int start, int count) { if (count < 0) { throw new IllegalArgumentException(); } List<JavadocToken> tokens = new ArrayList<>(count); for (int i = 0; i < count; i++) { JavadocToken token = scanner.lookahead(start + i); if (token.getKind() == JavadocTokenKind.EOF) { break; } tokens.add(token); } return tokens; } 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 List<JavadocToken> lookaheadTokens(JavadocScanner scanner, int start, int count) { if (count < 0) { throw new IllegalArgumentException(); } List<JavadocToken> tokens = new ArrayList<>(count); for (int i = 0; i < count; i++) { JavadocToken token = scanner.lookahead(start + i); if (token.getKind() == JavadocTokenKind.EOF) { break; } tokens.add(token); } return tokens; } 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);  }