Java 类com.intellij.psi.impl.source.tree.PsiWhiteSpaceImpl 实例源码

项目:consulo    文件:DefaultASTLeafFactory.java   
@Nonnull
@Override
public LeafElement createLeaf(@Nonnull IElementType type, @Nonnull LanguageVersion languageVersion, @Nonnull CharSequence text) {
  final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(type.getLanguage());
  if(parserDefinition != null) {
    if(parserDefinition.getCommentTokens(languageVersion).contains(type)) {
      return new PsiCoreCommentImpl(type, text);
    }
  }

  // this is special case, then type is WHITE_SPACE, but no parser definition
  if(type == TokenType.WHITE_SPACE) {
    return new PsiWhiteSpaceImpl(text);
  }

  if (type instanceof ILeafElementType) {
    return (LeafElement)((ILeafElementType)type).createLeafNode(text);
  }
  return new LeafPsiElement(type, text);
}
项目:intellij-ce-playground    文件:ASTFactory.java   
@NotNull
public static LeafElement leaf(@NotNull final IElementType type, @NotNull CharSequence text) {
  if (type == TokenType.WHITE_SPACE) {
    return new PsiWhiteSpaceImpl(text);
  }

  if (type instanceof ILeafElementType) {
    return (LeafElement)((ILeafElementType)type).createLeafNode(text);
  }

  final LeafElement customLeaf = factory(type).createLeaf(type, text);
  return customLeaf != null ? customLeaf : DefaultFactoryHolder.DEFAULT.createLeaf(type, text);
}
项目:consulo-xml    文件:XmlASTLeafFactory.java   
@NotNull
@Override
public LeafElement createLeaf(@NotNull IElementType type, @NotNull LanguageVersion languageVersion, @NotNull CharSequence text) {
  if (type instanceof IXmlLeafElementType) {
    if (type == XML_REAL_WHITE_SPACE) {
      return new PsiWhiteSpaceImpl(text);
    }
    return new XmlTokenImpl(type, text);
  }

  return null;
}
项目:intellij-ce-playground    文件:ASTFactory.java   
@NotNull
public static LeafElement whitespace(final CharSequence text) {
  final PsiWhiteSpaceImpl w = new PsiWhiteSpaceImpl(WHITESPACES.intern(text));
  CodeEditUtil.setNodeGenerated(w, true);
  return w;
}
项目:consulo    文件:ASTFactory.java   
@Nonnull
public static LeafElement whitespace(final CharSequence text) {
  final PsiWhiteSpaceImpl w = new PsiWhiteSpaceImpl(WHITESPACES.intern(text));
  CodeEditUtil.setNodeGenerated(w, true);
  return w;
}