本文整理匯總了Java中com.intellij.psi.tree.TokenSet.getTypes方法的典型用法代碼示例。如果您正苦於以下問題:Java TokenSet.getTypes方法的具體用法?Java TokenSet.getTypes怎麽用?Java TokenSet.getTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.tree.TokenSet
的用法示例。
在下文中一共展示了TokenSet.getTypes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: safeMap
import com.intellij.psi.tree.TokenSet; //導入方法依賴的package包/類
/**
* Tries to update the map by associating given keys with a given value.
* Throws error if the map already contains different mapping for one of given keys.
*/
protected static void safeMap(@NotNull final Map<IElementType, TextAttributesKey> map,
@NotNull final TokenSet keys,
@NotNull final TextAttributesKey value) {
for (final IElementType type : keys.getTypes()) {
safeMap(map, type, value);
}
}
示例2: consumeBadTokens
import com.intellij.psi.tree.TokenSet; //導入方法依賴的package包/類
private static void consumeBadTokens(PsiBuilder builder, TokenSet nextAccepted) {
if (nextAccepted.getTypes().length == 0 && builder.eof()) {
return;
}
if (!nextAccepted.contains(builder.getTokenType())) {
builder.error("Unexpected token");
do {
if (builder.eof()) {
builder.error("Unexpected end of file");
break;
}
builder.advanceLexer();
} while (!nextAccepted.contains(builder.getTokenType()));
}
}