KT-1545, KT-3161 KDoc lexer & parser

This commit is contained in:
Sergey Rostov
2013-05-23 18:32:13 +04:00
committed by Mikhael Bogdanov
parent 2ad1bfa743
commit 5ff1f746d4
40 changed files with 1221 additions and 154 deletions
@@ -1,4 +0,0 @@
JetFile: DocCommentAtBeginningOfFile2.jet
PsiComment(DOC_COMMENT)('/**\n/**')
NAMESPACE_HEADER
<empty list>
@@ -1,4 +0,0 @@
JetFile: DocCommentAtBeginningOfFile3.jet
PsiComment(DOC_COMMENT)('/**\n\nfooo')
NAMESPACE_HEADER
<empty list>
@@ -1,4 +0,0 @@
JetFile: DocCommentAtBeginningOfFile4.jet
PsiComment(DOC_COMMENT)('/**\n\n/**foo*/\n\nasdfas')
NAMESPACE_HEADER
<empty list>
+8 -2
View File
@@ -25,7 +25,10 @@ JetFile: EOLsInComments.jet
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiWhiteSpace('\n ')
PsiComment(DOC_COMMENT)('/** */')
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace(' ')
PsiElement(KDOC_END)('*/')
PREFIX_EXPRESSION
OPERATION_REFERENCE
PsiElement(PLUS)('+')
@@ -72,7 +75,10 @@ JetFile: EOLsInComments.jet
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiWhiteSpace(' ')
PsiComment(DOC_COMMENT)('/**\n */')
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(PLUS)('+')
+16 -3
View File
@@ -32,17 +32,30 @@ JetFile: NestedComments.jet
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiWhiteSpace('\n')
PsiComment(DOC_COMMENT)('/***/')
KDoc
PsiElement(KDOC_START)('/**')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiWhiteSpace('\n')
PsiComment(DOC_COMMENT)('/** /***/*/')
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('/***/')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiWhiteSpace('\n')
PsiComment(DOC_COMMENT)('/** /**\n\n*/***/')
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('/**')
PsiWhiteSpace('\n\n')
PsiElement(KDOC_LEADING_ASTERISK)('*')
PsiElement(KDOC_TEXT)('/**')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
@@ -1,5 +1,44 @@
JetFile: MutableArray.jet
PsiComment(DOC_COMMENT)('/**\n These declarations are "shallow" in the sense that they are not really compiled, only the type-checker uses them\n*/')
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_TEXT)('These')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('declarations')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('are')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('"shallow"')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('in')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('the')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('sense')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('that')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('they')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('are')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('not')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('really')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('compiled,')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('only')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('the')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('type-checker')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('uses')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('them')
PsiWhiteSpace('\n')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n\n')
NAMESPACE_HEADER
<empty list>
@@ -1,4 +1,5 @@
JetFile: DocCommentAtBeginningOfFile1.jet
PsiComment(DOC_COMMENT)('/**')
KDoc
PsiElement(KDOC_START)('/**')
NAMESPACE_HEADER
<empty list>
@@ -0,0 +1,7 @@
JetFile: DocCommentAtBeginningOfFile2.jet
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n')
PsiElement(KDOC_TEXT)('/**')
NAMESPACE_HEADER
<empty list>
@@ -0,0 +1,7 @@
JetFile: DocCommentAtBeginningOfFile3.jet
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n\n')
PsiElement(KDOC_TEXT)('fooo')
NAMESPACE_HEADER
<empty list>
@@ -0,0 +1,9 @@
JetFile: DocCommentAtBeginningOfFile4.jet
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n\n')
PsiElement(KDOC_TEXT)('/**foo*/')
PsiWhiteSpace('\n\n')
PsiElement(KDOC_TEXT)('asdfas')
NAMESPACE_HEADER
<empty list>
@@ -0,0 +1,2 @@
/**
*/
@@ -0,0 +1,7 @@
JetFile: EndOnLeadingAsterisks.kt
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_END)('*/')
NAMESPACE_HEADER
<empty list>
@@ -0,0 +1 @@
/**text*/
@@ -0,0 +1,7 @@
JetFile: EndRightAfterText.kt
KDoc
PsiElement(KDOC_START)('/**')
PsiElement(KDOC_TEXT)('text')
PsiElement(KDOC_END)('*/')
NAMESPACE_HEADER
<empty list>
+2
View File
@@ -0,0 +1,2 @@
/**
contents
@@ -0,0 +1,7 @@
JetFile: Incomplete.kt
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_TEXT)('contents')
NAMESPACE_HEADER
<empty list>
+7
View File
@@ -0,0 +1,7 @@
/** line 0
line 1 //
** line 2 /*
line 3 /**
* line * 4
*** line */ 5
** line 6 */
+52
View File
@@ -0,0 +1,52 @@
JetFile: Simple.kt
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('line')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('0')
PsiWhiteSpace('\n ')
PsiElement(KDOC_TEXT)('line')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('1')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('//')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('**')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('line')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('2')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('/*')
PsiWhiteSpace('\n ')
PsiElement(KDOC_TEXT)('line')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('3')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('/**')
PsiWhiteSpace('\n')
PsiElement(KDOC_LEADING_ASTERISK)('*')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('line')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('*')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('4')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('***')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('line')
PsiWhiteSpace(' */')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('5')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('**')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('line')
PsiWhiteSpace(' ')
PsiElement(KDOC_TEXT)('6')
PsiWhiteSpace(' ')
PsiElement(KDOC_END)('*/')
NAMESPACE_HEADER
<empty list>
@@ -0,0 +1,3 @@
/**
**test
*/
@@ -0,0 +1,10 @@
JetFile: TextRightAfterLeadAsterisks.kt
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n')
PsiElement(KDOC_LEADING_ASTERISK)('**')
PsiElement(KDOC_TEXT)('test')
PsiWhiteSpace('\n ')
PsiElement(KDOC_END)('*/')
NAMESPACE_HEADER
<empty list>