diff --git a/compiler/frontend/src/org/jetbrains/kotlin/lexer/Kotlin.flex b/compiler/frontend/src/org/jetbrains/kotlin/lexer/Kotlin.flex index e00541fb5c3..4540ad37a43 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/lexer/Kotlin.flex +++ b/compiler/frontend/src/org/jetbrains/kotlin/lexer/Kotlin.flex @@ -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]) //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} -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_LITERAL3=({DIGITS})({EXPONENT_PART})({FLOATING_POINT_LITERAL_SUFFIX})? FLOATING_POINT_LITERAL4=({DIGITS})({FLOATING_POINT_LITERAL_SUFFIX}) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/lexer/_JetLexer.java b/compiler/frontend/src/org/jetbrains/kotlin/lexer/_JetLexer.java index 14a117b6b01..2467044ceb2 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/lexer/_JetLexer.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/lexer/_JetLexer.java @@ -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 */ 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"+ "\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\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\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"+ @@ -411,7 +427,7 @@ class _JetLexer implements FlexLexer { "\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"+ "\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"+ "\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"+ diff --git a/compiler/testData/diagnostics/tests/underscoresInNumericLiterals/illegalUnderscores.kt b/compiler/testData/diagnostics/tests/underscoresInNumericLiterals/illegalUnderscores.kt index 20b9c28df0b..82c0a85ddaa 100644 --- a/compiler/testData/diagnostics/tests/underscoresInNumericLiterals/illegalUnderscores.kt +++ b/compiler/testData/diagnostics/tests/underscoresInNumericLiterals/illegalUnderscores.kt @@ -8,8 +8,6 @@ fun foo() { 0B_1 1.0_ 1_.1 - 1._1 - 1_._1 1.0_e1 1.0E_1 0Xe_ diff --git a/compiler/testData/diagnostics/tests/underscoresInNumericLiterals/noUnderscores.kt b/compiler/testData/diagnostics/tests/underscoresInNumericLiterals/noUnderscores.kt index bfcab8cb487..faaf4554302 100644 --- a/compiler/testData/diagnostics/tests/underscoresInNumericLiterals/noUnderscores.kt +++ b/compiler/testData/diagnostics/tests/underscoresInNumericLiterals/noUnderscores.kt @@ -4,7 +4,6 @@ fun foo() { 100_1 3_.1 - 3_._1 2___4 123_ } \ No newline at end of file diff --git a/compiler/testData/psi/FunctionCalls.kt b/compiler/testData/psi/FunctionCalls.kt index fd078cffd6a..aa224e5a25c 100644 --- a/compiler/testData/psi/FunctionCalls.kt +++ b/compiler/testData/psi/FunctionCalls.kt @@ -32,4 +32,9 @@ fun foo() { v(fred(a)) w(plugh(a)) xyzzy<*>() + 1._foo() + 1.__foo() + 1_1._foo() + 1._1foo() + 1._1_foo() } diff --git a/compiler/testData/psi/FunctionCalls.txt b/compiler/testData/psi/FunctionCalls.txt index 1bfe8745a06..a3575752d1f 100644 --- a/compiler/testData/psi/FunctionCalls.txt +++ b/compiler/testData/psi/FunctionCalls.txt @@ -495,5 +495,60 @@ JetFile: FunctionCalls.kt 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') + 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') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/PropertyInvokes.kt b/compiler/testData/psi/PropertyInvokes.kt new file mode 100644 index 00000000000..dc824634470 --- /dev/null +++ b/compiler/testData/psi/PropertyInvokes.kt @@ -0,0 +1,7 @@ +fun foo() { + 1._some + 1.__some + 1_1._some + 1._1some + 1._1_some +} \ No newline at end of file diff --git a/compiler/testData/psi/PropertyInvokes.txt b/compiler/testData/psi/PropertyInvokes.txt new file mode 100644 index 00000000000..75086ae595c --- /dev/null +++ b/compiler/testData/psi/PropertyInvokes.txt @@ -0,0 +1,52 @@ +JetFile: PropertyInvokes.kt + PACKAGE_DIRECTIVE + + IMPORT_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)('}') \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java index 019175aca00..633e7ddf77f 100644 --- a/compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java @@ -680,6 +680,12 @@ public class ParsingTestGenerated extends AbstractParsingTest { doParsingTest(fileName); } + @TestMetadata("PropertyInvokes.kt") + public void testPropertyInvokes() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/PropertyInvokes.kt"); + doParsingTest(fileName); + } + @TestMetadata("QuotedIdentifiers.kt") public void testQuotedIdentifiers() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/QuotedIdentifiers.kt");