Class JavadocWriter
java.lang.Object
com.google.googlejavaformat.java.javadoc.JavadocWriter
Stateful object that accepts "requests" and "writes," producing formatted Javadoc.
Our Javadoc formatter doesn't ever generate a parse tree, only a stream of tokens, so the writer must compute and store the answer to questions like "How many levels of nested HTML list are we inside?"
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum(package private) static enumThe kind of whitespace that has been requested between the previous and next tokens. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final intprivate booleanprivate final NestingCounterprivate final NestingCounterprivate booleanWhether we are inside an<li>element, excluding the case in which the<li>contains a<ul>or<ol>that we are also inside -- unless of course we're inside an<li>element in that inner list :)private intprivate final StringBuilderprivate final NestingCounterprivate intprivate Tokenprivate static final com.google.common.collect.ImmutableSet<Token.Type> Tokens that are always pinned to the following token.private boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidappendSpaces(int count) private intprivate void(package private) voidrequestMoeBeginStripComment(Token token) private void(package private) voidRequests whitespace between the previously written token and the next written token.private voidrequestWhitespace(JavadocWriter.RequestedWhitespace requestedWhitespace) toString()(package private) voidprivate void(package private) voidwriteBlockquoteOpenOrClose(Token token) (package private) void(package private) voidwriteCodeClose(Token token) (package private) voidwriteCodeOpen(Token token) (package private) void(package private) voidwriteFooterJavadocTagStart(Token token) (package private) voidwriteHeaderClose(Token token) (package private) voidwriteHeaderOpen(Token token) (package private) voidwriteHtmlComment(Token token) (package private) void(package private) voidwriteListClose(Token token) (package private) voidwriteListItemOpen(Token token) (package private) voidwriteListOpen(Token token) (package private) voidwriteLiteral(Token token) (package private) voidwriteMoeEndStripComment(Token token) private voidprivate voidwriteNewline(JavadocWriter.AutoIndent autoIndent) (package private) voidwriteParagraphOpen(Token token) (package private) voidwritePreClose(Token token) (package private) voidwritePreOpen(Token token) (package private) voidwriteTableClose(Token token) (package private) voidwriteTableOpen(Token token) private voidwriteToken(Token token)
-
Field Details
-
blockIndent
private final int blockIndent -
output
-
continuingListItemOfInnermostList
private boolean continuingListItemOfInnermostListWhether we are inside an<li>element, excluding the case in which the<li>contains a<ul>or<ol>that we are also inside -- unless of course we're inside an<li>element in that inner list :) -
continuingListItemCount
-
continuingListCount
-
postWriteModifiedContinuingListCount
-
remainingOnLine
private int remainingOnLine -
atStartOfLine
private boolean atStartOfLine -
requestedWhitespace
-
requestedMoeBeginStripComment
-
indentForMoeEndStripComment
private int indentForMoeEndStripComment -
wroteAnythingSignificant
private boolean wroteAnythingSignificant -
START_OF_LINE_TOKENS
Tokens that are always pinned to the following token. For example,<p>in<p>Foo bar(never<p> Foo baror<p>\nFoo bar).This is not the only kind of "pinning" that we do: See also the joining of LITERAL tokens done by the lexer. The special pinning here is necessary because these tokens are not of type LITERAL (because they require other special handling).
-
-
Constructor Details
-
JavadocWriter
JavadocWriter(int blockIndent)
-
-
Method Details
-
requestWhitespace
void requestWhitespace()Requests whitespace between the previously written token and the next written token. The request may be honored, or it may be overridden by a request for "more significant" whitespace, like a newline. -
requestMoeBeginStripComment
-
writeBeginJavadoc
void writeBeginJavadoc() -
writeEndJavadoc
void writeEndJavadoc() -
writeListOpen
-
writeListClose
-
writeListItemOpen
-
writeHeaderOpen
-
writeHeaderClose
-
writeParagraphOpen
-
writeBlockquoteOpenOrClose
-
writePreOpen
-
writePreClose
-
writeCodeOpen
-
writeCodeClose
-
writeTableOpen
-
writeTableClose
-
writeMoeEndStripComment
-
writeHtmlComment
-
writeBr
-
writeLineBreakNoAutoIndent
void writeLineBreakNoAutoIndent() -
writeLiteral
-
toString
-
requestBlankLine
private void requestBlankLine() -
requestNewline
private void requestNewline() -
requestWhitespace
-
writeToken
-
writeBlankLine
private void writeBlankLine() -
writeNewline
private void writeNewline() -
writeNewline
-
innerIndent
private int innerIndent() -
appendSpaces
private void appendSpaces(int count)
-