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

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


     */
    @Test
    public void testFetchLinkTarget() {
        {
            DefaultJavadocScanner scanner = string("java.lang.String");
            IrDocFragment target = JavadocBlockParserUtil.fetchLinkTarget(scanner, null);
            assertNotNull(target);
            assertEquals(IrDocElementKind.NAMED_TYPE, target.getKind());
            IrDocNamedType elem = (IrDocNamedType) target;
            assertEquals("java.lang.String", elem.getName().asString());
            assertSameLocation(0, "java.lang.String".length(), elem.getLocation());
            assertEquals(EOF, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string("Math#PI{");
            IrDocFragment target = JavadocBlockParserUtil.fetchLinkTarget(scanner, null);
            assertNotNull(target);
            assertEquals(IrDocElementKind.FIELD, target.getKind());
            IrDocField elem = (IrDocField) target;
            assertEquals("Math", elem.getDeclaringType().getName().asString());
            assertEquals("PI", elem.getName().getIdentifier());
            assertSameLocation(0, "Math#PI".length(), elem.getLocation());

            assertEquals(LEFT_BRACE, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string("Math#max(int a, int b)");
            IrDocFragment target = JavadocBlockParserUtil.fetchLinkTarget(scanner, null);
            assertNotNull(target);
            assertEquals(IrDocElementKind.METHOD, target.getKind());
            IrDocMethod elem = (IrDocMethod) target;
            assertEquals("Math", elem.getDeclaringType().getName().asString());
            assertEquals("max", elem.getName().asString());
            assertEquals(2, elem.getParameters().size());
            {
View Full Code Here


    }

    @Override
    public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException {
        ArrayList<IrDocFragment> fragments = new ArrayList<IrDocFragment>();
        IrDocFragment first = fetchLinkTarget(scanner);
        if (first != null) {
            fragments.add(first);
        }
        fragments.addAll(fetchRestFragments(scanner));
        fragments.trimToSize();
View Full Code Here

TOP

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

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.