Minor, get rid of repeating parsing semantics
This commit is contained in:
@@ -442,14 +442,8 @@ public class JetParsing extends AbstractJetParsing {
|
||||
if (annotationParsingMode == PRIMARY_CONSTRUCTOR_MODIFIER_LIST && atSet(CONSTRUCTOR_KEYWORD, WHERE_KEYWORD)) break;
|
||||
|
||||
if (at(AT)) {
|
||||
IElementType strictlyNextToken = myBuilder.rawLookup(1);
|
||||
if (strictlyNextToken == IDENTIFIER || MODIFIER_KEYWORDS.contains(strictlyNextToken)) {
|
||||
if (!tryParseModifier(tokenConsumer)) {
|
||||
parseAnnotationEntry();
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorAndAdvance("Expected modifier or annotation after '@'"); // AT
|
||||
if (!tryParseModifier(tokenConsumer)) {
|
||||
parseAnnotation(annotationParsingMode);
|
||||
}
|
||||
}
|
||||
else if (tryParseModifier(tokenConsumer)) {
|
||||
@@ -475,7 +469,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
private boolean tryParseModifier(@Nullable Consumer<IElementType> tokenConsumer) {
|
||||
PsiBuilder.Marker marker = mark();
|
||||
|
||||
if (at(AT)) {
|
||||
if (at(AT) && !WHITE_SPACE_OR_COMMENT_BIT_SET.contains(myBuilder.rawLookup(1))) {
|
||||
advance(); // AT
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
MODIFIER_LIST
|
||||
PsiElement(private)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION
|
||||
@@ -49,7 +49,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('private')
|
||||
@@ -67,7 +67,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('private')
|
||||
@@ -85,7 +85,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(open)('open')
|
||||
@@ -105,7 +105,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
@@ -120,7 +120,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
@@ -139,7 +139,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
PsiWhiteSpace('\n\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
ANNOTATION
|
||||
@@ -179,7 +179,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(private)('private')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
ANNOTATION_ENTRY
|
||||
@@ -211,7 +211,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
@@ -248,7 +248,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
@@ -285,12 +285,12 @@ JetFile: declarationsJustAtTyped.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY_ACCESSOR
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(open)('open')
|
||||
|
||||
@@ -103,7 +103,7 @@ JetFile: expressionJustAtTyped.kt
|
||||
VALUE_ARGUMENT
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -93,7 +93,7 @@ JetFile: primaryConstructor.kt
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
@@ -126,7 +126,7 @@ JetFile: primaryConstructor.kt
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('@private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
@@ -201,7 +201,7 @@ JetFile: primaryConstructor.kt
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(private)('@private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION
|
||||
|
||||
@@ -71,7 +71,7 @@ JetFile: forParameters.kt
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
PsiErrorElement:Expected modifier or annotation after '@'
|
||||
PsiErrorElement:Expected annotation identifier after '@'
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(in)('in')
|
||||
|
||||
Reference in New Issue
Block a user