introduce the concept of sections
This commit is contained in:
@@ -17,9 +17,11 @@
|
||||
package org.jetbrains.kotlin.kdoc.parser;
|
||||
|
||||
import org.jetbrains.kotlin.kdoc.psi.impl.KDocLink;
|
||||
import org.jetbrains.kotlin.kdoc.psi.impl.KDocSection;
|
||||
import org.jetbrains.kotlin.kdoc.psi.impl.KDocTag;
|
||||
|
||||
public class KDocElementTypes {
|
||||
public static final KDocElementType KDOC_SECTION = new KDocElementType("KDOC_SECTION", KDocSection.class);
|
||||
public static final KDocElementType KDOC_TAG = new KDocElementType("KDOC_TAG", KDocTag.class);
|
||||
public static final KDocElementType KDOC_LINK = new KDocElementType("KDOC_LINK", KDocLink.class);
|
||||
}
|
||||
|
||||
@@ -17,24 +17,32 @@
|
||||
package org.jetbrains.kotlin.kdoc.parser;
|
||||
|
||||
public enum KDocKnownTag {
|
||||
AUTHOR(false),
|
||||
THROWS(true),
|
||||
EXCEPTION(true),
|
||||
PARAM(true),
|
||||
RETURN(false),
|
||||
SEE(false),
|
||||
SINCE(false);
|
||||
AUTHOR(false, false),
|
||||
THROWS(true, false),
|
||||
EXCEPTION(true, false),
|
||||
PARAM(true, false),
|
||||
RETURN(false, false),
|
||||
SEE(false, false),
|
||||
SINCE(false, false),
|
||||
CONSTRUCTOR(false, true),
|
||||
PROPERTY(true, true);
|
||||
|
||||
private final boolean takesReference;
|
||||
private final boolean startsSection;
|
||||
|
||||
KDocKnownTag(boolean takesReference) {
|
||||
KDocKnownTag(boolean takesReference, boolean startsSection) {
|
||||
this.takesReference = takesReference;
|
||||
this.startsSection = startsSection;
|
||||
}
|
||||
|
||||
public boolean isReferenceRequired() {
|
||||
return takesReference;
|
||||
}
|
||||
|
||||
public boolean isSectionStart() {
|
||||
return startsSection;
|
||||
}
|
||||
|
||||
public static KDocKnownTag findByTagName(String tagName) {
|
||||
if (tagName.startsWith("@")) {
|
||||
try {
|
||||
|
||||
@@ -28,30 +28,48 @@ public class KDocParser implements PsiParser {
|
||||
@NotNull
|
||||
public ASTNode parse(IElementType root, PsiBuilder builder) {
|
||||
PsiBuilder.Marker rootMarker = builder.mark();
|
||||
if (builder.getTokenType() == KDocTokens.START) {
|
||||
builder.advanceLexer();
|
||||
}
|
||||
PsiBuilder.Marker currentSectionMarker = builder.mark();
|
||||
|
||||
// todo: parse KDoc tags, markdown, etc...
|
||||
while (!builder.eof()) {
|
||||
if (builder.getTokenType() == KDocTokens.TAG_NAME) {
|
||||
parseTag(builder);
|
||||
currentSectionMarker = parseTag(builder, currentSectionMarker);
|
||||
}
|
||||
else if (builder.getTokenType() == KDocTokens.MARKDOWN_LINK) {
|
||||
PsiBuilder.Marker linkStart = builder.mark();
|
||||
builder.advanceLexer();
|
||||
linkStart.done(KDocElementTypes.KDOC_LINK);
|
||||
}
|
||||
else if (builder.getTokenType() == KDocTokens.END) {
|
||||
if (currentSectionMarker != null) {
|
||||
currentSectionMarker.done(KDocElementTypes.KDOC_SECTION);
|
||||
currentSectionMarker = null;
|
||||
}
|
||||
builder.advanceLexer();
|
||||
}
|
||||
else {
|
||||
builder.advanceLexer();
|
||||
}
|
||||
}
|
||||
|
||||
if (currentSectionMarker != null) {
|
||||
currentSectionMarker.done(KDocElementTypes.KDOC_SECTION);
|
||||
}
|
||||
rootMarker.done(root);
|
||||
return builder.getTreeBuilt();
|
||||
}
|
||||
|
||||
private static void parseTag(PsiBuilder builder) {
|
||||
PsiBuilder.Marker tagStart = builder.mark();
|
||||
private static PsiBuilder.Marker parseTag(PsiBuilder builder, PsiBuilder.Marker currentSectionMarker) {
|
||||
String tagName = builder.getTokenText();
|
||||
KDocKnownTag knownTag = KDocKnownTag.findByTagName(tagName);
|
||||
if (knownTag != null && knownTag.isSectionStart()) {
|
||||
currentSectionMarker.done(KDocElementTypes.KDOC_SECTION);
|
||||
currentSectionMarker = builder.mark();
|
||||
}
|
||||
PsiBuilder.Marker tagStart = builder.mark();
|
||||
builder.advanceLexer();
|
||||
|
||||
if (knownTag != null && knownTag.isReferenceRequired() && builder.getTokenType() == KDocTokens.TEXT_OR_LINK) {
|
||||
@@ -71,6 +89,7 @@ public class KDocParser implements PsiParser {
|
||||
}
|
||||
}
|
||||
tagStart.done(KDocElementTypes.KDOC_TAG);
|
||||
return currentSectionMarker;
|
||||
}
|
||||
|
||||
private static boolean isAtEndOfTag(PsiBuilder builder) {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.kdoc.psi.impl;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* The part of a doc comment which describes a single class, method or property
|
||||
* produced by the element being documented. For example, the doc comment of a class
|
||||
* can have sections for the class itself, its primary constructor and each of the
|
||||
* properties defined in the primary constructor.
|
||||
*/
|
||||
public class KDocSection extends KDocElementImpl {
|
||||
public KDocSection(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
}
|
||||
@@ -64,8 +64,9 @@ JetFile: CommentsBinding.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for A')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for A')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n')
|
||||
@@ -128,7 +129,8 @@ JetFile: CommentsBinding.kt
|
||||
PROPERTY
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)(' v2 doc comment ')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)(' v2 doc comment ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(val)('val')
|
||||
@@ -356,7 +358,8 @@ JetFile: CommentsBinding.kt
|
||||
ENUM_ENTRY
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)(' This is B ')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)(' This is B ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace(' ')
|
||||
OBJECT_DECLARATION_NAME
|
||||
@@ -371,7 +374,8 @@ JetFile: CommentsBinding.kt
|
||||
ENUM_ENTRY
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)(' This is X ')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)(' This is X ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n ')
|
||||
OBJECT_DECLARATION_NAME
|
||||
|
||||
@@ -18,8 +18,9 @@ JetFile: DocCommentAfterFileAnnotations.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n')
|
||||
|
||||
@@ -5,8 +5,9 @@ JetFile: DocCommentForFirstDeclaration.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n')
|
||||
|
||||
@@ -12,7 +12,8 @@ JetFile: DocCommentOnPackageDirectiveLine.kt
|
||||
FUN
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)(' some ')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)(' some ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -5,8 +5,9 @@ JetFile: DocCommentsBinding.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for A')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for A')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n')
|
||||
@@ -22,8 +23,9 @@ JetFile: DocCommentsBinding.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for val-parameter')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for val-parameter')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n ')
|
||||
@@ -47,8 +49,9 @@ JetFile: DocCommentsBinding.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for function')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for function')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n ')
|
||||
@@ -66,8 +69,9 @@ JetFile: DocCommentsBinding.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for local function')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for local function')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n ')
|
||||
@@ -87,8 +91,9 @@ JetFile: DocCommentsBinding.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for local class')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for local class')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n ')
|
||||
@@ -102,8 +107,9 @@ JetFile: DocCommentsBinding.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for property')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for property')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n ')
|
||||
@@ -120,7 +126,8 @@ JetFile: DocCommentsBinding.kt
|
||||
PROPERTY_ACCESSOR
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for getter ')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for getter ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(get)('get')
|
||||
@@ -135,7 +142,8 @@ JetFile: DocCommentsBinding.kt
|
||||
PROPERTY_ACCESSOR
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for setter ')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for setter ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(set)('set')
|
||||
@@ -155,8 +163,9 @@ JetFile: DocCommentsBinding.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for B')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Doc comment for B')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n')
|
||||
|
||||
@@ -27,7 +27,8 @@ JetFile: EOLsInComments.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PREFIX_EXPRESSION
|
||||
OPERATION_REFERENCE
|
||||
@@ -78,6 +79,8 @@ JetFile: EOLsInComments.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
KDOC_SECTION
|
||||
<empty list>
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace(' ')
|
||||
OPERATION_REFERENCE
|
||||
|
||||
@@ -34,6 +34,8 @@ JetFile: NestedComments.kt
|
||||
PsiWhiteSpace('\n')
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
KDOC_SECTION
|
||||
<empty list>
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -41,7 +43,8 @@ JetFile: NestedComments.kt
|
||||
PsiWhiteSpace('\n')
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)(' /***/')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)(' /***/')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -49,9 +52,10 @@ JetFile: NestedComments.kt
|
||||
PsiWhiteSpace('\n')
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)(' /**')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(KDOC_TEXT)('*/')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)(' /**')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(KDOC_TEXT)('*/')
|
||||
PsiElement(KDOC_END)('***/')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
|
||||
@@ -5,7 +5,8 @@ JetFile: MutableArray.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_TEXT)('These declarations are "shallow" in the sense that they are not really compiled, only the type-checker uses them')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)('These declarations are "shallow" in the sense that they are not really compiled, only the type-checker uses them')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
PsiWhiteSpace('\n\n')
|
||||
|
||||
@@ -4,15 +4,16 @@ JetFile: AtTags.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@tag')
|
||||
PsiWhiteSpace('\n ')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' text @notATag')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' @')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@tag')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' text @notATag')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' @')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
@@ -2,4 +2,6 @@ JetFile: DocCommentAtBeginningOfFile1.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_START)('/**')
|
||||
KDOC_SECTION
|
||||
<empty list>
|
||||
@@ -4,4 +4,5 @@ JetFile: DocCommentAtBeginningOfFile2.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(KDOC_TEXT)('/**')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)('/**')
|
||||
@@ -4,4 +4,5 @@ JetFile: DocCommentAtBeginningOfFile3.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(KDOC_TEXT)('fooo')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)('fooo')
|
||||
@@ -4,6 +4,7 @@ JetFile: DocCommentAtBeginningOfFile4.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(KDOC_TEXT)('/**foo*/')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(KDOC_TEXT)('asdfas')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)('/**foo*/')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(KDOC_TEXT)('asdfas')
|
||||
@@ -4,4 +4,6 @@ JetFile: EndOnLeadingAsterisks.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
KDOC_SECTION
|
||||
<empty list>
|
||||
PsiElement(KDOC_END)('*/')
|
||||
@@ -3,5 +3,6 @@ JetFile: EndRightAfterText.kt
|
||||
<empty list>
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)('text')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)('text')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
@@ -4,4 +4,5 @@ JetFile: Incomplete.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_TEXT)('contents')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)('contents')
|
||||
@@ -4,26 +4,27 @@ JetFile: Markdown.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_LINK
|
||||
PsiElement(KDOC_MARKDOWN_LINK)('[WikiLink]')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
PsiElement(KDOC_MARKDOWN_ESCAPED_CHAR)('\[')
|
||||
PsiElement(KDOC_TEXT)('NotALink]')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' [')
|
||||
KDOC_LINK
|
||||
PsiElement(KDOC_MARKDOWN_LINK)('[DoubleQuotedLink]')
|
||||
PsiElement(KDOC_TEXT)(']')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Just ')
|
||||
PsiElement(KDOC_MARKDOWN_ESCAPED_CHAR)('\[')
|
||||
PsiElement(KDOC_TEXT)(' and ')
|
||||
PsiElement(KDOC_MARKDOWN_ESCAPED_CHAR)('\]')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_LINK
|
||||
PsiElement(KDOC_MARKDOWN_LINK)('[WikiLink]')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
PsiElement(KDOC_MARKDOWN_ESCAPED_CHAR)('\[')
|
||||
PsiElement(KDOC_TEXT)('NotALink]')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' [')
|
||||
KDOC_LINK
|
||||
PsiElement(KDOC_MARKDOWN_LINK)('[DoubleQuotedLink]')
|
||||
PsiElement(KDOC_TEXT)(']')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' Just ')
|
||||
PsiElement(KDOC_MARKDOWN_ESCAPED_CHAR)('\[')
|
||||
PsiElement(KDOC_TEXT)(' and ')
|
||||
PsiElement(KDOC_MARKDOWN_ESCAPED_CHAR)('\]')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
@@ -4,13 +4,14 @@ JetFile: ParamTag.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@param')
|
||||
PsiWhiteSpace(' ')
|
||||
KDOC_LINK
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('a')
|
||||
PsiElement(KDOC_TEXT)(' The description of a.')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@param')
|
||||
PsiWhiteSpace(' ')
|
||||
KDOC_LINK
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('a')
|
||||
PsiElement(KDOC_TEXT)(' The description of a.')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
@@ -4,20 +4,21 @@ JetFile: ReturnWithBrackets.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@return')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('This')
|
||||
PsiElement(KDOC_TEXT)(' is not a reference')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@return')
|
||||
KDOC_LINK
|
||||
PsiElement(KDOC_MARKDOWN_LINK)('[x]')
|
||||
PsiElement(KDOC_TEXT)(' This is a reference')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@return')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('This')
|
||||
PsiElement(KDOC_TEXT)(' is not a reference')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@return')
|
||||
KDOC_LINK
|
||||
PsiElement(KDOC_MARKDOWN_LINK)('[x]')
|
||||
PsiElement(KDOC_TEXT)(' This is a reference')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* This is the doc comment for a class.
|
||||
* @param T a type parameter.
|
||||
* @constructor This is the doc comment for the primary constructor.
|
||||
* @param a a constructor parameter.
|
||||
*/
|
||||
@@ -0,0 +1,38 @@
|
||||
JetFile: Sections.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' This is the doc comment for a class.')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@param')
|
||||
PsiWhiteSpace(' ')
|
||||
KDOC_LINK
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('T')
|
||||
PsiElement(KDOC_TEXT)(' a type parameter.')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_SECTION
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@constructor')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('This')
|
||||
PsiElement(KDOC_TEXT)(' is the doc comment for the primary constructor.')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@param')
|
||||
PsiWhiteSpace(' ')
|
||||
KDOC_LINK
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('a')
|
||||
PsiElement(KDOC_TEXT)(' a constructor parameter.')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
@@ -3,21 +3,22 @@ JetFile: Simple.kt
|
||||
<empty list>
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiElement(KDOC_TEXT)(' line 0')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_TEXT)('line 1 //')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('**')
|
||||
PsiElement(KDOC_TEXT)(' line 2 /*')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_TEXT)('line 3 /**')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' line * 4')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('***')
|
||||
PsiElement(KDOC_TEXT)(' line */ 5')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('**')
|
||||
PsiElement(KDOC_TEXT)(' line 6 ')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_TEXT)(' line 0')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_TEXT)('line 1 //')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('**')
|
||||
PsiElement(KDOC_TEXT)(' line 2 /*')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_TEXT)('line 3 /**')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' line * 4')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('***')
|
||||
PsiElement(KDOC_TEXT)(' line */ 5')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('**')
|
||||
PsiElement(KDOC_TEXT)(' line 6 ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
@@ -4,7 +4,8 @@ JetFile: TextRightAfterLeadAsterisks.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('**')
|
||||
PsiElement(KDOC_TEXT)('test')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('**')
|
||||
PsiElement(KDOC_TEXT)('test')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
@@ -4,19 +4,20 @@ JetFile: TwoTags.kt
|
||||
KDoc
|
||||
PsiElement(KDOC_START)('/**')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@author')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('Dmitry')
|
||||
PsiElement(KDOC_TEXT)(' Jemerov')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@since')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('M12')
|
||||
KDOC_SECTION
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@author')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('Dmitry')
|
||||
PsiElement(KDOC_TEXT)(' Jemerov')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_LEADING_ASTERISK)('*')
|
||||
PsiElement(KDOC_TEXT)(' ')
|
||||
KDOC_TAG
|
||||
PsiElement(KDOC_TAG_NAME)('@since')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(KDOC_TEXT_OR_LINK)('M12')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(KDOC_END)('*/')
|
||||
@@ -1097,6 +1097,12 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Sections.kt")
|
||||
public void testSections() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/kdoc/Sections.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/kdoc/Simple.kt");
|
||||
|
||||
Reference in New Issue
Block a user