FIC: Parse fun keyword in front of interface as a modifier

This commit is contained in:
Mikhail Zarechenskiy
2019-11-12 01:07:59 +03:00
parent 174b3db723
commit 4aa195e912
7 changed files with 218 additions and 4 deletions
+11
View File
@@ -0,0 +1,11 @@
interface fun Foo
fun private interface Foo
fun @Bar interface Foo
fun class Foo
fun abstract class Foo
fun object Foo
+79
View File
@@ -0,0 +1,79 @@
KtFile: kotlinFunInterface_ERR.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
CLASS
PsiElement(interface)('interface')
PsiErrorElement:Name expected
<empty list>
PsiWhiteSpace(' ')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiErrorElement:Expecting '('
<empty list>
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('private')
PsiErrorElement:Expecting '('
<empty list>
PsiWhiteSpace(' ')
CLASS
PsiElement(interface)('interface')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiErrorElement:Annotations are not allowed in this position
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Bar')
PsiErrorElement:Expecting function name or receiver type
<empty list>
PsiWhiteSpace(' ')
CLASS
PsiElement(interface)('interface')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiErrorElement:Expecting function name or receiver type
<empty list>
PsiWhiteSpace(' ')
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('abstract')
PsiErrorElement:Expecting '('
<empty list>
PsiWhiteSpace(' ')
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiErrorElement:Expecting function name or receiver type
<empty list>
PsiWhiteSpace(' ')
OBJECT_DECLARATION
PsiElement(object)('object')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
+17
View File
@@ -0,0 +1,17 @@
fun interface Foo
fun interface Foo {
fun invoke()
}
private fun interface Foo
@Bar
fun interface Foo
class TopLevel {
fun interface Foo
}
fun
interface Foo
+85
View File
@@ -0,0 +1,85 @@
KtFile: validKotlinFunInterface.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
CLASS
MODIFIER_LIST
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(interface)('interface')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(interface)('interface')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('invoke')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(private)('private')
PsiWhiteSpace(' ')
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(interface)('interface')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Bar')
PsiWhiteSpace('\n')
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(interface)('interface')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('TopLevel')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
CLASS
MODIFIER_LIST
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(interface)('interface')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(fun)('fun')
PsiWhiteSpace('\n')
PsiElement(interface)('interface')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')