public class JavadocDetailNodeParser
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
JavadocDetailNodeParser.DescriptiveErrorListener
Custom error listener for JavadocParser that prints user readable errors.
|
static class |
JavadocDetailNodeParser.ParseErrorMessage
Contains information about parse error message.
|
static class |
JavadocDetailNodeParser.ParseStatus
Contains result of parsing javadoc comment: DetailNode tree and parse
error message.
|
Modifier and Type | Field and Description |
---|---|
private int |
blockCommentLineNumber
Line number of the Block comment AST that is being parsed.
|
private JavadocDetailNodeParser.DescriptiveErrorListener |
errorListener
Custom error listener.
|
private static java.lang.String |
JAVADOC_START
Symbols with which javadoc starts.
|
static java.lang.String |
MSG_JAVADOC_MISSED_HTML_CLOSE
Message key of error message.
|
static java.lang.String |
MSG_JAVADOC_PARSE_RULE_ERROR
Parse error while rule recognition.
|
static java.lang.String |
MSG_JAVADOC_WRONG_SINGLETON_TAG
Message key of error message.
|
static java.lang.String |
MSG_KEY_PARSE_ERROR
Error message key for common javadoc errors.
|
static java.lang.String |
MSG_KEY_UNRECOGNIZED_ANTLR_ERROR
Unrecognized error from antlr parser.
|
Constructor and Description |
---|
JavadocDetailNodeParser() |
Modifier and Type | Method and Description |
---|---|
private void |
adjustFirstLineToJavadocIndent(DetailNode tree,
int javadocColumnNumber)
Adjust first line nodes to javadoc indent.
|
private DetailNode |
convertParseTreeToDetailNode(org.antlr.v4.runtime.tree.ParseTree parseTreeNode)
Converts ParseTree (that is generated by ANTLRv4) to DetailNode tree.
|
private JavadocNodeImpl[] |
createChildrenNodes(JavadocNodeImpl parentJavadocNode,
org.antlr.v4.runtime.tree.ParseTree parseTreeNode)
Creates children Javadoc nodes base on ParseTree node's children.
|
private JavadocNodeImpl |
createJavadocNode(org.antlr.v4.runtime.tree.ParseTree parseTree,
DetailNode parent,
int index)
Creates JavadocNodeImpl node on base of ParseTree node.
|
private JavadocNodeImpl |
createRootJavadocNode(org.antlr.v4.runtime.tree.ParseTree parseTreeNode)
Creates root JavadocNodeImpl node base on ParseTree root node.
|
private static int |
getColumn(org.antlr.v4.runtime.tree.ParseTree tree)
Gets column number from ParseTree node.
|
private static java.lang.String |
getFormattedNodeClassNameWithoutContext(org.antlr.v4.runtime.tree.ParseTree node)
Gets class name of ParseTree node and removes 'Context' postfix at the
end and formats it.
|
private static int |
getLine(org.antlr.v4.runtime.tree.ParseTree tree)
Gets line number from ParseTree node.
|
private static org.antlr.v4.runtime.tree.ParseTree |
getNextSibling(org.antlr.v4.runtime.tree.ParseTree node)
Gets next sibling of ParseTree node.
|
private static java.lang.String |
getNodeClassNameWithoutContext(org.antlr.v4.runtime.tree.ParseTree node)
Gets class name of ParseTree node and removes 'Context' postfix at the
end.
|
private static int |
getTokenType(org.antlr.v4.runtime.tree.ParseTree node)
Gets token type of ParseTree node from JavadocTokenTypes class.
|
private void |
insertChildrenNodes(JavadocNodeImpl[] nodes,
org.antlr.v4.runtime.tree.ParseTree parseTreeParent)
Creates child nodes for each node from 'nodes' array.
|
JavadocDetailNodeParser.ParseStatus |
parseJavadocAsDetailNode(DetailAST javadocCommentAst)
Parses Javadoc comment as DetailNode tree.
|
private org.antlr.v4.runtime.tree.ParseTree |
parseJavadocAsParseTree(java.lang.String blockComment)
Parses block comment content as javadoc comment.
|
public static final java.lang.String MSG_JAVADOC_MISSED_HTML_CLOSE
"no viable alternative at input 'b \n *\n'"
and it is not
clear that error is about missed close HTML tag.public static final java.lang.String MSG_JAVADOC_WRONG_SINGLETON_TAG
public static final java.lang.String MSG_JAVADOC_PARSE_RULE_ERROR
public static final java.lang.String MSG_KEY_PARSE_ERROR
public static final java.lang.String MSG_KEY_UNRECOGNIZED_ANTLR_ERROR
private static final java.lang.String JAVADOC_START
private int blockCommentLineNumber
private JavadocDetailNodeParser.DescriptiveErrorListener errorListener
public JavadocDetailNodeParser.ParseStatus parseJavadocAsDetailNode(DetailAST javadocCommentAst)
javadocCommentAst
- DetailAST of Javadoc commentprivate org.antlr.v4.runtime.tree.ParseTree parseJavadocAsParseTree(java.lang.String blockComment)
blockComment
- block comment content.private DetailNode convertParseTreeToDetailNode(org.antlr.v4.runtime.tree.ParseTree parseTreeNode)
parseTreeNode
- root node of ParseTreeprivate void insertChildrenNodes(JavadocNodeImpl[] nodes, org.antlr.v4.runtime.tree.ParseTree parseTreeParent)
parseTreeParent
- original ParseTree parent nodenodes
- array of JavadocNodeImpl nodesprivate JavadocNodeImpl[] createChildrenNodes(JavadocNodeImpl parentJavadocNode, org.antlr.v4.runtime.tree.ParseTree parseTreeNode)
parentJavadocNode
- node that will be parent for created childrenparseTreeNode
- original ParseTree nodeprivate JavadocNodeImpl createRootJavadocNode(org.antlr.v4.runtime.tree.ParseTree parseTreeNode)
parseTreeNode
- ParseTree root nodeprivate JavadocNodeImpl createJavadocNode(org.antlr.v4.runtime.tree.ParseTree parseTree, DetailNode parent, int index)
parseTree
- ParseTree nodeparent
- DetailNode that will be parent of new nodeindex
- child index that has new nodeprivate void adjustFirstLineToJavadocIndent(DetailNode tree, int javadocColumnNumber)
tree
- DetailNode tree rootjavadocColumnNumber
- javadoc indentprivate static int getLine(org.antlr.v4.runtime.tree.ParseTree tree)
tree
- ParseTree nodeprivate static int getColumn(org.antlr.v4.runtime.tree.ParseTree tree)
tree
- ParseTree nodeprivate static org.antlr.v4.runtime.tree.ParseTree getNextSibling(org.antlr.v4.runtime.tree.ParseTree node)
node
- ParseTree nodeprivate static int getTokenType(org.antlr.v4.runtime.tree.ParseTree node)
node
- ParseTree node.private static java.lang.String getFormattedNodeClassNameWithoutContext(org.antlr.v4.runtime.tree.ParseTree node)
node
- ParseTree
node whose class name is to be formatted and returnedprivate static java.lang.String getNodeClassNameWithoutContext(org.antlr.v4.runtime.tree.ParseTree node)
node
- ParseTree node.