Java Code Examples for com.intellij.psi.tree.TokenSet#create()

The following examples show how to use com.intellij.psi.tree.TokenSet#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OclFindUsagesProvider.java    From reasonml-idea-plugin with MIT License 5 votes vote down vote up
@Nullable
@Override
public WordsScanner getWordsScanner() {
    OclTypes types = OclTypes.INSTANCE;
    return new DefaultWordsScanner(
            new OclLexer(),
            TokenSet.create(types.C_UPPER_SYMBOL, types.C_LOWER_SYMBOL, types.C_VARIANT),
            TokenSet.EMPTY,
            TokenSet.EMPTY);
}
 
Example 2
Source File: NASMFindUsagesProvider.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
@Nullable
@Override
public WordsScanner getWordsScanner() {
    return new DefaultWordsScanner(new NASMLexer(),
            TokenSet.create(NASMTypes.LBL),
            TokenSet.create(NASMTypes.COMMENT),
            TokenSet.EMPTY);
}
 
Example 3
Source File: PrattParsingUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static boolean searchFor(final PrattBuilder builder, final boolean consume, final PrattTokenType... types) {
  final TokenSet set = TokenSet.create(types);
  if (!set.contains(builder.getTokenType())) {
    builder.assertToken(types[0]);
    while (!set.contains(builder.getTokenType()) && !builder.isEof()) {
      builder.advance();
    }
  }
  if (consume) {
    builder.advance();
  }
  return !builder.isEof();
}
 
Example 4
Source File: ANTLRv4IndexPatternBuilder.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Nullable
@Override
public TokenSet getCommentTokenSet(@NotNull PsiFile file) {
	if ( file instanceof ANTLRv4FileRoot ) {
		return TokenSet.create(getTokenElementType(ANTLRv4Lexer.LINE_COMMENT));
	}
	return null;
}
 
Example 5
Source File: FileTemplateConfigurable.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@VisibleForTesting
static Lexer createDefaultLexer() {
  return new MergingLexerAdapter(new FileTemplateTextLexer(), TokenSet.create(FileTemplateTokenType.TEXT));
}
 
Example 6
Source File: CabalParserDefinition.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public TokenSet getCommentTokens() {
  return TokenSet.create(CabalTypes.COMMENT);
}
 
Example 7
Source File: HamletParserDefinition.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public TokenSet getStringLiteralElements() {
    return TokenSet.create();
}
 
Example 8
Source File: SpacingBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
public RuleBuilder aroundInside(IElementType token, TokenSet parent) {
  final TokenSet tokenSet = TokenSet.create(token);
  RuleCondition before = new RuleCondition(parent, null, tokenSet);
  RuleCondition after = new RuleCondition(parent, tokenSet, null);
  return new RuleBuilder(before, after);
}
 
Example 9
Source File: SpacingBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
public RuleBuilder between(TokenSet leftSet, IElementType right) {
  return new RuleBuilder(new RuleCondition(null, leftSet, TokenSet.create(right)));
}
 
Example 10
Source File: SpacingBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
public RuleBuilder aroundInside(IElementType token, IElementType parent) {
  final TokenSet tokenSet = TokenSet.create(token);
  RuleCondition before = new RuleCondition(TokenSet.create(parent), null, tokenSet);
  RuleCondition after = new RuleCondition(TokenSet.create(parent), tokenSet, null);
  return new RuleBuilder(before, after);
}
 
Example 11
Source File: FusionParserDefinition.java    From intellij-neos with GNU General Public License v3.0 4 votes vote down vote up
@NotNull
@Override
public TokenSet getCommentTokens() {
    return TokenSet.create(FusionTypes.SINGLE_LINE_COMMENT, FusionTypes.C_STYLE_COMMENT, FusionTypes.DOC_COMMENT);
}
 
Example 12
Source File: GLSLParserDefinition.java    From glsl4idea with GNU Lesser General Public License v3.0 4 votes vote down vote up
@NotNull
public TokenSet getWhitespaceTokens() {
    return TokenSet.create(GLSLTokenTypes.WHITE_SPACE);
}
 
Example 13
Source File: SpacingBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
public RuleBuilder between(IElementType left, TokenSet rightSet) {
  return new RuleBuilder(new RuleCondition(null, TokenSet.create(left), rightSet));
}
 
Example 14
Source File: CabalParserDefinition.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public TokenSet getWhitespaceTokens() {
  return TokenSet.create(TokenType.WHITE_SPACE);
}
 
Example 15
Source File: CGParserDefinition.java    From consulo-unity3d with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public TokenSet getWhitespaceTokens(@Nonnull LanguageVersion languageVersion)
{
	return TokenSet.create(CGTokens.WHITE_SPACE);
}
 
Example 16
Source File: Sand2LanguageVersion.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public TokenSet getWhitespaceTokens() {
  return TokenSet.create(SandTokens.WHITE_SPACE);
}
 
Example 17
Source File: SpacingBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
public RuleBuilder between(IElementType left, IElementType right) {
  return new RuleBuilder(new RuleCondition(null, TokenSet.create(left), TokenSet.create(right)));
}
 
Example 18
Source File: GeneratedParserUtilBase.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public static TokenSet create_token_set_(IElementType... tokenTypes) {
    return TokenSet.create(tokenTypes);
}
 
Example 19
Source File: ConceptStepWordScanner.java    From Intellij-Plugin with Apache License 2.0 4 votes vote down vote up
public ConceptStepWordScanner() {
    super(new ConceptLexer(), TokenSet.create(ConceptTokenTypes.STEP), TokenSet.create(ConceptTokenTypes.COMMENT), TokenSet.create(ConceptTokenTypes.STEP));
}
 
Example 20
Source File: SimpleTokenSetQuoteHandler.java    From consulo with Apache License 2.0 4 votes vote down vote up
public SimpleTokenSetQuoteHandler(IElementType... _literalTokens) {
  this(TokenSet.create(_literalTokens));
}