@Test public void testFetchPrimitiveType() { { DefaultJavadocScanner scanner = string("int"); IrDocBasicType elem = JavadocBlockParserUtil.fetchPrimitiveType(scanner, null); assertNotNull(elem); assertEquals(IrBasicTypeKind.INT, elem.getTypeKind()); assertSameLocation(0, "int".length(), elem.getLocation()); assertEquals(EOF, scanner.lookahead(0).getKind()); } { DefaultJavadocScanner scanner = string("void"); IrDocBasicType elem = JavadocBlockParserUtil.fetchPrimitiveType(scanner, null); assertNull(elem); assertEquals(IDENTIFIER, scanner.lookahead(0).getKind()); } }
public static IrDocBasicType fetchPrimitiveType(JavadocScanner scanner, Set<JavadocTokenKind> follow) { JavadocTokenStream stream = new DefaultJavadocTokenStream(scanner); stream.mark(); IrDocBasicType elem = fetchBasicType(stream); if (elem.getTypeKind() == IrBasicTypeKind.VOID) { stream.rewind(); return null; } if (!follows(stream, follow)) { stream.rewind(); return null; } else { stream.discard(); return elem; } }
JavadocBlockParserUtil { public static IrDocBasicType fetchPrimitiveType(JavadocScanner scanner, Set<JavadocTokenKind> follow) { JavadocTokenStream stream = new DefaultJavadocTokenStream(scanner); stream.mark(); IrDocBasicType elem = fetchBasicType(stream); if (elem.getTypeKind() == IrBasicTypeKind.VOID) { stream.rewind(); return null; } if (!follows(stream, follow)) { stream.rewind(); return null; } else { stream.discard(); return elem; } } }
JavadocBlockParserUtil { public static IrDocBasicType fetchPrimitiveType(JavadocScanner scanner, Set<JavadocTokenKind> follow) { JavadocTokenStream stream = new DefaultJavadocTokenStream(scanner); stream.mark(); IrDocBasicType elem = fetchBasicType(stream); if (elem.getTypeKind() == IrBasicTypeKind.VOID) { stream.rewind(); return null; } if (!follows(stream, follow)) { stream.rewind(); return null; } else { stream.discard(); return elem; } } private  JavadocBlockParserUtil(); }
JavadocBlockParserUtil { public static IrDocBasicType fetchPrimitiveType(JavadocScanner scanner, Set<JavadocTokenKind> follow) { JavadocTokenStream stream = new DefaultJavadocTokenStream(scanner); stream.mark(); IrDocBasicType elem = fetchBasicType(stream); if (elem.getTypeKind() == IrBasicTypeKind.VOID) { stream.rewind(); return null; } if (!follows(stream, follow)) { stream.rewind(); return null; } else { stream.discard(); return elem; } } private  JavadocBlockParserUtil(); static T setLocation(T elem, JavadocToken start, JavadocToken stop); static T setLocation(T elem, IrLocation start, IrLocation stop); static IrDocText fetchText(JavadocScanner scanner, boolean trimHead, boolean trimTail); static JavadocBlockInfo fetchBlockInfo(JavadocScanner scanner); static int countWhileTagName(JavadocScanner scanner, int start); static IrDocSimpleName fetchSimpleName(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocName fetchName(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocBasicType fetchBasicType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocBasicType fetchPrimitiveType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocNamedType fetchNamedType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocType fetchType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocField fetchField(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocMethod fetchMethod(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocFragment fetchLinkTarget(JavadocScanner scanner, Set<JavadocTokenKind> follow); static String buildString(List<? extends JavadocToken> tokens); }
JavadocBlockParserUtil { public static IrDocBasicType fetchPrimitiveType(JavadocScanner scanner, Set<JavadocTokenKind> follow) { JavadocTokenStream stream = new DefaultJavadocTokenStream(scanner); stream.mark(); IrDocBasicType elem = fetchBasicType(stream); if (elem.getTypeKind() == IrBasicTypeKind.VOID) { stream.rewind(); return null; } if (!follows(stream, follow)) { stream.rewind(); return null; } else { stream.discard(); return elem; } } private  JavadocBlockParserUtil(); static T setLocation(T elem, JavadocToken start, JavadocToken stop); static T setLocation(T elem, IrLocation start, IrLocation stop); static IrDocText fetchText(JavadocScanner scanner, boolean trimHead, boolean trimTail); static JavadocBlockInfo fetchBlockInfo(JavadocScanner scanner); static int countWhileTagName(JavadocScanner scanner, int start); static IrDocSimpleName fetchSimpleName(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocName fetchName(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocBasicType fetchBasicType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocBasicType fetchPrimitiveType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocNamedType fetchNamedType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocType fetchType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocField fetchField(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocMethod fetchMethod(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocFragment fetchLinkTarget(JavadocScanner scanner, Set<JavadocTokenKind> follow); static String buildString(List<? extends JavadocToken> tokens); static final Set<JavadocTokenKind> S_WHITE; }