Package com.intellij.psi.tree

Examples of com.intellij.psi.tree.TokenSet


                } else {
                    tokenSetList.add(tokenType);
                }
            }
            IElementType[] tokenSetArray = tokenSetList.toArray(new IElementType[tokenSetList.size()]);
            TokenSet tokenSet = TokenSet.create(tokenSetArray);
            tokenSets.put(id, tokenSet);
        }
    }
View Full Code Here


        }
        return tokenType;
    }

    public TokenSet getTokenSet(String id) {
        TokenSet tokenSet = super.getTokenSet(id);
        if (tokenSet == null) {
            tokenSet = getSharedTokenTypes().getTokenSet(id);
            if (tokenSet == null) {
                System.out.println("DEBUG - [" + getLanguage().getID() + "] undefined token set: " + id);
                //log.info("[DBN-WARNING] Undefined token set '" + id + "'");
View Full Code Here

  @NotNull
  @Override
  public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
    if (element instanceof GherkinStepImpl) {

      TokenSet textAndParamSet = TokenSet.create(GherkinTokenTypes.TEXT, GherkinTokenTypes.STEP_PARAMETER_TEXT,
                                                 GherkinTokenTypes.STEP_PARAMETER_BRACE, GherkinElementTypes.STEP_PARAMETER);
      ASTNode textNode = element.getNode().findChildByType(textAndParamSet);
      textAndParamSet = TokenSet.orSet(textAndParamSet, TokenSet.create(TokenType.WHITE_SPACE));
      if (textNode != null) {
        int start = textNode.getTextRange().getStartOffset();
        int end = textNode.getTextRange().getEndOffset();
        int endBeforeSpace = end;
        textNode = textNode.getTreeNext();
        while (textNode != null && textAndParamSet.contains(textNode.getElementType())) {
          if (textNode.getElementType() == TokenType.WHITE_SPACE) {
            endBeforeSpace = end;
          } else {
            endBeforeSpace = textNode.getTextRange().getEndOffset();
          }
View Full Code Here

    final StringBuilder preparedRegexp = new StringBuilder();

    final RegExpLexer lexer = new RegExpLexer(EnumSet.noneOf(RegExpCapability.class));
    lexer.start(source);
    IElementType previous = null;
    final TokenSet toSkip = TokenSet.create(RegExpTT.CHARACTER, RegExpTT.CARET, RegExpTT.DOLLAR);

    StringBuilder currentStaticText = new StringBuilder();

    boolean insideAddedGroup = false;
    final Stack<IElementType> elementsWaitingToClose = new Stack<IElementType>();

    while (lexer.getTokenType() != null) {
      if (!toSkip.contains(lexer.getTokenType())) {
        if (!insideAddedGroup) {
          insideAddedGroup = true;
          preparedRegexp.append('(');

          result.add(currentStaticText.toString());
View Full Code Here

    extendKeywordCompletion(AFTER_IDENTIFIER,
                            INSTANCEOF);
  }

  private void installBooleanNull() {
    final TokenSet precedingOperators =
      TokenSet.create(OgnlTypes.EQUAL,
                      OgnlTypes.EQ_KEYWORD,
                      OgnlTypes.NOT_EQUAL,
                      OgnlTypes.NEQ_KEYWORD,
                      OgnlTypes.QUESTION,
View Full Code Here

    ErlangFormattingBlock block = new ErlangFormattingBlock(element.getNode(), null, null, null, commonSettings, erlangSettings, spacingBuilder, -1);
    return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), block, settings);
  }

  private static SpacingBuilder createSpacingBuilder(@NotNull CommonCodeStyleSettings settings, @NotNull ErlangCodeStyleSettings erlangSettings) {
    TokenSet rules = TokenSet.create(ERL_RULE, ERL_RECORD_DEFINITION, ERL_INCLUDE, ERL_MACROS_DEFINITION, ERL_ATTRIBUTE);
    TokenSet keywords = TokenSet.create(
      ERL_AFTER, ERL_WHEN, ERL_BEGIN, ERL_END, ERL_OF, ERL_CASE, ERL_CATCH, ERL_IF, ERL_RECEIVE,
      ERL_TRY, ERL_DIV, ERL_REM, ERL_OR, ERL_XOR, ERL_BOR, ERL_BXOR, ERL_BSL, ERL_BSR, ERL_AND, ERL_BAND);

    //noinspection SuspiciousNameCombination
    return new SpacingBuilder(settings.getRootSettings(), ErlangLanguage.INSTANCE)
View Full Code Here

    if (psiParent instanceof ClojureFile) {
      return Indent.getNoneIndent();
    }

    ASTNode node = parent.getNode();
    final TokenSet L_BRACES = TokenSet.create(LEFT_CURLY, LEFT_PAREN, LEFT_SQUARE);
    if (LIST_LIKE_FORMS.contains(node.getElementType())) {
      if (L_BRACES.contains(child.getElementType())) {
        return Indent.getNoneIndent();
      } else {
        return Indent.getNormalIndent(true);
      }
    }
View Full Code Here

    RustFormattingBlock block = new RustFormattingBlock(element.getNode(), null, null, null, commonSettings, spacingBuilder, -1);
    return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), block, settings);
  }

  private static SpacingBuilder createSpacingBuilder(@NotNull CommonCodeStyleSettings settings) {
    TokenSet keywords = TokenSet.create(
      KW_AS, KW_BREAK, KW_CRATE, KW_ELSE, KW_ENUM, KW_EXTERN, KW_FALSE, KW_FN, KW_FOR, KW_IF, KW_IMPL,
      KW_IN, KW_LET, KW_LOOP, KW_MATCH, KW_MOD, KW_PRIV, KW_PROC, KW_PUB, KW_RETURN, KW_CONTINUE, KW_MACRO_RULES,
      KW_SELF, KW_STATIC, KW_STRUCT, KW_SUPER, KW_TRUE, KW_TRAIT, KW_TYPE, KW_UNSAFE, KW_USE, KW_WHILE
    );
View Full Code Here

TOP

Related Classes of com.intellij.psi.tree.TokenSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.