Types with modifiers

This commit is contained in:
Andrey Breslav
2010-12-16 16:33:08 +03:00
parent dee94c5e12
commit 04de3ffcb0
5 changed files with 76 additions and 5 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ functionType
; ;
functionTypeContents functionTypeContents
: "(" (parameter | type){","} ")" ":" type : "(" (parameter | modifiers /*lazy out ref*/ type){","} ")" ":" type
; ;
tupleType tupleType
@@ -772,6 +772,7 @@ public class JetParsing {
if (!at(RPAR)) { if (!at(RPAR)) {
while (true) { while (true) {
if (!parseValueParameter()) { if (!parseValueParameter()) {
parseModifierList(); // lazy, out, ref
parseTypeRef(); parseTypeRef();
} }
if (!at(COMMA)) break; if (!at(COMMA)) break;
+2
View File
@@ -12,3 +12,5 @@ type f = {(a : [a] a, foo, x : bar) : b}
type f = {(foo, a : a) : b} type f = {(foo, a : a) : b}
type f = {(foo, a : {(a) : b}) : b} type f = {(foo, a : {(a) : b}) : b}
type f = {(foo, a : {(a) : b}) : {() : ()}} type f = {(foo, a : {(a) : b}) : {() : ()}}
type f = {(lazy foo, out a : {(ref a) : b}) : {() : ()}}
+69 -2
View File
@@ -13,7 +13,7 @@ JetFile: FunctionTypes.jet
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST VALUE_PARAMETER_LIST
PsiElement(LPAR)('(') PsiElement(LPAR)('(')
TYPE_REFERENCE MODIFIER_LIST
ATTRIBUTE_ANNOTATION ATTRIBUTE_ANNOTATION
PsiElement(LBRACKET)('[') PsiElement(LBRACKET)('[')
ATTRIBUTE ATTRIBUTE
@@ -21,7 +21,8 @@ JetFile: FunctionTypes.jet
USER_TYPE USER_TYPE
PsiElement(IDENTIFIER)('a') PsiElement(IDENTIFIER)('a')
PsiElement(RBRACKET)(']') PsiElement(RBRACKET)(']')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE USER_TYPE
PsiElement(IDENTIFIER)('a') PsiElement(IDENTIFIER)('a')
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
@@ -401,6 +402,72 @@ JetFile: FunctionTypes.jet
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(COLON)(':') PsiElement(COLON)(':')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
TYPE_REFERENCE
PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
TUPLE_TYPE
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(RBRACE)('}')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
TYPEDEF
PsiElement(type)('type')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('f')
PsiWhiteSpace(' ')
TYPE_PARAMETER_LIST
<empty list>
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
TYPE_REFERENCE
PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
MODIFIER_LIST
PsiElement(lazy)('lazy')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
PsiElement(IDENTIFIER)('foo')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
MODIFIER_LIST
PsiElement(out)('out')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('a')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
MODIFIER_LIST
PsiElement(ref)('ref')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
PsiElement(IDENTIFIER)('a')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
PsiElement(IDENTIFIER)('b')
PsiElement(RBRACE)('}')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE TYPE_REFERENCE
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST VALUE_PARAMETER_LIST
+3 -2
View File
@@ -13,7 +13,7 @@ JetFile: FunctionTypes_ERR.jet
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST VALUE_PARAMETER_LIST
PsiElement(LPAR)('(') PsiElement(LPAR)('(')
TYPE_REFERENCE MODIFIER_LIST
ATTRIBUTE_ANNOTATION ATTRIBUTE_ANNOTATION
PsiElement(LBRACKET)('[') PsiElement(LBRACKET)('[')
ATTRIBUTE ATTRIBUTE
@@ -21,7 +21,8 @@ JetFile: FunctionTypes_ERR.jet
USER_TYPE USER_TYPE
PsiElement(IDENTIFIER)('a') PsiElement(IDENTIFIER)('a')
PsiElement(RBRACKET)(']') PsiElement(RBRACKET)(']')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE USER_TYPE
PsiElement(IDENTIFIER)('a') PsiElement(IDENTIFIER)('a')
PsiElement(RPAR)(')') PsiElement(RPAR)(')')