LeafElement (@NotNull IElementType type, @NotNull CharSequence text) { if (type == JavaTokenType.C_STYLE_COMMENT || type == JavaTokenType.END_OF_LINE_COMMENT) { return myDefaultASTFactory.createComment(type, text); } if (type == JavaTokenType.IDENTIFIER) { return new PsiIdentifierImpl(text); } if (ElementType.KEYWORD_BIT_SET.contains(type)) { return new PsiKeywordImpl(type, text); } if (ElementType.STRING_TEMPLATE_FRAGMENTS.contains(type)) { return new PsiFragmentImpl(type, text); } if (type instanceof IJavaElementType) { return new PsiJavaTokenImpl(type, text); } if (type instanceof IJavaDocElementType) { if (type == JavaDocElementType.DOC_SNIPPET_ATTRIBUTE_VALUE) { return new PsiSnippetAttributeValueImpl(text); } assert type != JavaDocElementType.DOC_TAG_VALUE_ELEMENT; return new PsiDocTokenImpl(type, text); } return null; }