本文整理汇总了Java中com.intellij.psi.tree.TokenSet.create方法的典型用法代码示例。如果您正苦于以下问题:Java TokenSet.create方法的具体用法?Java TokenSet.create怎么用?Java TokenSet.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.tree.TokenSet
的用法示例。
在下文中一共展示了TokenSet.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doApply
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
@Override
public void doApply(@NotNull Editor editor, @NotNull PySmartEnterProcessor processor, @NotNull PyConditionalStatementPart statementPart)
throws IncorrectOperationException {
final PyExpression condition = statementPart.getCondition();
final Document document = editor.getDocument();
final PsiElement colon = PyPsiUtils.getFirstChildOfType(statementPart, PyTokenTypes.COLON);
if (colon == null) {
if (condition != null) {
final PsiElement firstNonComment = PyPsiUtils.getNextNonCommentSibling(condition.getNextSibling(), false);
if (firstNonComment != null && !":".equals(firstNonComment.getNode().getText())) {
document.insertString(firstNonComment.getTextRange().getEndOffset(), ":");
}
}
else {
final TokenSet keywords = TokenSet.create(PyTokenTypes.IF_KEYWORD, PyTokenTypes.ELIF_KEYWORD, PyTokenTypes.WHILE_KEYWORD);
final PsiElement keywordToken = PyPsiUtils.getChildByFilter(statementPart,
keywords, 0);
final int offset = sure(keywordToken).getTextRange().getEndOffset();
document.insertString(offset, " :");
processor.registerUnresolvedError(offset + 1);
}
}
else if (condition == null) {
processor.registerUnresolvedError(colon.getTextRange().getStartOffset());
}
}
示例2: TemplateLanguageErrorFilter
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
protected TemplateLanguageErrorFilter(
@NotNull final TokenSet templateExpressionStartTokens,
@NotNull final Class templateFileViewProviderClass,
@NotNull final String... knownSubLanguageNames)
{
myTemplateExpressionStartTokens = TokenSet.create(templateExpressionStartTokens.getTypes());
myTemplateFileViewProviderClass = templateFileViewProviderClass;
List<String> knownSubLanguageList = new ArrayList<String>(Arrays.asList(knownSubLanguageNames));
knownSubLanguageList.add("JavaScript");
knownSubLanguageList.add("CSS");
knownLanguageSet = new HashSet<Language>();
for (String name : knownSubLanguageList) {
final Language language = Language.findLanguageByID(name);
if (language != null) {
knownLanguageSet.add(language);
}
}
}
示例3: getWordsScanner
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
@Nullable
@Override
public WordsScanner getWordsScanner() {
return new DefaultWordsScanner(
new TSLexerAdapter(),
TokenSet.create(TSTypes.ID),
TokenSet.create(TSTypes.COMMENT),
TokenSet.EMPTY
);
}
示例4: getWordsScanner
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
@Nullable
@Override
public WordsScanner getWordsScanner() {
return new DefaultWordsScanner(new AppleScriptLexerAdapter(),
TokenSet.create(AppleScriptTypes.IDENTIFIER),
TokenSet.create(AppleScriptTypes.COMMENT),
TokenSet.create(AppleScriptTypes.STRING_LITERAL));
}
示例5: getWordsScanner
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
@Nullable
@Override
public WordsScanner getWordsScanner() {
return new DefaultWordsScanner(
new SoyLexer(),
TokenSet.create(SoyTypes.IDENTIFIER_WORD),
TokenSet.create(SoyTypes.COMMENT_BLOCK),
TokenSet.EMPTY);
}
示例6: getWordsScanner
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
@Nullable
@Override
public WordsScanner getWordsScanner() {
return new DefaultWordsScanner(new YAMLFlexLexer(),
TokenSet.create(YAMLTokenTypes.SCALAR_KEY),
TokenSet.create(YAMLTokenTypes.COMMENT),
TokenSet.create(YAMLTokenTypes.SCALAR_TEXT, YAMLTokenTypes.SCALAR_DSTRING, YAMLTokenTypes.SCALAR_STRING));
}
示例7: getWordsScanner
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
@Nullable
@Override
public WordsScanner getWordsScanner() {
return new DefaultWordsScanner(new CrystalLexerAdapter(),
TokenSet.create(CrystalTypes.KEY),
TokenSet.create(CrystalTypes.COMMENT),
TokenSet.EMPTY);
}
示例8: getKeywordTokens
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
@NotNull
@Override
public TokenSet getKeywordTokens() {
return TokenSet.create(
AND_KEYWORD, AS_KEYWORD, ASSERT_KEYWORD, BREAK_KEYWORD, CLASS_KEYWORD,
CONTINUE_KEYWORD, DEF_KEYWORD, DEL_KEYWORD, ELIF_KEYWORD, ELSE_KEYWORD,
EXCEPT_KEYWORD, EXEC_KEYWORD, FINALLY_KEYWORD, FOR_KEYWORD,
FROM_KEYWORD,
GLOBAL_KEYWORD, IF_KEYWORD, IMPORT_KEYWORD, IN_KEYWORD, IS_KEYWORD,
LAMBDA_KEYWORD, NOT_KEYWORD, OR_KEYWORD, PASS_KEYWORD, PRINT_KEYWORD,
RAISE_KEYWORD, RETURN_KEYWORD, TRY_KEYWORD, WITH_KEYWORD, WHILE_KEYWORD,
YIELD_KEYWORD,
NONE_KEYWORD, TRUE_KEYWORD, FALSE_KEYWORD, NONLOCAL_KEYWORD, DEBUG_KEYWORD, ASYNC_KEYWORD, AWAIT_KEYWORD);
}
示例9: PsiAwareLineWrapPositionStrategy
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
/**
* Creates new <code>PsiAwareLineWrapPositionStrategy</code> object.
*
* @param nonVirtualOnly defines if current PSI-aware logic should be exploited only for 'real wrap' position requests
* @param enabledTypes target element/token types where line wrapping is allowed
*/
public PsiAwareLineWrapPositionStrategy(boolean nonVirtualOnly, @NotNull IElementType ... enabledTypes) {
myEnabledTypes = TokenSet.create(enabledTypes);
myNonVirtualOnly = nonVirtualOnly;
if (enabledTypes.length <= 0) {
LOG.warn(String.format("%s instance is created with empty token/element types. That will lead to inability to perform line wrap",
getClass().getName()));
}
}
示例10: getFunctionDeclarationTokens
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
@NotNull
@Override
public TokenSet getFunctionDeclarationTokens() {
return TokenSet.create(FUNCTION_DECLARATION);
}
示例11: PyWordsScanner
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
public PyWordsScanner() {
super(new PythonLexer(),
TokenSet.create(PyTokenTypes.IDENTIFIER),
TokenSet.create(PyTokenTypes.END_OF_LINE_COMMENT),
PyTokenTypes.STRING_NODES);
}
示例12: TemplateHighlighter
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
public TemplateHighlighter() {
myLexer = new MergingLexerAdapter(new FlexAdapter(new FileTemplateTextLexer()), TokenSet.create(FileTemplateTokenType.TEXT));
}
示例13: withinPairInside
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
public RuleBuilder withinPairInside(IElementType pairFirst, IElementType pairSecond, IElementType parent) {
TokenSet parentSet = TokenSet.create(parent);
RuleCondition before = new RuleCondition(parentSet, TokenSet.create(pairFirst), null);
RuleCondition after = new RuleCondition(parentSet, null, TokenSet.create(pairSecond));
return new RuleBuilder(before, after);
}
示例14: BinaryExpression
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
public BinaryExpression(IElementType compositeType, IElementType... opTokens) {
myCompositeType = compositeType;
myOpTokens = TokenSet.create(opTokens);
}
示例15: betweenInside
import com.intellij.psi.tree.TokenSet; //导入方法依赖的package包/类
public RuleBuilder betweenInside(IElementType leftType, IElementType rightType, IElementType parentType) {
return new RuleBuilder(new RuleCondition(TokenSet.create(parentType), TokenSet.create(leftType), TokenSet.create(rightType)));
}