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

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


     */
    @Test
    public void testFetchSimpleName() {
        {
            DefaultJavadocScanner scanner = string("java.lang.String");
            IrDocSimpleName elem = JavadocBlockParserUtil.fetchSimpleName(scanner, null);
            assertNotNull(elem);
            assertEquals("java", elem.getIdentifier());
            assertEquals(0, elem.getLocation().getStartPosition());
            assertEquals("java".length(), elem.getLocation().getLength());
            assertEquals(DOT, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string(".String");
            IrDocSimpleName elem = JavadocBlockParserUtil.fetchSimpleName(scanner, null);
            assertNull(elem);
            assertEquals(DOT, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string("java.lang.String");
            IrDocSimpleName elem = JavadocBlockParserUtil.fetchSimpleName(scanner, EnumSet.of(WHITE_SPACES));
            assertNull(elem);
            assertEquals(IDENTIFIER, scanner.lookahead(0).getKind());
        }
    }
View Full Code Here


    @Override
    public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException {
        ArrayList<IrDocFragment> fragments = new ArrayList<IrDocFragment>();

        IrDocSimpleName name = fetchSimpleName(scanner);
        if (name != null) {
            fragments.add(name);

            IrDocType type = fetchType(scanner);
            if (type != null) {
View Full Code Here

        if (sharp == null) {
            stream.rewind();
            return null;
        }

        IrDocSimpleName name = fetchSimpleName(stream);
        if (name == null) {
            stream.rewind();
            return null;
        }

        IrDocField elem = new IrDocField();
        elem.setDeclaringType(decl);
        elem.setName(name);
        setLocation(elem, decl == null ? sharp.getLocation() : decl
            .getLocation(), name.getLocation());

        return elem;
    }
View Full Code Here

            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

    }

    private static IrDocSimpleName fetchSimpleName(JavadocTokenStream stream) {
        JavadocToken token = consumeIfMatch(stream, JavadocTokenKind.IDENTIFIER);
        if (token != null) {
            IrDocSimpleName name = new IrDocSimpleName(token.getText());
            setLocation(name, token, token);
            return name;
        } else {
            return null;
        }
View Full Code Here

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

            varargs = true;
        } else {
            varargs = false;
        }

        IrDocSimpleName name = fetchSimpleName(stream);
        if (name != null) {
            delim = name.getLocation();
        }

        IrDocMethodParameter elem = new IrDocMethodParameter();
        elem.setType(type);
        elem.setVariableArity(varargs);
View Full Code Here

            assertEquals("@code", block.getTag());
            assertEquals(1, block.getFragments().size());
            assertEquals(f0, block.getFragments().get(0));
        }
        {
            IrDocSimpleName f0 = new IrDocSimpleName("arg0");
            IrDocText f1 = new IrDocText("Hello!");
            IrDocText f2 = new IrDocText("This is text");
            IrDocBlock block = parser.newBlock("param", Arrays.<IrDocFragment>asList(f0, f1, f2));
            assertEquals("@param", block.getTag());
            assertEquals(3, block.getFragments().size());
View Full Code Here

    @Override
    public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException {
        ArrayList<IrDocFragment> fragments = new ArrayList<IrDocFragment>();

        IrDocSimpleName name = fetchSimpleName(scanner);
        if (name != null) {
            fragments.add(name);
        } else {
            consumeIfTypeParameter(scanner, fragments);
        }
View Full Code Here

        stream.discard();

        IrDocText open = new IrDocText(first.getText());
        open.setLocation(first.getLocation());

        IrDocSimpleName name = new IrDocSimpleName(second.getText());
        name.setLocation(second.getLocation());

        IrDocText close = new IrDocText(third.getText());
        close.setLocation(third.getLocation());

        fragments.add(open);
View Full Code Here

TOP

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

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.