'...' reserved as a token

KT-9708 Ambiguous syntax for Double ranges: `.1...2` (triple dot)

 #KT-9708 Fixed
This commit is contained in:
Andrey Breslav
2015-11-27 15:17:04 +03:00
parent 877129340f
commit aca355acdc
10 changed files with 768 additions and 627 deletions
+2 -2
View File
@@ -33,8 +33,8 @@ import -
import ^_^
import .
import ---; import +++
import ..{...
import ..}...
import ..{.. .
import ..}.. .
import foo
fun foo() {
+2
View File
@@ -366,6 +366,7 @@ JetFile: Imports_ERR.kt
PsiElement(RANGE)('..')
PsiElement(LBRACE)('{')
PsiElement(RANGE)('..')
PsiWhiteSpace(' ')
PsiElement(DOT)('.')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
@@ -375,6 +376,7 @@ JetFile: Imports_ERR.kt
PsiElement(RANGE)('..')
PsiElement(RBRACE)('}')
PsiElement(RANGE)('..')
PsiWhiteSpace(' ')
PsiElement(DOT)('.')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
+11
View File
@@ -0,0 +1,11 @@
...
fun foo() {
for (i in 1...2) {
}
for (i in 1.. .2) {
}
}
+75
View File
@@ -0,0 +1,75 @@
JetFile: TripleDot.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
PsiErrorElement:Expecting a top level declaration
PsiElement(RESERVED)('...')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
FOR
PsiElement(for)('for')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('i')
PsiWhiteSpace(' ')
PsiElement(in)('in')
PsiWhiteSpace(' ')
LOOP_RANGE
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiErrorElement:Expecting ')'
<empty list>
BODY
<empty list>
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(RESERVED)('...')
PsiElement(INTEGER_LITERAL)('2')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
FUNCTION_LITERAL_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n\n ')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ')
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)('..')
PsiWhiteSpace(' ')
FLOAT_CONSTANT
PsiElement(FLOAT_CONSTANT)('.2')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BODY
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
+1 -2
View File
@@ -21,8 +21,7 @@ JetFile: MarkdownLinkWithError.kt
PsiElement(IDENTIFIER)('C')
PsiErrorElement:Closing bracket expected
<empty list>
PsiElement(RANGE)('..')
PsiElement(DOT)('.')
PsiElement(RESERVED)('...')
PsiElement(RBRACKET)(']')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('*')