Parse expressions like '1._foo()' after dot as references
This commit is contained in:
@@ -100,7 +100,7 @@ LONG_SUFFIX=[Ll]
|
|||||||
//FLOAT_LITERAL=(({FLOATING_POINT_LITERAL1})[Ff])|(({FLOATING_POINT_LITERAL2})[Ff])|(({FLOATING_POINT_LITERAL3})[Ff])|(({FLOATING_POINT_LITERAL4})[Ff])
|
//FLOAT_LITERAL=(({FLOATING_POINT_LITERAL1})[Ff])|(({FLOATING_POINT_LITERAL2})[Ff])|(({FLOATING_POINT_LITERAL3})[Ff])|(({FLOATING_POINT_LITERAL4})[Ff])
|
||||||
//DOUBLE_LITERAL=(({FLOATING_POINT_LITERAL1})[Dd]?)|(({FLOATING_POINT_LITERAL2})[Dd]?)|(({FLOATING_POINT_LITERAL3})[Dd]?)|(({FLOATING_POINT_LITERAL4})[Dd])
|
//DOUBLE_LITERAL=(({FLOATING_POINT_LITERAL1})[Dd]?)|(({FLOATING_POINT_LITERAL2})[Dd]?)|(({FLOATING_POINT_LITERAL3})[Dd]?)|(({FLOATING_POINT_LITERAL4})[Dd])
|
||||||
DOUBLE_LITERAL={FLOATING_POINT_LITERAL1}|{FLOATING_POINT_LITERAL2}|{FLOATING_POINT_LITERAL3}|{FLOATING_POINT_LITERAL4}
|
DOUBLE_LITERAL={FLOATING_POINT_LITERAL1}|{FLOATING_POINT_LITERAL2}|{FLOATING_POINT_LITERAL3}|{FLOATING_POINT_LITERAL4}
|
||||||
FLOATING_POINT_LITERAL1=({DIGITS})"."({DIGIT_OR_UNDERSCORE})+({EXPONENT_PART})?({FLOATING_POINT_LITERAL_SUFFIX})?
|
FLOATING_POINT_LITERAL1=({DIGITS})"."({DIGITS})+({EXPONENT_PART})?({FLOATING_POINT_LITERAL_SUFFIX})?
|
||||||
FLOATING_POINT_LITERAL2="."({DIGITS})({EXPONENT_PART})?({FLOATING_POINT_LITERAL_SUFFIX})?
|
FLOATING_POINT_LITERAL2="."({DIGITS})({EXPONENT_PART})?({FLOATING_POINT_LITERAL_SUFFIX})?
|
||||||
FLOATING_POINT_LITERAL3=({DIGITS})({EXPONENT_PART})({FLOATING_POINT_LITERAL_SUFFIX})?
|
FLOATING_POINT_LITERAL3=({DIGITS})({EXPONENT_PART})({FLOATING_POINT_LITERAL_SUFFIX})?
|
||||||
FLOATING_POINT_LITERAL4=({DIGITS})({FLOATING_POINT_LITERAL_SUFFIX})
|
FLOATING_POINT_LITERAL4=({DIGITS})({FLOATING_POINT_LITERAL_SUFFIX})
|
||||||
|
|||||||
@@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2016 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
/* The following code was generated by JFlex 1.7.0-SNAPSHOT tweaked for IntelliJ platform */
|
/* The following code was generated by JFlex 1.7.0-SNAPSHOT tweaked for IntelliJ platform */
|
||||||
|
|
||||||
package org.jetbrains.kotlin.lexer;
|
package org.jetbrains.kotlin.lexer;
|
||||||
@@ -347,7 +363,7 @@ class _JetLexer implements FlexLexer {
|
|||||||
"\4\76\4\0\21\76\20\0\7\206\2\0\72\206\1\0"+
|
"\4\76\4\0\21\76\20\0\7\206\2\0\72\206\1\0"+
|
||||||
"\3\76\1\0\2\76\6\0\4\76\1\0\2\76\3\0"+
|
"\3\76\1\0\2\76\6\0\4\76\1\0\2\76\3\0"+
|
||||||
"\1\76\2\0\1\76\1\207\2\76\4\0\21\76\57\0"+
|
"\1\76\2\0\1\76\1\207\2\76\4\0\21\76\57\0"+
|
||||||
"\1\210\55\0\1\211\111\0\1\212\62\0\2\126\12\0"+
|
"\1\210\55\0\1\211\111\0\1\212\62\0\1\126\13\0"+
|
||||||
"\1\126\3\0\1\213\62\0\2\214\12\0\1\214\4\0"+
|
"\1\126\3\0\1\213\62\0\2\214\12\0\1\214\4\0"+
|
||||||
"\1\110\1\0\1\214\24\0\1\110\13\0\1\214\15\0"+
|
"\1\110\1\0\1\214\24\0\1\110\13\0\1\214\15\0"+
|
||||||
"\7\112\1\215\1\0\72\112\1\0\3\113\1\0\2\113"+
|
"\7\112\1\215\1\0\72\112\1\0\3\113\1\0\2\113"+
|
||||||
@@ -411,7 +427,7 @@ class _JetLexer implements FlexLexer {
|
|||||||
"\62\0\2\214\12\0\1\214\4\0\1\110\26\0\1\110"+
|
"\62\0\2\214\12\0\1\214\4\0\1\110\26\0\1\110"+
|
||||||
"\31\0\7\216\1\263\1\0\72\216\12\0\1\264\71\0"+
|
"\31\0\7\216\1\263\1\0\72\216\12\0\1\264\71\0"+
|
||||||
"\3\265\1\0\2\265\6\0\4\265\1\0\2\265\3\0"+
|
"\3\265\1\0\2\265\6\0\4\265\1\0\2\265\3\0"+
|
||||||
"\1\265\2\0\4\265\4\0\21\265\21\0\2\126\12\0"+
|
"\1\265\2\0\4\265\4\0\21\265\21\0\1\126\13\0"+
|
||||||
"\1\126\66\0\3\11\1\0\2\11\6\0\4\11\1\0"+
|
"\1\126\66\0\3\11\1\0\2\11\6\0\4\11\1\0"+
|
||||||
"\2\11\3\0\1\11\2\0\3\11\1\266\4\0\21\11"+
|
"\2\11\3\0\1\11\2\0\3\11\1\266\4\0\21\11"+
|
||||||
"\21\0\3\11\1\0\2\11\6\0\4\11\1\0\2\11"+
|
"\21\0\3\11\1\0\2\11\6\0\4\11\1\0\2\11"+
|
||||||
|
|||||||
-2
@@ -8,8 +8,6 @@ fun foo() {
|
|||||||
<!ILLEGAL_UNDERSCORE!>0B_1<!>
|
<!ILLEGAL_UNDERSCORE!>0B_1<!>
|
||||||
<!ILLEGAL_UNDERSCORE!>1.0_<!>
|
<!ILLEGAL_UNDERSCORE!>1.0_<!>
|
||||||
<!ILLEGAL_UNDERSCORE!>1_.1<!>
|
<!ILLEGAL_UNDERSCORE!>1_.1<!>
|
||||||
<!ILLEGAL_UNDERSCORE!>1._1<!>
|
|
||||||
<!ILLEGAL_UNDERSCORE!>1_._1<!>
|
|
||||||
<!ILLEGAL_UNDERSCORE!>1.0_e1<!>
|
<!ILLEGAL_UNDERSCORE!>1.0_e1<!>
|
||||||
<!ILLEGAL_UNDERSCORE!>1.0E_1<!>
|
<!ILLEGAL_UNDERSCORE!>1.0E_1<!>
|
||||||
<!ILLEGAL_UNDERSCORE!>0Xe_<!>
|
<!ILLEGAL_UNDERSCORE!>0Xe_<!>
|
||||||
|
|||||||
-1
@@ -4,7 +4,6 @@
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
<!UNSUPPORTED_FEATURE!>100_1<!>
|
<!UNSUPPORTED_FEATURE!>100_1<!>
|
||||||
<!UNSUPPORTED_FEATURE!>3_.1<!>
|
<!UNSUPPORTED_FEATURE!>3_.1<!>
|
||||||
<!UNSUPPORTED_FEATURE!>3_._1<!>
|
|
||||||
<!UNSUPPORTED_FEATURE!>2___4<!>
|
<!UNSUPPORTED_FEATURE!>2___4<!>
|
||||||
<!UNSUPPORTED_FEATURE!>123_<!>
|
<!UNSUPPORTED_FEATURE!>123_<!>
|
||||||
}
|
}
|
||||||
+5
@@ -32,4 +32,9 @@ fun foo() {
|
|||||||
v(fred<a, *, b>(a))
|
v(fred<a, *, b>(a))
|
||||||
w(plugh<a, "", b>(a))
|
w(plugh<a, "", b>(a))
|
||||||
xyzzy<*>()
|
xyzzy<*>()
|
||||||
|
1._foo()
|
||||||
|
1.__foo()
|
||||||
|
1_1._foo()
|
||||||
|
1._1foo()
|
||||||
|
1._1_foo()
|
||||||
}
|
}
|
||||||
|
|||||||
+56
-1
@@ -495,5 +495,60 @@ JetFile: FunctionCalls.kt
|
|||||||
VALUE_ARGUMENT_LIST
|
VALUE_ARGUMENT_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('_foo')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('__foo')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1_1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('_foo')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('_1foo')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('_1_foo')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
fun foo() {
|
||||||
|
1._some
|
||||||
|
1.__some
|
||||||
|
1_1._some
|
||||||
|
1._1some
|
||||||
|
1._1_some
|
||||||
|
}
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
JetFile: PropertyInvokes.kt
|
||||||
|
PACKAGE_DIRECTIVE
|
||||||
|
<empty list>
|
||||||
|
IMPORT_LIST
|
||||||
|
<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
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('_some')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('__some')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1_1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('_some')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('_1some')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('_1_some')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
@@ -680,6 +680,12 @@ public class ParsingTestGenerated extends AbstractParsingTest {
|
|||||||
doParsingTest(fileName);
|
doParsingTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("PropertyInvokes.kt")
|
||||||
|
public void testPropertyInvokes() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/PropertyInvokes.kt");
|
||||||
|
doParsingTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("QuotedIdentifiers.kt")
|
@TestMetadata("QuotedIdentifiers.kt")
|
||||||
public void testQuotedIdentifiers() throws Exception {
|
public void testQuotedIdentifiers() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/QuotedIdentifiers.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/QuotedIdentifiers.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user