Class JavadocCommentsLexerUtil

java.lang.Object
com.puppycrawl.tools.checkstyle.grammar.JavadocCommentsLexerUtil

public final class JavadocCommentsLexerUtil extends Object
Utility class for Javadoc comments lexer operations.
  • Constructor Details

  • 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 of Token instances representing open tag names
      closeTagNameTokens - a deque of Token instances representing close tag names
      Returns:
      a set of SimpleToken instances representing unclosed tag names
    • isOpenTagName

      public static boolean isOpenTagName(org.antlr.v4.runtime.Token previousToken)
      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