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

项目:intellij-ce-playground    文件:DtdParsing.java   
public DtdParsing(CharSequence chars,
                  final IElementType type,
                  final XmlEntityDecl.EntityContextType contextType,
                  PsiFile contextFile
) {
  this(
    type,
    contextType,
    PsiBuilderFactory.getInstance().createBuilder(
      LanguageParserDefinitions.INSTANCE.forLanguage(DTDLanguage.INSTANCE),
      new DtdLexer(false) {
        final int myInitialState = getLexerInitialState(type, contextType);
        @Override
        public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
          super.start(buffer, startOffset, endOffset, myInitialState);
        }
      }, chars
    )
  );
  if (contextFile != null) myBuilder.putUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY, contextFile);
}
项目:intellij-ce-playground    文件:GroovyDocTagValueTokenType.java   
private ASTNode parseImpl(ASTNode chameleon) {
  final PsiElement parentElement = chameleon.getTreeParent().getPsi();
  final Project project = parentElement.getProject();
  final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new GroovyLexer(), getLanguage(), chameleon.getText());

  PsiBuilder.Marker rootMarker = builder.mark();
  if (BUILT_IN_TYPES.contains(chameleon.getText())) {
    builder.advanceLexer();
  } else {
    ReferenceElement.parse(builder, false, false, false, false, false);
    while (!builder.eof()) {
      builder.advanceLexer();
    }
  }
  rootMarker.done(this);
  return builder.getTreeBuilt().getFirstChildNode();
}
项目:spoofax-intellij    文件:MetaborgFileElementType.java   
@Override protected ASTNode doParseContents(final ASTNode chameleon, final PsiElement psi) {
    final Project project = psi.getProject();

    final MetaborgIdeaLanguage language = getMetaborgIdeaLanguage();
    final PsiBuilder builder =
        PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, language, chameleon.getChars());


    @Nullable final FileObject resource = getResource(psi, builder);
    final ILanguageImpl languageImpl = getLanguageImpl(resource, psi, this);

    final String text = builder.getOriginalText().toString();
    final ISpoofaxInputUnit input = unitService.inputUnit(resource, text, languageImpl, null);
    final ISpoofaxParseUnit parseResult = parseAll(input);

    final AstBuilder astBuilder =
        new AstBuilder(languageImpl, this.elementTypeProviderFactory, this.tokenTypesManager);
    final ASTNode tree = astBuilder.build(parseResult, this, builder);

    final ASTNode rootNode = tree.getFirstChildNode();

    final MetaborgFile file = (MetaborgFile) psi;
    file.putUserData(MetaborgFile.PARSE_RESULT_KEY, parseResult);

    return rootNode;
}
项目:tools-idea    文件:DtdParsing.java   
public DtdParsing(CharSequence chars,
                  final IElementType type,
                  final XmlEntityDecl.EntityContextType contextType,
                  PsiFile contextFile
) {
  this(
    type,
    contextType,
    PsiBuilderFactory.getInstance().createBuilder(
      LanguageParserDefinitions.INSTANCE.forLanguage(DTDLanguage.INSTANCE),
      new DtdLexer(false) {
        final int myInitialState = getLexerInitialState(type, contextType);
        @Override
        public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
          super.start(buffer, startOffset, endOffset, myInitialState);
        }
      }, chars
    )
  );
  if (contextFile != null) myBuilder.putUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY, contextFile);
}
项目:tools-idea    文件:GroovyDocTagValueTokenType.java   
private ASTNode parseImpl(ASTNode chameleon) {
  final PsiElement parentElement = chameleon.getTreeParent().getPsi();
  final Project project = parentElement.getProject();
  final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new GroovyLexer(), getLanguage(), chameleon.getText());

  PsiBuilder.Marker rootMarker = builder.mark();
  if (BUILT_IN_TYPES.contains(chameleon.getText())) {
    builder.advanceLexer();
  } else {
    ReferenceElement.parse(builder, false, false, false, false, false);
    while (!builder.eof()) {
      builder.advanceLexer();
    }
  }
  rootMarker.done(this);
  return builder.getTreeBuilt().getFirstChildNode();
}
项目:consulo-csharp    文件:CSharpFileFactory.java   
@NotNull
private static IElementType createElementType(String id, BiConsumer<PsiBuilder, LanguageVersion> consumer)
{
    return new IFileElementType(id, CSharpLanguage.INSTANCE)
    {
        @Override
        protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)
        {
            final Project project = psi.getProject();
            final Language languageForParser = getLanguageForParser(psi);
            final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
            final LanguageVersion languageVersion = tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion;
            final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, languageVersion, chameleon.getChars());
            consumer.accept(builder, languageVersion);
            while(!builder.eof())
            {
                builder.advanceLexer();
            }
            return builder.getTreeBuilt();
        }
    };
}
项目:consulo-haxe    文件:HaxeExpressionCodeFragmentImpl.java   
@Override
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)
{
    final PsiBuilderFactory factory = PsiBuilderFactory.getInstance();
    final PsiBuilder psiBuilder = factory.createBuilder(getProject(), chameleon, LanguageVersionUtil.findDefaultVersion(getLanguage()));
    final PsiBuilder builder = adapt_builder_(HaxeTokenTypes.EXPRESSION, psiBuilder, new HaxeParser());

    final PsiBuilder.Marker marker = builder.mark();
    enter_section_(builder, 0, _NONE_, "<code fragment>");
    HaxeParser.expression(builder, 1);
    while(builder.getTokenType() != null)
    {
        builder.advanceLexer();
    }
    marker.done(HaxeTokenTypes.EXPRESSION);
    return builder.getTreeBuilt();
}
项目:consulo-play    文件:PlayBaseTemplateGroovyExpressionElementType.java   
@Override
public ASTNode parseContents(ASTNode chameleon)
{
    Project project = chameleon.getTreeParent().getPsi().getProject();
    PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new GroovyLexer(), GroovyFileType.GROOVY_LANGUAGE,
            LanguageVersionUtil.findDefaultVersion(GroovyFileType.GROOVY_LANGUAGE), chameleon.getText());

    PsiBuilder.Marker mark = builder.mark();
    GroovyParser.parseExpression(builder);
    if(!builder.eof())
    {
        builder.error("expression expected");

        while(!builder.eof())
        {
            builder.advanceLexer();
        }
    }
    mark.done(GroovyParserDefinition.GROOVY_FILE);

    return builder.getTreeBuilt().getFirstChildNode();
}
项目:consulo    文件:PsiManagerImpl.java   
public PsiManagerImpl(Project project,
                      FileDocumentManager fileDocumentManager,
                      PsiBuilderFactory psiBuilderFactory,
                      FileIndexFacade fileIndex,
                      MessageBus messageBus,
                      PsiModificationTracker modificationTracker) {
  myProject = project;
  myFileIndex = fileIndex;
  myMessageBus = messageBus;
  myModificationTracker = modificationTracker;

  //We need to initialize PsiBuilderFactory service so it won't initialize under PsiLock from ChameleonTransform
  @SuppressWarnings({"UnusedDeclaration", "UnnecessaryLocalVariable"}) Object used = psiBuilderFactory;

  myFileManager = new FileManagerImpl(this, fileDocumentManager, fileIndex);

  myTreeChangePreprocessors.add((PsiTreeChangePreprocessor)modificationTracker);

  Disposer.register(project, () -> myIsDisposed = true);
}
项目:consulo-xml    文件:DtdParsing.java   
public DtdParsing(CharSequence chars,
                  final IElementType type,
                  final XmlEntityDecl.EntityContextType contextType,
                  PsiFile contextFile
) {
  this(
    type,
    contextType,
    PsiBuilderFactory.getInstance().createBuilder(
      LanguageParserDefinitions.INSTANCE.forLanguage(DTDLanguage.INSTANCE),
      new DtdLexer(false) {
        final int myInitialState = getLexerInitialState(type, contextType);
        @Override
        public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
          super.start(buffer, startOffset, endOffset, myInitialState);
        }
      }, LanguageVersionUtil.findDefaultVersion(DTDLanguage.INSTANCE), chars
    )
  );
  if (contextFile != null) myBuilder.putUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY, contextFile);
}
项目:intellij-ce-playground    文件:PsiManagerImpl.java   
public PsiManagerImpl(Project project,
                      FileDocumentManager fileDocumentManager,
                      PsiBuilderFactory psiBuilderFactory,
                      FileIndexFacade fileIndex,
                      MessageBus messageBus,
                      PsiModificationTracker modificationTracker) {
  myProject = project;
  myFileIndex = fileIndex;
  myMessageBus = messageBus;
  myModificationTracker = modificationTracker;

  //We need to initialize PsiBuilderFactory service so it won't initialize under PsiLock from ChameleonTransform
  @SuppressWarnings({"UnusedDeclaration", "UnnecessaryLocalVariable"}) Object used = psiBuilderFactory;

  boolean isProjectDefault = project.isDefault();

  myFileManager = isProjectDefault ? new EmptyFileManager(this) : new FileManagerImpl(this, fileDocumentManager, fileIndex);

  myTreeChangePreprocessors.add((PsiTreeChangePreprocessor)modificationTracker);
  Collections.addAll(myTreeChangePreprocessors, Extensions.getExtensions(PsiTreeChangePreprocessor.EP_NAME, myProject));

  Disposer.register(project, new Disposable() {
    @Override
    public void dispose() {
      myIsDisposed = true;
    }
  });
}
项目:squirrel-lang-idea-plugin    文件:SquirrelTokenTypesSets.java   
@Override
public ASTNode parseContents(final ASTNode chameleon) {
    final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(chameleon.getTreeParent().getPsi().getProject(),
            chameleon,
            new SquirrelDocLexer(),
            getLanguage(),
            chameleon.getChars());
    doParse(builder);
    return builder.getTreeBuilt().getFirstChildNode();
}
项目:tools-idea    文件:PsiManagerImpl.java   
public PsiManagerImpl(Project project,
                      FileDocumentManager fileDocumentManager,
                      PsiBuilderFactory psiBuilderFactory,
                      FileIndexFacade excludedFileIndex,
                      MessageBus messageBus,
                      PsiModificationTracker modificationTracker) {
  myProject = project;
  myExcludedFileIndex = excludedFileIndex;
  myMessageBus = messageBus;
  myModificationTracker = modificationTracker;

  //We need to initialize PsiBuilderFactory service so it won't initialize under PsiLock from ChameleonTransform
  @SuppressWarnings({"UnusedDeclaration", "UnnecessaryLocalVariable"}) Object used = psiBuilderFactory;

  boolean isProjectDefault = project.isDefault();

  myFileManager = isProjectDefault ? new EmptyFileManager(this) : new FileManagerImpl(this, fileDocumentManager, excludedFileIndex);

  myTreeChangePreprocessors.add((PsiTreeChangePreprocessor)modificationTracker);
  Collections.addAll(myTreeChangePreprocessors, Extensions.getExtensions(PsiTreeChangePreprocessor.EP_NAME, myProject));

  Disposer.register(project, new Disposable() {
    @Override
    public void dispose() {
      myIsDisposed = true;
    }
  });
}
项目:consulo-csharp    文件:CSharpPreprocessorElements.java   
@Override
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)
{
    final Project project = psi.getProject();
    final Language languageForParser = getLanguageForParser(psi);
    final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
    final LanguageVersion languageVersion = tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion;
    final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new _CSharpMacroLexer(), languageForParser, languageVersion, chameleon.getChars());
    final PsiParser parser = LanguageParserDefinitions.INSTANCE.forLanguage(languageForParser).createParser(languageVersion);
    return parser.parse(this, builder, languageVersion).getFirstChildNode();
}
项目:consulo-csharp    文件:CSharpFragmentFactory.java   
@Override
protected ASTNode doParseContents(@NotNull final ASTNode chameleon, @NotNull final PsiElement psi)
{
    final Project project = psi.getProject();
    final Language languageForParser = getLanguageForParser(psi);
    final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
    final LanguageVersion languageVersion = tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion;
    final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, languageVersion,
            chameleon.getChars());

    return ourExpressionParser.parse(this, builder, languageVersion).getFirstChildNode();
}
项目:consulo-csharp    文件:CSharpFragmentFactory.java   
@Override
protected ASTNode doParseContents(@NotNull final ASTNode chameleon, @NotNull final PsiElement psi)
{
    final Project project = psi.getProject();
    final Language languageForParser = getLanguageForParser(psi);
    final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
    final LanguageVersion languageVersion = tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion;
    final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, languageVersion,
            chameleon.getChars());

    return ourTypeParser.parse(this, builder, languageVersion).getFirstChildNode();
}
项目:consulo-csharp    文件:CSharpInjectExpressionElementType.java   
@Override
protected ASTNode doParseContents(@NotNull final ASTNode chameleon, @NotNull final PsiElement psi)
{
    final Project project = psi.getProject();
    final Language languageForParser = getLanguageForParser(psi);
    CSharpReferenceLexer lexer = new CSharpReferenceLexer();
    PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, lexer, languageForParser, languageForParser.getVersions()[0], chameleon.getChars());
    return ourParser.parse(this, builder, languageForParser.getVersions()[0]).getFirstChildNode();
}
项目:consulo-csharp    文件:CSharpDocElements.java   
@Override
@RequiredReadAction
protected ASTNode doParseContents(@NotNull final ASTNode chameleon, @NotNull final PsiElement psi)
{
    final Project project = psi.getProject();
    CSharpDocLanguage docLanguage = CSharpDocLanguage.INSTANCE;
    final LanguageVersion languageVersion = LanguageVersionUtil.findDefaultVersion(docLanguage);
    DeprecatedCSharpDocLexer docLexer = new DeprecatedCSharpDocLexer();
    final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, docLexer, docLanguage, languageVersion, chameleon.getChars());
    final PsiParser parser = LanguageParserDefinitions.INSTANCE.forLanguage(docLanguage).createParser(languageVersion);
    return parser.parse(this, builder, languageVersion).getFirstChildNode();
}
项目:consulo-csharp    文件:CSharpDocElements.java   
@Override
protected ASTNode doParseContents(@NotNull final ASTNode chameleon, @NotNull final PsiElement psi)
{
    Project project = psi.getProject();
    Language languageForParser = getLanguageForParser(psi);
    CSharpReferenceLexer lexer = new CSharpReferenceLexer();
    PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, lexer, languageForParser, languageForParser.getVersions()[0], chameleon.getChars());
    return myParser.parse(this, builder, languageForParser.getVersions()[0]).getFirstChildNode();
}
项目:intellij-haxe    文件:HaxeExpressionCodeFragmentImpl.java   
@Override
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi) {
  final PsiBuilderFactory factory = PsiBuilderFactory.getInstance();
  final PsiBuilder psiBuilder = factory.createBuilder(getProject(), chameleon);
  final PsiBuilder builder = adapt_builder_(HaxeTokenTypes.EXPRESSION, psiBuilder, new HaxeParser());

  final PsiBuilder.Marker marker = enter_section_(builder, 0, _NONE_, "<code fragment>");
  HaxeParser.expression(builder, 1);
  while (builder.getTokenType() != null) {
    builder.advanceLexer();
  }
  marker.done(HaxeTokenTypes.EXPRESSION);
  return builder.getTreeBuilt();
}
项目:consulo-play    文件:PlayBaseTemplateGroovyElementType.java   
@Override
public ASTNode parseContents(ASTNode chameleon)
{
    PsiElement parentElement = chameleon.getPsi();
    Project project = JavaPsiFacade.getInstance(parentElement.getProject()).getProject();

    Language groovyLanguage = GroovyFileType.GROOVY_LANGUAGE;
    LanguageVersion defaultVersion = LanguageVersionUtil.findDefaultVersion(groovyLanguage);
    PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new GroovyLexer(), groovyLanguage, defaultVersion, chameleon.getText());

    return new GroovyParser().parse(this, builder, defaultVersion).getFirstChildNode();
}
项目:consulo-javaee    文件:JspJavaFileElementType.java   
@NotNull
private PsiBuilder doParse(@NotNull ASTNode chameleon, Project project, LanguageVersion languageVersion)
{
    LanguageLevel languageLevel = LanguageLevel.HIGHEST;
    PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new JspJavaLexer(languageLevel), JavaLanguage.INSTANCE, languageVersion, chameleon.getChars());
    JavaParserUtil.setLanguageLevel(builder, languageLevel);
    PsiParser parser = new JavaInJspParser();
    parser.parse(this, builder, languageVersion);
    return builder;
}
项目:consulo-css    文件:CssHtmlElements.java   
@Override
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)
{
    final Project project = psi.getProject();
    final Language languageForParser = getLanguageForParser(psi);
    final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
    final LanguageVersion languageVersion = tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion;
    CssInlineLexer lexer = new CssInlineLexer();

    final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, lexer, languageForParser, languageVersion, chameleon.getChars());
    final CssParser parser = new CssParser();

    PsiBuilder.Marker mark = builder.mark();

    boolean inline = true;
    // if we can't parse as selector - rollback
    if(parser.parseSelectorListNew(builder) && builder.getTokenType() == CssTokens.LBRACE)
    {
        inline = false;
    }

    mark.rollbackTo();

    if(inline)
    {
        PsiBuilder.Marker rootMark = builder.mark();
        parseInlineRule(parser, builder);
        rootMark.done(CssElements.ROOT);
    }
    else
    {
        parser.parseRoot(builder);
    }

    return builder.getTreeBuilt();
}
项目:consulo-javascript    文件:JSTokenTypes.java   
@Override
@RequiredReadAction
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)
{
    final Project project = psi.getProject();
    final Language languageForParser = getLanguageForParser(psi);
    final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
    final LanguageVersion languageVersion = tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion;
    final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, createLexer(), languageForParser, languageVersion, chameleon.getChars());
    final JavaScriptParser parser = (JavaScriptParser) LanguageParserDefinitions.INSTANCE.forLanguage(languageForParser).createParser(languageVersion);

    JavaScriptParsingContext parsingContext = parser.createParsingContext();
    doParse(parsingContext, builder);
    return builder.getTreeBuilt();
}
项目:k-intellij-plugin    文件:KParserTest.java   
private PsiBuilder newPsiBuilder(String expression) {
  final Lexer lexer = SPEC.createLexer(null);
  final PsiBuilderFactory factory = PsiBuilderFactory.getInstance();
  return factory.createBuilder(SPEC, lexer, expression);
}
项目:consulo-csharp    文件:CSharpFileStubElementType.java   
@RequiredReadAction
@Override
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)
{
    final Project project = psi.getProject();
    final Language languageForParser = getLanguageForParser(psi);
    final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
    final CSharpLanguageVersionWrapper languageVersion = (CSharpLanguageVersionWrapper) (tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion);

    FileViewProvider viewProvider = ((PsiFile) psi).getViewProvider();
    VirtualFile virtualFile = viewProvider.getVirtualFile();
    if(virtualFile instanceof LightVirtualFile)
    {
        virtualFile = ((LightVirtualFile) virtualFile).getOriginalFile();
        // we need call second time, due second original file will be light
        if(virtualFile instanceof LightVirtualFile)
        {
            virtualFile = ((LightVirtualFile) virtualFile).getOriginalFile();
        }
    }
    if(virtualFile == null)
    {
        virtualFile = psi.getUserData(IndexingDataKeys.VIRTUAL_FILE);
    }

    Set<String> defVariables = Collections.emptySet();
    if(virtualFile != null)
    {
        List<String> variables = findVariables(virtualFile, project);

        if(variables != null)
        {
            defVariables = new HashSet<>(variables);
        }
    }

    final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, languageVersion, chameleon.getChars());
    builder.putUserData(PREPROCESSOR_VARIABLES, defVariables);

    final PsiParser parser = LanguageParserDefinitions.INSTANCE.forLanguage(languageForParser).createParser(languageVersion);
    return parser.parse(this, builder, languageVersion).getFirstChildNode();
}
项目:consulo    文件:CoreApplicationEnvironment.java   
public CoreApplicationEnvironment(@Nonnull Disposable parentDisposable) {
  myParentDisposable = parentDisposable;

  myFileTypeRegistry = new CoreFileTypeRegistry();

  myApplication = createApplication(myParentDisposable);
  ApplicationManager.setApplication(myApplication,
                                    new StaticGetter<>(myFileTypeRegistry),
                                    myParentDisposable);
  myLocalFileSystem = createLocalFileSystem();
  myJarFileSystem = createJarFileSystem();

  Extensions.registerAreaClass(ExtensionAreas.PROJECT, null);

  final MutablePicoContainer appContainer = myApplication.getPicoContainer();
  registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(DocumentImpl::new, null));

  VirtualFileSystem[] fs = {myLocalFileSystem, myJarFileSystem};
  VirtualFileManagerImpl virtualFileManager = new VirtualFileManagerImpl(fs, myApplication.getMessageBus());
  registerComponentInstance(appContainer, VirtualFileManager.class, virtualFileManager);

  registerApplicationExtensionPoint(ASTLazyFactory.EP.getExtensionPointName(), ASTLazyFactory.class);
  registerApplicationExtensionPoint(ASTLeafFactory.EP.getExtensionPointName(), ASTLeafFactory.class);
  registerApplicationExtensionPoint(ASTCompositeFactory.EP.getExtensionPointName(), ASTCompositeFactory.class);

  addExtension(ASTLazyFactory.EP.getExtensionPointName(), new DefaultASTLazyFactory());
  addExtension(ASTLeafFactory.EP.getExtensionPointName(), new DefaultASTLeafFactory());
  addExtension(ASTCompositeFactory.EP.getExtensionPointName(), new DefaultASTCompositeFactory());

  registerApplicationService(EncodingManager.class, new CoreEncodingRegistry());
  registerApplicationService(VirtualFilePointerManager.class, createVirtualFilePointerManager());
  registerApplicationService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl());
  registerApplicationService(ReferenceProvidersRegistry.class, new MockReferenceProvidersRegistry());
  registerApplicationService(StubTreeLoader.class, new CoreStubTreeLoader());
  registerApplicationService(PsiReferenceService.class, new PsiReferenceServiceImpl());
  registerApplicationService(MetaDataRegistrar.class, new MetaRegistry());

  registerApplicationService(ProgressManager.class, createProgressIndicatorProvider());

  registerApplicationService(JobLauncher.class, createJobLauncher());
  registerApplicationService(CodeFoldingSettings.class, new CodeFoldingSettings());
  registerApplicationService(CommandProcessor.class, new CoreCommandProcessor());
  myApplication.registerService(ApplicationInfo.class, ApplicationInfoImpl.class);
}