Package com.asakusafw.utils.java.internal.parser.javadoc.ir

Examples of com.asakusafw.utils.java.internal.parser.javadoc.ir.IrDocName


     */
    @Test
    public void testFetchName() {
        {
            DefaultJavadocScanner scanner = string("java.lang.String#length()");
            IrDocName elem = JavadocBlockParserUtil.fetchName(scanner, null);
            assertNotNull(elem);
            assertEquals("java.lang.String", elem.asString());
            assertSameLocation(0, "java.lang.String".length(), elem.getLocation());

            assertEquals(IrDocElementKind.QUALIFIED_NAME, elem.getKind());
            assertEquals(3, elem.asSimpleNameList().size());
            assertSameLocation("".length(), "java".length(), elem.asSimpleNameList().get(0).getLocation());
            assertSameLocation("java.".length(), "lang".length(), elem.asSimpleNameList().get(1).getLocation());
            assertSameLocation("java.lang.".length(), "String".length(), elem.asSimpleNameList().get(2).getLocation());
            assertEquals(SHARP, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string(".java.lang.String");
            IrDocName elem = JavadocBlockParserUtil.fetchName(scanner, null);
            assertNull(elem);
            assertEquals(DOT, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string("java.lang.String#length()");
            IrDocName elem = JavadocBlockParserUtil.fetchName(scanner, EnumSet.of(WHITE_SPACES));
            assertNull(elem);
            assertEquals(IDENTIFIER, scanner.lookahead(0).getKind());
        }
    }
View Full Code Here


    public static IrDocName fetchName(JavadocScanner scanner,
            Set<JavadocTokenKind> follow) {
        DefaultJavadocTokenStream stream = new DefaultJavadocTokenStream(
            scanner);
        stream.mark();
        IrDocName elem = fetchName(stream);
        if (elem == null) {
            return null;
        }
        if (!follows(stream, follow)) {
            stream.rewind();
View Full Code Here

        return elem;
    }

    private static IrDocNamedType fetchNamedType(JavadocTokenStream stream) {
        IrDocName name = fetchName(stream);
        if (name == null) {
            return null;
        }
        IrDocNamedType elem = new IrDocNamedType(name);
        setLocation(elem, name.getLocation(), name.getLocation());
        return elem;
    }
View Full Code Here

    private static IrDocType fetchType(JavadocTokenStream stream) {
        stream.mark();
        IrDocType elem = fetchBasicType(stream);
        if (elem == null) {
            IrDocName name = fetchName(stream);
            if (name == null) {
                stream.rewind();
                return null;
            }
            elem = new IrDocNamedType(name);
            elem.setLocation(name.getLocation());
        }
        while (true) {
            stream.mark();
            if (consumeIfMatch(stream, JavadocTokenKind.LEFT_BRACKET) == null) {
                stream.rewind();
View Full Code Here

        stream.discard();
        return elem;
    }

    private static IrDocName fetchName(JavadocTokenStream stream) {
        IrDocName name = fetchSimpleName(stream);
        if (name == null) {
            return null;
        }
        while (true) {
            stream.mark();
            if (consumeIfMatch(stream, JavadocTokenKind.DOT) == null) {
                stream.rewind();
                break;
            }
            IrDocSimpleName simple = fetchSimpleName(stream);
            if (simple == null) {
                stream.rewind();
                break;
            } else {
                IrDocQualifiedName qualified = new IrDocQualifiedName(name,
                    simple);
                setLocation(qualified, name.getLocation(), simple.getLocation());
                name = qualified;
                stream.discard();
            }
        }
        return name;
View Full Code Here

TOP

Related Classes of com.asakusafw.utils.java.internal.parser.javadoc.ir.IrDocName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.