Implement new parsing rules for labels
See changes in expressions.grm
This commit is contained in:
@@ -3,9 +3,9 @@ fun a(
|
||||
a : foo = throw Foo(),
|
||||
a : foo = return 10,
|
||||
a : foo = break,
|
||||
a : foo = break @la,
|
||||
a : foo = break@la,
|
||||
a : foo = continue,
|
||||
a : foo = continue @la,
|
||||
a : foo = continue@la,
|
||||
a : foo = if (10) foo else bar,
|
||||
a : foo = if (10) foo
|
||||
) {
|
||||
@@ -13,11 +13,11 @@ fun a(
|
||||
return
|
||||
10
|
||||
break
|
||||
@la
|
||||
break @la
|
||||
la@
|
||||
break@la
|
||||
continue
|
||||
@la
|
||||
continue @la
|
||||
la@
|
||||
continue@la
|
||||
if (foo)
|
||||
if (foo)
|
||||
bar
|
||||
|
||||
@@ -80,10 +80,10 @@ JetFile: ControlStructures.kt
|
||||
PsiWhiteSpace(' ')
|
||||
BREAK
|
||||
PsiElement(break)('break')
|
||||
PsiWhiteSpace(' ')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
@@ -116,10 +116,10 @@ JetFile: ControlStructures.kt
|
||||
PsiWhiteSpace(' ')
|
||||
CONTINUE
|
||||
PsiElement(continue)('continue')
|
||||
PsiWhiteSpace(' ')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
@@ -202,14 +202,15 @@ JetFile: ControlStructures.kt
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
BREAK
|
||||
PsiElement(break)('break')
|
||||
PsiWhiteSpace(' ')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiWhiteSpace('\n ')
|
||||
CONTINUE
|
||||
PsiElement(continue)('continue')
|
||||
@@ -217,14 +218,15 @@ JetFile: ControlStructures.kt
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
CONTINUE
|
||||
PsiElement(continue)('continue')
|
||||
PsiWhiteSpace(' ')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiWhiteSpace('\n ')
|
||||
IF
|
||||
PsiElement(if)('if')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
fun foo() {
|
||||
return
|
||||
return 1
|
||||
return (@a 1)
|
||||
return (a@ 1)
|
||||
|
||||
return@
|
||||
return@ 1
|
||||
@@ -10,8 +10,8 @@ fun foo() {
|
||||
|
||||
return@a
|
||||
return@a 1
|
||||
return@a (@a 1)
|
||||
return@a @a 1
|
||||
return@a (a@ 1)
|
||||
return@a a@ 1
|
||||
|
||||
return@@
|
||||
return@@ 1
|
||||
@@ -24,7 +24,7 @@ fun foo() {
|
||||
continue@
|
||||
continue@a
|
||||
|
||||
a.filter @f{
|
||||
a.filter f@{
|
||||
if (1) return
|
||||
return@f true
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ JetFile: Labels.kt
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
@@ -38,12 +39,12 @@ JetFile: Labels.kt
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
@@ -51,13 +52,13 @@ JetFile: Labels.kt
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PARENTHESIZED
|
||||
PsiElement(LPAR)('(')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
@@ -66,11 +67,11 @@ JetFile: Labels.kt
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
@@ -79,13 +80,15 @@ JetFile: Labels.kt
|
||||
PsiElement(return)('return')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
@@ -94,14 +97,16 @@ JetFile: Labels.kt
|
||||
PsiElement(return)('return')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PARENTHESIZED
|
||||
PsiElement(LPAR)('(')
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
@@ -111,12 +116,14 @@ JetFile: Labels.kt
|
||||
PsiElement(return)('return')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
@@ -124,18 +131,18 @@ JetFile: Labels.kt
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
@@ -146,13 +153,14 @@ JetFile: Labels.kt
|
||||
BREAK
|
||||
PsiElement(break)('break')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
BREAK
|
||||
PsiElement(break)('break')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
CONTINUE
|
||||
PsiElement(continue)('continue')
|
||||
@@ -160,13 +168,14 @@ JetFile: Labels.kt
|
||||
CONTINUE
|
||||
PsiElement(continue)('continue')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
CONTINUE
|
||||
PsiElement(continue)('continue')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -180,7 +189,8 @@ JetFile: Labels.kt
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@f')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiElement(AT)('@')
|
||||
FUNCTION_LITERAL_EXPRESSION
|
||||
FUNCTION_LITERAL
|
||||
PsiElement(LBRACE)('{')
|
||||
@@ -203,7 +213,8 @@ JetFile: Labels.kt
|
||||
PsiElement(return)('return')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@f')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiWhiteSpace(' ')
|
||||
BOOLEAN_CONSTANT
|
||||
PsiElement(true)('true')
|
||||
@@ -221,7 +232,7 @@ JetFile: Labels.kt
|
||||
FUNCTION_LITERAL_ARGUMENT
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
FUNCTION_LITERAL_EXPRESSION
|
||||
FUNCTION_LITERAL
|
||||
PsiElement(LBRACE)('{')
|
||||
@@ -243,7 +254,7 @@ JetFile: Labels.kt
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
BOOLEAN_CONSTANT
|
||||
PsiElement(true)('true')
|
||||
@@ -258,14 +269,15 @@ JetFile: Labels.kt
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(this)('this')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
THIS_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(this)('this')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
SUPER_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -287,7 +299,7 @@ JetFile: Labels.kt
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(GT)('>')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(LABEL_IDENTIFIER)('@')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
SUPER_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -300,6 +312,7 @@ JetFile: Labels.kt
|
||||
PsiElement(GT)('>')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -25,9 +25,9 @@ fun a(
|
||||
a : foo = throw Foo(),
|
||||
a : foo = return 10,
|
||||
a : foo = break,
|
||||
a : foo = break @la,
|
||||
a : foo = break@la,
|
||||
a : foo = continue,
|
||||
a : foo = continue @la,
|
||||
a : foo = continue@la,
|
||||
a : foo = 10,
|
||||
a : foo = 10,
|
||||
a : foo = 10,
|
||||
@@ -38,9 +38,9 @@ fun a(
|
||||
return
|
||||
10
|
||||
break
|
||||
@la
|
||||
break @la
|
||||
la@
|
||||
break@la
|
||||
continue
|
||||
@la
|
||||
continue @la
|
||||
la@
|
||||
continue@la
|
||||
}
|
||||
|
||||
@@ -552,10 +552,10 @@ JetFile: SimpleExpressions.kt
|
||||
PsiWhiteSpace(' ')
|
||||
BREAK
|
||||
PsiElement(break)('break')
|
||||
PsiWhiteSpace(' ')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
@@ -588,10 +588,10 @@ JetFile: SimpleExpressions.kt
|
||||
PsiWhiteSpace(' ')
|
||||
CONTINUE
|
||||
PsiElement(continue)('continue')
|
||||
PsiWhiteSpace(' ')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
@@ -700,14 +700,15 @@ JetFile: SimpleExpressions.kt
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
BREAK
|
||||
PsiElement(break)('break')
|
||||
PsiWhiteSpace(' ')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiWhiteSpace('\n ')
|
||||
CONTINUE
|
||||
PsiElement(continue)('continue')
|
||||
@@ -715,13 +716,14 @@ JetFile: SimpleExpressions.kt
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace('\n ')
|
||||
CONTINUE
|
||||
PsiElement(continue)('continue')
|
||||
PsiWhiteSpace(' ')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('la')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -76,7 +76,8 @@ JetFile: Super.kt
|
||||
PsiElement(GT)('>')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@label')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('label')
|
||||
PsiElement(DOT)('.')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
fun foo() {
|
||||
x1.filter b@ {
|
||||
return 1
|
||||
}
|
||||
c@ {
|
||||
return 2
|
||||
}
|
||||
|
||||
loop1@ for (i in 1..100) {
|
||||
return 4
|
||||
}
|
||||
|
||||
loop2@ for (i in 1..100) {
|
||||
return@loop2 4
|
||||
return@loop2 5
|
||||
}
|
||||
|
||||
label1@ val x = 1
|
||||
|
||||
1 + label3@ 3 + 4
|
||||
|
||||
l1@ foo bar l2@ baz // binary expression
|
||||
|
||||
return (a@ 1)
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
JetFile: basic.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x1')
|
||||
PsiElement(DOT)('.')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('filter')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_LITERAL_ARGUMENT
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_LITERAL_EXPRESSION
|
||||
FUNCTION_LITERAL
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
BLOCK
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUNCTION_LITERAL_ARGUMENT
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_LITERAL_EXPRESSION
|
||||
FUNCTION_LITERAL
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
BLOCK
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('2')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('loop1')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
FOR
|
||||
PsiElement(for)('for')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('i')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(in)('in')
|
||||
PsiWhiteSpace(' ')
|
||||
LOOP_RANGE
|
||||
BINARY_EXPRESSION
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(RANGE)('..')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('100')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BODY
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('4')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('loop2')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
FOR
|
||||
PsiElement(for)('for')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('i')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(in)('in')
|
||||
PsiWhiteSpace(' ')
|
||||
LOOP_RANGE
|
||||
BINARY_EXPRESSION
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(RANGE)('..')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('100')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BODY
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('loop2')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('4')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('loop2')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('5')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('label1')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
BINARY_EXPRESSION
|
||||
BINARY_EXPRESSION
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace(' ')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(PLUS)('+')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('label3')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('3')
|
||||
PsiWhiteSpace(' ')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(PLUS)('+')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('4')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
BINARY_EXPRESSION
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('l1')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('l2')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('baz')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// binary expression')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
PARENTHESIZED
|
||||
PsiElement(LPAR)('(')
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,11 @@
|
||||
fun foo() {
|
||||
@loop1 for (i in 1..100) { }
|
||||
|
||||
x2.filter @f {
|
||||
return 2
|
||||
}
|
||||
|
||||
return (@f 3)
|
||||
|
||||
val x = 1
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
JetFile: oldSyntaxExpressions.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('loop1')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
FOR
|
||||
PsiElement(for)('for')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('i')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(in)('in')
|
||||
PsiWhiteSpace(' ')
|
||||
LOOP_RANGE
|
||||
BINARY_EXPRESSION
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(RANGE)('..')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('100')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BODY
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x2')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('filter')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_LITERAL_EXPRESSION
|
||||
FUNCTION_LITERAL
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
BLOCK
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('2')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
PARENTHESIZED
|
||||
PsiElement(LPAR)('(')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiErrorElement:Expecting ')'
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(INTEGER_LITERAL)('3')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,32 @@
|
||||
fun foo() {
|
||||
|
||||
x2.filter c @ { // should be no space after c
|
||||
return 2
|
||||
}
|
||||
|
||||
x3.filter @ { // no label identifier
|
||||
return 3
|
||||
}
|
||||
|
||||
loop2 @ for (i in 1..100) { // should be no space after loop2
|
||||
return@ loop2 5
|
||||
return @ loop2 7
|
||||
return
|
||||
@loop2 4
|
||||
}
|
||||
|
||||
@ while (1) {
|
||||
return 123
|
||||
}
|
||||
|
||||
label2 @ fun foo() {} // should be no space after label2
|
||||
|
||||
1 + label3@ 3 + 4
|
||||
|
||||
l1 @ foo bar l2 @ baz // binary expression with extra spaces
|
||||
foo l3 @ bar baz // binary expression with `@ bar` parsed as wrong label
|
||||
|
||||
foo@ bar baz // binary expression labeled `bar` and return as second arg
|
||||
|
||||
return @ 1
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
JetFile: recovery.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
BINARY_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x2')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('filter')
|
||||
PsiWhiteSpace(' ')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_LITERAL_EXPRESSION
|
||||
FUNCTION_LITERAL
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// should be no space after c')
|
||||
PsiWhiteSpace('\n ')
|
||||
BLOCK
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('2')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x3')
|
||||
PsiElement(DOT)('.')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('filter')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_LITERAL_ARGUMENT
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_LITERAL_EXPRESSION
|
||||
FUNCTION_LITERAL
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// no label identifier')
|
||||
PsiWhiteSpace('\n ')
|
||||
BLOCK
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('3')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('loop2')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(for)('for')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(IDENTIFIER)('i')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(in)('in')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiElement(RANGE)('..')
|
||||
PsiElement(INTEGER_LITERAL)('100')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_LITERAL_EXPRESSION
|
||||
FUNCTION_LITERAL
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// should be no space after loop2')
|
||||
PsiWhiteSpace('\n ')
|
||||
BLOCK
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('loop2')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(INTEGER_LITERAL)('5')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('loop2')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(INTEGER_LITERAL)('7')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace('\n ')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('loop2')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(INTEGER_LITERAL)('4')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
WHILE
|
||||
PsiElement(while)('while')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
CONDITION
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BODY
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('123')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('label2')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_LITERAL_EXPRESSION
|
||||
FUNCTION_LITERAL
|
||||
PsiElement(LBRACE)('{')
|
||||
BLOCK
|
||||
<empty list>
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// should be no space after label2')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
BINARY_EXPRESSION
|
||||
BINARY_EXPRESSION
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace(' ')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(PLUS)('+')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('label3')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('3')
|
||||
PsiWhiteSpace(' ')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(PLUS)('+')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('4')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('l1')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('l2')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('baz')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// binary expression with extra spaces')
|
||||
PsiWhiteSpace('\n ')
|
||||
BINARY_EXPRESSION
|
||||
BINARY_EXPRESSION
|
||||
BINARY_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(IDENTIFIER)('l3')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiWhiteSpace(' ')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(IDENTIFIER)('baz')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// binary expression with `@ bar` parsed as wrong label')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
LABELED_EXPRESSION
|
||||
LABEL_QUALIFIER
|
||||
LABEL
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiWhiteSpace(' ')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(IDENTIFIER)('baz')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// binary expression labeled `bar` and return as second arg')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,30 @@
|
||||
fun foo() {
|
||||
break @l1
|
||||
|
||||
val x = 1
|
||||
|
||||
return @l2 1
|
||||
|
||||
val x = 2
|
||||
|
||||
return @l3
|
||||
|
||||
val x = 3
|
||||
|
||||
continue @l4 5
|
||||
|
||||
val x = 6
|
||||
|
||||
break/**/@l5
|
||||
|
||||
val x = 7
|
||||
|
||||
return /**/@l6
|
||||
|
||||
val x = 8
|
||||
|
||||
return//
|
||||
@l7 4
|
||||
|
||||
val x = 9
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
JetFile: spaceBeforeLabelReference.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
BREAK
|
||||
PsiElement(break)('break')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('l1')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('l2')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('2')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('l3')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('3')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
CONTINUE
|
||||
PsiElement(continue)('continue')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('l4')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(INTEGER_LITERAL)('5')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('6')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
BREAK
|
||||
PsiElement(break)('break')
|
||||
PsiComment(BLOCK_COMMENT)('/**/')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('l5')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('7')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(BLOCK_COMMENT)('/**/')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('l6')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('8')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiComment(EOL_COMMENT)('//')
|
||||
PsiWhiteSpace('\n')
|
||||
LABELED_EXPRESSION
|
||||
PsiErrorElement:Label must be named
|
||||
PsiElement(AT)('@')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('l7')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||
PsiElement(INTEGER_LITERAL)('4')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('9')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
Reference in New Issue
Block a user