本文整理汇总了Java中com.intellij.psi.TokenType类的典型用法代码示例。如果您正苦于以下问题:Java TokenType类的具体用法?Java TokenType怎么用?Java TokenType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TokenType类属于com.intellij.psi包,在下文中一共展示了TokenType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIdentifiers
import com.intellij.psi.TokenType; //导入依赖的package包/类
@Override
public List<PsiElement> getIdentifiers() {
final List<PsiElement> result = new ArrayList<>();
PsiElement psiChild = getFirstChild();
if (psiChild == null) {
result.add(this);
return result;
}
while (psiChild != null) {
if (psiChild.getNode().getElementType() != TokenType.WHITE_SPACE) {
result.add(psiChild);
}
psiChild = psiChild.getNextSibling();
}
return result;
}
示例2: buildChildren
import com.intellij.psi.TokenType; //导入依赖的package包/类
@Override
protected List<Block> buildChildren() {
List<Block> blocks = new ArrayList<Block>();
Alignment innerBodyAlignment = Alignment.createAlignment();
ASTNode child = getNode().getFirstChildNode();
while (child != null) {
if (child.getElementType() != TokenType.WHITE_SPACE) {
if (child.getElementType() == GCMTypes.PROP) {
blocks.add(new GCMBlock(child, innerBodyAlignment, getWrap()));
} else {
blocks.add(new GCMBlock(child, getAlignment(), getWrap()));
}
}
child = child.getTreeNext();
}
return blocks;
}
示例3: getMergeFunction
import com.intellij.psi.TokenType; //导入依赖的package包/类
@Override
public MergeFunction getMergeFunction() {
return ((final IElementType type, final Lexer originalLexer) -> {
if (type == SoyTypes.OTHER || type == TokenType.WHITE_SPACE) {
IElementType returnType = type;
while (originalLexer.getTokenType() == SoyTypes.OTHER
|| originalLexer.getTokenType() == TokenType.WHITE_SPACE) {
if (originalLexer.getTokenType() == SoyTypes.OTHER) {
returnType = SoyTypes.OTHER;
}
originalLexer.advance();
}
return returnType;
}
return type;
});
}
示例4: getTokenHighlights
import com.intellij.psi.TokenType; //导入依赖的package包/类
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
if (tokenType.equals(CptTypes.SEPARATOR) || tokenType.equals(CptTypes.MAP)) {
return SEPARATOR_KEYS;
} else if (tokenType.equals(CptTypes.TEMPLATE_NAME)) {
return TEMPLATE_NAME_KEYS;
} else if (tokenType.equals(CptTypes.CLASS_NAME)) {
return CLASS_NAME_KEYS;
} else if (tokenType.equals(CptTypes.TEMPLATE_DESCRIPTION)) {
return TEMPLATE_DESCRIPTION_KEYS;
} else if (tokenType.equals(CptTypes.TEMPLATE_CODE)) {
return TEMPLATE_CODE_KEYS;
} else if (TEMPLATE_VARIABLE_PARTS.contains(tokenType)) {
return TEMPLATE_VARIABLE_KEYS;
} else if (tokenType.equals(CptTypes.TEMPLATE_ESCAPE)) {
return TEMPLATE_ESCAPE_KEYS;
} else if (tokenType.equals(CptTypes.COMMENT)) {
return COMMENT_KEYS;
} else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
return BAD_CHAR_KEYS;
} else {
return EMPTY_KEYS;
}
}
示例5: buildChildren
import com.intellij.psi.TokenType; //导入依赖的package包/类
@Override
protected List<Block> buildChildren() {
List<Block> blocks = new ArrayList<>();
ASTNode child = myNode.getFirstChildNode();
while (child != null) {
if (child.getElementType() != TokenType.WHITE_SPACE) {
Block block = new FlexibleSearchBlock(
child,
Wrap.createWrap(WrapType.NONE, false),
null,
spacingBuilder
);
blocks.add(block);
}
child = child.getTreeNext();
}
return blocks;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:FlexibleSearchBlock.java
示例6: getTokenHighlights
import com.intellij.psi.TokenType; //导入依赖的package包/类
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
if (tokenType.equals(CrystalTypes.SEPARATOR)) {
return SEPARATOR_KEYS;
} else if (tokenType.equals(CrystalTypes.KEY)) {
return KEY_KEYS;
} else if (tokenType.equals(CrystalTypes.VALUE)) {
return VALUE_KEYS;
} else if (tokenType.equals(CrystalTypes.COMMENT)) {
return COMMENT_KEYS;
} else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
return BAD_CHAR_KEYS;
} else {
return EMPTY_KEYS;
}
}
示例7: getTokenHighlights
import com.intellij.psi.TokenType; //导入依赖的package包/类
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
if (tokenType.equals(CapnpTypes.SEPARATOR)) {
return SEPARATOR_KEYS;
} else if (tokenType.equals(CapnpTypes.IDENTIFIER)){
return IDENTIFIER_KEYS;
} else if (tokenType.equals(CapnpTypes.KEYWORD)) {
return KEY_KEYS;
} else if (tokenType.equals(CapnpTypes.TYPE)) {
return TYPE_KEYS;
} else if (tokenType.equals(CapnpTypes.COMMENT)) {
return COMMENT_KEYS;
} else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
return BAD_CHAR_KEYS;
} else {
return EMPTY_KEYS;
}
}
示例8: getTokenHighlights
import com.intellij.psi.TokenType; //导入依赖的package包/类
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
if (tokenType.equals(CsvTypes.COMMA)) {
return COMMA_KEYS;
} else if (tokenType.equals(CsvTypes.QUOTE)) {
return QUOTE_KEYS;
} else if (tokenType.equals(CsvTypes.TEXT)) {
return TEXT_KEYS;
} else if (tokenType.equals(CsvTypes.ESCAPED_TEXT)) {
return ESCAPED_TEXT_KEYS;
} else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
return BAD_CHAR_KEYS;
} else {
return EMPTY_KEYS;
}
}
示例9: getParentFieldElement
import com.intellij.psi.TokenType; //导入依赖的package包/类
public static PsiElement getParentFieldElement(PsiElement element) {
if (getElementType(element) == TokenType.WHITE_SPACE) {
if (getElementType(element.getParent()) == CsvTypes.FIELD) {
element = element.getParent();
} else if (getElementType(element.getPrevSibling()) == CsvTypes.FIELD) {
element = element.getPrevSibling();
} else {
element = null;
}
} else {
while (element != null && CsvIntentionHelper.getElementType(element) != CsvTypes.FIELD) {
element = element.getParent();
}
}
return element;
}
示例10: getTokenHighlights
import com.intellij.psi.TokenType; //导入依赖的package包/类
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
if (tokenType.equals(CupTypes.LINE_COMMENT)) {
return pack(LINE_COMMENT);
} else if (tokenType.equals(CupTypes.BLOCK_COMMENT)) {
return pack(BLOCK_COMMENT);
} else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
return pack(ILLEGAL);
} else if (KEYWORDS.contains(tokenType)) {
return pack(KEYWORD);
} else if (tokenType.equals(CupTypes.COMMA)) {
return pack(COMMA);
} else if (tokenType.equals(CupTypes.SEMI)) {
return pack(SEMI);
} else if (tokenType.equals(CupTypes.CCEQ) || tokenType.equals(CupTypes.BAR) || tokenType.equals(CupTypes.COLON)) {
return pack(PUNCTUATION);
}
return EMPTY;
}
示例11: findFurthestSiblingOfSameType
import com.intellij.psi.TokenType; //导入依赖的package包/类
private static PsiElement findFurthestSiblingOfSameType(@NotNull PsiElement anchor, boolean after) {
ASTNode node = anchor.getNode();
final IElementType expectedType = node.getElementType();
ASTNode lastSeen = node;
while (node != null) {
final IElementType elementType = node.getElementType();
if (elementType == expectedType) {
lastSeen = node;
} else if (elementType == TokenType.WHITE_SPACE) {
if (expectedType == token(LINE_COMMENT)
&& node.getText().indexOf('\n', 1) != -1) {
break;
}
} else if (!COMMENT_TOKEN_SET.contains(elementType) || COMMENT_TOKEN_SET.contains(expectedType)) {
break;
}
node = after ? node.getTreeNext() : node.getTreePrev();
}
return lastSeen.getPsi();
}
示例12: buildChildren
import com.intellij.psi.TokenType; //导入依赖的package包/类
@Override
protected List<Block> buildChildren() {
List<Block> blocks = new ArrayList<>();
ASTNode child = myNode.getFirstChildNode();
while (child != null) {
if (child.getElementType() != TokenType.WHITE_SPACE) {
Block block = new DotBlock(child, Wrap.createWrap(WrapType.NONE, false), null,
spacingBuilder);
if (block.getTextRange().getLength() > 0) {
blocks.add(block);
}
}
child = child.getTreeNext();
}
return blocks;
}
示例13: getTokenHighlights
import com.intellij.psi.TokenType; //导入依赖的package包/类
/**
* Returns the list of text attribute keys used for highlighting the specified token type. The attributes of all attribute keys
* returned for the token type are successively merged to obtain the color and attributes of the token.
*
* @param tokenType The token type for which the highlighting is requested.
* @return The array of text attribute keys.
*/
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
if (tokenType.equals(TokenType.BAD_CHARACTER) || tokenType.equals(RESERVED))
return BAD_CHARACTER_KEYS;
else if (tokenType.equals(BLOCK_START) || tokenType.equals(BLOCK_END) || tokenType.equals(BLOCK_NAME))
return BLOCK_KEYS;
else if (SyntaxTokens.KEYWORDS.contains(tokenType))
return KEYWORD_KEYS;
else if (SyntaxTokens.TYPES.contains(tokenType))
return TYPE_KEYS;
else if (SyntaxTokens.NUMBERS.contains(tokenType))
return NUMBER_KEYS;
else if (SyntaxTokens.STORAGE_QUALIFERS.contains(tokenType))
return STORAGE_QUALIFIER_KEYS;
else if (tokenType.equals(BOOL))
return BOOLEAN_KEYS;
else if (SyntaxTokens.VERSIONS.contains(tokenType))
return VERSION_KEYS;
else if (SyntaxTokens.PREPROCESSORS.contains(tokenType))
return PREPROCESSOR_KEYS;
else if (tokenType.equals(NullShaderTypes.COMMENT))
return COMMENT_KEYS;
return EMPY_KEYS;
}
示例14: buildChildren
import com.intellij.psi.TokenType; //导入依赖的package包/类
@SuppressWarnings("ConstantConditions")
@Override
protected List<Block> buildChildren() {
List<Block> blocks = new ArrayList<Block>();
if (myNode.getElementType() == STRUCT) {
goDeep(blocks, myNode, myAlignment, Alignment.createAlignment(), false, pairContainers);
} else if (myNode.getElementType() == ARRAY) {
goDeep(blocks, myNode, myAlignment, Alignment.createAlignment(), false, arrayContainers);
} else if (myNode.getElementType() == EXPRESSION) {
goDeep(blocks, myNode, myAlignment, Alignment.createAlignment(), false, expressionContainers);
} else {
ASTNode child = myNode.getFirstChildNode();
while (child != null) {
if (child.getElementType() != TokenType.WHITE_SPACE) {
Block block = new IonBlock(child, Wrap.createWrap(WrapType.NORMAL, false), myAlignment, spacingBuilder, settings);
blocks.add(block);
}
child = child.getTreeNext();
}
}
return blocks;
}
示例15: deleteChildInternal
import com.intellij.psi.TokenType; //导入依赖的package包/类
@Override
public void deleteChildInternal(@NotNull ASTNode child) {
if (child.getElementType() == CODE_BLOCK) {
final ASTNode prevWS = TreeUtil.prevLeaf(child);
if (prevWS != null && prevWS.getElementType() == TokenType.WHITE_SPACE) {
removeChild(prevWS);
}
super.deleteChildInternal(child);
final CharTable treeCharTab = SharedImplUtil.findCharTableByTree(this);
LeafElement semicolon = Factory.createSingleLeafElement(SEMICOLON, ";", 0, 1, treeCharTab, getManager());
addInternal(semicolon, semicolon, null, Boolean.TRUE);
}
else {
super.deleteChildInternal(child);
}
}