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
: "(" (parameter | type){","} ")" ":" type
: "(" (parameter | modifiers /*lazy out ref*/ type){","} ")" ":" type
;
tupleType
@@ -772,6 +772,7 @@ public class JetParsing {
if (!at(RPAR)) {
while (true) {
if (!parseValueParameter()) {
parseModifierList(); // lazy, out, ref
parseTypeRef();
}
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}) : 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)('{')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
TYPE_REFERENCE
MODIFIER_LIST
ATTRIBUTE_ANNOTATION
PsiElement(LBRACKET)('[')
ATTRIBUTE
@@ -21,7 +21,8 @@ JetFile: FunctionTypes.jet
USER_TYPE
PsiElement(IDENTIFIER)('a')
PsiElement(RBRACKET)(']')
PsiWhiteSpace(' ')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
PsiElement(IDENTIFIER)('a')
PsiElement(RPAR)(')')
@@ -401,6 +402,72 @@ JetFile: FunctionTypes.jet
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
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
PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST
+3 -2
View File
@@ -13,7 +13,7 @@ JetFile: FunctionTypes_ERR.jet
PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
TYPE_REFERENCE
MODIFIER_LIST
ATTRIBUTE_ANNOTATION
PsiElement(LBRACKET)('[')
ATTRIBUTE
@@ -21,7 +21,8 @@ JetFile: FunctionTypes_ERR.jet
USER_TYPE
PsiElement(IDENTIFIER)('a')
PsiElement(RBRACKET)(']')
PsiWhiteSpace(' ')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
PsiElement(IDENTIFIER)('a')
PsiElement(RPAR)(')')