DocTree node into a similar one with
doc-comment "extensions" translated into equivalent standard DocTree nodes.
The primary extension is to allow references to program elements to be
translated to {@link ...} or {@linkplain ...} tags.
| Modifier and Type | Class and Description |
|---|---|
| private static class | MarkdownTransformer.
An |
| private static class | |
| private static class | MarkdownTransformer.
A visitor to scan a Markdown document looking for any constructs that should be mapped to doc comment nodes. |
| Modifier and Type | Field and Description |
|---|---|
| private static final DocTreeVisitor | isMarkdownVisitor
A fast scanner for detecting Markdown nodes in documentation comment nodes. |
| private static final char |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | |
| public String | name()
Implements com. Returns the name of this transformer. |
| public DocCommentTree | transform(DocTrees trees, DocCommentTree tree)
Implements com. Transforms a documentation comment tree. |
| isMarkdownVisitor | back to summary |
|---|---|
| private static final DocTreeVisitor<Boolean, Void> isMarkdownVisitor A fast scanner for detecting Markdown nodes in documentation comment nodes. The scanner returns as soon as any Markdown node is found. | |
| PLACEHOLDER | back to summary |
|---|---|
| private static final char PLACEHOLDER | |
| MarkdownTransformer | back to summary |
|---|---|
| public MarkdownTransformer() Public no-args constructor, suitable for use with | |
| isMarkdown | back to summary |
|---|---|
| private boolean isMarkdown(DocCommentTree node) | |
| name | back to summary |
|---|---|
| public String name() Implements com. Doc from com. Returns the name of this transformer. | |
| transform | back to summary |
|---|---|
| public DocCommentTree transform(DocTrees trees, DocCommentTree tree) Implements com. Doc from com. Transforms a documentation comment tree.
| |
InlineParserFactory that checks any unresolved link references in
reference links. If an unresolved link reference appears to be a reference to a
program element, such as may be used in @see ... or {@link ...}
tags, it generates a synthetic LinkReferenceDefinition.
The reference is not validated to ensure it refers to any existing element.
The primary function of this InlineParserFactory is to provide
a custom implementation of an InlineParserContext via the
create(InlineParserContext inlineParserContext) method.
It is this InlineParserContext that actually manages the set
of link reference definitions.
This InlineParserFactory is intended to be registered with a
Parser.Builder using setInlineParserFactory.
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final ReferenceParser |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public InlineParser | Returns: theInlineParserthe standard inlineParserContext)InlineParserContextImplements jdk. Creates a parser with a modified |
| private boolean | Returns: whether a string appears to be a reference to a program elementthe string s)Returns whether a string appears to be a reference to a program element. |
| autorefScheme | back to summary |
|---|---|
| private final String autorefScheme | |
| refParser | back to summary |
|---|---|
| private final ReferenceParser refParser | |
| AutoRefInlineParserFactory | back to summary |
|---|---|
| pack-priv AutoRefInlineParserFactory(ReferenceParser refParser, String autorefScheme) | |
| create | back to summary |
|---|---|
| public InlineParser create(InlineParserContext inlineParserContext) Implements jdk. Creates a parser with a modified
| |
| isReference | back to summary |
|---|---|
| private boolean isReference(String s) Returns whether a string appears to be a reference to a program element.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final DocTreeMaker | |
| private final ReferenceParser |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private static < the type of the items T extends DocTree> boolean | Returns: true if the items are reference-equal, and false otherwisethe first item item1, T the second item item2)Shallow "equals" for two doc tree nodes. |
| private static < the type of the items T extends DocTree> boolean | |
| public DCTree | |
| private List | |
| private DCTree. | |
| private DCTree. | |
| public DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| pack-priv DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. | |
| private DCTree. |
| autorefScheme | back to summary |
|---|---|
| private final String autorefScheme | |
| m | back to summary |
|---|---|
| private final DocTreeMaker m | |
| refParser | back to summary |
|---|---|
| private final ReferenceParser refParser | |
| DCTransformer | back to summary |
|---|---|
| pack-priv DCTransformer(JavacTrees t) | |
| equal | back to summary |
|---|---|
| private static <T extends DocTree> boolean equal(T item1, T item2) Shallow "equals" for two doc tree nodes.
| |
| equal | back to summary |
|---|---|
| private static <T extends DocTree> boolean equal(List<? extends T> list1, List<? extends T> list2) Shallow "equals" for two lists of doc tree nodes. | |
| transform | back to summary |
|---|---|
| public DCTree transform(DCTree tree) Transforms a doc tree node. This node dispatches to a more specific overload, based on the kind of the node. The result may be the same as the argument if no transformations were made. | |
| transform | back to summary |
|---|---|
| private List Transforms a list of doc tree nodes. If any of the nodes contain Markdown, the Markdown source is parsed and analyzed for any transformations. Any non-Markdown nodes are individually transformed. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| public DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| pack-priv DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
| transform | back to summary |
|---|---|
| private DCTree. | |
Lower v = new Lower(document, source, replacements);
document.accept(v);
var result = v.getTrees();
Note
SourceSpan objects never include newline characters.
See Lower#toSourcePos(int, int) to convert from (line, column)
coordinates to a source position.
See Lower#sourcePosToTreePos(int) to convert from a source
position to a position in the original comment, for use in tree nodes.
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private int | copyStartPos
The start of source text to be copied literally when required. |
| private final Node | document
The Markdown document being processed. |
| private static final Pattern | lineBreak
The pattern for a line break. |
| private final DocTreeMaker | |
| private int | mainStartPos
The initial position in the enclosing comment of the source being transformed. |
| private static final int[] | |
| private int | replaceAdjustPos
The current adjustment from positions in |
| private final Iterator | replaceIter
An iterator containing the values to be substituted into the generated tree when U+FFFC characters are encountered in the document. |
| private final String | source
The source for the Markdown document being processed. |
| private final int[] | sourceLineOffsets
An array giving the position of the first character after each newline in the source. |
| private final StringBuilder | text
The source text being accumulated, prior to being placed in a
Markdown source node ( |
| private List | trees
The list of trees being built. |
| Access | Constructor and Description |
|---|---|
| public | Lower(DocTreeMaker docTreeMaker, Node
the document to be converted document, String the source of the document to be converted source, int the position in the enclosing comment of the source to be converted sourcePos, List<?> the objects to be substituted when U+FFFC is encountered replacements, String the scheme used for auto-generated references autorefScheme)Creates an instance of the visitor, given a document, the source text for the document and objects to be substituted when U+FFFC characters are encountered. |
| Modifier and Type | Method and Description |
|---|---|
| private void | copyTo(int
the end position endPos)Copies source text from the saved copy-start position to the given end position
using the saved |
| private void | flushText(int pos)
Flushes any text in the |
| private int | |
| private int[] | Returns: the position in the source for the reference in a linkthe reference to find ref, Link the link containing the reference link)Returns the position in the source for the reference in a link. |
| private int | Returns: the start of this node, from the start of the first spanthe node node)Returns the start of this node, from the start of the first span. |
| public List | Returns: the trees that were built after using the visitorReturns the trees that were built after using the visitor. |
| private int | sourcePosToTreePos(int
the position in pos)sourceReturns the position in the original comment for a position in |
| private int | Returns: the position in thesource string for a given (line, columnthe line index lineIndex, int the column index columnIndex)Returns the position in the |
| public void | visit(Link
the link node link)Overrides jdk. Implements jdk. Visits a CommonMark |
| protected void | visitChildren(Node
the node whose children should be visited node)Overrides jdk. Processes a node and any children. |
| autorefScheme | back to summary |
|---|---|
| private final String autorefScheme | |
| copyStartPos | back to summary |
|---|---|
| private int copyStartPos The start of source text to be copied literally when required. | |
| document | back to summary |
|---|---|
| private final Node document The Markdown document being processed. | |
| lineBreak | back to summary |
|---|---|
| private static final Pattern lineBreak The pattern for a line break.
This is equivalent to the detection in the Markdown parser, so that
| |
| m | back to summary |
|---|---|
| private final DocTreeMaker m | |
| mainStartPos | back to summary |
|---|---|
| private int mainStartPos The initial position in the enclosing comment of the source being transformed. | |
| NOSPAN | back to summary |
|---|---|
| private static final int[] NOSPAN | |
| replaceAdjustPos | back to summary |
|---|---|
| private int replaceAdjustPos The current adjustment from positions in | |
| replaceIter | back to summary |
|---|---|
| private final Iterator<?> replaceIter An iterator containing the values to be substituted into the generated
tree when U+FFFC characters are encountered in the document.
There is a 1-1 correspondence between the values returned by the
iterator and the U+FFFC characters in the document.
The replacement objects may be either | |
| source | back to summary |
|---|---|
| private final String source The source for the Markdown document being processed.
The document has "source spans" that indirectly point into this string
using
| |
| sourceLineOffsets | back to summary |
|---|---|
| private final int[] sourceLineOffsets An array giving the position of the first character after each newline
in the source.
Used to convert | |
| text | back to summary |
|---|---|
| private final StringBuilder text The source text being accumulated, prior to being placed in a
Markdown source node ( | |
| trees | back to summary |
|---|---|
| private List<DCTree> trees The list of trees being built.
It may be temporarily replaced while visiting the children of
| |
| Lower | back to summary |
|---|---|
| public Lower(DocTreeMaker docTreeMaker, Node document, String source, int sourcePos, List<?> replacements, String autorefScheme) Creates an instance of the visitor, given a document,
the source text for the document and objects to be substituted
when U+FFFC characters are encountered.
Note the document does not itself contain any source text:
it just contains
| |
| copyTo | back to summary |
|---|---|
| private void copyTo(int endPos) Copies source text from the saved copy-start position to the given end position
using the saved
| |
| flushText | back to summary |
|---|---|
| private void flushText(int pos) Flushes any text in the | |
| getEndPos | back to summary |
|---|---|
| private int getEndPos(Node node) Returns the end of this node, from the end of the last span. The end points to the first character not included in the span.
| |
| getRefSpan | back to summary |
|---|---|
| private int[] getRefSpan(String ref, Link link) Returns the position in the source for the reference in a link.
Many syntactic forms may yield a | |
| getStartPos | back to summary |
|---|---|
| private int getStartPos(Node node) Returns the start of this node, from the start of the first span.
| |
| getTrees | back to summary |
|---|---|
| public List Returns the trees that were built after using the visitor. | |
| sourcePosToTreePos | back to summary |
|---|---|
| private int sourcePosToTreePos(int pos) Returns the position in the original comment for a position in
| |
| toSourcePos | back to summary |
|---|---|
| private int toSourcePos(int lineIndex, int columnIndex) Returns the position in the
| |
| visit | back to summary |
|---|---|
| public void visit(Link link) Overrides jdk. Implements jdk. Visits a CommonMark | |
| visitChildren | back to summary |
|---|---|
| protected void visitChildren(Node node) Overrides jdk. Processes a node and any children.
If the node has children, the children are each visited by
calling their | |