• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java LighterASTTokenNode类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.intellij.lang.LighterASTTokenNode的典型用法代码示例。如果您正苦于以下问题:Java LighterASTTokenNode类的具体用法?Java LighterASTTokenNode怎么用?Java LighterASTTokenNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

LighterASTTokenNode类属于com.intellij.lang包,在下文中一共展示了LighterASTTokenNode类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: toBuffer

点赞 3

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
public static void toBuffer(@NotNull LighterAST tree, @NotNull LighterASTNode node, @NotNull StringBuilder buffer, @Nullable TokenSet skipTypes) {
  if (skipTypes != null && skipTypes.contains(node.getTokenType())) {
    return;
  }

  if (node instanceof LighterASTTokenNode) {
    buffer.append(((LighterASTTokenNode)node).getText());
    return;
  }

  if (node instanceof LighterLazyParseableNode) {
    buffer.append(((LighterLazyParseableNode)node).getText());
    return;
  }

  List<LighterASTNode> children = tree.getChildren(node);
  for (int i = 0, size = children.size(); i < size; ++i) {
    toBuffer(tree, children.get(i), buffer, skipTypes);
  }
  tree.disposeChildren(children);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:22,
代码来源:LightTreeUtil.java

示例2: toBuffer

点赞 3

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
public static void toBuffer(@NotNull LighterAST tree, @NotNull LighterASTNode node, @NotNull StringBuilder buffer, @Nullable TokenSet skipTypes) {
  if (skipTypes != null && skipTypes.contains(node.getTokenType())) return;

  if (node instanceof LighterASTTokenNode) {
    buffer.append(((LighterASTTokenNode)node).getText());
    return;
  }

  if (node instanceof LighterLazyParseableNode) {
    buffer.append(((LighterLazyParseableNode)node).getText());
    return;
  }

  List<LighterASTNode> children = tree.getChildren(node);
  for (int i = 0, size = children.size(); i < size; ++i) {
    toBuffer(tree, children.get(i), buffer, skipTypes);
  }
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:19,
代码来源:LightTreeUtil.java

示例3: toBuffer

点赞 3

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
public static void toBuffer(@Nonnull LighterAST tree, @Nonnull LighterASTNode node, @Nonnull StringBuilder buffer, @Nullable TokenSet skipTypes) {
  if (skipTypes != null && skipTypes.contains(node.getTokenType())) {
    return;
  }

  if (node instanceof LighterASTTokenNode) {
    buffer.append(((LighterASTTokenNode)node).getText());
    return;
  }

  if (node instanceof LighterLazyParseableNode) {
    buffer.append(((LighterLazyParseableNode)node).getText());
    return;
  }

  List<LighterASTNode> children = tree.getChildren(node);
  for (int i = 0, size = children.size(); i < size; ++i) {
    toBuffer(tree, children.get(i), buffer, skipTypes);
  }
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:21,
代码来源:LightTreeUtil.java

示例4: fun

点赞 3

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
@Override
public ThreeState fun(ASTNode oldNode,
                      LighterASTNode newNode,
                      FlyweightCapableTreeStructure<LighterASTNode> structure) {
  if (oldNode instanceof XmlTag && newNode.getTokenType() == XmlElementType.XML_TAG) {
    String oldName = ((XmlTag)oldNode).getName();
    Ref<LighterASTNode[]> childrenRef = Ref.create(null);
    int count = structure.getChildren(newNode, childrenRef);
    if (count < 3) return ThreeState.UNSURE;
    LighterASTNode[] children = childrenRef.get();
    if (children[0].getTokenType() != XmlTokenType.XML_START_TAG_START) return ThreeState.UNSURE;
    if (children[1].getTokenType() != XmlTokenType.XML_NAME) return ThreeState.UNSURE;
    if (children[2].getTokenType() != XmlTokenType.XML_TAG_END) return ThreeState.UNSURE;
    LighterASTTokenNode name = (LighterASTTokenNode)children[1];
    CharSequence newName = name.getText();
    if (!oldName.equals(newName)) return ThreeState.NO;
  }

  return ThreeState.UNSURE;
}
 

开发者ID:consulo,
项目名称:consulo-xml,
代码行数:21,
代码来源:XmlParser.java

示例5: RecursiveLighterASTNodeWalkingVisitor

点赞 2

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
protected RecursiveLighterASTNodeWalkingVisitor(@NotNull final LighterAST ast) {
  this.ast = ast;

  myWalkingState = new WalkingState<IndexedLighterASTNode>(new LighterASTGuide()) {
    @Override
    public void elementFinished(@NotNull IndexedLighterASTNode element) {
      RecursiveLighterASTNodeWalkingVisitor.this.elementFinished(element.node);

      if (parentStack.peek() == element) { // getFirstChild returned nothing. otherwise getFirstChild() was not called, i.e. super.visitNode() was not called i.e. just ignore
        IndexedLighterASTNode[] children = childrenStack.pop();
        List<LighterASTNode> list = children.length == 0 ? Collections.<LighterASTNode>emptyList() : ContainerUtil.map(children, new Function<IndexedLighterASTNode, LighterASTNode>() {
          @Override
          public LighterASTNode fun(IndexedLighterASTNode node) {
            return node.node;
          }
        });
        ast.disposeChildren(list);
        parentStack.pop();
      }
    }

    @Override
    public void visit(@NotNull IndexedLighterASTNode iNode) {
      LighterASTNode element = iNode.node;
      RecursiveLighterASTNodeWalkingVisitor visitor = RecursiveLighterASTNodeWalkingVisitor.this;
      if (element instanceof LighterLazyParseableNode) {
        visitor.visitLazyParseableNode((LighterLazyParseableNode)element);
      }
      else if (element instanceof LighterASTTokenNode) {
        visitor.visitTokenNode((LighterASTTokenNode)element);
      }
      else {
        visitor.visitNode(element);
      }
    }
  };
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:38,
代码来源:RecursiveLighterASTNodeWalkingVisitor.java

示例6: RecursiveLighterASTNodeWalkingVisitor

点赞 2

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
protected RecursiveLighterASTNodeWalkingVisitor(@Nonnull final LighterAST ast) {
  this.ast = ast;

  myWalkingState = new WalkingState<IndexedLighterASTNode>(new LighterASTGuide()) {
    @Override
    public void elementFinished(@Nonnull IndexedLighterASTNode element) {
      RecursiveLighterASTNodeWalkingVisitor.this.elementFinished(element.node);

      if (parentStack.peek() == element) { // getFirstChild returned nothing. otherwise getFirstChild() was not called, i.e. super.visitNode() was not called i.e. just ignore
        childrenStack.pop();
        parentStack.pop();
      }
    }

    @Override
    public void visit(@Nonnull IndexedLighterASTNode iNode) {
      LighterASTNode element = iNode.node;
      RecursiveLighterASTNodeWalkingVisitor visitor = RecursiveLighterASTNodeWalkingVisitor.this;
      if (element instanceof LighterLazyParseableNode) {
        visitor.visitLazyParseableNode((LighterLazyParseableNode)element);
      }
      else if (element instanceof LighterASTTokenNode) {
        visitor.visitTokenNode((LighterASTTokenNode)element);
      }
      else {
        visitor.visitNode(element);
      }
    }
  };
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:31,
代码来源:RecursiveLighterASTNodeWalkingVisitor.java

示例7: parent

点赞 2

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
@Nullable
@Override
public LighterASTNode parent(@NotNull LighterASTNode node) {
  return node instanceof LighterASTTokenNode ? null : super.parent(node);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:6,
代码来源:SyntaxTraverser.java

示例8: lightTreeToBuffer

点赞 2

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
public static void lightTreeToBuffer(@NotNull final FlyweightCapableTreeStructure<LighterASTNode> tree,
                                     @NotNull final LighterASTNode node,
                                     @NotNull final Appendable buffer,
                                     final int indent,
                                     final boolean skipWhiteSpaces) {
  final IElementType tokenType = node.getTokenType();
  if (skipWhiteSpaces && tokenType == TokenType.WHITE_SPACE) return;

  final boolean isLeaf = (node instanceof LighterASTTokenNode);

  StringUtil.repeatSymbol(buffer, ' ', indent);
  try {
    if (tokenType == TokenType.ERROR_ELEMENT) {
      buffer.append("PsiErrorElement:").append(PsiBuilderImpl.getErrorMessage(node));
    }
    else if (tokenType == TokenType.WHITE_SPACE) {
      buffer.append("PsiWhiteSpace");
    }
    else {
      buffer.append(isLeaf ? "PsiElement" : "Element").append('(').append(tokenType.toString()).append(')');
    }

    if (isLeaf) {
      final String text = ((LighterASTTokenNode)node).getText().toString();
      buffer.append("('").append(fixWhiteSpaces(text)).append("')");
    }
    buffer.append('\n');

    if (!isLeaf) {
      final Ref<LighterASTNode[]> kids = new Ref<LighterASTNode[]>();
      final int numKids = tree.getChildren(tree.prepareForGetChildren(node), kids);
      if (numKids == 0) {
        StringUtil.repeatSymbol(buffer, ' ', indent + 2);
        buffer.append("<empty list>\n");
      }
      else {
        for (int i = 0; i < numKids; i++) {
          lightTreeToBuffer(tree, kids.get()[i], buffer, indent + 2, skipWhiteSpaces);
        }
      }
    }
  }
  catch (IOException e) {
    LOG.error(e);
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:47,
代码来源:DebugUtil.java

示例9: visitTokenNode

点赞 2

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
public void visitTokenNode(@NotNull LighterASTTokenNode node) {
  visitNode(node);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:4,
代码来源:LighterASTNodeVisitor.java

示例10: parent

点赞 2

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
@Nullable
@Override
public LighterASTNode parent(@Nonnull LighterASTNode node) {
  return node instanceof LighterASTTokenNode ? null : super.parent(node);
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:6,
代码来源:SyntaxTraverser.java

示例11: lightTreeToBuffer

点赞 2

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
public static void lightTreeToBuffer(@Nonnull final FlyweightCapableTreeStructure<LighterASTNode> tree,
                                     @Nonnull final LighterASTNode node,
                                     @Nonnull final Appendable buffer,
                                     final int indent,
                                     final boolean skipWhiteSpaces) {
  final IElementType tokenType = node.getTokenType();
  if (skipWhiteSpaces && tokenType == TokenType.WHITE_SPACE) return;

  final boolean isLeaf = (node instanceof LighterASTTokenNode);

  StringUtil.repeatSymbol(buffer, ' ', indent);
  try {
    if (tokenType == TokenType.ERROR_ELEMENT) {
      buffer.append("PsiErrorElement:").append(PsiBuilderImpl.getErrorMessage(node));
    }
    else if (tokenType == TokenType.WHITE_SPACE) {
      buffer.append("PsiWhiteSpace");
    }
    else {
      buffer.append(isLeaf ? "PsiElement" : "Element").append('(').append(tokenType.toString()).append(')');
    }

    if (isLeaf) {
      final String text = ((LighterASTTokenNode)node).getText().toString();
      buffer.append("('").append(fixWhiteSpaces(text)).append("')");
    }
    buffer.append('\n');

    if (!isLeaf) {
      final Ref<LighterASTNode[]> kids = new Ref<LighterASTNode[]>();
      final int numKids = tree.getChildren(tree.prepareForGetChildren(node), kids);
      if (numKids == 0) {
        StringUtil.repeatSymbol(buffer, ' ', indent + 2);
        buffer.append("<empty list>\n");
      }
      else {
        for (int i = 0; i < numKids; i++) {
          lightTreeToBuffer(tree, kids.get()[i], buffer, indent + 2, skipWhiteSpaces);
        }
      }
    }
  }
  catch (IOException e) {
    LOG.error(e);
  }
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:47,
代码来源:DebugUtil.java

示例12: visitTokenNode

点赞 2

import com.intellij.lang.LighterASTTokenNode; //导入依赖的package包/类
public void visitTokenNode(@Nonnull LighterASTTokenNode node) {
  visitNode(node);
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:4,
代码来源:LighterASTNodeVisitor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)