Examples of JavaComment


Examples of com.pogofish.jadt.ast.JavaComment

    private void testStripTags(String expected, List<String> inputs, Set<String> tags) {
        final JavaDocParser parser = new JavaDocParser();
        final List<JavaComment> outputs = new ArrayList<JavaComment>(inputs.size());
        final CommentProcessor commentProcessor = new CommentProcessor();
        for (String input : inputs) {
            final JavaComment comment = parser.parse(new StringReader(input));
            outputs.add(comment);
        }
        final List<JavaComment> stripped = commentProcessor.stripTags(tags, outputs);
        final String actual = ASTPrinter.printComments("", stripped);
        assertEquals(expected, actual);   
View Full Code Here

Examples of com.pogofish.jadt.ast.JavaComment

   }
   
    @Test
    public void testJavaDocOnly() {
        final CommentProcessor commentProcessor = new CommentProcessor();
        JavaComment javaDocComment = _JavaDocComment("/**", list(ONEWS), NO_TAG_SECTIONS, "*/");
        @SuppressWarnings("unchecked")
        List<JavaComment> comments = list(javaDocComment, _JavaEOLComment("//whatever"), _JavaBlockComment(list(list(_BlockWord("/*"), _BlockWhiteSpace(" "), _BlockWord("*/")))));
        assertEquals(list(javaDocComment), commentProcessor.javaDocOnly(comments));
    }
View Full Code Here

Examples of com.pogofish.jadt.ast.JavaComment

    private void testBlockAlign(String expected, List<String> inputs) {
        final BlockCommentParser parser = new BlockCommentParser();
        final List<JavaComment> outputs = new ArrayList<JavaComment>(inputs.size());
        final CommentProcessor commentProcessor = new CommentProcessor();
        for (String input : inputs) {
            final JavaComment comment = parser.parse(new StringReader(input));
            outputs.add(comment);
        }
        final List<JavaComment> aligned = commentProcessor.leftAlign(outputs);
        final String actual = ASTPrinter.printComments("", aligned);
        assertEquals(expected, actual);
View Full Code Here

Examples of com.pogofish.jadt.ast.JavaComment

    private void testJavaDocAlign(String expected, List<String> inputs) {
        final JavaDocParser parser = new JavaDocParser();
        final List<JavaComment> outputs = new ArrayList<JavaComment>(inputs.size());
        final CommentProcessor commentProcessor = new CommentProcessor();
        for (String input : inputs) {
            final JavaComment comment = parser.parse(new StringReader(input));
            outputs.add(comment);
        }
        final List<JavaComment> aligned = commentProcessor.leftAlign(outputs);
        final String actual = ASTPrinter.printComments("", aligned);
        assertEquals(expected, actual);
View Full Code Here

Examples of com.pogofish.jadt.ast.JavaComment

    private void testParamDoc(String expected, String paramName, List<String> inputs) {
        final JavaDocParser parser = new JavaDocParser();
        final List<JavaComment> outputs = new ArrayList<JavaComment>(inputs.size());
        final CommentProcessor commentProcessor = new CommentProcessor();
        for (String input : inputs) {
            final JavaComment comment = parser.parse(new StringReader(input));
            outputs.add(comment);
        }
        final List<JavaComment> paramDoc = commentProcessor.paramDoc(paramName, outputs);
        final String actual = ASTPrinter.printComments("", paramDoc);
        assertEquals(expected, actual);
View Full Code Here

Examples of net.percederberg.grammatica.code.java.JavaComment

        file.addClass(cls);
        str = CLASS_COMMENT;
        if (gen.getClassComment() != null) {
            str += "\n\n" + gen.getClassComment();
        }
        cls.addComment(new JavaComment(str));

        // Add file comment
        str = file.toString() + "\n\n" + gen.getFileComment();
        file.addComment(new JavaComment(JavaComment.BLOCK, str));

        // Add constructor
        constr = new JavaConstructor("Reader input");
        cls.addConstructor(constr);
        constr.addComment(new JavaComment(CONSTRUCTOR_COMMENT));
        constr.addThrows("ParserCreationException");
        constr.addCode("super(input, " +
                       !gen.getGrammar().getCaseSensitive() +
                       ");");
        constr.addCode("createPatterns();");

        // Add init method
        cls.addMethod(initMethod);
        initMethod.addComment(new JavaComment(INIT_METHOD_COMMENT));
        initMethod.addThrows("ParserCreationException");
        initMethod.addCode("TokenPattern  pattern;");
    }
View Full Code Here

Examples of net.percederberg.grammatica.code.java.JavaComment

        // Add class
        file.addClass(cls);

        // Add file comment
        str = file.toString() + "\n\n" + gen.getFileComment();
        file.addComment(new JavaComment(JavaComment.BLOCK, str));

        // Add imports
        file.addImport(new JavaImport("net.percederberg.grammatica.parser",
                                      "Analyzer"));
        file.addImport(new JavaImport("net.percederberg.grammatica.parser",
                                      "Node"));
        file.addImport(new JavaImport("net.percederberg.grammatica.parser",
                                      "ParseException"));
        file.addImport(new JavaImport("net.percederberg.grammatica.parser",
                                      "Production"));
        file.addImport(new JavaImport("net.percederberg.grammatica.parser",
                                      "Token"));

        // Add class comment
        str = TYPE_COMMENT;
        if (gen.getClassComment() != null) {
            str += "\n\n" + gen.getClassComment();
        }
        cls.addComment(new JavaComment(str));

        // Add enter method
        enter.addComment(new JavaComment(ENTER_COMMENT));
        enter.addThrows("ParseException");
        enter.addCode("switch (node.getId()) {");
        cls.addMethod(enter);

        // Add exit method
        exit.addComment(new JavaComment(EXIT_COMMENT));
        exit.addThrows("ParseException");
        exit.addCode("switch (node.getId()) {");
        cls.addMethod(exit);

        // Add child method
        child.addComment(new JavaComment(CHILD_COMMENT));
        child.addThrows("ParseException");
        child.addCode("switch (node.getId()) {");
        cls.addMethod(child);
    }
View Full Code Here

Examples of net.percederberg.grammatica.code.java.JavaComment

        m = new JavaMethod(JavaMethod.PROTECTED,
                           "enter" + name,
                           type + " node",
                           "void");
        m.addComment(new JavaComment(ENTER_COMMENT));
        m.addThrows("ParseException");
        cls.addMethod(m);
    }
View Full Code Here

Examples of net.percederberg.grammatica.code.java.JavaComment

        m = new JavaMethod(JavaMethod.PROTECTED,
                           "exit" + name,
                           type + " node",
                           "Node");
        m.addComment(new JavaComment(EXIT_COMMENT));
        m.addThrows("ParseException");
        m.addCode("return node;");
        cls.addMethod(m);
    }
View Full Code Here

Examples of net.percederberg.grammatica.code.java.JavaComment

        m = new JavaMethod(JavaMethod.PROTECTED,
                           "child" + name,
                           "Production node, Node child",
                           "void");
        m.addComment(new JavaComment(CHILD_COMMENT));
        m.addThrows("ParseException");
        m.addCode("node.addChild(child);");
        cls.addMethod(m);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.