本文整理汇总了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()));
}
}