protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi) {
    Project project = psi.getProject();
    Language languageForParser = getLanguageForParser(psi);
    PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, chameleon.getChars());
    PsiParser parser = LanguageParserDefinitions.INSTANCE.forLanguage(languageForParser).createParser(project);
    long startTime = System.nanoTime();
    ASTNode node = parser.parse(this, builder);
    ParsingDiagnostics.registerParse(builder, languageForParser, System.nanoTime() - startTime);
    return node.getFirstChildNode();
  }
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)