APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.parser

public Class DocCommentParser

extends Object
Class Inheritance
Imports
java.io.Serial, java.util.ArrayList, .HashMap, .Map, java.util.regex.Pattern, com.sun.source.doctree.AttributeTree.ValueKind, .DocTree, .ErroneousTree, .LiteralTree, .StartElementTree, .TextTree, .UnknownBlockTagTree, .UnknownInlineTagTree, com.sun.source.util.SimpleDocTreeVisitor, com.sun.tools.javac.parser.Tokens.Comment, com.sun.tools.javac.tree.DCTree, .DCTree.DCAttribute, .DCTree.DCDocComment, .DCTree.DCEndPosTree, .DCTree.DCErroneous, .DCTree.DCIdentifier, .DCTree.DCReference, .DCTree.DCText, .DocTreeMaker, com.sun.tools.javac.util.DiagnosticSource, .JCDiagnostic, .List, .ListBuffer, .Name, .Names, .Position, .StringUtils

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum
DocCommentParser.LineKind

The kinds of line, used when reading a Markdown documentation comment.

pack-priv class
DocCommentParser.Markdown

A class to encapsulate the work to parse Markdown enough to detect the boundaries of character sequences of literal text, and to skip over such sequences, without analyzing the content.

pack-priv static class
private static enum
DocCommentParser.Phase

An indication of the part of documentation comment or file being read.

private abstract static class
private static enum

Field Summary

Modifier and TypeField and Description
private int
private char[]
buf

The input buffer, index of most recent character read, index of one past last character in buffer.

private int
private char
ch

The current character.

private final Tokens.Comment
private final JCDiagnostic.Factory
private final DiagnosticSource
private final ParserFactory
private boolean
inPre

Used for whitespace normalization in pre/code/literal tags.

private final boolean
private int
private final DocTreeMaker
m

private final DocCommentParser.Markdown
private final Names
private boolean
private final Map<Name, DocCommentParser.TagParser>
private final DocTree.Kind
private int

Constructor Summary

AccessConstructor and Description
public
DocCommentParser(ParserFactory
a parser factory, for a doc-tree maker and for reference parsers
fac
,
DiagnosticSource
the source in which the comment was found
diagSource
,
Tokens.Comment
the comment
comment
)

Creates a parser for a documentation comment.

public
DocCommentParser(ParserFactory
a parser factory, for a doc-tree maker and for reference parsers
fac
,
DiagnosticSource
the source in which the comment was found
diagSource
,
Tokens.Comment
the comment
comment
,
boolean
whether the comment is the entire content of an HTML file
isHtmlFile
)

Creates a parser for a documentation comment.

Method Summary

Modifier and TypeMethod and Description
protected void
addPendingText(ListBuffer<DCTree> list, int textEnd)

protected void
addPendingText(ListBuffer<DCTree> list, int textEnd, DocTree.Kind kind)

protected void
protected List<DCTree>
protected DCTree
blockTag()

Read a single block tag, including its content.

protected List<DCTree>
blockTags()

Read a series of block tags, including their content.

protected List<DCTree>
content(DocCommentParser.Phase phase)

Reads "rich text" content, consisting of text, html and inline tags, according to the given phase.

private Map<Name, DocCommentParser.TagParser>
pack-priv void
protected void
protected DCTree
entity()

Reads an HTML entity.

protected DCTree.DCErroneous

Returns:

the ErroneousTree node
erroneous
(String
the resource key for the error message
code
,
int
the starting position
pos
)

Creates an ErroneousTree node, for a range of text starting at a given position, ending at the last non-whitespace character before the current position, and with the preferred position set to the last character within that range.

protected DCTree.DCErroneous

Returns:

the ErroneousTree node
erroneous
(String
the resource key for the error message
code
,
int
the starting position
pos
,
int
the preferred position for the node, or NOPOS to use the default value as the last character of the range
pref
)

Creates an ErroneousTree node, for a range of text starting at a given position, ending at the last non-whitespace character before the current position, and with a given preferred position.

private static DocTree.Kind
private DCTree
html()

Reads an HTML construct, beginning with <.

protected List<DCTree>
htmlAttrs()

Read a series of HTML attributes, terminated by > .

protected DCTree.DCIdentifier
identifier()

Reads a Java identifier.

pack-priv void
private List<DCTree>
inlineContent()

Reads general text content of an inline tag, including HTML entities and elements.

protected boolean

Returns:

true if an inline tag was read, and false otherwise
inlineTag
(ListBuffer<DCTree>
the list of trees being accumulated
list
)

Reads a possible inline tag, after finding an opening brace { character.

protected DCTree
inlineTag()

Read a single inline tag, including its content.

private DCTree.DCText
inlineText(DocCommentParser.WhitespaceRetentionPolicy whitespacePolicy)

Read plain text content of an inline tag.

protected DCTree.DCText
inlineWord()

Reads a term (that is, one word).

protected boolean
isDecimalDigit(char ch)

pack-priv boolean

Returns:

whether this is the end of the main body of the content
isEndBody
()

Returns whether this is the end of the main body of the content in a standalone HTML file.

pack-priv boolean

Returns:

whether this is the end of the preamble
isEndPreamble
()

Returns whether this is the end of the preamble of an HTML file.

protected boolean
isHexDigit(char ch)

protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
isWhitespace(char ch)

pack-priv String
newString(int
position of first character of string
start
,
int
position of character beyond last character to be included
end
)

pack-priv void
pack-priv ListBuffer<DCTree>
public DCTree.DCDocComment

Returns:

the result of parsing the content given to the constructor
parse
()

Returns the result of parsing the content given to the constructor.

pack-priv boolean
pack-priv char
protected DCTree.DCText
quotedString()

Reads a quoted string.

protected Name
protected Name
protected Name
protected Name
protected Name
protected DCTree.DCReference
reference(ReferenceParser.Mode mode)

Read Java class name, possibly followed by member Matching pairs of < > are skipped.

private String
showPos(int p)

protected void
private IllegalStateException
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait