Parse label reference with spaces before '@'
But still report error
This commit is contained in:
@@ -1647,10 +1647,13 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* label?
|
* labelReference?
|
||||||
*/
|
*/
|
||||||
private void parseLabelReferenceWithNoWhitespace() {
|
private void parseLabelReferenceWithNoWhitespace() {
|
||||||
if (at(AT) && !WHITE_SPACE_OR_COMMENT_BIT_SET.contains(myBuilder.rawLookup(-1))) {
|
if (at(AT) && !myBuilder.newlineBeforeCurrentToken()) {
|
||||||
|
if (WHITE_SPACE_OR_COMMENT_BIT_SET.contains(myBuilder.rawLookup(-1))) {
|
||||||
|
error("There should be no space or comments before '@' in label reference");
|
||||||
|
}
|
||||||
parseLabelReference();
|
parseLabelReference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,13 +108,14 @@ JetFile: recovery.kt
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
|
PsiErrorElement:There should be no space or comments before '@' in label reference
|
||||||
|
<empty list>
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
LABELED_EXPRESSION
|
PsiErrorElement:Label must be named
|
||||||
PsiErrorElement:Label must be named
|
PsiElement(AT)('@')
|
||||||
PsiElement(AT)('@')
|
PsiWhiteSpace(' ')
|
||||||
PsiWhiteSpace(' ')
|
REFERENCE_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
PsiElement(IDENTIFIER)('loop2')
|
||||||
PsiElement(IDENTIFIER)('loop2')
|
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||||
PsiElement(INTEGER_LITERAL)('7')
|
PsiElement(INTEGER_LITERAL)('7')
|
||||||
@@ -257,12 +258,13 @@ JetFile: recovery.kt
|
|||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
|
PsiErrorElement:There should be no space or comments before '@' in label reference
|
||||||
|
<empty list>
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
LABELED_EXPRESSION
|
PsiErrorElement:Label must be named
|
||||||
PsiErrorElement:Label must be named
|
PsiElement(AT)('@')
|
||||||
PsiElement(AT)('@')
|
PsiWhiteSpace(' ')
|
||||||
PsiWhiteSpace(' ')
|
INTEGER_CONSTANT
|
||||||
INTEGER_CONSTANT
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
@@ -14,10 +14,13 @@ JetFile: spaceBeforeLabelReference.kt
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
BREAK
|
BREAK
|
||||||
PsiElement(break)('break')
|
PsiElement(break)('break')
|
||||||
PsiWhiteSpace(' ')
|
PsiErrorElement:There should be no space or comments before '@' in label reference
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
<empty list>
|
||||||
PsiElement(AT)('@')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(IDENTIFIER)('l1')
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiElement(IDENTIFIER)('l1')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PROPERTY
|
PROPERTY
|
||||||
PsiElement(val)('val')
|
PsiElement(val)('val')
|
||||||
@@ -31,15 +34,16 @@ JetFile: spaceBeforeLabelReference.kt
|
|||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
|
PsiErrorElement:There should be no space or comments before '@' in label reference
|
||||||
|
<empty list>
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
LABELED_EXPRESSION
|
LABEL_QUALIFIER
|
||||||
PsiErrorElement:Label must be named
|
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
|
||||||
PsiElement(val)('val')
|
PsiElement(val)('val')
|
||||||
@@ -53,11 +57,12 @@ JetFile: spaceBeforeLabelReference.kt
|
|||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
|
PsiErrorElement:There should be no space or comments before '@' in label reference
|
||||||
|
<empty list>
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
LABELED_EXPRESSION
|
LABEL_QUALIFIER
|
||||||
PsiErrorElement:Label must be named
|
LABEL
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('l3')
|
PsiElement(IDENTIFIER)('l3')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PROPERTY
|
PROPERTY
|
||||||
@@ -72,11 +77,15 @@ JetFile: spaceBeforeLabelReference.kt
|
|||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
CONTINUE
|
CONTINUE
|
||||||
PsiElement(continue)('continue')
|
PsiElement(continue)('continue')
|
||||||
|
PsiErrorElement:There should be no space or comments before '@' in label reference
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiElement(IDENTIFIER)('l4')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||||
PsiElement(AT)('@')
|
|
||||||
PsiElement(IDENTIFIER)('l4')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(INTEGER_LITERAL)('5')
|
PsiElement(INTEGER_LITERAL)('5')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PROPERTY
|
PROPERTY
|
||||||
@@ -91,10 +100,13 @@ JetFile: spaceBeforeLabelReference.kt
|
|||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
BREAK
|
BREAK
|
||||||
PsiElement(break)('break')
|
PsiElement(break)('break')
|
||||||
PsiComment(BLOCK_COMMENT)('/**/')
|
PsiErrorElement:There should be no space or comments before '@' in label reference
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
<empty list>
|
||||||
PsiElement(AT)('@')
|
PsiComment(BLOCK_COMMENT)('/**/')
|
||||||
PsiElement(IDENTIFIER)('l5')
|
LABEL_QUALIFIER
|
||||||
|
LABEL
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiElement(IDENTIFIER)('l5')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PROPERTY
|
PROPERTY
|
||||||
PsiElement(val)('val')
|
PsiElement(val)('val')
|
||||||
@@ -108,12 +120,13 @@ JetFile: spaceBeforeLabelReference.kt
|
|||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
|
PsiErrorElement:There should be no space or comments before '@' in label reference
|
||||||
|
<empty list>
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiComment(BLOCK_COMMENT)('/**/')
|
PsiComment(BLOCK_COMMENT)('/**/')
|
||||||
LABELED_EXPRESSION
|
LABEL_QUALIFIER
|
||||||
PsiErrorElement:Label must be named
|
LABEL
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('l6')
|
PsiElement(IDENTIFIER)('l6')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PROPERTY
|
PROPERTY
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ fun test4(): Int {
|
|||||||
|
|
||||||
fun test5(): Int {
|
fun test5(): Int {
|
||||||
return synchronized(this) {(): Int ->
|
return synchronized(this) {(): Int ->
|
||||||
return @synchronized 12
|
return@synchronized 12
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user