Class JavadocCommentsLexerUtil
java.lang.Object
com.puppycrawl.tools.checkstyle.grammar.JavadocCommentsLexerUtil
Utility class for Javadoc comments lexer operations.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Private constructor to prevent instantiation of this utility class. -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<SimpleToken>
getUnclosedTagNameTokens
(Deque<org.antlr.v4.runtime.Token> openTagNameTokens, Deque<org.antlr.v4.runtime.Token> closeTagNameTokens) Finds unclosed tag name tokens by comparing open and close tag name tokens.static boolean
isOpenTagName
(org.antlr.v4.runtime.Token previousToken) Checks if the previous token is an open tag name.
-
Constructor Details
-
JavadocCommentsLexerUtil
private JavadocCommentsLexerUtil()Private constructor to prevent instantiation of this utility class.- Throws:
IllegalStateException
- if this constructor is called, indicating that
-
-
Method Details
-
getUnclosedTagNameTokens
public static Set<SimpleToken> getUnclosedTagNameTokens(Deque<org.antlr.v4.runtime.Token> openTagNameTokens, Deque<org.antlr.v4.runtime.Token> closeTagNameTokens) Finds unclosed tag name tokens by comparing open and close tag name tokens.This method attempts to match each closing tag with the most recent unmatched opening tag of the same name, considering only tags that appear before it in the token stream. Any remaining unmatched opening tags are considered unclosed and returned.
Note: This method must be called after lexing is complete to ensure that all tokens have their index values set.
- Parameters:
openTagNameTokens
- a deque ofToken
instances representing open tag namescloseTagNameTokens
- a deque ofToken
instances representing close tag names- Returns:
- a set of
SimpleToken
instances representing unclosed tag names
-
isOpenTagName
Checks if the previous token is an open tag name.- Parameters:
previousToken
- the previous token to check- Returns:
- true if the previous token is null or not a closing tag, false otherwise
-