Java 类com.intellij.lang.LighterLazyParseableNode 实例源码

项目:intellij-ce-playground    文件:LightTreeUtil.java   
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);
}
项目:tools-idea    文件:LightTreeUtil.java   
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);
  }
}
项目:consulo    文件:LightTreeUtil.java   
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);
  }
}
项目:intellij-ce-playground    文件:JavaLightStubBuilder.java   
@Override
protected boolean skipChildProcessingWhenBuildingStubs(@NotNull LighterAST tree, @NotNull LighterASTNode parent, @NotNull LighterASTNode node) {
  IElementType parentType = parent.getTokenType();
  IElementType nodeType = node.getTokenType();

  if (checkByTypes(parentType, nodeType)) return true;

  if (nodeType == JavaElementType.CODE_BLOCK) {
    CodeBlockVisitor visitor = new CodeBlockVisitor();
    ((LighterLazyParseableNode)node).accept(visitor);
    return visitor.result;
  }

  return false;
}
项目:intellij-ce-playground    文件:RecursiveLighterASTNodeWalkingVisitor.java   
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);
      }
    }
  };
}
项目:intellij-ce-playground    文件:MasqueradingPsiBuilderAdapter.java   
public MasqueradingPsiBuilderAdapter(@NotNull final Project project,
                      @NotNull final ParserDefinition parserDefinition,
                      @NotNull final MasqueradingLexer lexer,
                      @NotNull final LighterLazyParseableNode chameleon,
                      @NotNull final CharSequence text) {
  this(new PsiBuilderImpl(project, parserDefinition, lexer, chameleon, text));
}
项目:tools-idea    文件:JavaLightStubBuilder.java   
@Override
protected boolean skipChildProcessingWhenBuildingStubs(@NotNull LighterAST tree, @NotNull LighterASTNode parent, @NotNull LighterASTNode node) {
  IElementType parentType = parent.getTokenType();
  IElementType nodeType = node.getTokenType();

  if (checkByTypes(parentType, nodeType)) return true;

  if (nodeType == JavaElementType.CODE_BLOCK && node instanceof LighterLazyParseableNode) {
    CodeBlockVisitor visitor = new CodeBlockVisitor();
    ((LighterLazyParseableNode)node).accept(visitor);
    return visitor.result;
  }

  return false;
}
项目:intellij-haxe    文件:HaxePsiBuilder.java   
public HaxePsiBuilder(@NotNull Project project,
                      @NotNull ParserDefinition parserDefinition,
                      @NotNull Lexer lexer,
                      @NotNull LighterLazyParseableNode chameleon,
                      @NotNull CharSequence text) {
  super(project, parserDefinition, lexer, chameleon, text);
  psiFile = chameleon.getContainingFile();
  setupDebugTraces();
}
项目:consulo    文件:RecursiveLighterASTNodeWalkingVisitor.java   
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);
      }
    }
  };
}
项目:consulo-java    文件:JavaParserUtil.java   
@NotNull
public static PsiBuilder createBuilder(final LighterLazyParseableNode chameleon)
{
    final PsiElement psi = chameleon.getContainingFile();
    assert psi != null : chameleon;
    final Project project = psi.getProject();

    final PsiBuilderFactory factory = PsiBuilderFactory.getInstance();
    final LanguageLevel level = PsiUtil.getLanguageLevel(psi);
    final Lexer lexer = new JavaLexer(level);
    final PsiBuilder builder = factory.createBuilder(project, chameleon, lexer, chameleon.getTokenType().getLanguage(), level.toLangVersion(), chameleon.getText());
    setLanguageLevel(builder, level);

    return builder;
}
项目:consulo-java    文件:JavaElementType.java   
@Override
public FlyweightCapableTreeStructure<LighterASTNode> parseContents(final LighterLazyParseableNode chameleon)
{
    final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
    JavaParser.INSTANCE.getStatementParser().parseCodeBlockDeep(builder, true);
    return builder.getLightTree();
}
项目:consulo-java    文件:JavaLightStubBuilder.java   
public static boolean isCodeBlockWithoutStubs(@NotNull LighterASTNode node)
{
    if(node.getTokenType() == JavaElementType.CODE_BLOCK && node instanceof LighterLazyParseableNode)
    {
        CodeBlockVisitor visitor = new CodeBlockVisitor();
        ((LighterLazyParseableNode) node).accept(visitor);
        return visitor.result;
    }

    return false;
}
项目:intellij-ce-playground    文件:LighterASTNodeVisitor.java   
public void visitLazyParseableNode(@NotNull LighterLazyParseableNode node) {
  visitNode(node);
}
项目:consulo    文件:LighterASTNodeVisitor.java   
public void visitLazyParseableNode(@Nonnull LighterLazyParseableNode node) {
  visitNode(node);
}
项目:intellij-ce-playground    文件:ILightLazyParseableElementType.java   
/**
 * Parses the contents of the specified chameleon node and returns the lightweight tree
 * representing parsed contents.
 *
 * @param chameleon the node to parse.
 * @return the parsed contents of the node.
 */
FlyweightCapableTreeStructure<LighterASTNode> parseContents(final LighterLazyParseableNode chameleon);
项目:tools-idea    文件:ILightLazyParseableElementType.java   
/**
 * Parses the contents of the specified chameleon node and returns the lightweight tree
 * representing parsed contents.
 *
 * @param chameleon the node to parse.
 * @return the parsed contents of the node.
 */
FlyweightCapableTreeStructure<LighterASTNode> parseContents(final LighterLazyParseableNode chameleon);
项目:consulo    文件:ILightLazyParseableElementType.java   
/**
 * Parses the contents of the specified chameleon node and returns the lightweight tree
 * representing parsed contents.
 *
 * @param chameleon the node to parse.
 * @return the parsed contents of the node.
 */
FlyweightCapableTreeStructure<LighterASTNode> parseContents(final LighterLazyParseableNode chameleon);