Search in sources :

Example 1 with JavaDocLexer

use of com.intellij.lang.java.lexer.JavaDocLexer in project intellij-community by JetBrains.

the class RecordUtil method isDeprecatedByDocComment.

public static boolean isDeprecatedByDocComment(@NotNull LighterAST tree, @NotNull LighterASTNode comment) {
    String text = LightTreeUtil.toFilteredString(tree, comment, null);
    if (text.contains(DEPRECATED_TAG)) {
        JavaDocLexer lexer = new JavaDocLexer(LanguageLevel.HIGHEST);
        lexer.start(text);
        IElementType token;
        while ((token = lexer.getTokenType()) != null) {
            if (token == JavaDocTokenType.DOC_TAG_NAME && DEPRECATED_TAG.equals(lexer.getTokenText())) {
                return true;
            }
            lexer.advance();
        }
    }
    return false;
}
Also used : IElementType(com.intellij.psi.tree.IElementType) JavaDocLexer(com.intellij.lang.java.lexer.JavaDocLexer)

Aggregations

JavaDocLexer (com.intellij.lang.java.lexer.JavaDocLexer)1 IElementType (com.intellij.psi.tree.IElementType)1