correctly parse tag in the beginning of doc comment

This commit is contained in:
Dmitry Jemerov
2015-02-02 15:19:50 +01:00
parent 1c87464695
commit 223882d292
5 changed files with 33 additions and 28 deletions
@@ -59,7 +59,7 @@ CODE_LINK=\[{CODE_LINK_START}{CODE_LINK_CHAR}*\]
%%
<YYINITIAL> "/**" { yybegin(CONTENTS);
<YYINITIAL> "/**" { yybegin(CONTENTS_BEGINNING);
return KDocTokens.START; }
"*"+ "/" { if (isLastToken()) return KDocTokens.END;
else return KDocTokens.TEXT; }
@@ -1,20 +1,4 @@
/*
* 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.
*/
/* The following code was generated by JFlex 1.4.3 on 1/19/15 8:28 PM */
/* The following code was generated by JFlex 1.4.3 on 2/2/15 2:35 PM */
package org.jetbrains.kotlin.kdoc.lexer;
@@ -28,7 +12,7 @@ import java.lang.Character;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 1/19/15 8:28 PM from the specification file
* on 2/2/15 2:35 PM from the specification file
* <tt>/Users/yole/jetbrains/kotlin/compiler/frontend/src/org/jetbrains/kotlin/kdoc/lexer/KDoc.flex</tt>
*/
class _KDocLexer implements FlexLexer {
@@ -582,37 +566,37 @@ class _KDocLexer implements FlexLexer {
}
}
case 13: break;
case 11:
{ yybegin(CONTENTS_BEGINNING);
return KDocTokens.START;
}
case 14: break;
case 7:
{ yybegin(CONTENTS);
return KDocTokens.TEXT_OR_LINK;
}
case 14: break;
case 15: break;
case 8:
{ if (isLastToken()) return KDocTokens.END;
else return KDocTokens.TEXT;
}
case 15: break;
case 16: break;
case 5:
{ yybegin(CONTENTS);
return KDocTokens.TEXT;
}
case 16: break;
case 17: break;
case 6:
{ if (yytextContainLineBreaks()) {
yybegin(LINE_BEGINNING);
}
return TokenType.WHITE_SPACE;
}
case 17: break;
case 18: break;
case 12:
{ yybegin(CONTENTS);
return KDocTokens.MARKDOWN_LINK;
}
case 18: break;
case 11:
{ yybegin(CONTENTS);
return KDocTokens.START;
}
case 19: break;
case 10:
{ yybegin(TAG_BEGINNING);
@@ -0,0 +1 @@
/** @param a this is a */
@@ -0,0 +1,14 @@
JetFile: ParamTagAtStart.kt
PACKAGE_DIRECTIVE
<empty list>
KDoc
PsiElement(KDOC_START)('/**')
KDOC_SECTION
PsiElement(KDOC_TEXT)(' ')
KDOC_TAG
PsiElement(KDOC_TAG_NAME)('@param')
PsiWhiteSpace(' ')
KDOC_LINK
PsiElement(KDOC_TEXT_OR_LINK)('a')
PsiElement(KDOC_TEXT)(' this is a ')
PsiElement(KDOC_END)('*/')
@@ -1091,6 +1091,12 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
doParsingTest(fileName);
}
@TestMetadata("ParamTagAtStart.kt")
public void testParamTagAtStart() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/kdoc/ParamTagAtStart.kt");
doParsingTest(fileName);
}
@TestMetadata("ReturnWithBrackets.kt")
public void testReturnWithBrackets() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/kdoc/ReturnWithBrackets.kt");