Search in sources :

Example 1 with ParserRuntimeException

use of org.parboiled.errors.ParserRuntimeException in project markdown-doclet by Abnaxos.

the class MarkdownDoclet method defaultProcess.

/**
 * Default processing of any documentation node.
 *
 * @param doc              The documentation.
 * @param fixLeadingSpaces `true` if leading spaces should be fixed.
 *
 * @see Options#toHtml(String, boolean)
 */
protected void defaultProcess(Doc doc, boolean fixLeadingSpaces) {
    try {
        StringBuilder buf = new StringBuilder();
        buf.append(getOptions().toHtml(doc.commentText(), fixLeadingSpaces));
        buf.append('\n');
        for (Tag tag : doc.tags()) {
            processTag(tag, buf);
            buf.append('\n');
        }
        doc.setRawCommentText(buf.toString());
    } catch (final ParserRuntimeException e) {
        if (doc instanceof RootDoc) {
            printError(new SourcePosition() {

                @Override
                public File file() {
                    return options.getOverviewFile();
                }

                @Override
                public int line() {
                    return 0;
                }

                @Override
                public int column() {
                    return 0;
                }
            }, e.getMessage());
        } else {
            printError(doc.position(), e.getMessage());
        }
    }
}
Also used : ParserRuntimeException(org.parboiled.errors.ParserRuntimeException) SourcePosition(com.sun.javadoc.SourcePosition) Tag(com.sun.javadoc.Tag) RootDoc(com.sun.javadoc.RootDoc)

Aggregations

RootDoc (com.sun.javadoc.RootDoc)1 SourcePosition (com.sun.javadoc.SourcePosition)1 Tag (com.sun.javadoc.Tag)1 ParserRuntimeException (org.parboiled.errors.ParserRuntimeException)1