From 0677075335913dc9c17c411fe369f7979f0af6d7 Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Wed, 7 May 2014 12:24:08 +0400 Subject: [PATCH] Parser for JetBlockCodeFragment --- .../src/org/jetbrains/jet/JetNodeTypes.java | 1 + .../jetbrains/jet/lang/parsing/JetParser.java | 7 + .../jet/lang/parsing/JetParserDefinition.java | 4 +- .../jet/lang/parsing/JetParsing.java | 36 +- .../jet/lang/psi/JetBlockCodeFragment.kt | 31 + .../lang/psi/JetBlockCodeFragmentType.java | 50 + .../jetbrains/jet/lang/psi/JetPsiFactory.java | 5 + .../block/expressionOnTopLevel.kt | 2 + .../block/expressionOnTopLevel.txt | 21 + .../parseCodeFragment/block/imports.kt | 2 + .../parseCodeFragment/block/imports.txt | 21 + .../parseCodeFragment/block/localFun.kt | 2 + .../parseCodeFragment/block/localFun.txt | 21 + .../parseCodeFragment/block/oneLine.kt | 1 + .../parseCodeFragment/block/oneLine.txt | 21 + .../parseCodeFragment/block/oneStatement.kt | 1 + .../parseCodeFragment/block/oneStatement.txt | 11 + .../block/packageAndImport.kt | 5 + .../block/packageAndImport.txt | 27 + .../block/packageDirective.kt | 2 + .../block/packageDirective.txt | 18 + .../block/severalExpressions.kt | 2 + .../block/severalExpressions.txt | 21 + .../block/severalStatements.kt | 2 + .../block/severalStatements.txt | 21 + .../block/unexpectedSymbol.kt | 3 + .../block/unexpectedSymbol.txt | 26 + .../parseCodeFragment/expression/error.kt | 1 + .../parseCodeFragment/expression/error.txt | 9 + .../parseCodeFragment/expression/simple.kt | 1 + .../parseCodeFragment/expression/simple.txt | 10 + .../testData/psi/script/unexpectedSymbol.kts | 2 + .../testData/psi/script/unexpectedSymbol.txt | 17 + .../jet/parsing/AbstractJetParsingTest.java | 30 +- .../jet/parsing/JetParsingTestGenerated.java | 1778 +++++++++-------- .../jet/generators/tests/GenerateTests.kt | 2 + 36 files changed, 1361 insertions(+), 853 deletions(-) create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBlockCodeFragment.kt create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBlockCodeFragmentType.java create mode 100644 compiler/testData/parseCodeFragment/block/expressionOnTopLevel.kt create mode 100644 compiler/testData/parseCodeFragment/block/expressionOnTopLevel.txt create mode 100644 compiler/testData/parseCodeFragment/block/imports.kt create mode 100644 compiler/testData/parseCodeFragment/block/imports.txt create mode 100644 compiler/testData/parseCodeFragment/block/localFun.kt create mode 100644 compiler/testData/parseCodeFragment/block/localFun.txt create mode 100644 compiler/testData/parseCodeFragment/block/oneLine.kt create mode 100644 compiler/testData/parseCodeFragment/block/oneLine.txt create mode 100644 compiler/testData/parseCodeFragment/block/oneStatement.kt create mode 100644 compiler/testData/parseCodeFragment/block/oneStatement.txt create mode 100644 compiler/testData/parseCodeFragment/block/packageAndImport.kt create mode 100644 compiler/testData/parseCodeFragment/block/packageAndImport.txt create mode 100644 compiler/testData/parseCodeFragment/block/packageDirective.kt create mode 100644 compiler/testData/parseCodeFragment/block/packageDirective.txt create mode 100644 compiler/testData/parseCodeFragment/block/severalExpressions.kt create mode 100644 compiler/testData/parseCodeFragment/block/severalExpressions.txt create mode 100644 compiler/testData/parseCodeFragment/block/severalStatements.kt create mode 100644 compiler/testData/parseCodeFragment/block/severalStatements.txt create mode 100644 compiler/testData/parseCodeFragment/block/unexpectedSymbol.kt create mode 100644 compiler/testData/parseCodeFragment/block/unexpectedSymbol.txt create mode 100644 compiler/testData/parseCodeFragment/expression/error.kt create mode 100644 compiler/testData/parseCodeFragment/expression/error.txt create mode 100644 compiler/testData/parseCodeFragment/expression/simple.kt create mode 100644 compiler/testData/parseCodeFragment/expression/simple.txt create mode 100644 compiler/testData/psi/script/unexpectedSymbol.kts create mode 100644 compiler/testData/psi/script/unexpectedSymbol.txt diff --git a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java index d14e880ac16..254a8885081 100644 --- a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java +++ b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java @@ -152,4 +152,5 @@ public interface JetNodeTypes { IFileElementType TYPE_CODE_FRAGMENT = new JetTypeCodeFragmentType(); IFileElementType EXPRESSION_CODE_FRAGMENT = new JetExpressionCodeFragmentType(); + IFileElementType BLOCK_CODE_FRAGMENT = new JetBlockCodeFragmentType(); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParser.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParser.java index a7702d673e6..49eb18c91fe 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParser.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParser.java @@ -65,4 +65,11 @@ public class JetParser implements PsiParser { jetParsing.parseExpressionCodeFragment(); return psiBuilder.getTreeBuilt(); } + + @NotNull + public static ASTNode parseBlockCodeFragment(PsiBuilder psiBuilder) { + JetParsing jetParsing = JetParsing.createForTopLevel(new SemanticWhitespaceAwarePsiBuilderImpl(psiBuilder)); + jetParsing.parseBlockCodeFragment(); + return psiBuilder.getTreeBuilt(); + } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParserDefinition.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParserDefinition.java index eec764ff0cd..3e5f30e7186 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParserDefinition.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParserDefinition.java @@ -97,7 +97,9 @@ public class JetParserDefinition implements ParserDefinition { if (elementType instanceof JetStubElementType) { return ((JetStubElementType) elementType).createPsiFromAst(astNode); } - else if (elementType == JetNodeTypes.TYPE_CODE_FRAGMENT || elementType == JetNodeTypes.EXPRESSION_CODE_FRAGMENT) { + else if (elementType == JetNodeTypes.TYPE_CODE_FRAGMENT || + elementType == JetNodeTypes.EXPRESSION_CODE_FRAGMENT || + elementType == JetNodeTypes.BLOCK_CODE_FRAGMENT) { return new ASTWrapperPsiElement(astNode); } else { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java index 387ba405c9b..8f83717c3ca 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java @@ -106,10 +106,7 @@ public class JetParsing extends AbstractJetParsing { PsiBuilder.Marker marker = mark(); parseTypeRef(); - while (!eof()) { - error("unexpected symbol"); - advance(); - } + checkForUnexpectedSymbols(); marker.done(TYPE_CODE_FRAGMENT); } @@ -118,14 +115,29 @@ public class JetParsing extends AbstractJetParsing { PsiBuilder.Marker marker = mark(); myExpressionParsing.parseExpression(); - while (!eof()) { - error("unexpected symbol"); - advance(); - } + checkForUnexpectedSymbols(); marker.done(EXPRESSION_CODE_FRAGMENT); } + void parseBlockCodeFragment() { + PsiBuilder.Marker marker = mark(); + PsiBuilder.Marker blockMarker = mark(); + + if (at(PACKAGE_KEYWORD) || at(IMPORT_KEYWORD)) { + PsiBuilder.Marker err = mark(); + parsePreamble(); + err.error("Package directive and imports are forbidden in code fragments"); + } + + myExpressionParsing.parseStatements(); + + checkForUnexpectedSymbols(); + + blockMarker.done(BLOCK); + marker.done(BLOCK_CODE_FRAGMENT); + } + void parseScript() { PsiBuilder.Marker fileMarker = mark(); @@ -137,11 +149,19 @@ public class JetParsing extends AbstractJetParsing { myExpressionParsing.parseStatements(); + checkForUnexpectedSymbols(); + blockMarker.done(BLOCK); scriptMarker.done(SCRIPT); fileMarker.done(JET_FILE); } + private void checkForUnexpectedSymbols() { + while (!eof()) { + errorAndAdvance("unexpected symbol"); + } + } + /* *preamble * : packageDirective? import* diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBlockCodeFragment.kt b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBlockCodeFragment.kt new file mode 100644 index 00000000000..e2cdc8ece38 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBlockCodeFragment.kt @@ -0,0 +1,31 @@ +/* + * Copyright 2010-2014 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. + */ + +package org.jetbrains.jet.lang.psi + +import com.intellij.openapi.project.Project +import com.intellij.psi.PsiElement +import org.jetbrains.jet.JetNodeTypes + +public class JetBlockCodeFragment( + project: Project, + name: String, + text: CharSequence, + context: PsiElement? +) : JetCodeFragment(project, name, text, JetNodeTypes.BLOCK_CODE_FRAGMENT, context) { + + fun getBlock() = findChildByClass(javaClass()) ?: throw IllegalStateException("Block expression should be parsed for BlockCodeFragment") +} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBlockCodeFragmentType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBlockCodeFragmentType.java new file mode 100644 index 00000000000..b1117da36f0 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBlockCodeFragmentType.java @@ -0,0 +1,50 @@ +/* + * Copyright 2010-2014 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. + */ + +package org.jetbrains.jet.lang.psi; + +import com.intellij.lang.ASTNode; +import com.intellij.lang.Language; +import com.intellij.lang.PsiBuilder; +import com.intellij.lang.PsiBuilderFactory; +import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.lang.parsing.JetParser; +import org.jetbrains.jet.lang.psi.stubs.elements.JetFileElementType; + +public class JetBlockCodeFragmentType extends JetFileElementType { + private static final String NAME = "jet.BLOCK_CODE_FRAGMENT"; + + public JetBlockCodeFragmentType() { + super(NAME); + } + + @NotNull + @Override + public String getExternalId() { + return NAME; + } + + @Override + protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi) { + Project project = psi.getProject(); + Language languageForParser = getLanguageForParser(psi); + PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, chameleon.getChars()); + return JetParser.parseBlockCodeFragment(builder).getFirstChildNode(); + } +} + diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.java index eeb4b62f663..9cd5d4fd696 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.java @@ -344,6 +344,11 @@ public class JetPsiFactory { return new JetExpressionCodeFragment(project, "fragment.kt", text, context); } + @NotNull + public static JetBlockCodeFragment createBlockCodeFragment(Project project, String text, PsiElement context) { + return new JetBlockCodeFragment(project, "fragment.kt", text, context); + } + @NotNull public static JetReturnExpression createReturn(Project project, @NotNull String text) { return (JetReturnExpression) createExpression(project, "return " + text); diff --git a/compiler/testData/parseCodeFragment/block/expressionOnTopLevel.kt b/compiler/testData/parseCodeFragment/block/expressionOnTopLevel.kt new file mode 100644 index 00000000000..83d765f0dba --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/expressionOnTopLevel.kt @@ -0,0 +1,2 @@ +val a = 1 +1 + 1 \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/expressionOnTopLevel.txt b/compiler/testData/parseCodeFragment/block/expressionOnTopLevel.txt new file mode 100644 index 00000000000..dcdaab41611 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/expressionOnTopLevel.txt @@ -0,0 +1,21 @@ +JetFile: fragment.kt + BLOCK + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n') + BINARY_EXPRESSION + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(PLUS)('+') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/imports.kt b/compiler/testData/parseCodeFragment/block/imports.kt new file mode 100644 index 00000000000..d82b930892a --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/imports.kt @@ -0,0 +1,2 @@ +import a +val a = 1 \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/imports.txt b/compiler/testData/parseCodeFragment/block/imports.txt new file mode 100644 index 00000000000..082206a2713 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/imports.txt @@ -0,0 +1,21 @@ +JetFile: fragment.kt + BLOCK + PsiErrorElement:Package directive and imports are forbidden in code fragments + PACKAGE_DIRECTIVE + + IMPORT_LIST + IMPORT_DIRECTIVE + PsiElement(import)('import') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/localFun.kt b/compiler/testData/parseCodeFragment/block/localFun.kt new file mode 100644 index 00000000000..5b2b0af4ba8 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/localFun.kt @@ -0,0 +1,2 @@ +fun foo() = 1 +foo() \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/localFun.txt b/compiler/testData/parseCodeFragment/block/localFun.txt new file mode 100644 index 00000000000..504a2bfa8c4 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/localFun.txt @@ -0,0 +1,21 @@ +JetFile: fragment.kt + BLOCK + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/oneLine.kt b/compiler/testData/parseCodeFragment/block/oneLine.kt new file mode 100644 index 00000000000..86b0e106ea1 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/oneLine.kt @@ -0,0 +1 @@ +val a = 1;val b = 2 \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/oneLine.txt b/compiler/testData/parseCodeFragment/block/oneLine.txt new file mode 100644 index 00000000000..ce4133f7838 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/oneLine.txt @@ -0,0 +1,21 @@ +JetFile: fragment.kt + BLOCK + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiElement(SEMICOLON)(';') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('2') \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/oneStatement.kt b/compiler/testData/parseCodeFragment/block/oneStatement.kt new file mode 100644 index 00000000000..a62c3f43966 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/oneStatement.kt @@ -0,0 +1 @@ +val a = 1 \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/oneStatement.txt b/compiler/testData/parseCodeFragment/block/oneStatement.txt new file mode 100644 index 00000000000..f259cc71302 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/oneStatement.txt @@ -0,0 +1,11 @@ +JetFile: fragment.kt + BLOCK + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/packageAndImport.kt b/compiler/testData/parseCodeFragment/block/packageAndImport.kt new file mode 100644 index 00000000000..248d44752da --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/packageAndImport.kt @@ -0,0 +1,5 @@ +package a + +import foo.* + +val a = 1 \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/packageAndImport.txt b/compiler/testData/parseCodeFragment/block/packageAndImport.txt new file mode 100644 index 00000000000..922ecf82b87 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/packageAndImport.txt @@ -0,0 +1,27 @@ +JetFile: fragment.kt + BLOCK + PsiErrorElement:Package directive and imports are forbidden in code fragments + PACKAGE_DIRECTIVE + PsiElement(package)('package') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace('\n\n') + IMPORT_LIST + IMPORT_DIRECTIVE + PsiElement(import)('import') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + PsiElement(MUL)('*') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/packageDirective.kt b/compiler/testData/parseCodeFragment/block/packageDirective.kt new file mode 100644 index 00000000000..e819ddd9693 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/packageDirective.kt @@ -0,0 +1,2 @@ +package a +val a = 1 \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/packageDirective.txt b/compiler/testData/parseCodeFragment/block/packageDirective.txt new file mode 100644 index 00000000000..3a8e4031aa1 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/packageDirective.txt @@ -0,0 +1,18 @@ +JetFile: fragment.kt + BLOCK + PsiErrorElement:Package directive and imports are forbidden in code fragments + PACKAGE_DIRECTIVE + PsiElement(package)('package') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/severalExpressions.kt b/compiler/testData/parseCodeFragment/block/severalExpressions.kt new file mode 100644 index 00000000000..b52c5d87fbf --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/severalExpressions.kt @@ -0,0 +1,2 @@ +1 + 1 +1 * 1 \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/severalExpressions.txt b/compiler/testData/parseCodeFragment/block/severalExpressions.txt new file mode 100644 index 00000000000..dc0c898a801 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/severalExpressions.txt @@ -0,0 +1,21 @@ +JetFile: fragment.kt + BLOCK + BINARY_EXPRESSION + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(PLUS)('+') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n') + BINARY_EXPRESSION + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(MUL)('*') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/severalStatements.kt b/compiler/testData/parseCodeFragment/block/severalStatements.kt new file mode 100644 index 00000000000..860f6bfb223 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/severalStatements.kt @@ -0,0 +1,2 @@ +val a = 1 +val b = 2 \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/severalStatements.txt b/compiler/testData/parseCodeFragment/block/severalStatements.txt new file mode 100644 index 00000000000..a2416e68a2f --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/severalStatements.txt @@ -0,0 +1,21 @@ +JetFile: fragment.kt + BLOCK + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('2') \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/unexpectedSymbol.kt b/compiler/testData/parseCodeFragment/block/unexpectedSymbol.kt new file mode 100644 index 00000000000..50e06adfd12 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/unexpectedSymbol.kt @@ -0,0 +1,3 @@ +val a = 1 +} +val b = 4 \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/block/unexpectedSymbol.txt b/compiler/testData/parseCodeFragment/block/unexpectedSymbol.txt new file mode 100644 index 00000000000..305b65abad9 --- /dev/null +++ b/compiler/testData/parseCodeFragment/block/unexpectedSymbol.txt @@ -0,0 +1,26 @@ +JetFile: fragment.kt + BLOCK + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n') + PsiErrorElement:unexpected symbol + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PsiErrorElement:unexpected symbol + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiErrorElement:unexpected symbol + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') + PsiErrorElement:unexpected symbol + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + PsiErrorElement:unexpected symbol + PsiElement(INTEGER_LITERAL)('4') \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/expression/error.kt b/compiler/testData/parseCodeFragment/expression/error.kt new file mode 100644 index 00000000000..42b0e1f2ffd --- /dev/null +++ b/compiler/testData/parseCodeFragment/expression/error.kt @@ -0,0 +1 @@ +1 + \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/expression/error.txt b/compiler/testData/parseCodeFragment/expression/error.txt new file mode 100644 index 00000000000..7bd861f3abd --- /dev/null +++ b/compiler/testData/parseCodeFragment/expression/error.txt @@ -0,0 +1,9 @@ +JetFile: fragment.kt + BINARY_EXPRESSION + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(PLUS)('+') + PsiErrorElement:Expecting an element + \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/expression/simple.kt b/compiler/testData/parseCodeFragment/expression/simple.kt new file mode 100644 index 00000000000..1a5a117eb38 --- /dev/null +++ b/compiler/testData/parseCodeFragment/expression/simple.kt @@ -0,0 +1 @@ +1 + 1 \ No newline at end of file diff --git a/compiler/testData/parseCodeFragment/expression/simple.txt b/compiler/testData/parseCodeFragment/expression/simple.txt new file mode 100644 index 00000000000..344db2d68a3 --- /dev/null +++ b/compiler/testData/parseCodeFragment/expression/simple.txt @@ -0,0 +1,10 @@ +JetFile: fragment.kt + BINARY_EXPRESSION + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(PLUS)('+') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') \ No newline at end of file diff --git a/compiler/testData/psi/script/unexpectedSymbol.kts b/compiler/testData/psi/script/unexpectedSymbol.kts new file mode 100644 index 00000000000..5b52dacaa1c --- /dev/null +++ b/compiler/testData/psi/script/unexpectedSymbol.kts @@ -0,0 +1,2 @@ +println(1) +} diff --git a/compiler/testData/psi/script/unexpectedSymbol.txt b/compiler/testData/psi/script/unexpectedSymbol.txt new file mode 100644 index 00000000000..9b131578c1a --- /dev/null +++ b/compiler/testData/psi/script/unexpectedSymbol.txt @@ -0,0 +1,17 @@ +JetFile: unexpectedSymbol.kts + PACKAGE_DIRECTIVE + + SCRIPT + BLOCK + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('println') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + PsiErrorElement:unexpected symbol + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/parsing/AbstractJetParsingTest.java b/compiler/tests/org/jetbrains/jet/parsing/AbstractJetParsingTest.java index a2ec69117d5..06c30f62672 100644 --- a/compiler/tests/org/jetbrains/jet/parsing/AbstractJetParsingTest.java +++ b/compiler/tests/org/jetbrains/jet/parsing/AbstractJetParsingTest.java @@ -18,14 +18,18 @@ package org.jetbrains.jet.parsing; import com.intellij.openapi.util.io.FileUtil; import com.intellij.psi.PsiErrorElement; +import com.intellij.psi.PsiFile; +import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.testFramework.ParsingTestCase; import com.intellij.util.PathUtil; import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.JetNodeTypes; import org.jetbrains.jet.JetTestCaseBuilder; import org.jetbrains.jet.lang.parsing.JetParserDefinition; import org.jetbrains.jet.lang.psi.IfNotParsed; import org.jetbrains.jet.lang.psi.JetElement; +import org.jetbrains.jet.lang.psi.JetPsiFactory; import org.jetbrains.jet.lang.psi.JetVisitorVoid; import java.lang.annotation.Annotation; @@ -72,8 +76,20 @@ public abstract class AbstractJetParsingTest extends ParsingTestCase { } protected void doParsingTest(@NotNull String filePath) throws Exception { + doBaseTest(filePath, JetNodeTypes.JET_FILE); + } + + protected void doExpressionCodeFragmentParsingTest(@NotNull String filePath) throws Exception { + doBaseTest(filePath, JetNodeTypes.EXPRESSION_CODE_FRAGMENT); + } + + protected void doBlockCodeFragmentParsingTest(@NotNull String filePath) throws Exception { + doBaseTest(filePath, JetNodeTypes.BLOCK_CODE_FRAGMENT); + } + + private void doBaseTest(@NotNull String filePath, @NotNull IElementType fileType) throws Exception { myFileExt = FileUtil.getExtension(PathUtil.getFileName(filePath)); - myFile = createPsiFile(FileUtil.getNameWithoutExtension(PathUtil.getFileName(filePath)), loadFile(filePath)); + myFile = createFile(filePath, fileType); myFile.acceptChildren(new JetVisitorVoid() { @Override @@ -90,4 +106,16 @@ public abstract class AbstractJetParsingTest extends ParsingTestCase { doCheckResult(myFullDataPath, filePath.replaceAll("\\.kts?", ".txt"), toParseTreeText(myFile, false, false).trim()); } + + private PsiFile createFile(@NotNull String filePath, @NotNull IElementType fileType) throws Exception { + if (fileType == JetNodeTypes.EXPRESSION_CODE_FRAGMENT) { + return JetPsiFactory.createExpressionCodeFragment(myProject, loadFile(filePath), null); + } + else if (fileType == JetNodeTypes.BLOCK_CODE_FRAGMENT) { + return JetPsiFactory.createBlockCodeFragment(myProject, loadFile(filePath), null); + } + else { + return createPsiFile(FileUtil.getNameWithoutExtension(PathUtil.getFileName(filePath)), loadFile(filePath)); + } + } } diff --git a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java b/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java index 6c19f738115..f4a97b1ee11 100644 --- a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java @@ -30,968 +30,1060 @@ import org.jetbrains.jet.parsing.AbstractJetParsingTest; /** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") -@TestMetadata("compiler/testData/psi") -@InnerTestClasses({JetParsingTestGenerated.Examples.class, JetParsingTestGenerated.FunctionReceivers.class, JetParsingTestGenerated.GreatSyntacticShift.class, JetParsingTestGenerated.Kdoc.class, JetParsingTestGenerated.PropertyDelegate.class, JetParsingTestGenerated.Recovery.class, JetParsingTestGenerated.Script.class, JetParsingTestGenerated.StringTemplates.class}) +@InnerTestClasses({JetParsingTestGenerated.Psi.class, JetParsingTestGenerated.Expression.class, JetParsingTestGenerated.Block.class}) public class JetParsingTestGenerated extends AbstractJetParsingTest { - @TestMetadata("AbsentInnerType.kt") - public void testAbsentInnerType() throws Exception { - doParsingTest("compiler/testData/psi/AbsentInnerType.kt"); - } - - public void testAllFilesPresentInPsi() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi"), Pattern.compile("^(.*)\\.kts?$"), true); - } - - @TestMetadata("AnnotatedExpressions.kt") - public void testAnnotatedExpressions() throws Exception { - doParsingTest("compiler/testData/psi/AnnotatedExpressions.kt"); - } - - @TestMetadata("AnonymousInitializer.kt") - public void testAnonymousInitializer() throws Exception { - doParsingTest("compiler/testData/psi/AnonymousInitializer.kt"); - } - - @TestMetadata("AssertNotNull.kt") - public void testAssertNotNull() throws Exception { - doParsingTest("compiler/testData/psi/AssertNotNull.kt"); - } - - @TestMetadata("Attributes.kt") - public void testAttributes() throws Exception { - doParsingTest("compiler/testData/psi/Attributes.kt"); - } - - @TestMetadata("AttributesOnPatterns.kt") - public void testAttributesOnPatterns() throws Exception { - doParsingTest("compiler/testData/psi/AttributesOnPatterns.kt"); - } - - @TestMetadata("Attributes_ERR.kt") - public void testAttributes_ERR() throws Exception { - doParsingTest("compiler/testData/psi/Attributes_ERR.kt"); - } - - @TestMetadata("BabySteps.kt") - public void testBabySteps() throws Exception { - doParsingTest("compiler/testData/psi/BabySteps.kt"); - } - - @TestMetadata("BabySteps_ERR.kt") - public void testBabySteps_ERR() throws Exception { - doParsingTest("compiler/testData/psi/BabySteps_ERR.kt"); - } - - @TestMetadata("BlockCommentAtBeginningOfFile1.kt") - public void testBlockCommentAtBeginningOfFile1() throws Exception { - doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile1.kt"); - } - - @TestMetadata("BlockCommentAtBeginningOfFile2.kt") - public void testBlockCommentAtBeginningOfFile2() throws Exception { - doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile2.kt"); - } - - @TestMetadata("BlockCommentAtBeginningOfFile3.kt") - public void testBlockCommentAtBeginningOfFile3() throws Exception { - doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile3.kt"); - } - - @TestMetadata("BlockCommentAtBeginningOfFile4.kt") - public void testBlockCommentAtBeginningOfFile4() throws Exception { - doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile4.kt"); - } - - @TestMetadata("ByClauses.kt") - public void testByClauses() throws Exception { - doParsingTest("compiler/testData/psi/ByClauses.kt"); - } - - @TestMetadata("CallWithManyClosures.kt") - public void testCallWithManyClosures() throws Exception { - doParsingTest("compiler/testData/psi/CallWithManyClosures.kt"); - } - - @TestMetadata("CallsInWhen.kt") - public void testCallsInWhen() throws Exception { - doParsingTest("compiler/testData/psi/CallsInWhen.kt"); - } - - @TestMetadata("Constructors.kt") - public void testConstructors() throws Exception { - doParsingTest("compiler/testData/psi/Constructors.kt"); - } - - @TestMetadata("ControlStructures.kt") - public void testControlStructures() throws Exception { - doParsingTest("compiler/testData/psi/ControlStructures.kt"); - } - - @TestMetadata("DoubleColon.kt") - public void testDoubleColon() throws Exception { - doParsingTest("compiler/testData/psi/DoubleColon.kt"); - } - - @TestMetadata("EOLsInComments.kt") - public void testEOLsInComments() throws Exception { - doParsingTest("compiler/testData/psi/EOLsInComments.kt"); - } - - @TestMetadata("EOLsOnRollback.kt") - public void testEOLsOnRollback() throws Exception { - doParsingTest("compiler/testData/psi/EOLsOnRollback.kt"); - } - - @TestMetadata("EmptyFile.kt") - public void testEmptyFile() throws Exception { - doParsingTest("compiler/testData/psi/EmptyFile.kt"); - } - - @TestMetadata("Enums.kt") - public void testEnums() throws Exception { - doParsingTest("compiler/testData/psi/Enums.kt"); - } - - @TestMetadata("Expressions_ERR.kt") - public void testExpressions_ERR() throws Exception { - doParsingTest("compiler/testData/psi/Expressions_ERR.kt"); - } - - @TestMetadata("ExtensionsWithQNReceiver.kt") - public void testExtensionsWithQNReceiver() throws Exception { - doParsingTest("compiler/testData/psi/ExtensionsWithQNReceiver.kt"); - } - - @TestMetadata("FileStart_ERR.kt") - public void testFileStart_ERR() throws Exception { - doParsingTest("compiler/testData/psi/FileStart_ERR.kt"); - } - - @TestMetadata("FloatingPointLiteral.kt") - public void testFloatingPointLiteral() throws Exception { - doParsingTest("compiler/testData/psi/FloatingPointLiteral.kt"); - } - - @TestMetadata("ForWithMultiDecl.kt") - public void testForWithMultiDecl() throws Exception { - doParsingTest("compiler/testData/psi/ForWithMultiDecl.kt"); - } - - @TestMetadata("FunctionCalls.kt") - public void testFunctionCalls() throws Exception { - doParsingTest("compiler/testData/psi/FunctionCalls.kt"); - } - - @TestMetadata("FunctionLiterals.kt") - public void testFunctionLiterals() throws Exception { - doParsingTest("compiler/testData/psi/FunctionLiterals.kt"); - } - - @TestMetadata("FunctionLiterals_ERR.kt") - public void testFunctionLiterals_ERR() throws Exception { - doParsingTest("compiler/testData/psi/FunctionLiterals_ERR.kt"); - } - - @TestMetadata("FunctionNoParameterList.kt") - public void testFunctionNoParameterList() throws Exception { - doParsingTest("compiler/testData/psi/FunctionNoParameterList.kt"); - } - - @TestMetadata("FunctionTypes.kt") - public void testFunctionTypes() throws Exception { - doParsingTest("compiler/testData/psi/FunctionTypes.kt"); - } - - @TestMetadata("FunctionTypes_ERR.kt") - public void testFunctionTypes_ERR() throws Exception { - doParsingTest("compiler/testData/psi/FunctionTypes_ERR.kt"); - } - - @TestMetadata("Functions.kt") - public void testFunctions() throws Exception { - doParsingTest("compiler/testData/psi/Functions.kt"); - } - - @TestMetadata("Functions_ERR.kt") - public void testFunctions_ERR() throws Exception { - doParsingTest("compiler/testData/psi/Functions_ERR.kt"); - } - - @TestMetadata("HangOnLonelyModifier.kt") - public void testHangOnLonelyModifier() throws Exception { - doParsingTest("compiler/testData/psi/HangOnLonelyModifier.kt"); - } - - @TestMetadata("IfWithPropery.kt") - public void testIfWithPropery() throws Exception { - doParsingTest("compiler/testData/psi/IfWithPropery.kt"); - } - - @TestMetadata("ImportSoftKW.kt") - public void testImportSoftKW() throws Exception { - doParsingTest("compiler/testData/psi/ImportSoftKW.kt"); - } - - @TestMetadata("Imports.kt") - public void testImports() throws Exception { - doParsingTest("compiler/testData/psi/Imports.kt"); - } - - @TestMetadata("Imports_ERR.kt") - public void testImports_ERR() throws Exception { - doParsingTest("compiler/testData/psi/Imports_ERR.kt"); - } - - @TestMetadata("Inner.kt") - public void testInner() throws Exception { - doParsingTest("compiler/testData/psi/Inner.kt"); - } - - @TestMetadata("IntegerLiteral.kt") - public void testIntegerLiteral() throws Exception { - doParsingTest("compiler/testData/psi/IntegerLiteral.kt"); - } - - @TestMetadata("Labels.kt") - public void testLabels() throws Exception { - doParsingTest("compiler/testData/psi/Labels.kt"); - } - - @TestMetadata("LocalDeclarations.kt") - public void testLocalDeclarations() throws Exception { - doParsingTest("compiler/testData/psi/LocalDeclarations.kt"); - } - - @TestMetadata("LongPackageName.kt") - public void testLongPackageName() throws Exception { - doParsingTest("compiler/testData/psi/LongPackageName.kt"); - } - - @TestMetadata("ModifierAsSelector.kt") - public void testModifierAsSelector() throws Exception { - doParsingTest("compiler/testData/psi/ModifierAsSelector.kt"); - } - - @TestMetadata("MultiVariableDeclarations.kt") - public void testMultiVariableDeclarations() throws Exception { - doParsingTest("compiler/testData/psi/MultiVariableDeclarations.kt"); - } - - @TestMetadata("NestedComments.kt") - public void testNestedComments() throws Exception { - doParsingTest("compiler/testData/psi/NestedComments.kt"); - } - - @TestMetadata("NewLinesValidOperations.kt") - public void testNewLinesValidOperations() throws Exception { - doParsingTest("compiler/testData/psi/NewLinesValidOperations.kt"); - } - - @TestMetadata("NewlinesInParentheses.kt") - public void testNewlinesInParentheses() throws Exception { - doParsingTest("compiler/testData/psi/NewlinesInParentheses.kt"); - } - - @TestMetadata("NotIsAndNotIn.kt") - public void testNotIsAndNotIn() throws Exception { - doParsingTest("compiler/testData/psi/NotIsAndNotIn.kt"); - } - - @TestMetadata("ObjectLiteralAsStatement.kt") - public void testObjectLiteralAsStatement() throws Exception { - doParsingTest("compiler/testData/psi/ObjectLiteralAsStatement.kt"); - } - - @TestMetadata("PackageBlockFirst.kt") - public void testPackageBlockFirst() throws Exception { - doParsingTest("compiler/testData/psi/PackageBlockFirst.kt"); - } - - @TestMetadata("PackageModifiers.kt") - public void testPackageModifiers() throws Exception { - doParsingTest("compiler/testData/psi/PackageModifiers.kt"); - } - - @TestMetadata("ParameterNameMising.kt") - public void testParameterNameMising() throws Exception { - doParsingTest("compiler/testData/psi/ParameterNameMising.kt"); - } - - @TestMetadata("Precedence.kt") - public void testPrecedence() throws Exception { - doParsingTest("compiler/testData/psi/Precedence.kt"); - } - - @TestMetadata("PrimaryConstructorModifiers_ERR.kt") - public void testPrimaryConstructorModifiers_ERR() throws Exception { - doParsingTest("compiler/testData/psi/PrimaryConstructorModifiers_ERR.kt"); - } - - @TestMetadata("Properties.kt") - public void testProperties() throws Exception { - doParsingTest("compiler/testData/psi/Properties.kt"); - } - - @TestMetadata("PropertiesFollowedByInitializers.kt") - public void testPropertiesFollowedByInitializers() throws Exception { - doParsingTest("compiler/testData/psi/PropertiesFollowedByInitializers.kt"); - } - - @TestMetadata("Properties_ERR.kt") - public void testProperties_ERR() throws Exception { - doParsingTest("compiler/testData/psi/Properties_ERR.kt"); - } - - @TestMetadata("QuotedIdentifiers.kt") - public void testQuotedIdentifiers() throws Exception { - doParsingTest("compiler/testData/psi/QuotedIdentifiers.kt"); - } - - @TestMetadata("RootPackage.kt") - public void testRootPackage() throws Exception { - doParsingTest("compiler/testData/psi/RootPackage.kt"); - } - - @TestMetadata("SemicolonAfterIf.kt") - public void testSemicolonAfterIf() throws Exception { - doParsingTest("compiler/testData/psi/SemicolonAfterIf.kt"); - } - - @TestMetadata("ShortAnnotations.kt") - public void testShortAnnotations() throws Exception { - doParsingTest("compiler/testData/psi/ShortAnnotations.kt"); - } - - @TestMetadata("SimpleClassMembers.kt") - public void testSimpleClassMembers() throws Exception { - doParsingTest("compiler/testData/psi/SimpleClassMembers.kt"); - } - - @TestMetadata("SimpleClassMembers_ERR.kt") - public void testSimpleClassMembers_ERR() throws Exception { - doParsingTest("compiler/testData/psi/SimpleClassMembers_ERR.kt"); - } - - @TestMetadata("SimpleExpressions.kt") - public void testSimpleExpressions() throws Exception { - doParsingTest("compiler/testData/psi/SimpleExpressions.kt"); - } - - @TestMetadata("SimpleModifiers.kt") - public void testSimpleModifiers() throws Exception { - doParsingTest("compiler/testData/psi/SimpleModifiers.kt"); - } - - @TestMetadata("SoftKeywords.kt") - public void testSoftKeywords() throws Exception { - doParsingTest("compiler/testData/psi/SoftKeywords.kt"); - } - - @TestMetadata("SoftKeywordsInTypeArguments.kt") - public void testSoftKeywordsInTypeArguments() throws Exception { - doParsingTest("compiler/testData/psi/SoftKeywordsInTypeArguments.kt"); - } - - @TestMetadata("StringTemplates.kt") - public void testStringTemplates() throws Exception { - doParsingTest("compiler/testData/psi/StringTemplates.kt"); - } - - @TestMetadata("Super.kt") - public void testSuper() throws Exception { - doParsingTest("compiler/testData/psi/Super.kt"); - } - - @TestMetadata("ThisType.kt") - public void testThisType() throws Exception { - doParsingTest("compiler/testData/psi/ThisType.kt"); - } - - @TestMetadata("TryRecovery.kt") - public void testTryRecovery() throws Exception { - doParsingTest("compiler/testData/psi/TryRecovery.kt"); - } - - @TestMetadata("TypeAnnotations.kt") - public void testTypeAnnotations() throws Exception { - doParsingTest("compiler/testData/psi/TypeAnnotations.kt"); - } - - @TestMetadata("TypeConstraints.kt") - public void testTypeConstraints() throws Exception { - doParsingTest("compiler/testData/psi/TypeConstraints.kt"); - } - - @TestMetadata("TypeDef.kt") - public void testTypeDef() throws Exception { - doParsingTest("compiler/testData/psi/TypeDef.kt"); - } - - @TestMetadata("TypeDef_ERR.kt") - public void testTypeDef_ERR() throws Exception { - doParsingTest("compiler/testData/psi/TypeDef_ERR.kt"); - } - - @TestMetadata("TypeExpressionAmbiguities_ERR.kt") - public void testTypeExpressionAmbiguities_ERR() throws Exception { - doParsingTest("compiler/testData/psi/TypeExpressionAmbiguities_ERR.kt"); - } - - @TestMetadata("TypeParametersBeforeName.kt") - public void testTypeParametersBeforeName() throws Exception { - doParsingTest("compiler/testData/psi/TypeParametersBeforeName.kt"); - } - - @TestMetadata("When.kt") - public void testWhen() throws Exception { - doParsingTest("compiler/testData/psi/When.kt"); - } - - @TestMetadata("When_ERR.kt") - public void testWhen_ERR() throws Exception { - doParsingTest("compiler/testData/psi/When_ERR.kt"); - } - - @TestMetadata("compiler/testData/psi/examples") - @InnerTestClasses({Examples.Array.class, Examples.Collections.class, Examples.Io.class, Examples.Map.class, Examples.Priorityqueues.class, Examples.Util.class}) - public static class Examples extends AbstractJetParsingTest { - public void testAllFilesPresentInExamples() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples"), Pattern.compile("^(.*)\\.kts?$"), true); + @TestMetadata("compiler/testData/psi") + @InnerTestClasses({Psi.Examples.class, Psi.FunctionReceivers.class, Psi.GreatSyntacticShift.class, Psi.Kdoc.class, Psi.PropertyDelegate.class, Psi.Recovery.class, Psi.Script.class, Psi.StringTemplates.class}) + public static class Psi extends AbstractJetParsingTest { + @TestMetadata("AbsentInnerType.kt") + public void testAbsentInnerType() throws Exception { + doParsingTest("compiler/testData/psi/AbsentInnerType.kt"); } - @TestMetadata("AnonymousObjects.kt") - public void testAnonymousObjects() throws Exception { - doParsingTest("compiler/testData/psi/examples/AnonymousObjects.kt"); + public void testAllFilesPresentInPsi() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi"), Pattern.compile("^(.*)\\.kts?$"), true); } - @TestMetadata("BinaryTree.kt") - public void testBinaryTree() throws Exception { - doParsingTest("compiler/testData/psi/examples/BinaryTree.kt"); + @TestMetadata("AnnotatedExpressions.kt") + public void testAnnotatedExpressions() throws Exception { + doParsingTest("compiler/testData/psi/AnnotatedExpressions.kt"); } - @TestMetadata("BitArith.kt") - public void testBitArith() throws Exception { - doParsingTest("compiler/testData/psi/examples/BitArith.kt"); + @TestMetadata("AnonymousInitializer.kt") + public void testAnonymousInitializer() throws Exception { + doParsingTest("compiler/testData/psi/AnonymousInitializer.kt"); } - @TestMetadata("Builder.kt") - public void testBuilder() throws Exception { - doParsingTest("compiler/testData/psi/examples/Builder.kt"); + @TestMetadata("AssertNotNull.kt") + public void testAssertNotNull() throws Exception { + doParsingTest("compiler/testData/psi/AssertNotNull.kt"); } - @TestMetadata("Color.kt") - public void testColor() throws Exception { - doParsingTest("compiler/testData/psi/examples/Color.kt"); + @TestMetadata("Attributes.kt") + public void testAttributes() throws Exception { + doParsingTest("compiler/testData/psi/Attributes.kt"); } - @TestMetadata("FunctionsAndTypes.kt") - public void testFunctionsAndTypes() throws Exception { - doParsingTest("compiler/testData/psi/examples/FunctionsAndTypes.kt"); + @TestMetadata("AttributesOnPatterns.kt") + public void testAttributesOnPatterns() throws Exception { + doParsingTest("compiler/testData/psi/AttributesOnPatterns.kt"); } - @TestMetadata("Graph.kt") - public void testGraph() throws Exception { - doParsingTest("compiler/testData/psi/examples/Graph.kt"); + @TestMetadata("Attributes_ERR.kt") + public void testAttributes_ERR() throws Exception { + doParsingTest("compiler/testData/psi/Attributes_ERR.kt"); } - @TestMetadata("IPushPop.kt") - public void testIPushPop() throws Exception { - doParsingTest("compiler/testData/psi/examples/IPushPop.kt"); + @TestMetadata("BabySteps.kt") + public void testBabySteps() throws Exception { + doParsingTest("compiler/testData/psi/BabySteps.kt"); } - @TestMetadata("LINQ.kt") - public void testLINQ() throws Exception { - doParsingTest("compiler/testData/psi/examples/LINQ.kt"); + @TestMetadata("BabySteps_ERR.kt") + public void testBabySteps_ERR() throws Exception { + doParsingTest("compiler/testData/psi/BabySteps_ERR.kt"); } - @TestMetadata("PolymorphicClassObjects.kt") - public void testPolymorphicClassObjects() throws Exception { - doParsingTest("compiler/testData/psi/examples/PolymorphicClassObjects.kt"); + @TestMetadata("BlockCommentAtBeginningOfFile1.kt") + public void testBlockCommentAtBeginningOfFile1() throws Exception { + doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile1.kt"); } - @TestMetadata("Queue.kt") - public void testQueue() throws Exception { - doParsingTest("compiler/testData/psi/examples/Queue.kt"); + @TestMetadata("BlockCommentAtBeginningOfFile2.kt") + public void testBlockCommentAtBeginningOfFile2() throws Exception { + doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile2.kt"); } - @TestMetadata("Stack.kt") - public void testStack() throws Exception { - doParsingTest("compiler/testData/psi/examples/Stack.kt"); + @TestMetadata("BlockCommentAtBeginningOfFile3.kt") + public void testBlockCommentAtBeginningOfFile3() throws Exception { + doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile3.kt"); } - @TestMetadata("UnionFind.kt") - public void testUnionFind() throws Exception { - doParsingTest("compiler/testData/psi/examples/UnionFind.kt"); + @TestMetadata("BlockCommentAtBeginningOfFile4.kt") + public void testBlockCommentAtBeginningOfFile4() throws Exception { + doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile4.kt"); } - @TestMetadata("UpdateOperation.kt") - public void testUpdateOperation() throws Exception { - doParsingTest("compiler/testData/psi/examples/UpdateOperation.kt"); + @TestMetadata("ByClauses.kt") + public void testByClauses() throws Exception { + doParsingTest("compiler/testData/psi/ByClauses.kt"); } - @TestMetadata("With.kt") - public void testWith() throws Exception { - doParsingTest("compiler/testData/psi/examples/With.kt"); + @TestMetadata("CallWithManyClosures.kt") + public void testCallWithManyClosures() throws Exception { + doParsingTest("compiler/testData/psi/CallWithManyClosures.kt"); } - @TestMetadata("compiler/testData/psi/examples/array") - public static class Array extends AbstractJetParsingTest { - public void testAllFilesPresentInArray() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/array"), Pattern.compile("^(.*)\\.kts?$"), true); + @TestMetadata("CallsInWhen.kt") + public void testCallsInWhen() throws Exception { + doParsingTest("compiler/testData/psi/CallsInWhen.kt"); + } + + @TestMetadata("Constructors.kt") + public void testConstructors() throws Exception { + doParsingTest("compiler/testData/psi/Constructors.kt"); + } + + @TestMetadata("ControlStructures.kt") + public void testControlStructures() throws Exception { + doParsingTest("compiler/testData/psi/ControlStructures.kt"); + } + + @TestMetadata("DoubleColon.kt") + public void testDoubleColon() throws Exception { + doParsingTest("compiler/testData/psi/DoubleColon.kt"); + } + + @TestMetadata("EOLsInComments.kt") + public void testEOLsInComments() throws Exception { + doParsingTest("compiler/testData/psi/EOLsInComments.kt"); + } + + @TestMetadata("EOLsOnRollback.kt") + public void testEOLsOnRollback() throws Exception { + doParsingTest("compiler/testData/psi/EOLsOnRollback.kt"); + } + + @TestMetadata("EmptyFile.kt") + public void testEmptyFile() throws Exception { + doParsingTest("compiler/testData/psi/EmptyFile.kt"); + } + + @TestMetadata("Enums.kt") + public void testEnums() throws Exception { + doParsingTest("compiler/testData/psi/Enums.kt"); + } + + @TestMetadata("Expressions_ERR.kt") + public void testExpressions_ERR() throws Exception { + doParsingTest("compiler/testData/psi/Expressions_ERR.kt"); + } + + @TestMetadata("ExtensionsWithQNReceiver.kt") + public void testExtensionsWithQNReceiver() throws Exception { + doParsingTest("compiler/testData/psi/ExtensionsWithQNReceiver.kt"); + } + + @TestMetadata("FileStart_ERR.kt") + public void testFileStart_ERR() throws Exception { + doParsingTest("compiler/testData/psi/FileStart_ERR.kt"); + } + + @TestMetadata("FloatingPointLiteral.kt") + public void testFloatingPointLiteral() throws Exception { + doParsingTest("compiler/testData/psi/FloatingPointLiteral.kt"); + } + + @TestMetadata("ForWithMultiDecl.kt") + public void testForWithMultiDecl() throws Exception { + doParsingTest("compiler/testData/psi/ForWithMultiDecl.kt"); + } + + @TestMetadata("FunctionCalls.kt") + public void testFunctionCalls() throws Exception { + doParsingTest("compiler/testData/psi/FunctionCalls.kt"); + } + + @TestMetadata("FunctionLiterals.kt") + public void testFunctionLiterals() throws Exception { + doParsingTest("compiler/testData/psi/FunctionLiterals.kt"); + } + + @TestMetadata("FunctionLiterals_ERR.kt") + public void testFunctionLiterals_ERR() throws Exception { + doParsingTest("compiler/testData/psi/FunctionLiterals_ERR.kt"); + } + + @TestMetadata("FunctionNoParameterList.kt") + public void testFunctionNoParameterList() throws Exception { + doParsingTest("compiler/testData/psi/FunctionNoParameterList.kt"); + } + + @TestMetadata("FunctionTypes.kt") + public void testFunctionTypes() throws Exception { + doParsingTest("compiler/testData/psi/FunctionTypes.kt"); + } + + @TestMetadata("FunctionTypes_ERR.kt") + public void testFunctionTypes_ERR() throws Exception { + doParsingTest("compiler/testData/psi/FunctionTypes_ERR.kt"); + } + + @TestMetadata("Functions.kt") + public void testFunctions() throws Exception { + doParsingTest("compiler/testData/psi/Functions.kt"); + } + + @TestMetadata("Functions_ERR.kt") + public void testFunctions_ERR() throws Exception { + doParsingTest("compiler/testData/psi/Functions_ERR.kt"); + } + + @TestMetadata("HangOnLonelyModifier.kt") + public void testHangOnLonelyModifier() throws Exception { + doParsingTest("compiler/testData/psi/HangOnLonelyModifier.kt"); + } + + @TestMetadata("IfWithPropery.kt") + public void testIfWithPropery() throws Exception { + doParsingTest("compiler/testData/psi/IfWithPropery.kt"); + } + + @TestMetadata("ImportSoftKW.kt") + public void testImportSoftKW() throws Exception { + doParsingTest("compiler/testData/psi/ImportSoftKW.kt"); + } + + @TestMetadata("Imports.kt") + public void testImports() throws Exception { + doParsingTest("compiler/testData/psi/Imports.kt"); + } + + @TestMetadata("Imports_ERR.kt") + public void testImports_ERR() throws Exception { + doParsingTest("compiler/testData/psi/Imports_ERR.kt"); + } + + @TestMetadata("Inner.kt") + public void testInner() throws Exception { + doParsingTest("compiler/testData/psi/Inner.kt"); + } + + @TestMetadata("IntegerLiteral.kt") + public void testIntegerLiteral() throws Exception { + doParsingTest("compiler/testData/psi/IntegerLiteral.kt"); + } + + @TestMetadata("Labels.kt") + public void testLabels() throws Exception { + doParsingTest("compiler/testData/psi/Labels.kt"); + } + + @TestMetadata("LocalDeclarations.kt") + public void testLocalDeclarations() throws Exception { + doParsingTest("compiler/testData/psi/LocalDeclarations.kt"); + } + + @TestMetadata("LongPackageName.kt") + public void testLongPackageName() throws Exception { + doParsingTest("compiler/testData/psi/LongPackageName.kt"); + } + + @TestMetadata("ModifierAsSelector.kt") + public void testModifierAsSelector() throws Exception { + doParsingTest("compiler/testData/psi/ModifierAsSelector.kt"); + } + + @TestMetadata("MultiVariableDeclarations.kt") + public void testMultiVariableDeclarations() throws Exception { + doParsingTest("compiler/testData/psi/MultiVariableDeclarations.kt"); + } + + @TestMetadata("NestedComments.kt") + public void testNestedComments() throws Exception { + doParsingTest("compiler/testData/psi/NestedComments.kt"); + } + + @TestMetadata("NewLinesValidOperations.kt") + public void testNewLinesValidOperations() throws Exception { + doParsingTest("compiler/testData/psi/NewLinesValidOperations.kt"); + } + + @TestMetadata("NewlinesInParentheses.kt") + public void testNewlinesInParentheses() throws Exception { + doParsingTest("compiler/testData/psi/NewlinesInParentheses.kt"); + } + + @TestMetadata("NotIsAndNotIn.kt") + public void testNotIsAndNotIn() throws Exception { + doParsingTest("compiler/testData/psi/NotIsAndNotIn.kt"); + } + + @TestMetadata("ObjectLiteralAsStatement.kt") + public void testObjectLiteralAsStatement() throws Exception { + doParsingTest("compiler/testData/psi/ObjectLiteralAsStatement.kt"); + } + + @TestMetadata("PackageBlockFirst.kt") + public void testPackageBlockFirst() throws Exception { + doParsingTest("compiler/testData/psi/PackageBlockFirst.kt"); + } + + @TestMetadata("PackageModifiers.kt") + public void testPackageModifiers() throws Exception { + doParsingTest("compiler/testData/psi/PackageModifiers.kt"); + } + + @TestMetadata("ParameterNameMising.kt") + public void testParameterNameMising() throws Exception { + doParsingTest("compiler/testData/psi/ParameterNameMising.kt"); + } + + @TestMetadata("Precedence.kt") + public void testPrecedence() throws Exception { + doParsingTest("compiler/testData/psi/Precedence.kt"); + } + + @TestMetadata("PrimaryConstructorModifiers_ERR.kt") + public void testPrimaryConstructorModifiers_ERR() throws Exception { + doParsingTest("compiler/testData/psi/PrimaryConstructorModifiers_ERR.kt"); + } + + @TestMetadata("Properties.kt") + public void testProperties() throws Exception { + doParsingTest("compiler/testData/psi/Properties.kt"); + } + + @TestMetadata("PropertiesFollowedByInitializers.kt") + public void testPropertiesFollowedByInitializers() throws Exception { + doParsingTest("compiler/testData/psi/PropertiesFollowedByInitializers.kt"); + } + + @TestMetadata("Properties_ERR.kt") + public void testProperties_ERR() throws Exception { + doParsingTest("compiler/testData/psi/Properties_ERR.kt"); + } + + @TestMetadata("QuotedIdentifiers.kt") + public void testQuotedIdentifiers() throws Exception { + doParsingTest("compiler/testData/psi/QuotedIdentifiers.kt"); + } + + @TestMetadata("RootPackage.kt") + public void testRootPackage() throws Exception { + doParsingTest("compiler/testData/psi/RootPackage.kt"); + } + + @TestMetadata("SemicolonAfterIf.kt") + public void testSemicolonAfterIf() throws Exception { + doParsingTest("compiler/testData/psi/SemicolonAfterIf.kt"); + } + + @TestMetadata("ShortAnnotations.kt") + public void testShortAnnotations() throws Exception { + doParsingTest("compiler/testData/psi/ShortAnnotations.kt"); + } + + @TestMetadata("SimpleClassMembers.kt") + public void testSimpleClassMembers() throws Exception { + doParsingTest("compiler/testData/psi/SimpleClassMembers.kt"); + } + + @TestMetadata("SimpleClassMembers_ERR.kt") + public void testSimpleClassMembers_ERR() throws Exception { + doParsingTest("compiler/testData/psi/SimpleClassMembers_ERR.kt"); + } + + @TestMetadata("SimpleExpressions.kt") + public void testSimpleExpressions() throws Exception { + doParsingTest("compiler/testData/psi/SimpleExpressions.kt"); + } + + @TestMetadata("SimpleModifiers.kt") + public void testSimpleModifiers() throws Exception { + doParsingTest("compiler/testData/psi/SimpleModifiers.kt"); + } + + @TestMetadata("SoftKeywords.kt") + public void testSoftKeywords() throws Exception { + doParsingTest("compiler/testData/psi/SoftKeywords.kt"); + } + + @TestMetadata("SoftKeywordsInTypeArguments.kt") + public void testSoftKeywordsInTypeArguments() throws Exception { + doParsingTest("compiler/testData/psi/SoftKeywordsInTypeArguments.kt"); + } + + @TestMetadata("StringTemplates.kt") + public void testStringTemplates() throws Exception { + doParsingTest("compiler/testData/psi/StringTemplates.kt"); + } + + @TestMetadata("Super.kt") + public void testSuper() throws Exception { + doParsingTest("compiler/testData/psi/Super.kt"); + } + + @TestMetadata("ThisType.kt") + public void testThisType() throws Exception { + doParsingTest("compiler/testData/psi/ThisType.kt"); + } + + @TestMetadata("TryRecovery.kt") + public void testTryRecovery() throws Exception { + doParsingTest("compiler/testData/psi/TryRecovery.kt"); + } + + @TestMetadata("TypeAnnotations.kt") + public void testTypeAnnotations() throws Exception { + doParsingTest("compiler/testData/psi/TypeAnnotations.kt"); + } + + @TestMetadata("TypeConstraints.kt") + public void testTypeConstraints() throws Exception { + doParsingTest("compiler/testData/psi/TypeConstraints.kt"); + } + + @TestMetadata("TypeDef.kt") + public void testTypeDef() throws Exception { + doParsingTest("compiler/testData/psi/TypeDef.kt"); + } + + @TestMetadata("TypeDef_ERR.kt") + public void testTypeDef_ERR() throws Exception { + doParsingTest("compiler/testData/psi/TypeDef_ERR.kt"); + } + + @TestMetadata("TypeExpressionAmbiguities_ERR.kt") + public void testTypeExpressionAmbiguities_ERR() throws Exception { + doParsingTest("compiler/testData/psi/TypeExpressionAmbiguities_ERR.kt"); + } + + @TestMetadata("TypeParametersBeforeName.kt") + public void testTypeParametersBeforeName() throws Exception { + doParsingTest("compiler/testData/psi/TypeParametersBeforeName.kt"); + } + + @TestMetadata("When.kt") + public void testWhen() throws Exception { + doParsingTest("compiler/testData/psi/When.kt"); + } + + @TestMetadata("When_ERR.kt") + public void testWhen_ERR() throws Exception { + doParsingTest("compiler/testData/psi/When_ERR.kt"); + } + + @TestMetadata("compiler/testData/psi/examples") + @InnerTestClasses({Examples.Array.class, Examples.Collections.class, Examples.Io.class, Examples.Map.class, Examples.Priorityqueues.class, Examples.Util.class}) + public static class Examples extends AbstractJetParsingTest { + public void testAllFilesPresentInExamples() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples"), Pattern.compile("^(.*)\\.kts?$"), true); } - @TestMetadata("MutableArray.kt") - public void testMutableArray() throws Exception { - doParsingTest("compiler/testData/psi/examples/array/MutableArray.kt"); + @TestMetadata("AnonymousObjects.kt") + public void testAnonymousObjects() throws Exception { + doParsingTest("compiler/testData/psi/examples/AnonymousObjects.kt"); + } + + @TestMetadata("BinaryTree.kt") + public void testBinaryTree() throws Exception { + doParsingTest("compiler/testData/psi/examples/BinaryTree.kt"); + } + + @TestMetadata("BitArith.kt") + public void testBitArith() throws Exception { + doParsingTest("compiler/testData/psi/examples/BitArith.kt"); + } + + @TestMetadata("Builder.kt") + public void testBuilder() throws Exception { + doParsingTest("compiler/testData/psi/examples/Builder.kt"); + } + + @TestMetadata("Color.kt") + public void testColor() throws Exception { + doParsingTest("compiler/testData/psi/examples/Color.kt"); + } + + @TestMetadata("FunctionsAndTypes.kt") + public void testFunctionsAndTypes() throws Exception { + doParsingTest("compiler/testData/psi/examples/FunctionsAndTypes.kt"); + } + + @TestMetadata("Graph.kt") + public void testGraph() throws Exception { + doParsingTest("compiler/testData/psi/examples/Graph.kt"); + } + + @TestMetadata("IPushPop.kt") + public void testIPushPop() throws Exception { + doParsingTest("compiler/testData/psi/examples/IPushPop.kt"); + } + + @TestMetadata("LINQ.kt") + public void testLINQ() throws Exception { + doParsingTest("compiler/testData/psi/examples/LINQ.kt"); + } + + @TestMetadata("PolymorphicClassObjects.kt") + public void testPolymorphicClassObjects() throws Exception { + doParsingTest("compiler/testData/psi/examples/PolymorphicClassObjects.kt"); + } + + @TestMetadata("Queue.kt") + public void testQueue() throws Exception { + doParsingTest("compiler/testData/psi/examples/Queue.kt"); + } + + @TestMetadata("Stack.kt") + public void testStack() throws Exception { + doParsingTest("compiler/testData/psi/examples/Stack.kt"); + } + + @TestMetadata("UnionFind.kt") + public void testUnionFind() throws Exception { + doParsingTest("compiler/testData/psi/examples/UnionFind.kt"); + } + + @TestMetadata("UpdateOperation.kt") + public void testUpdateOperation() throws Exception { + doParsingTest("compiler/testData/psi/examples/UpdateOperation.kt"); + } + + @TestMetadata("With.kt") + public void testWith() throws Exception { + doParsingTest("compiler/testData/psi/examples/With.kt"); + } + + @TestMetadata("compiler/testData/psi/examples/array") + public static class Array extends AbstractJetParsingTest { + public void testAllFilesPresentInArray() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/array"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("MutableArray.kt") + public void testMutableArray() throws Exception { + doParsingTest("compiler/testData/psi/examples/array/MutableArray.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/examples/collections") + public static class Collections extends AbstractJetParsingTest { + public void testAllFilesPresentInCollections() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/collections"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("ArrayList.kt") + public void testArrayList() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/ArrayList.kt"); + } + + @TestMetadata("HashMap.kt") + public void testHashMap() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/HashMap.kt"); + } + + @TestMetadata("IIterable.kt") + public void testIIterable() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IIterable.kt"); + } + + @TestMetadata("IIterator.kt") + public void testIIterator() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IIterator.kt"); + } + + @TestMetadata("IList.kt") + public void testIList() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IList.kt"); + } + + @TestMetadata("IMutableIterable.kt") + public void testIMutableIterable() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IMutableIterable.kt"); + } + + @TestMetadata("IMutableIterator.kt") + public void testIMutableIterator() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IMutableIterator.kt"); + } + + @TestMetadata("IMutableList.kt") + public void testIMutableList() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IMutableList.kt"); + } + + @TestMetadata("IMutableSet.kt") + public void testIMutableSet() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IMutableSet.kt"); + } + + @TestMetadata("ISet.kt") + public void testISet() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/ISet.kt"); + } + + @TestMetadata("ISized.kt") + public void testISized() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/ISized.kt"); + } + + @TestMetadata("LinkedList.kt") + public void testLinkedList() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/LinkedList.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/examples/io") + public static class Io extends AbstractJetParsingTest { + public void testAllFilesPresentInIo() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/io"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("IOSamples.kt") + public void testIOSamples() throws Exception { + doParsingTest("compiler/testData/psi/examples/io/IOSamples.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/examples/map") + public static class Map extends AbstractJetParsingTest { + public void testAllFilesPresentInMap() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/map"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("IMap.kt") + public void testIMap() throws Exception { + doParsingTest("compiler/testData/psi/examples/map/IMap.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/examples/priorityqueues") + public static class Priorityqueues extends AbstractJetParsingTest { + public void testAllFilesPresentInPriorityqueues() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/priorityqueues"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("BinaryHeap.kt") + public void testBinaryHeap() throws Exception { + doParsingTest("compiler/testData/psi/examples/priorityqueues/BinaryHeap.kt"); + } + + @TestMetadata("IPriorityQueue.kt") + public void testIPriorityQueue() throws Exception { + doParsingTest("compiler/testData/psi/examples/priorityqueues/IPriorityQueue.kt"); + } + + @TestMetadata("PriorityQueueAsPushPop.kt") + public void testPriorityQueueAsPushPop() throws Exception { + doParsingTest("compiler/testData/psi/examples/priorityqueues/PriorityQueueAsPushPop.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/examples/util") + public static class Util extends AbstractJetParsingTest { + public void testAllFilesPresentInUtil() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/util"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("Comparison.kt") + public void testComparison() throws Exception { + doParsingTest("compiler/testData/psi/examples/util/Comparison.kt"); + } + + @TestMetadata("IComparable.kt") + public void testIComparable() throws Exception { + doParsingTest("compiler/testData/psi/examples/util/IComparable.kt"); + } + + } + + public static Test innerSuite() { + TestSuite suite = new TestSuite("Examples"); + suite.addTestSuite(Examples.class); + suite.addTestSuite(Array.class); + suite.addTestSuite(Collections.class); + suite.addTestSuite(Io.class); + suite.addTestSuite(Map.class); + suite.addTestSuite(Priorityqueues.class); + suite.addTestSuite(Util.class); + return suite; + } + } + + @TestMetadata("compiler/testData/psi/functionReceivers") + public static class FunctionReceivers extends AbstractJetParsingTest { + public void testAllFilesPresentInFunctionReceivers() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/functionReceivers"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("FunctionTypesWithFunctionReceivers.kt") + public void testFunctionTypesWithFunctionReceivers() throws Exception { + doParsingTest("compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.kt"); + } + + @TestMetadata("FunctionsWithFunctionReceivers.kt") + public void testFunctionsWithFunctionReceivers() throws Exception { + doParsingTest("compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.kt"); + } + + @TestMetadata("PropertiesWithFunctionReceivers.kt") + public void testPropertiesWithFunctionReceivers() throws Exception { + doParsingTest("compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.kt"); } } - @TestMetadata("compiler/testData/psi/examples/collections") - public static class Collections extends AbstractJetParsingTest { - public void testAllFilesPresentInCollections() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/collections"), Pattern.compile("^(.*)\\.kts?$"), true); + @TestMetadata("compiler/testData/psi/greatSyntacticShift") + public static class GreatSyntacticShift extends AbstractJetParsingTest { + public void testAllFilesPresentInGreatSyntacticShift() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/greatSyntacticShift"), Pattern.compile("^(.*)\\.kts?$"), true); } - @TestMetadata("ArrayList.kt") - public void testArrayList() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/ArrayList.kt"); + @TestMetadata("functionLiterals.kt") + public void testFunctionLiterals() throws Exception { + doParsingTest("compiler/testData/psi/greatSyntacticShift/functionLiterals.kt"); } - @TestMetadata("HashMap.kt") - public void testHashMap() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/HashMap.kt"); + @TestMetadata("functionTypes.kt") + public void testFunctionTypes() throws Exception { + doParsingTest("compiler/testData/psi/greatSyntacticShift/functionTypes.kt"); } - @TestMetadata("IIterable.kt") - public void testIIterable() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/IIterable.kt"); - } - - @TestMetadata("IIterator.kt") - public void testIIterator() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/IIterator.kt"); - } - - @TestMetadata("IList.kt") - public void testIList() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/IList.kt"); - } - - @TestMetadata("IMutableIterable.kt") - public void testIMutableIterable() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/IMutableIterable.kt"); - } - - @TestMetadata("IMutableIterator.kt") - public void testIMutableIterator() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/IMutableIterator.kt"); - } - - @TestMetadata("IMutableList.kt") - public void testIMutableList() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/IMutableList.kt"); - } - - @TestMetadata("IMutableSet.kt") - public void testIMutableSet() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/IMutableSet.kt"); - } - - @TestMetadata("ISet.kt") - public void testISet() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/ISet.kt"); - } - - @TestMetadata("ISized.kt") - public void testISized() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/ISized.kt"); - } - - @TestMetadata("LinkedList.kt") - public void testLinkedList() throws Exception { - doParsingTest("compiler/testData/psi/examples/collections/LinkedList.kt"); + @TestMetadata("FunctionTypesAsArguments.kt") + public void testFunctionTypesAsArguments() throws Exception { + doParsingTest("compiler/testData/psi/greatSyntacticShift/FunctionTypesAsArguments.kt"); } } - @TestMetadata("compiler/testData/psi/examples/io") - public static class Io extends AbstractJetParsingTest { - public void testAllFilesPresentInIo() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/io"), Pattern.compile("^(.*)\\.kts?$"), true); + @TestMetadata("compiler/testData/psi/kdoc") + public static class Kdoc extends AbstractJetParsingTest { + public void testAllFilesPresentInKdoc() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/kdoc"), Pattern.compile("^(.*)\\.kts?$"), true); } - @TestMetadata("IOSamples.kt") - public void testIOSamples() throws Exception { - doParsingTest("compiler/testData/psi/examples/io/IOSamples.kt"); + @TestMetadata("AtTags.kt") + public void testAtTags() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/AtTags.kt"); + } + + @TestMetadata("DocCommentAtBeginningOfFile1.kt") + public void testDocCommentAtBeginningOfFile1() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile1.kt"); + } + + @TestMetadata("DocCommentAtBeginningOfFile2.kt") + public void testDocCommentAtBeginningOfFile2() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile2.kt"); + } + + @TestMetadata("DocCommentAtBeginningOfFile3.kt") + public void testDocCommentAtBeginningOfFile3() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile3.kt"); + } + + @TestMetadata("DocCommentAtBeginningOfFile4.kt") + public void testDocCommentAtBeginningOfFile4() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile4.kt"); + } + + @TestMetadata("EndOnLeadingAsterisks.kt") + public void testEndOnLeadingAsterisks() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/EndOnLeadingAsterisks.kt"); + } + + @TestMetadata("EndRightAfterText.kt") + public void testEndRightAfterText() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/EndRightAfterText.kt"); + } + + @TestMetadata("Incomplete.kt") + public void testIncomplete() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/Incomplete.kt"); + } + + @TestMetadata("Markdown.kt") + public void testMarkdown() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/Markdown.kt"); + } + + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/Simple.kt"); + } + + @TestMetadata("TextRightAfterLeadAsterisks.kt") + public void testTextRightAfterLeadAsterisks() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/TextRightAfterLeadAsterisks.kt"); } } - @TestMetadata("compiler/testData/psi/examples/map") - public static class Map extends AbstractJetParsingTest { - public void testAllFilesPresentInMap() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/map"), Pattern.compile("^(.*)\\.kts?$"), true); + @TestMetadata("compiler/testData/psi/propertyDelegate") + public static class PropertyDelegate extends AbstractJetParsingTest { + public void testAllFilesPresentInPropertyDelegate() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/propertyDelegate"), Pattern.compile("^(.*)\\.kts?$"), true); } - @TestMetadata("IMap.kt") - public void testIMap() throws Exception { - doParsingTest("compiler/testData/psi/examples/map/IMap.kt"); + @TestMetadata("BracketsInDelegate.kt") + public void testBracketsInDelegate() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/BracketsInDelegate.kt"); + } + + @TestMetadata("DelegateAndInitializer.kt") + public void testDelegateAndInitializer() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/DelegateAndInitializer.kt"); + } + + @TestMetadata("GetterInSameLine.kt") + public void testGetterInSameLine() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/GetterInSameLine.kt"); + } + + @TestMetadata("LocalProperty.kt") + public void testLocalProperty() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/LocalProperty.kt"); + } + + @TestMetadata("OnlyBy.kt") + public void testOnlyBy() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/OnlyBy.kt"); + } + + @TestMetadata("PropertyInClass.kt") + public void testPropertyInClass() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/PropertyInClass.kt"); + } + + @TestMetadata("PropertyWithGetter.kt") + public void testPropertyWithGetter() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/PropertyWithGetter.kt"); + } + + @TestMetadata("PropertyWithInitializer.kt") + public void testPropertyWithInitializer() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/PropertyWithInitializer.kt"); + } + + @TestMetadata("PropertyWithoutTypeRef.kt") + public void testPropertyWithoutTypeRef() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/PropertyWithoutTypeRef.kt"); + } + + @TestMetadata("TopLevelProperty.kt") + public void testTopLevelProperty() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/TopLevelProperty.kt"); + } + + @TestMetadata("TwoProperties.kt") + public void testTwoProperties() throws Exception { + doParsingTest("compiler/testData/psi/propertyDelegate/TwoProperties.kt"); } } - @TestMetadata("compiler/testData/psi/examples/priorityqueues") - public static class Priorityqueues extends AbstractJetParsingTest { - public void testAllFilesPresentInPriorityqueues() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/priorityqueues"), Pattern.compile("^(.*)\\.kts?$"), true); + @TestMetadata("compiler/testData/psi/recovery") + public static class Recovery extends AbstractJetParsingTest { + @TestMetadata("AbsentLeftHandSide.kt") + public void testAbsentLeftHandSide() throws Exception { + doParsingTest("compiler/testData/psi/recovery/AbsentLeftHandSide.kt"); } - @TestMetadata("BinaryHeap.kt") - public void testBinaryHeap() throws Exception { - doParsingTest("compiler/testData/psi/examples/priorityqueues/BinaryHeap.kt"); + public void testAllFilesPresentInRecovery() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/recovery"), Pattern.compile("^(.*)\\.kts?$"), true); } - @TestMetadata("IPriorityQueue.kt") - public void testIPriorityQueue() throws Exception { - doParsingTest("compiler/testData/psi/examples/priorityqueues/IPriorityQueue.kt"); + @TestMetadata("ForRecovery.kt") + public void testForRecovery() throws Exception { + doParsingTest("compiler/testData/psi/recovery/ForRecovery.kt"); } - @TestMetadata("PriorityQueueAsPushPop.kt") - public void testPriorityQueueAsPushPop() throws Exception { - doParsingTest("compiler/testData/psi/examples/priorityqueues/PriorityQueueAsPushPop.kt"); + @TestMetadata("ImportRecovery.kt") + public void testImportRecovery() throws Exception { + doParsingTest("compiler/testData/psi/recovery/ImportRecovery.kt"); + } + + @TestMetadata("kt2172.kt") + public void testKt2172() throws Exception { + doParsingTest("compiler/testData/psi/recovery/kt2172.kt"); + } + + @TestMetadata("MissingCommaInConstructorValueParameterList.kt") + public void testMissingCommaInConstructorValueParameterList() throws Exception { + doParsingTest("compiler/testData/psi/recovery/MissingCommaInConstructorValueParameterList.kt"); + } + + @TestMetadata("MissingCommaInValueArgumentList.kt") + public void testMissingCommaInValueArgumentList() throws Exception { + doParsingTest("compiler/testData/psi/recovery/MissingCommaInValueArgumentList.kt"); + } + + @TestMetadata("MissingCommaInValueParameterList.kt") + public void testMissingCommaInValueParameterList() throws Exception { + doParsingTest("compiler/testData/psi/recovery/MissingCommaInValueParameterList.kt"); + } + + @TestMetadata("MissingCommaInValueParameterListWithValOrVar.kt") + public void testMissingCommaInValueParameterListWithValOrVar() throws Exception { + doParsingTest("compiler/testData/psi/recovery/MissingCommaInValueParameterListWithValOrVar.kt"); + } + + @TestMetadata("PackageNewLineRecovery.kt") + public void testPackageNewLineRecovery() throws Exception { + doParsingTest("compiler/testData/psi/recovery/PackageNewLineRecovery.kt"); + } + + @TestMetadata("PackageRecovery.kt") + public void testPackageRecovery() throws Exception { + doParsingTest("compiler/testData/psi/recovery/PackageRecovery.kt"); + } + + @TestMetadata("SameLineStatementRecovery.kt") + public void testSameLineStatementRecovery() throws Exception { + doParsingTest("compiler/testData/psi/recovery/SameLineStatementRecovery.kt"); + } + + @TestMetadata("ValueParameterNoTypeRecovery.kt") + public void testValueParameterNoTypeRecovery() throws Exception { + doParsingTest("compiler/testData/psi/recovery/ValueParameterNoTypeRecovery.kt"); } } - @TestMetadata("compiler/testData/psi/examples/util") - public static class Util extends AbstractJetParsingTest { - public void testAllFilesPresentInUtil() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/examples/util"), Pattern.compile("^(.*)\\.kts?$"), true); + @TestMetadata("compiler/testData/psi/script") + public static class Script extends AbstractJetParsingTest { + public void testAllFilesPresentInScript() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/script"), Pattern.compile("^(.*)\\.kts?$"), true); } - @TestMetadata("Comparison.kt") - public void testComparison() throws Exception { - doParsingTest("compiler/testData/psi/examples/util/Comparison.kt"); + @TestMetadata("ComplexScript.kts") + public void testComplexScript() throws Exception { + doParsingTest("compiler/testData/psi/script/ComplexScript.kts"); } - @TestMetadata("IComparable.kt") - public void testIComparable() throws Exception { - doParsingTest("compiler/testData/psi/examples/util/IComparable.kt"); + @TestMetadata("Import.kts") + public void testImport() throws Exception { + doParsingTest("compiler/testData/psi/script/Import.kts"); + } + + @TestMetadata("Shebang.kts") + public void testShebang() throws Exception { + doParsingTest("compiler/testData/psi/script/Shebang.kts"); + } + + @TestMetadata("ShebangIncorrect.kts") + public void testShebangIncorrect() throws Exception { + doParsingTest("compiler/testData/psi/script/ShebangIncorrect.kts"); + } + + @TestMetadata("SimpleScript.kts") + public void testSimpleScript() throws Exception { + doParsingTest("compiler/testData/psi/script/SimpleScript.kts"); + } + + @TestMetadata("unexpectedSymbol.kts") + public void testUnexpectedSymbol() throws Exception { + doParsingTest("compiler/testData/psi/script/unexpectedSymbol.kts"); + } + + } + + @TestMetadata("compiler/testData/psi/stringTemplates") + public static class StringTemplates extends AbstractJetParsingTest { + public void testAllFilesPresentInStringTemplates() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/stringTemplates"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("RawStringsWithManyQuotes.kt") + public void testRawStringsWithManyQuotes() throws Exception { + doParsingTest("compiler/testData/psi/stringTemplates/RawStringsWithManyQuotes.kt"); } } public static Test innerSuite() { - TestSuite suite = new TestSuite("Examples"); - suite.addTestSuite(Examples.class); - suite.addTestSuite(Array.class); - suite.addTestSuite(Collections.class); - suite.addTestSuite(Io.class); - suite.addTestSuite(Map.class); - suite.addTestSuite(Priorityqueues.class); - suite.addTestSuite(Util.class); + TestSuite suite = new TestSuite("Psi"); + suite.addTestSuite(Psi.class); + suite.addTest(Examples.innerSuite()); + suite.addTestSuite(FunctionReceivers.class); + suite.addTestSuite(GreatSyntacticShift.class); + suite.addTestSuite(Kdoc.class); + suite.addTestSuite(PropertyDelegate.class); + suite.addTestSuite(Recovery.class); + suite.addTestSuite(Script.class); + suite.addTestSuite(StringTemplates.class); return suite; } } - @TestMetadata("compiler/testData/psi/functionReceivers") - public static class FunctionReceivers extends AbstractJetParsingTest { - public void testAllFilesPresentInFunctionReceivers() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/functionReceivers"), Pattern.compile("^(.*)\\.kts?$"), true); + @TestMetadata("compiler/testData/parseCodeFragment/expression") + public static class Expression extends AbstractJetParsingTest { + public void testAllFilesPresentInExpression() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/parseCodeFragment/expression"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("FunctionTypesWithFunctionReceivers.kt") - public void testFunctionTypesWithFunctionReceivers() throws Exception { - doParsingTest("compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.kt"); + @TestMetadata("error.kt") + public void testError() throws Exception { + doExpressionCodeFragmentParsingTest("compiler/testData/parseCodeFragment/expression/error.kt"); } - @TestMetadata("FunctionsWithFunctionReceivers.kt") - public void testFunctionsWithFunctionReceivers() throws Exception { - doParsingTest("compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.kt"); - } - - @TestMetadata("PropertiesWithFunctionReceivers.kt") - public void testPropertiesWithFunctionReceivers() throws Exception { - doParsingTest("compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.kt"); - } - - } - - @TestMetadata("compiler/testData/psi/greatSyntacticShift") - public static class GreatSyntacticShift extends AbstractJetParsingTest { - public void testAllFilesPresentInGreatSyntacticShift() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/greatSyntacticShift"), Pattern.compile("^(.*)\\.kts?$"), true); - } - - @TestMetadata("functionLiterals.kt") - public void testFunctionLiterals() throws Exception { - doParsingTest("compiler/testData/psi/greatSyntacticShift/functionLiterals.kt"); - } - - @TestMetadata("functionTypes.kt") - public void testFunctionTypes() throws Exception { - doParsingTest("compiler/testData/psi/greatSyntacticShift/functionTypes.kt"); - } - - @TestMetadata("FunctionTypesAsArguments.kt") - public void testFunctionTypesAsArguments() throws Exception { - doParsingTest("compiler/testData/psi/greatSyntacticShift/FunctionTypesAsArguments.kt"); - } - - } - - @TestMetadata("compiler/testData/psi/kdoc") - public static class Kdoc extends AbstractJetParsingTest { - public void testAllFilesPresentInKdoc() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/kdoc"), Pattern.compile("^(.*)\\.kts?$"), true); - } - - @TestMetadata("AtTags.kt") - public void testAtTags() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/AtTags.kt"); - } - - @TestMetadata("DocCommentAtBeginningOfFile1.kt") - public void testDocCommentAtBeginningOfFile1() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile1.kt"); - } - - @TestMetadata("DocCommentAtBeginningOfFile2.kt") - public void testDocCommentAtBeginningOfFile2() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile2.kt"); - } - - @TestMetadata("DocCommentAtBeginningOfFile3.kt") - public void testDocCommentAtBeginningOfFile3() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile3.kt"); - } - - @TestMetadata("DocCommentAtBeginningOfFile4.kt") - public void testDocCommentAtBeginningOfFile4() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile4.kt"); - } - - @TestMetadata("EndOnLeadingAsterisks.kt") - public void testEndOnLeadingAsterisks() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/EndOnLeadingAsterisks.kt"); - } - - @TestMetadata("EndRightAfterText.kt") - public void testEndRightAfterText() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/EndRightAfterText.kt"); - } - - @TestMetadata("Incomplete.kt") - public void testIncomplete() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/Incomplete.kt"); - } - - @TestMetadata("Markdown.kt") - public void testMarkdown() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/Markdown.kt"); - } - - @TestMetadata("Simple.kt") + @TestMetadata("simple.kt") public void testSimple() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/Simple.kt"); - } - - @TestMetadata("TextRightAfterLeadAsterisks.kt") - public void testTextRightAfterLeadAsterisks() throws Exception { - doParsingTest("compiler/testData/psi/kdoc/TextRightAfterLeadAsterisks.kt"); + doExpressionCodeFragmentParsingTest("compiler/testData/parseCodeFragment/expression/simple.kt"); } } - @TestMetadata("compiler/testData/psi/propertyDelegate") - public static class PropertyDelegate extends AbstractJetParsingTest { - public void testAllFilesPresentInPropertyDelegate() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/propertyDelegate"), Pattern.compile("^(.*)\\.kts?$"), true); + @TestMetadata("compiler/testData/parseCodeFragment/block") + public static class Block extends AbstractJetParsingTest { + public void testAllFilesPresentInBlock() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/parseCodeFragment/block"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("BracketsInDelegate.kt") - public void testBracketsInDelegate() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/BracketsInDelegate.kt"); + @TestMetadata("expressionOnTopLevel.kt") + public void testExpressionOnTopLevel() throws Exception { + doBlockCodeFragmentParsingTest("compiler/testData/parseCodeFragment/block/expressionOnTopLevel.kt"); } - @TestMetadata("DelegateAndInitializer.kt") - public void testDelegateAndInitializer() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/DelegateAndInitializer.kt"); + @TestMetadata("imports.kt") + public void testImports() throws Exception { + doBlockCodeFragmentParsingTest("compiler/testData/parseCodeFragment/block/imports.kt"); } - @TestMetadata("GetterInSameLine.kt") - public void testGetterInSameLine() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/GetterInSameLine.kt"); + @TestMetadata("localFun.kt") + public void testLocalFun() throws Exception { + doBlockCodeFragmentParsingTest("compiler/testData/parseCodeFragment/block/localFun.kt"); } - @TestMetadata("LocalProperty.kt") - public void testLocalProperty() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/LocalProperty.kt"); + @TestMetadata("oneLine.kt") + public void testOneLine() throws Exception { + doBlockCodeFragmentParsingTest("compiler/testData/parseCodeFragment/block/oneLine.kt"); } - @TestMetadata("OnlyBy.kt") - public void testOnlyBy() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/OnlyBy.kt"); + @TestMetadata("oneStatement.kt") + public void testOneStatement() throws Exception { + doBlockCodeFragmentParsingTest("compiler/testData/parseCodeFragment/block/oneStatement.kt"); } - @TestMetadata("PropertyInClass.kt") - public void testPropertyInClass() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/PropertyInClass.kt"); + @TestMetadata("packageAndImport.kt") + public void testPackageAndImport() throws Exception { + doBlockCodeFragmentParsingTest("compiler/testData/parseCodeFragment/block/packageAndImport.kt"); } - @TestMetadata("PropertyWithGetter.kt") - public void testPropertyWithGetter() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/PropertyWithGetter.kt"); + @TestMetadata("packageDirective.kt") + public void testPackageDirective() throws Exception { + doBlockCodeFragmentParsingTest("compiler/testData/parseCodeFragment/block/packageDirective.kt"); } - @TestMetadata("PropertyWithInitializer.kt") - public void testPropertyWithInitializer() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/PropertyWithInitializer.kt"); + @TestMetadata("severalExpressions.kt") + public void testSeveralExpressions() throws Exception { + doBlockCodeFragmentParsingTest("compiler/testData/parseCodeFragment/block/severalExpressions.kt"); } - @TestMetadata("PropertyWithoutTypeRef.kt") - public void testPropertyWithoutTypeRef() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/PropertyWithoutTypeRef.kt"); + @TestMetadata("severalStatements.kt") + public void testSeveralStatements() throws Exception { + doBlockCodeFragmentParsingTest("compiler/testData/parseCodeFragment/block/severalStatements.kt"); } - @TestMetadata("TopLevelProperty.kt") - public void testTopLevelProperty() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/TopLevelProperty.kt"); - } - - @TestMetadata("TwoProperties.kt") - public void testTwoProperties() throws Exception { - doParsingTest("compiler/testData/psi/propertyDelegate/TwoProperties.kt"); - } - - } - - @TestMetadata("compiler/testData/psi/recovery") - public static class Recovery extends AbstractJetParsingTest { - @TestMetadata("AbsentLeftHandSide.kt") - public void testAbsentLeftHandSide() throws Exception { - doParsingTest("compiler/testData/psi/recovery/AbsentLeftHandSide.kt"); - } - - public void testAllFilesPresentInRecovery() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/recovery"), Pattern.compile("^(.*)\\.kts?$"), true); - } - - @TestMetadata("ForRecovery.kt") - public void testForRecovery() throws Exception { - doParsingTest("compiler/testData/psi/recovery/ForRecovery.kt"); - } - - @TestMetadata("ImportRecovery.kt") - public void testImportRecovery() throws Exception { - doParsingTest("compiler/testData/psi/recovery/ImportRecovery.kt"); - } - - @TestMetadata("kt2172.kt") - public void testKt2172() throws Exception { - doParsingTest("compiler/testData/psi/recovery/kt2172.kt"); - } - - @TestMetadata("MissingCommaInConstructorValueParameterList.kt") - public void testMissingCommaInConstructorValueParameterList() throws Exception { - doParsingTest("compiler/testData/psi/recovery/MissingCommaInConstructorValueParameterList.kt"); - } - - @TestMetadata("MissingCommaInValueArgumentList.kt") - public void testMissingCommaInValueArgumentList() throws Exception { - doParsingTest("compiler/testData/psi/recovery/MissingCommaInValueArgumentList.kt"); - } - - @TestMetadata("MissingCommaInValueParameterList.kt") - public void testMissingCommaInValueParameterList() throws Exception { - doParsingTest("compiler/testData/psi/recovery/MissingCommaInValueParameterList.kt"); - } - - @TestMetadata("MissingCommaInValueParameterListWithValOrVar.kt") - public void testMissingCommaInValueParameterListWithValOrVar() throws Exception { - doParsingTest("compiler/testData/psi/recovery/MissingCommaInValueParameterListWithValOrVar.kt"); - } - - @TestMetadata("PackageNewLineRecovery.kt") - public void testPackageNewLineRecovery() throws Exception { - doParsingTest("compiler/testData/psi/recovery/PackageNewLineRecovery.kt"); - } - - @TestMetadata("PackageRecovery.kt") - public void testPackageRecovery() throws Exception { - doParsingTest("compiler/testData/psi/recovery/PackageRecovery.kt"); - } - - @TestMetadata("SameLineStatementRecovery.kt") - public void testSameLineStatementRecovery() throws Exception { - doParsingTest("compiler/testData/psi/recovery/SameLineStatementRecovery.kt"); - } - - @TestMetadata("ValueParameterNoTypeRecovery.kt") - public void testValueParameterNoTypeRecovery() throws Exception { - doParsingTest("compiler/testData/psi/recovery/ValueParameterNoTypeRecovery.kt"); - } - - } - - @TestMetadata("compiler/testData/psi/script") - public static class Script extends AbstractJetParsingTest { - public void testAllFilesPresentInScript() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/script"), Pattern.compile("^(.*)\\.kts?$"), true); - } - - @TestMetadata("ComplexScript.kts") - public void testComplexScript() throws Exception { - doParsingTest("compiler/testData/psi/script/ComplexScript.kts"); - } - - @TestMetadata("Import.kts") - public void testImport() throws Exception { - doParsingTest("compiler/testData/psi/script/Import.kts"); - } - - @TestMetadata("Shebang.kts") - public void testShebang() throws Exception { - doParsingTest("compiler/testData/psi/script/Shebang.kts"); - } - - @TestMetadata("ShebangIncorrect.kts") - public void testShebangIncorrect() throws Exception { - doParsingTest("compiler/testData/psi/script/ShebangIncorrect.kts"); - } - - @TestMetadata("SimpleScript.kts") - public void testSimpleScript() throws Exception { - doParsingTest("compiler/testData/psi/script/SimpleScript.kts"); - } - - } - - @TestMetadata("compiler/testData/psi/stringTemplates") - public static class StringTemplates extends AbstractJetParsingTest { - public void testAllFilesPresentInStringTemplates() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/psi/stringTemplates"), Pattern.compile("^(.*)\\.kts?$"), true); - } - - @TestMetadata("RawStringsWithManyQuotes.kt") - public void testRawStringsWithManyQuotes() throws Exception { - doParsingTest("compiler/testData/psi/stringTemplates/RawStringsWithManyQuotes.kt"); + @TestMetadata("unexpectedSymbol.kt") + public void testUnexpectedSymbol() throws Exception { + doBlockCodeFragmentParsingTest("compiler/testData/parseCodeFragment/block/unexpectedSymbol.kt"); } } public static Test suite() { TestSuite suite = new TestSuite("JetParsingTestGenerated"); - suite.addTestSuite(JetParsingTestGenerated.class); - suite.addTest(Examples.innerSuite()); - suite.addTestSuite(FunctionReceivers.class); - suite.addTestSuite(GreatSyntacticShift.class); - suite.addTestSuite(Kdoc.class); - suite.addTestSuite(PropertyDelegate.class); - suite.addTestSuite(Recovery.class); - suite.addTestSuite(Script.class); - suite.addTestSuite(StringTemplates.class); + suite.addTest(Psi.innerSuite()); + suite.addTestSuite(Expression.class); + suite.addTestSuite(Block.class); return suite; } } diff --git a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt index 42e851bc559..0d657958d76 100644 --- a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt @@ -139,6 +139,8 @@ fun main(args: Array) { testClass(javaClass()) { model("psi", testMethod = "doParsingTest", pattern = "^(.*)\\.kts?$") + model("parseCodeFragment/expression", testMethod = "doExpressionCodeFragmentParsingTest", extension = "kt") + model("parseCodeFragment/block", testMethod = "doBlockCodeFragmentParsingTest", extension = "kt") } GenerateRangesCodegenTestData.main(array())