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

项目:intellij    文件:BuildParserTest.java   
private ASTNode createAST(String text) {
  ParserDefinition definition = new BuildParserDefinition();
  PsiParser parser = definition.createParser(getProject());
  Lexer lexer = definition.createLexer(getProject());
  PsiBuilderImpl psiBuilder =
      new PsiBuilderImpl(
          getProject(), null, definition, lexer, new CharTableImpl(), text, null, null);
  PsiBuilderAdapter adapter =
      new PsiBuilderAdapter(psiBuilder) {
        @Override
        public void error(String messageText) {
          super.error(messageText);
          errors.add(messageText);
        }
      };
  return parser.parse(definition.getFileNodeType(), adapter);
}
项目:intellij-ce-playground    文件:PsiBuilderImpl.java   
@NotNull
private ASTNode createRootAST(@NotNull StartMarker rootMarker) {
  final IElementType type = rootMarker.getTokenType();
  @SuppressWarnings("NullableProblems")
  final ASTNode rootNode = type instanceof ILazyParseableElementType ?
                           ASTFactory.lazy((ILazyParseableElementType)type, null) : createComposite(rootMarker);
  if (myCharTable == null) {
    myCharTable = rootNode instanceof FileElement ? ((FileElement)rootNode).getCharTable() : new CharTableImpl();
  }
  if (!(rootNode instanceof FileElement)) {
    rootNode.putUserData(CharTable.CHAR_TABLE_KEY, myCharTable);
  }
  return rootNode;
}
项目:epigraph    文件:EpigraphPsiUtil.java   
public static @NotNull <T extends PsiElement> T parseText(
    @NotNull String text,
    @NotNull IElementType rootElementType,
    @NotNull Class<T> rootElementClass,
    @NotNull ParserDefinition parserDefinition,
    @Nullable ErrorProcessor errorProcessor) {

  LanguageParserDefinitions.INSTANCE.addExplicitExtension(
      parserDefinition.getFileNodeType().getLanguage(),
      parserDefinition
  );

  PsiParser parser = parserDefinition.createParser(model.first);
  Lexer lexer = parserDefinition.createLexer(model.first);
  PsiBuilderImpl psiBuilder = new PsiBuilderImpl(
      model.first,
      null,
      parserDefinition,
      lexer,
      new CharTableImpl(),
      text,
      null,
      null
  );

  ASTNode astNode = parser.parse(rootElementType, psiBuilder);
  T res = astNode.getPsi(rootElementClass);
  collectErrors(res, errorProcessor);

  return res;
}
项目:tools-idea    文件:PsiBuilderImpl.java   
private ASTNode createRootAST(final StartMarker rootMarker) {
  final IElementType type = rootMarker.getTokenType();
  @SuppressWarnings("NullableProblems")
  final ASTNode rootNode = type instanceof ILazyParseableElementType ?
                           ASTFactory.lazy((ILazyParseableElementType)type, null) : createComposite(rootMarker);
  if (myCharTable == null) {
    myCharTable = rootNode instanceof FileElement ? ((FileElement)rootNode).getCharTable() : new CharTableImpl();
  }
  if (!(rootNode instanceof FileElement)) {
    rootNode.putUserData(CharTable.CHAR_TABLE_KEY, myCharTable);
  }
  return rootNode;
}
项目:consulo    文件:PsiBuilderImpl.java   
@Nonnull
private TreeElement createRootAST(@Nonnull StartMarker rootMarker) {
  final IElementType type = rootMarker.getTokenType();
  @SuppressWarnings("NullableProblems") final TreeElement rootNode =
          type instanceof ILazyParseableElementType ? ASTFactory.lazy((ILazyParseableElementType)type, null) : createComposite(rootMarker);
  if (myCharTable == null) {
    myCharTable = rootNode instanceof FileElement ? ((FileElement)rootNode).getCharTable() : new CharTableImpl();
  }
  if (!(rootNode instanceof FileElement)) {
    rootNode.putUserData(CharTable.CHAR_TABLE_KEY, myCharTable);
  }
  return rootNode;
}
项目:intellij-ce-playground    文件:PsiAnnotationStubImpl.java   
public PsiAnnotationStubImpl(final StubElement parent, final String text) {
  super(parent, JavaStubElementTypes.ANNOTATION);
  CharSequence interned = CharTableImpl.getStaticInterned(text);
  myText = interned == null ? text : interned.toString();
}
项目:tools-idea    文件:PsiAnnotationStubImpl.java   
public PsiAnnotationStubImpl(final StubElement parent, final String text) {
  super(parent, JavaStubElementTypes.ANNOTATION);
  CharSequence interned = CharTableImpl.getStaticInterned(text);
  myText = interned == null ? text : interned.toString();
}
项目:consulo-java    文件:PsiAnnotationStubImpl.java   
public PsiAnnotationStubImpl(final StubElement parent, final String text) {
  super(parent, JavaStubElementTypes.ANNOTATION);
  CharSequence interned = CharTableImpl.getStaticInterned(text);
  myText = interned == null ? text : interned.toString();
}