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 (annotationParsingMode == PRIMARY_CONSTRUCTOR_MODIFIER_LIST && atSet(CONSTRUCTOR_KEYWORD, WHERE_KEYWORD)) break;
|
||||||
|
|
||||||
if (at(AT)) {
|
if (at(AT)) {
|
||||||
IElementType strictlyNextToken = myBuilder.rawLookup(1);
|
if (!tryParseModifier(tokenConsumer)) {
|
||||||
if (strictlyNextToken == IDENTIFIER || MODIFIER_KEYWORDS.contains(strictlyNextToken)) {
|
parseAnnotation(annotationParsingMode);
|
||||||
if (!tryParseModifier(tokenConsumer)) {
|
|
||||||
parseAnnotationEntry();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
errorAndAdvance("Expected modifier or annotation after '@'"); // AT
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tryParseModifier(tokenConsumer)) {
|
else if (tryParseModifier(tokenConsumer)) {
|
||||||
@@ -475,7 +469,7 @@ 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)) {
|
if (at(AT) && !WHITE_SPACE_OR_COMMENT_BIT_SET.contains(myBuilder.rawLookup(1))) {
|
||||||
advance(); // AT
|
advance(); // AT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiElement(private)('private')
|
PsiElement(private)('private')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
ANNOTATION
|
ANNOTATION
|
||||||
@@ -49,7 +49,7 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(private)('private')
|
PsiElement(private)('private')
|
||||||
@@ -67,7 +67,7 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(private)('private')
|
PsiElement(private)('private')
|
||||||
@@ -85,7 +85,7 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(open)('open')
|
PsiElement(open)('open')
|
||||||
@@ -105,7 +105,7 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
FUN
|
FUN
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(fun)('fun')
|
PsiElement(fun)('fun')
|
||||||
@@ -120,7 +120,7 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
CLASS
|
CLASS
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(class)('class')
|
PsiElement(class)('class')
|
||||||
@@ -139,7 +139,7 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
FUN
|
FUN
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
ANNOTATION
|
ANNOTATION
|
||||||
@@ -179,7 +179,7 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(private)('private')
|
PsiElement(private)('private')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
ANNOTATION_ENTRY
|
ANNOTATION_ENTRY
|
||||||
@@ -211,7 +211,7 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
ANNOTATION_ENTRY
|
ANNOTATION_ENTRY
|
||||||
@@ -248,7 +248,7 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(IDENTIFIER)('x')
|
PsiElement(IDENTIFIER)('x')
|
||||||
@@ -285,12 +285,12 @@ JetFile: declarationsJustAtTyped.kt
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PROPERTY_ACCESSOR
|
PROPERTY_ACCESSOR
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(private)('private')
|
PsiElement(private)('private')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(open)('open')
|
PsiElement(open)('open')
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ JetFile: expressionJustAtTyped.kt
|
|||||||
VALUE_ARGUMENT
|
VALUE_ARGUMENT
|
||||||
FUN
|
FUN
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(fun)('fun')
|
PsiElement(fun)('fun')
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ JetFile: primaryConstructor.kt
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(private)('private')
|
PsiElement(private)('private')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
@@ -126,7 +126,7 @@ JetFile: primaryConstructor.kt
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(private)('@private')
|
PsiElement(private)('@private')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
@@ -201,7 +201,7 @@ JetFile: primaryConstructor.kt
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(private)('@private')
|
PsiElement(private)('@private')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
ANNOTATION
|
ANNOTATION
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ JetFile: forParameters.kt
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
MODIFIER_LIST
|
MODIFIER_LIST
|
||||||
PsiErrorElement:Expected modifier or annotation after '@'
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(in)('in')
|
PsiElement(in)('in')
|
||||||
|
|||||||
Reference in New Issue
Block a user