Tests fixed
This commit is contained in:
@@ -89,11 +89,11 @@ property
|
|||||||
;
|
;
|
||||||
|
|
||||||
getter
|
getter
|
||||||
: modifiers "get" "(" ")" functionBody
|
: modifiers "get" "(" ")" (":" type)? functionBody
|
||||||
;
|
;
|
||||||
|
|
||||||
setter
|
setter
|
||||||
: modifiers "set" "(" modifiers parameter ")" functionBody // TODO: Can the parameter be lazy?
|
: modifiers "set" "(" modifiers (SimpleName | parameter) ")" functionBody // TODO: Can the parameter be lazy?
|
||||||
;
|
;
|
||||||
|
|
||||||
parameter
|
parameter
|
||||||
|
|||||||
@@ -265,32 +265,6 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
return DECOMPOSER;
|
return DECOMPOSER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* modifier
|
|
||||||
* : "virtual"
|
|
||||||
* : "enum"
|
|
||||||
* : "open"
|
|
||||||
* : "attribute"
|
|
||||||
* : "override"
|
|
||||||
* : "abstract"
|
|
||||||
* : "private"
|
|
||||||
* : "protected"
|
|
||||||
* : "public"
|
|
||||||
* : "internal"
|
|
||||||
* : "lazy"
|
|
||||||
*/
|
|
||||||
private boolean parseModifierSoftKeyword() {
|
|
||||||
if (!at(IDENTIFIER)) return false;
|
|
||||||
String tokenText = myBuilder.getTokenText();
|
|
||||||
IElementType tokenType = MODIFIER_KEYWORD_MAP.get(tokenText);
|
|
||||||
if (tokenType != null) {
|
|
||||||
myBuilder.remapCurrentToken(tokenType);
|
|
||||||
advance();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (modifier | attribute)*
|
* (modifier | attribute)*
|
||||||
*/
|
*/
|
||||||
@@ -304,7 +278,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
advance(); // MODIFIER
|
advance(); // MODIFIER
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!parseModifierSoftKeyword()) break;
|
break;
|
||||||
}
|
}
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
@@ -921,12 +895,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
parseAttributeList();
|
parseAttributeList();
|
||||||
|
|
||||||
PsiBuilder.Marker delegator = mark();
|
PsiBuilder.Marker delegator = mark();
|
||||||
if (at(LPAR)) {
|
parseTypeRef();
|
||||||
error("Expecting type name");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
parseTypeRef();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (at(BY_KEYWORD)) {
|
if (at(BY_KEYWORD)) {
|
||||||
advance(); // BY_KEYWORD
|
advance(); // BY_KEYWORD
|
||||||
@@ -980,7 +949,9 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
*/
|
*/
|
||||||
private void parsePrimaryConstructorParameter() {
|
private void parsePrimaryConstructorParameter() {
|
||||||
PsiBuilder.Marker param = mark();
|
PsiBuilder.Marker param = mark();
|
||||||
parseModifierList();
|
|
||||||
|
int lastId = findLastBefore(TokenSet.create(IDENTIFIER), TokenSet.create(COMMA, RPAR, COLON), false);
|
||||||
|
createTruncatedBuilder(lastId).parseModifierList();
|
||||||
|
|
||||||
if (at(VAR_KEYWORD) || at(VAL_KEYWORD)) {
|
if (at(VAR_KEYWORD) || at(VAL_KEYWORD)) {
|
||||||
advance(); // VAR_KEYWORD | VAL_KEYWORD
|
advance(); // VAR_KEYWORD | VAL_KEYWORD
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace foo
|
||||||
|
|
||||||
|
class Runnable<a,a>(a : doo = 0) : foo(d=0), ,bar by x, bar {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
JetFile: BabySteps_ERR.jet
|
||||||
|
NAMESPACE
|
||||||
|
PsiElement(namespace)('namespace')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
NAMESPACE_NAME
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n\n')
|
||||||
|
CLASS
|
||||||
|
PsiElement(class)('class')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('Runnable')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PRIMARY_CONSTRUCTOR_PARAMETERS_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PRIMARY_CONSTRUCTOR_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('doo')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(EQ)('=')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(INTEGER_LITERAL)('0')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DELEGATION_SPECIFIER_LIST
|
||||||
|
DELEGATION_SPECIFIER
|
||||||
|
DELEGATOR_SUPER_CALL
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
NAMED_ARGUMENT
|
||||||
|
PsiElement(IDENTIFIER)('d')
|
||||||
|
PsiElement(EQ)('=')
|
||||||
|
PsiElement(INTEGER_LITERAL)('0')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a delegation specifier
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
DELEGATION_SPECIFIER
|
||||||
|
DELEGATOR_BY
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(by)('by')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DELEGATION_SPECIFIER
|
||||||
|
DELEGATOR_SUPER_CLASS
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
CLASS_BODY
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
@@ -22,4 +22,8 @@ class foo {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this() : - {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,5 +182,22 @@ JetFile: SimpleClassMembers_ERR.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CONSTRUCTOR
|
||||||
|
PsiElement(this)('this')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INITIALIZER_LIST
|
||||||
|
PsiErrorElement:Expecting constructor call (this(...)) or supertype initializer
|
||||||
|
PsiElement(MINUS)('-')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n\n')
|
PsiWhiteSpace('\n\n')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
@@ -109,7 +109,63 @@ ref
|
|||||||
public : t,
|
public : t,
|
||||||
private : t,
|
private : t,
|
||||||
protected : t,
|
protected : t,
|
||||||
internal : t
|
internal : t,
|
||||||
|
public protected private internal abstract
|
||||||
|
virtual
|
||||||
|
enum
|
||||||
|
open
|
||||||
|
attribute
|
||||||
|
override
|
||||||
|
virtual
|
||||||
|
abstract
|
||||||
|
private
|
||||||
|
protected
|
||||||
|
public
|
||||||
|
internal
|
||||||
|
lazy open : t
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class F(val foo : bar,
|
||||||
|
abstract : t,
|
||||||
|
virtual : t,
|
||||||
|
enum : t,
|
||||||
|
open : t,
|
||||||
|
attribute : t,
|
||||||
|
override : t,
|
||||||
|
virtual : t,
|
||||||
|
abstract : t,
|
||||||
|
private : t,
|
||||||
|
protected : t,
|
||||||
|
public : t,
|
||||||
|
internal : t,
|
||||||
|
lazy : t,
|
||||||
|
wraps : t,
|
||||||
|
import : t,
|
||||||
|
where : t,
|
||||||
|
by : t,
|
||||||
|
get : t,
|
||||||
|
set : t,
|
||||||
|
public : t,
|
||||||
|
private : t,
|
||||||
|
protected : t,
|
||||||
|
internal : t,
|
||||||
|
public protected private internal abstract
|
||||||
|
virtual
|
||||||
|
enum
|
||||||
|
open
|
||||||
|
attribute
|
||||||
|
override
|
||||||
|
virtual
|
||||||
|
abstract
|
||||||
|
private
|
||||||
|
protected
|
||||||
|
public
|
||||||
|
internal
|
||||||
|
lazy open : b
|
||||||
|
) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class JetParsingTest extends ParsingTestCase {
|
|||||||
|
|
||||||
public void testEmptyFile() throws Exception {doTest(true);}
|
public void testEmptyFile() throws Exception {doTest(true);}
|
||||||
public void testBabySteps() throws Exception {doTest(true);}
|
public void testBabySteps() throws Exception {doTest(true);}
|
||||||
|
public void testBabySteps_ERR() throws Exception {doTest(true);}
|
||||||
public void testImports() throws Exception {doTest(true);}
|
public void testImports() throws Exception {doTest(true);}
|
||||||
public void testImports_ERR() throws Exception {doTest(true);}
|
public void testImports_ERR() throws Exception {doTest(true);}
|
||||||
public void testImportSoftKW() throws Exception {doTest(true);}
|
public void testImportSoftKW() throws Exception {doTest(true);}
|
||||||
|
|||||||
Reference in New Issue
Block a user