本文整理匯總了Java中com.intellij.psi.tree.TokenSet.andNot方法的典型用法代碼示例。如果您正苦於以下問題:Java TokenSet.andNot方法的具體用法?Java TokenSet.andNot怎麽用?Java TokenSet.andNot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.tree.TokenSet
的用法示例。
在下文中一共展示了TokenSet.andNot方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: annotate
import com.intellij.psi.tree.TokenSet; //導入方法依賴的package包/類
@Override
public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder annotationHolder) {
if (psiElement instanceof TagElement) {
TagElement tagElement = (TagElement) psiElement;
TokenSet allowedRBraces = SoyTokenTypes.RIGHT_BRACES;
if (mustCloseRBraceTags.contains(tagElement.getClass())) {
allowedRBraces = TokenSet.andNot(allowedRBraces, SoyTokenTypes.SLASH_R_BRACES);
} else if (mustCloseSlashRBraceTags.contains(tagElement.getClass())) {
allowedRBraces = TokenSet.andSet(allowedRBraces, SoyTokenTypes.SLASH_R_BRACES);
}
if (tagElement.isDoubleBraced()) {
allowedRBraces = TokenSet.andSet(allowedRBraces, SoyTokenTypes.DOUBLE_BRACES);
} else {
allowedRBraces = TokenSet.andNot(allowedRBraces, SoyTokenTypes.DOUBLE_BRACES);
}
if (!allowedRBraces.contains(tagElement.getClosingBraceType())) {
annotationHolder.createErrorAnnotation(tagElement, "Must close by " +
Stream.of(allowedRBraces.getTypes())
.map(SoyTokenTypes.BRACE_TYPE_TO_STRING::get)
.sorted()
.collect(Collectors.joining(" or ")));
}
}
}