Temporary parse label definitions with both syntax versions
Should be reverted after bootstrap
This commit is contained in:
@@ -554,10 +554,15 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
return lookahead(2) == LBRACE;
|
return lookahead(2) == LBRACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (at(AT) && myBuilder.rawLookup(1) == IDENTIFIER) {
|
||||||
|
return lookahead(2) == LBRACE;
|
||||||
|
}
|
||||||
|
|
||||||
return at(AT) && lookahead(1) == LBRACE;
|
return at(AT) && lookahead(1) == LBRACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAtLabelDefinitionOrMissingIdentifier() {
|
private boolean isAtLabelDefinitionOrMissingIdentifier() {
|
||||||
|
if (at(AT) && myBuilder.rawLookup(1) == IDENTIFIER) return true;
|
||||||
return (at(IDENTIFIER) && myBuilder.rawLookup(1) == AT) || at(AT);
|
return (at(IDENTIFIER) && myBuilder.rawLookup(1) == AT) || at(AT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1659,8 +1664,22 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
*/
|
*/
|
||||||
private void parseLabelDefinition() {
|
private void parseLabelDefinition() {
|
||||||
if (at(AT)) {
|
if (at(AT)) {
|
||||||
// recovery for empty label identifier
|
// recovery for old label syntax or empty label identifier
|
||||||
|
if (myBuilder.rawLookup(1) == IDENTIFIER) {
|
||||||
|
PsiBuilder.Marker labelWrap = mark();
|
||||||
|
PsiBuilder.Marker mark = mark();
|
||||||
|
|
||||||
|
advance(); // AT
|
||||||
|
advance(); // IDENTIFIER
|
||||||
|
|
||||||
|
mark.done(LABEL);
|
||||||
|
|
||||||
|
labelWrap.done(LABEL_QUALIFIER);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
errorAndAdvance("Label must be named"); // AT
|
errorAndAdvance("Label must be named"); // AT
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,10 @@ JetFile: oldSyntaxExpressions.kt
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
LABELED_EXPRESSION
|
LABELED_EXPRESSION
|
||||||
PsiErrorElement:Label must be named
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('loop1')
|
PsiElement(IDENTIFIER)('loop1')
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
FOR
|
FOR
|
||||||
PsiElement(for)('for')
|
PsiElement(for)('for')
|
||||||
@@ -49,10 +47,14 @@ JetFile: oldSyntaxExpressions.kt
|
|||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('x2')
|
PsiElement(IDENTIFIER)('x2')
|
||||||
PsiElement(DOT)('.')
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('filter')
|
PsiElement(IDENTIFIER)('filter')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
LABELED_EXPRESSION
|
||||||
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiElement(IDENTIFIER)('f')
|
PsiElement(IDENTIFIER)('f')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
@@ -75,14 +77,12 @@ JetFile: oldSyntaxExpressions.kt
|
|||||||
PARENTHESIZED
|
PARENTHESIZED
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
LABELED_EXPRESSION
|
LABELED_EXPRESSION
|
||||||
PsiErrorElement:Label must be named
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('f')
|
PsiElement(IDENTIFIER)('f')
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('3')
|
PsiElement(INTEGER_LITERAL)('3')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
|
|||||||
@@ -123,12 +123,12 @@ JetFile: recovery.kt
|
|||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
LABELED_EXPRESSION
|
LABELED_EXPRESSION
|
||||||
PsiErrorElement:Label must be named
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('loop2')
|
PsiElement(IDENTIFIER)('loop2')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('4')
|
PsiElement(INTEGER_LITERAL)('4')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
|
|||||||
@@ -33,12 +33,12 @@ JetFile: spaceBeforeLabelReference.kt
|
|||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
LABELED_EXPRESSION
|
LABELED_EXPRESSION
|
||||||
PsiErrorElement:Label must be named
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('l2')
|
PsiElement(IDENTIFIER)('l2')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PROPERTY
|
PROPERTY
|
||||||
@@ -55,9 +55,9 @@ JetFile: spaceBeforeLabelReference.kt
|
|||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
LABELED_EXPRESSION
|
LABELED_EXPRESSION
|
||||||
PsiErrorElement:Label must be named
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('l3')
|
PsiElement(IDENTIFIER)('l3')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PROPERTY
|
PROPERTY
|
||||||
@@ -111,9 +111,9 @@ JetFile: spaceBeforeLabelReference.kt
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiComment(BLOCK_COMMENT)('/**/')
|
PsiComment(BLOCK_COMMENT)('/**/')
|
||||||
LABELED_EXPRESSION
|
LABELED_EXPRESSION
|
||||||
PsiErrorElement:Label must be named
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('l6')
|
PsiElement(IDENTIFIER)('l6')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PROPERTY
|
PROPERTY
|
||||||
@@ -131,12 +131,12 @@ JetFile: spaceBeforeLabelReference.kt
|
|||||||
PsiComment(EOL_COMMENT)('//')
|
PsiComment(EOL_COMMENT)('//')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
LABELED_EXPRESSION
|
LABELED_EXPRESSION
|
||||||
PsiErrorElement:Label must be named
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('l7')
|
PsiElement(IDENTIFIER)('l7')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('4')
|
PsiElement(INTEGER_LITERAL)('4')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PROPERTY
|
PROPERTY
|
||||||
|
|||||||
Reference in New Issue
Block a user