Package com.puppycrawl.tools.checkstyle
Class JavadocCommentsAstVisitor.TextAccumulator
java.lang.Object
com.puppycrawl.tools.checkstyle.JavadocCommentsAstVisitor.TextAccumulator
- Enclosing class:
- JavadocCommentsAstVisitor
A small utility to accumulate consecutive TEXT tokens into one node,
preserving the starting token for accurate location metadata.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBuilder
Buffer to accumulate TEXT token texts.private org.antlr.v4.runtime.Token
The first token in the accumulation, used for line/column info. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(org.antlr.v4.runtime.Token token) Appends a TEXT token's text to the buffer and tracks the first token.void
flushTo
(JavadocNodeImpl parent) Flushes the accumulated buffer into a singleJavadocNodeImpl
node and adds it to the given parent.
-
Field Details
-
buffer
Buffer to accumulate TEXT token texts. -
startToken
The first token in the accumulation, used for line/column info.
-
-
Constructor Details
-
TextAccumulator
private TextAccumulator()
-
-
Method Details
-
append
Appends a TEXT token's text to the buffer and tracks the first token.- Parameters:
token
- the token to accumulate
-
flushTo
Flushes the accumulated buffer into a singleJavadocNodeImpl
node and adds it to the given parent. Clears the buffer after flushing.- Parameters:
parent
- the parent node to add the new node to
-