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