Do not parse '@' as a part of modifier
This commit is contained in:
@@ -456,9 +456,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
atSet(CONSTRUCTOR_KEYWORD, WHERE_KEYWORD)) break;
|
||||
|
||||
if (at(AT)) {
|
||||
if (!tryParseModifier(tokenConsumer)) {
|
||||
parseAnnotationOrList(annotationParsingMode);
|
||||
}
|
||||
parseAnnotationOrList(annotationParsingMode);
|
||||
}
|
||||
else if (tryParseModifier(tokenConsumer)) {
|
||||
// modifier advanced
|
||||
@@ -483,15 +481,6 @@ public class JetParsing extends AbstractJetParsing {
|
||||
private boolean tryParseModifier(@Nullable Consumer<IElementType> tokenConsumer) {
|
||||
PsiBuilder.Marker marker = mark();
|
||||
|
||||
if (at(AT) && !WHITE_SPACE_OR_COMMENT_BIT_SET.contains(myBuilder.rawLookup(1))) {
|
||||
advance(); // AT
|
||||
if (atSet(ANNOTATION_MODIFIERS_KEYWORDS)) {
|
||||
myBuilder.remapCurrentToken(IDENTIFIER);
|
||||
marker.rollbackTo();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (atSet(MODIFIER_KEYWORDS)) {
|
||||
IElementType tt = tt();
|
||||
if (tokenConsumer != null) {
|
||||
|
||||
+7
-1
@@ -122,7 +122,13 @@ JetFile: enumEntries.kt
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Ann')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('@private')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('Q')
|
||||
|
||||
@@ -5,8 +5,14 @@ JetFile: modifierAtFileStart.kt
|
||||
<empty list>
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
PsiElement(public)('@public')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
+14
-2
@@ -128,7 +128,13 @@ JetFile: primaryConstructor.kt
|
||||
PsiElement(IDENTIFIER)('Ann4')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('@private')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
@@ -204,7 +210,13 @@ JetFile: primaryConstructor.kt
|
||||
PsiElement(IDENTIFIER)('Ann5')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('@private')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
|
||||
+89
-14
@@ -7,7 +7,13 @@ JetFile: validDeclarations.kt
|
||||
MODIFIER_LIST
|
||||
PsiElement(private)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(open)('@open')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('open')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION
|
||||
PsiElement(AT)('@')
|
||||
@@ -122,7 +128,13 @@ JetFile: validDeclarations.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
PsiElement(private)('@private')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(var)('var')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -137,7 +149,13 @@ JetFile: validDeclarations.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
PsiElement(open)('@open')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('open')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('z')
|
||||
PsiElement(COLON)(':')
|
||||
@@ -154,7 +172,13 @@ JetFile: validDeclarations.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiElement(private)('@private')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION
|
||||
PsiElement(AT)('@')
|
||||
@@ -284,7 +308,13 @@ JetFile: validDeclarations.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(private)('private')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(abstract)('@abstract')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('abstract')
|
||||
PsiWhiteSpace('\n ')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
@@ -315,7 +345,13 @@ JetFile: validDeclarations.kt
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
PsiElement(vararg)('@vararg')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('vararg')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
@@ -381,7 +417,13 @@ JetFile: validDeclarations.kt
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(open)('@open')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('open')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(get)('get')
|
||||
PsiElement(LPAR)('(')
|
||||
@@ -394,7 +436,13 @@ JetFile: validDeclarations.kt
|
||||
PsiWhiteSpace('\n\n ')
|
||||
ANONYMOUS_INITIALIZER
|
||||
MODIFIER_LIST
|
||||
PsiElement(open)('@open')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('open')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
@@ -412,15 +460,30 @@ JetFile: validDeclarations.kt
|
||||
PsiWhiteSpace('\n\n ')
|
||||
OBJECT_DECLARATION
|
||||
MODIFIER_LIST
|
||||
PsiElement(companion)('@companion')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('companion')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(object)('object')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiErrorElement:Name expected
|
||||
PsiElement(AT)('@')
|
||||
OBJECT_DECLARATION
|
||||
MODIFIER_LIST
|
||||
PsiElement(companion)('@companion')
|
||||
PsiElement(companion)('companion')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('@private')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(object)('object')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -438,7 +501,13 @@ JetFile: validDeclarations.kt
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('main')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiElement(private)('@private')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('private')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(constructor)('constructor')
|
||||
VALUE_PARAMETER_LIST
|
||||
@@ -504,7 +573,13 @@ JetFile: validDeclarations.kt
|
||||
PsiWhiteSpace('\n')
|
||||
PROPERTY
|
||||
MODIFIER_LIST
|
||||
PsiElement(private)('@private')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
+7
-1
@@ -83,7 +83,13 @@ JetFile: valid.kt
|
||||
PsiWhiteSpace(' ')
|
||||
PRIMARY_CONSTRUCTOR
|
||||
MODIFIER_LIST
|
||||
PsiElement(private)('@private')
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(constructor)('constructor')
|
||||
VALUE_PARAMETER_LIST
|
||||
|
||||
@@ -7,7 +7,7 @@ modifiers
|
||||
;
|
||||
|
||||
modifier
|
||||
: "@"? ++ modifierKeyword
|
||||
: modifierKeyword
|
||||
;
|
||||
|
||||
modifierKeyword
|
||||
|
||||
@@ -1,27 +1,11 @@
|
||||
@<caret>[]
|
||||
|
||||
// EXIST: {"lookupString":"abstract","itemText":"abstract","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"class","itemText":"class","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"companion object","itemText":"companion object","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"enum","itemText":"enum","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"final","itemText":"final","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"fun","itemText":"fun","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"in","itemText":"in","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"inner","itemText":"inner","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"interface","itemText":"interface","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"internal","itemText":"internal","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"object","itemText":"object","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"open","itemText":"open","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"out","itemText":"out","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"override","itemText":"override","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"package","itemText":"package","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"private","itemText":"private","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"protected","itemText":"protected","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"public","itemText":"public","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"reified","itemText":"reified","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"sealed","itemText":"sealed","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"val","itemText":"val","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"var","itemText":"var","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"vararg","itemText":"vararg","attributes":"bold"}
|
||||
// EXIST: {"lookupString":"lateinit","itemText":"lateinit","attributes":"bold"}
|
||||
// NOTHING_ELSE
|
||||
|
||||
Reference in New Issue
Block a user