diff --git a/idea/src/org/jetbrains/jet/JetNodeTypes.java b/idea/src/org/jetbrains/jet/JetNodeTypes.java index bd88257546d..aa730156804 100644 --- a/idea/src/org/jetbrains/jet/JetNodeTypes.java +++ b/idea/src/org/jetbrains/jet/JetNodeTypes.java @@ -50,6 +50,7 @@ public interface JetNodeTypes { JetNodeType CONSTRUCTOR = new JetNodeType("CONSTRUCTOR"); JetNodeType INITIALIZER_LIST = new JetNodeType("INITIALIZER_LIST"); JetNodeType THIS_CALL = new JetNodeType("THIS_CALL"); + JetNodeType BLOCK = new JetNodeType("BLOCK"); IElementType NAMESPACE_NAME = new JetNodeType("NAMESPACE_NAME"); } diff --git a/idea/src/org/jetbrains/jet/lang/parsing/AbstractJetParsing.java b/idea/src/org/jetbrains/jet/lang/parsing/AbstractJetParsing.java index 3909b738c00..7a122cdf0e7 100644 --- a/idea/src/org/jetbrains/jet/lang/parsing/AbstractJetParsing.java +++ b/idea/src/org/jetbrains/jet/lang/parsing/AbstractJetParsing.java @@ -117,6 +117,7 @@ import static org.jetbrains.jet.lexer.JetTokens.*; } protected IElementType lookahead(int k) { + // TODO: use a faster implementation PsiBuilder.Marker tmp = mark(); for (int i = 0; i < k; i++) advance(); diff --git a/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java b/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java index 8ba6432abd2..7787d5d9448 100644 --- a/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java +++ b/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java @@ -1,11 +1,10 @@ package org.jetbrains.jet.lang.parsing; import com.intellij.lang.PsiBuilder; +import com.intellij.psi.tree.TokenSet; import org.jetbrains.jet.JetNodeType; -import static org.jetbrains.jet.JetNodeTypes.NAMED_ARGUMENT; -import static org.jetbrains.jet.JetNodeTypes.VALUE_ARGUMENT; -import static org.jetbrains.jet.JetNodeTypes.VALUE_ARGUMENT_LIST; +import static org.jetbrains.jet.JetNodeTypes.*; import static org.jetbrains.jet.lexer.JetTokens.*; /** @@ -50,11 +49,9 @@ public class JetExpressionParsing extends AbstractJetParsing { * ; */ public void parseValueArgumentList() { - assert at(LPAR); - PsiBuilder.Marker list = mark(); - advance(); // LPAR + expect(LPAR, "Expecting a parameter list", TokenSet.create(RPAR)); if (!at(RPAR)) { while (true) { diff --git a/idea/src/org/jetbrains/jet/lang/parsing/JetParsing.java b/idea/src/org/jetbrains/jet/lang/parsing/JetParsing.java index 90c118421df..95611843a91 100644 --- a/idea/src/org/jetbrains/jet/lang/parsing/JetParsing.java +++ b/idea/src/org/jetbrains/jet/lang/parsing/JetParsing.java @@ -536,7 +536,7 @@ public class JetParsing extends AbstractJetParsing { while (true) { if (at(COMMA)) errorAndAdvance("Expecting a this or super constructor call"); parseInitializer(); - if (at(COMMA)) break; + if (!at(COMMA)) break; advance(); // COMMA } list.done(INITIALIZER_LIST); @@ -557,9 +557,13 @@ public class JetParsing extends AbstractJetParsing { advance(); // THIS_KEYWORD type = THIS_CALL; } - else { + else if (atSet(TYPE_REF_FIRST)) { parseTypeRef(); type = DELEGATOR_SUPER_CALL; + } else { + errorWithRecovery("Expecting constructor call (this(...)) or supertype initializer", TokenSet.create(LBRACE, COMMA)); + initializer.drop(); + return; } myExpressionParsing.parseValueArgumentList(); @@ -620,10 +624,6 @@ public class JetParsing extends AbstractJetParsing { } else { createTruncatedBuilder(lastDot).parseTypeRef(); -// // The code below is NOT REENTRANT -// myBuilder.setEOFPosition(lastDot); -// parseTypeRef(); -// myBuilder.unSetEOFPosition(); expect(DOT, "Expecting '.' before a property name", propertyNameFollow); expect(IDENTIFIER, "Expecting property name", propertyNameFollow); @@ -716,10 +716,6 @@ public class JetParsing extends AbstractJetParsing { expect(IDENTIFIER, "Expecting function name or receiver type"); } else { createTruncatedBuilder(lastDot).parseTypeRef(); -// // The code below in NOT REENTRANT -// myBuilder.setEOFPosition(lastDot); -// parseTypeRef(); -// myBuilder.unSetEOFPosition(); TokenSet functionNameFollow = TokenSet.create(LT, LPAR, COLON, EQ); expect(DOT, "Expecting '.' before a function name", functionNameFollow); @@ -835,6 +831,8 @@ public class JetParsing extends AbstractJetParsing { private void parseBlock() { assert at(LBRACE); + PsiBuilder.Marker block = mark(); + advance(); // LBRACE while (!eof() && !at(RBRACE)) { @@ -843,6 +841,8 @@ public class JetParsing extends AbstractJetParsing { } expect(RBRACE, "Expecting '}"); + + block.done(BLOCK); } /* @@ -1043,10 +1043,6 @@ public class JetParsing extends AbstractJetParsing { int lastId = findLastBefore(TokenSet.create(IDENTIFIER), TokenSet.create(COMMA, GT, COLON), false); createTruncatedBuilder(lastId).parseModifierList(); -// // The code below is NOT REENTRANT -// myBuilder.setEOFPosition(lastId); -// parseModifierList(); -// myBuilder.unSetEOFPosition(); expect(IDENTIFIER, "Type parameter name expected", TokenSet.EMPTY); @@ -1275,10 +1271,6 @@ public class JetParsing extends AbstractJetParsing { int lastId = findLastBefore(TokenSet.create(IDENTIFIER), TokenSet.create(COMMA, RPAR, COLON), false); createTruncatedBuilder(lastId).parseModifierList(); -// // The code below is NOT REENTRANT -// myBuilder.setEOFPosition(lastId); -// parseModifierList(); -// myBuilder.unSetEOFPosition(); if (!parseFunctionParameterRest()) { parameter.rollbackTo(); diff --git a/idea/testData/psi/Functions.txt b/idea/testData/psi/Functions.txt index c4910308447..1aab6712952 100644 --- a/idea/testData/psi/Functions.txt +++ b/idea/testData/psi/Functions.txt @@ -412,8 +412,9 @@ JetFile: Functions.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') FUN PsiElement(fun)('fun') @@ -433,8 +434,9 @@ JetFile: Functions.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') FUN PsiElement(fun)('fun') @@ -458,8 +460,9 @@ JetFile: Functions.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') FUN PsiElement(fun)('fun') @@ -512,8 +515,9 @@ JetFile: Functions.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') FUN PsiElement(fun)('fun') @@ -551,8 +555,9 @@ JetFile: Functions.jet USER_TYPE PsiElement(IDENTIFIER)('bar') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') FUN PsiElement(fun)('fun') @@ -615,5 +620,6 @@ JetFile: Functions.jet USER_TYPE PsiElement(IDENTIFIER)('bar') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') \ No newline at end of file + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/Properties.txt b/idea/testData/psi/Properties.txt index e73bf798543..581cd24d38a 100644 --- a/idea/testData/psi/Properties.txt +++ b/idea/testData/psi/Properties.txt @@ -98,8 +98,9 @@ JetFile: Properties.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PROPERTY_GETTER PsiElement(set)('set') @@ -151,8 +152,9 @@ JetFile: Properties.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PROPERTY_GETTER PsiElement(set)('set') @@ -160,8 +162,9 @@ JetFile: Properties.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') @@ -220,8 +223,9 @@ JetFile: Properties.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PROPERTY_GETTER MODIFIER_LIST @@ -240,8 +244,9 @@ JetFile: Properties.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') @@ -300,8 +305,9 @@ JetFile: Properties.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') @@ -360,7 +366,8 @@ JetFile: Properties.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/Properties_ERR.txt b/idea/testData/psi/Properties_ERR.txt index e4a042d9587..55262325323 100644 --- a/idea/testData/psi/Properties_ERR.txt +++ b/idea/testData/psi/Properties_ERR.txt @@ -115,8 +115,9 @@ JetFile: Properties_ERR.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PROPERTY_GETTER PsiErrorElement:Expecting 'get' or 'set' @@ -170,8 +171,9 @@ JetFile: Properties_ERR.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PROPERTY_GETTER PsiElement(set)('set') @@ -180,8 +182,9 @@ JetFile: Properties_ERR.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') @@ -225,8 +228,9 @@ JetFile: Properties_ERR.jet PsiElement(IDENTIFIER)('foo') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PROPERTY_GETTER PsiElement(set)('set') @@ -234,8 +238,9 @@ JetFile: Properties_ERR.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiErrorElement:Expecting '}' PsiElement(IDENTIFIER)('set') diff --git a/idea/testData/psi/SimpleClassMembers.jet b/idea/testData/psi/SimpleClassMembers.jet new file mode 100644 index 00000000000..e9f36daf043 --- /dev/null +++ b/idea/testData/psi/SimpleClassMembers.jet @@ -0,0 +1,59 @@ +class foo { + + extension foo for X { + extension foo for X { + + } + + class Bar {} + + fun foo() + + val x + + var f + + type foo = bar + + decomposer (a, b, c) + + this() : this(a, b, c), Foo(bar) + } + + class Bar { + extension foo for X { + + } + + class Bar {} + + fun foo() + + val x + + var f + + type foo = bar + + decomposer (a, b, c) + + this() : this(a, b, c), Foo(bar) + } + + fun foo() + + val x + + var f + + type foo = bar + + decomposer (a, b, c) + + this() : this(a, b, c), Foo(bar) + + this() : this(a, b, c), Foo(bar) { + + } + +} diff --git a/idea/testData/psi/SimpleClassMembers.txt b/idea/testData/psi/SimpleClassMembers.txt new file mode 100644 index 00000000000..8997880b234 --- /dev/null +++ b/idea/testData/psi/SimpleClassMembers.txt @@ -0,0 +1,415 @@ +JetFile: SimpleClassMembers.jet + NAMESPACE + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + EXTENSION + PsiElement(extension)('extension') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + PsiElement(for)('for') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('X') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + EXTENSION + PsiElement(extension)('extension') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + PsiElement(for)('for') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('X') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Bar') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + TYPE_PARAMETER_LIST + + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace('\n\n ') + TYPEDEF + PsiElement(type)('type') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace('\n\n ') + DECOMPOSER + PsiElement(decomposer)('decomposer') + PsiWhiteSpace(' ') + DECOMPOSER_PROPERTY_LIST + PsiElement(LPAR)('(') + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('b') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('c') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n ') + CONSTRUCTOR + PsiElement(this)('this') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + INITIALIZER_LIST + THIS_CALL + PsiElement(this)('this') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('b') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('c') + PsiElement(RPAR)(')') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + DELEGATOR_SUPER_CALL + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('bar') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Bar') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + EXTENSION + PsiElement(extension)('extension') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + PsiElement(for)('for') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('X') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Bar') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + TYPE_PARAMETER_LIST + + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace('\n\n ') + TYPEDEF + PsiElement(type)('type') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace('\n\n ') + DECOMPOSER + PsiElement(decomposer)('decomposer') + PsiWhiteSpace(' ') + DECOMPOSER_PROPERTY_LIST + PsiElement(LPAR)('(') + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('b') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('c') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n ') + CONSTRUCTOR + PsiElement(this)('this') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + INITIALIZER_LIST + THIS_CALL + PsiElement(this)('this') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('b') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('c') + PsiElement(RPAR)(')') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + DELEGATOR_SUPER_CALL + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('bar') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + TYPE_PARAMETER_LIST + + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace('\n\n ') + TYPEDEF + PsiElement(type)('type') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace('\n\n ') + DECOMPOSER + PsiElement(decomposer)('decomposer') + PsiWhiteSpace(' ') + DECOMPOSER_PROPERTY_LIST + PsiElement(LPAR)('(') + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('b') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('c') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n ') + CONSTRUCTOR + PsiElement(this)('this') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + INITIALIZER_LIST + THIS_CALL + PsiElement(this)('this') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('b') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('c') + PsiElement(RPAR)(')') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + DELEGATOR_SUPER_CALL + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('bar') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n ') + CONSTRUCTOR + PsiElement(this)('this') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + INITIALIZER_LIST + THIS_CALL + PsiElement(this)('this') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('b') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('c') + PsiElement(RPAR)(')') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + DELEGATOR_SUPER_CALL + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_REFERENCE + USER_TYPE + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + PsiElement(IDENTIFIER)('bar') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/SoftKeywords.txt b/idea/testData/psi/SoftKeywords.txt index 970297e27f8..18f42c398fc 100644 --- a/idea/testData/psi/SoftKeywords.txt +++ b/idea/testData/psi/SoftKeywords.txt @@ -305,8 +305,9 @@ JetFile: SoftKeywords.jet PsiElement(IDENTIFIER)('s') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') diff --git a/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java b/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java index dbf7c7a8754..8861967ce98 100644 --- a/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java +++ b/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java @@ -53,4 +53,5 @@ public class JetParsingTest extends ParsingTestCase { public void testExtensions() throws Exception {doTest(true);} public void testExtensions_ERR() throws Exception {doTest(true);} public void testSoftKeywords() throws Exception {doTest(true);} + public void testSimpleClassMembers() throws Exception {doTest(true);} }