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

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


    public void testParse() throws Exception {
        JavadocParserBuilder builder = new JavadocParserBuilder();
        JavadocParser parser = builder.build();
        {
            DefaultJavadocScanner scanner = string("/***/");
            IrDocComment doc = parser.parse(scanner);
            List<? extends IrDocBlock> blocks = doc.getBlocks();
            assertEquals(0, blocks.size());
        }
        {
            DefaultJavadocScanner scanner = string("/** a */");
            IrDocComment doc = parser.parse(scanner);
            List<? extends IrDocBlock> blocks = doc.getBlocks();
            assertEquals(1, blocks.size());
        }
        {
            DefaultJavadocScanner scanner = string(
                "/**\n"
                + " * a\n"
                + " * @tag\n"
                + " */");
            IrDocComment doc = parser.parse(scanner);
            List<? extends IrDocBlock> blocks = doc.getBlocks();
            assertEquals(2, blocks.size());
            assertNull(blocks.get(0).getTag());
            assertEquals("@tag", blocks.get(1).getTag());
        }
        {
            DefaultJavadocScanner scanner = string(
                "/**\n"
                + " * a\n"
                + " * @tag1\n"
                + " * @tag2\n"
                + " */");
            IrDocComment doc = parser.parse(scanner);
            List<? extends IrDocBlock> blocks = doc.getBlocks();
            assertEquals(3, blocks.size());
            assertNull(blocks.get(0).getTag());
            assertEquals("@tag1", blocks.get(1).getTag());
            assertEquals("@tag2", blocks.get(2).getTag());
        }
View Full Code Here


        JavadocParser parser = builder.build();
        {
            DefaultJavadocScanner scanner = string(
                "/** */");
            IrDocComment doc = parser.parse(scanner);
            List<? extends IrDocBlock> blocks = doc.getBlocks();
            assertEquals(0, blocks.size());
        }
        {
            DefaultJavadocScanner scanner = string(
                "/**\n"
                + " * Hello, this is {@code world}!\n"
                + " * testtest\n"
                + " * @param a {@link String}\n"
                + " * @throws hoge.foo.Bar If occurred\n"
                + " */");
            IrDocComment doc = parser.parse(scanner);
            List<? extends IrDocBlock> blocks = doc.getBlocks();
            assertEquals(3, blocks.size());
            {
                IrDocBlock b = blocks.get(0);
                assertNull(b.getTag());
                List<? extends IrDocFragment> fragments = b.getFragments();
View Full Code Here

    public Javadoc convert(String content, int offset) throws JavadocParseException {
        if (content == null) {
            throw new IllegalArgumentException("content must not be null"); //$NON-NLS-1$
        }
        JavadocScanner scanner = DefaultJavadocScanner.newInstance(content);
        IrDocComment ir = parser.parse(scanner);
        return convert(ir, offset);
    }
View Full Code Here

            List<IrDocBlock> blocks = new ArrayList<IrDocBlock>(info.getBlocks().size());
            for (JavadocBlockInfo b: info.getBlocks()) {
                IrDocBlock block = parseBlock(b);
                blocks.add(block);
            }
            IrDocComment elem = new IrDocComment();
            elem.setBlocks(blocks);
            elem.setLocation(info.getLocation());
            return elem;
        } catch (JavadocParseException e) {
            scanner.seek(index);
            throw e;
        }
View Full Code Here

TOP

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

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.