<commit_before>package com.intellij.psi.impl.source.tree;

import com.intellij.lang.ASTNode;
import com.intellij.lang.StdLanguages;
import com.intellij.lexer.JavaLexer;
import com.intellij.openapi.project.Project;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiManager;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.impl.source.parsing.JavaParsingContext;
import com.intellij.psi.tree.IChameleonElementType;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.java.IJavaDocElementType;
import com.intellij.util.CharTable;
import com.intellij.util.text.CharArrayUtil;

public interface JavaDocElementType {
  //chameleon
  IElementType DOC_TAG = new IJavaDocElementType("DOC_TAG");
  IElementType DOC_TAG_VALUE = new IJavaDocElementType("DOC_TAG_VALUE");
  IElementType DOC_INLINE_TAG = new IJavaDocElementType("DOC_INLINE_TAG");
  IElementType DOC_METHOD_OR_FIELD_REF = new IJavaDocElementType("DOC_METHOD_OR_FIELD_REF");
  IElementType DOC_PARAMETER_REF = new IJavaDocElementType("DOC_PARAMETER_REF");

  IElementType DOC_REFERENCE_HOLDER = new IChameleonElementType("DOC_REFERENCE_HOLDER", StdLanguages.JAVA){
    public ASTNode parseContents(ASTNode chameleon) {
      final char[] chars = ((LeafElement)chameleon).textToCharArray();
      final PsiManager manager = chameleon.getTreeParent().getPsi().getManager();
      final CharTable table = SharedImplUtil.findCharTableByTree(chameleon);
      //no language features from higher java language versions are present in javadoc
      JavaParsingContext context = new JavaParsingContext(table, LanguageLevel.JDK_1_3);
      return context.getJavadocParsing().parseJavaDocReference(chars, table, new JavaLexer(LanguageLevel.JDK_1_3),
                                                  ((LeafElement)chameleon).getState(), false, manager);
    }
    public boolean isParsable(CharSequence buffer, final Project project) {return false;}
  };

  IElementType DOC_TYPE_HOLDER = new IChameleonElementType("DOC_TYPE_HOLDER", StdLanguages.JAVA){
    public ASTNode parseContents(ASTNode chameleon) {
      final char[] chars = ((LeafElement)chameleon).textToCharArray();
      final PsiManager manager = chameleon.getTreeParent().getPsi().getManager();
      final CharTable table = SharedImplUtil.findCharTableByTree(chameleon);
      //no language features from higher java language versions are present in javadoc
      JavaParsingContext context = new JavaParsingContext(table, LanguageLevel.JDK_1_3);
      return context.getJavadocParsing().parseJavaDocReference(chars, table, new JavaLexer(LanguageLevel.JDK_1_3),
                                                  ((LeafElement)chameleon).getState(), true, manager);
    }
    public boolean isParsable(CharSequence buffer, final Project project) {return false;}
  };

  IElementType DOC_COMMENT = new IChameleonElementType("DOC_COMMENT", StdLanguages.JAVA){
    public ASTNode parseContents(ASTNode chameleon) {
      final char[] chars = ((LeafElement)chameleon).textToCharArray();
      final PsiManager manager = chameleon.getTreeParent().getPsi().getManager();
      final JavaParsingContext context = new JavaParsingContext(SharedImplUtil.findCharTableByTree(chameleon), manager.getEffectiveLanguageLevel());
      return context.getJavadocParsing().parseDocCommentText(manager, chars, 0, chars.length);
    }
    public boolean isParsable(CharSequence buffer, final Project project) {
      final JavaLexer lexer = new JavaLexer(LanguageLevel.JDK_1_5);<commit_msg>per module language level take3<commit_after>package com.intellij.psi.impl.source.tree;

import com.intellij.lang.ASTNode;
import com.intellij.lang.StdLanguages;
import com.intellij.lexer.JavaLexer;
import com.intellij.openapi.project.Project;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiManager;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.impl.source.parsing.JavaParsingContext;
import com.intellij.psi.tree.IChameleonElementType;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.java.IJavaDocElementType;
import com.intellij.util.CharTable;
import com.intellij.util.text.CharArrayUtil;

public interface JavaDocElementType {
  //chameleon
  IElementType DOC_TAG = new IJavaDocElementType("DOC_TAG");
  IElementType DOC_TAG_VALUE = new IJavaDocElementType("DOC_TAG_VALUE");
  IElementType DOC_INLINE_TAG = new IJavaDocElementType("DOC_INLINE_TAG");
  IElementType DOC_METHOD_OR_FIELD_REF = new IJavaDocElementType("DOC_METHOD_OR_FIELD_REF");
  IElementType DOC_PARAMETER_REF = new IJavaDocElementType("DOC_PARAMETER_REF");

  IElementType DOC_REFERENCE_HOLDER = new IChameleonElementType("DOC_REFERENCE_HOLDER", StdLanguages.JAVA){
    public ASTNode parseContents(ASTNode chameleon) {
      final char[] chars = ((LeafElement)chameleon).textToCharArray();
      final PsiManager manager = chameleon.getTreeParent().getPsi().getManager();
      final CharTable table = SharedImplUtil.findCharTableByTree(chameleon);
      //no language features from higher java language versions are present in javadoc
      JavaParsingContext context = new JavaParsingContext(table, LanguageLevel.JDK_1_3);
      return context.getJavadocParsing().parseJavaDocReference(chars, table, new JavaLexer(LanguageLevel.JDK_1_3),
                                                  ((LeafElement)chameleon).getState(), false, manager);
    }
    public boolean isParsable(CharSequence buffer, final Project project) {return false;}
  };

  IElementType DOC_TYPE_HOLDER = new IChameleonElementType("DOC_TYPE_HOLDER", StdLanguages.JAVA){
    public ASTNode parseContents(ASTNode chameleon) {
      final char[] chars = ((LeafElement)chameleon).textToCharArray();
      final PsiManager manager = chameleon.getTreeParent().getPsi().getManager();
      final CharTable table = SharedImplUtil.findCharTableByTree(chameleon);
      //no language features from higher java language versions are present in javadoc
      JavaParsingContext context = new JavaParsingContext(table, LanguageLevel.JDK_1_3);
      return context.getJavadocParsing().parseJavaDocReference(chars, table, new JavaLexer(LanguageLevel.JDK_1_3),
                                                  ((LeafElement)chameleon).getState(), true, manager);
    }
    public boolean isParsable(CharSequence buffer, final Project project) {return false;}
  };

  IElementType DOC_COMMENT = new IChameleonElementType("DOC_COMMENT", StdLanguages.JAVA){
    public ASTNode parseContents(ASTNode chameleon) {
      final char[] chars = ((LeafElement)chameleon).textToCharArray();
      final PsiManager manager = chameleon.getTreeParent().getPsi().getManager();
      //no higher java language level features are allowed in javadoc
      final JavaParsingContext context = new JavaParsingContext(SharedImplUtil.findCharTableByTree(chameleon), LanguageLevel.JDK_1_3);
      return context.getJavadocParsing().parseDocCommentText(manager, chars, 0, chars.length);
    }
    public boolean isParsable(CharSequence buffer, final Project project) {
      final JavaLexer lexer = new JavaLexer(LanguageLevel.JDK_1_5);
{'fraction_non_alphanumeric': 0.0907563025210084, 'fraction_numerical': 0.0035014005602240898, 'mean_word_length': 4.935993349958437, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5451165', 'n_tokens_mistral': 2259, 'n_tokens_neox': 2151, 'n_words': 417}