diff --git a/examples/src/FunctionsAndTypes.jetl b/examples/src/FunctionsAndTypes.jetl index 3c85e50fb4a..168b9eea6de 100644 --- a/examples/src/FunctionsAndTypes.jetl +++ b/examples/src/FunctionsAndTypes.jetl @@ -30,5 +30,5 @@ val f1 = {(T) : X => something(it)} val f1 = {t => something(t)} val f1 = {something(it)} -val f1 : {(T) : X} = ... +val f1 : {(T) : X} = {X()} diff --git a/grammar/src/class.grm b/grammar/src/class.grm index cde2a46c394..f3ed4ce6b2c 100644 --- a/grammar/src/class.grm +++ b/grammar/src/class.grm @@ -22,6 +22,7 @@ class classModifier : accessModifier : "abstract" + : "interface" // TODO: better name : "sealed" ; @@ -31,7 +32,7 @@ delegationSpecifier ; explicitDelegation - : userType "by" expression // Syntax is questionable + : userType "by" expression // TODO: Syntax is questionable ; typeParameter @@ -40,7 +41,7 @@ typeParameter typeConstraint : userType ":" userType - // other constraints, maybe + // TODO: other constraints, maybe ; defaultConstructorParameter diff --git a/grammar/src/expressions.grm b/grammar/src/expressions.grm index 06bb08788e5..3bb9323f146 100644 --- a/grammar/src/expressions.grm +++ b/grammar/src/expressions.grm @@ -6,11 +6,11 @@ expression : tupleLiteral : listLiteral : mapLiteral + : typeLiteral : "null" : binOpExpression : unOpExpression - : name functionParameters? // TODO: ambiguity here - : infixFunctionCall + : functionCall : arrayAccess : match : FieldName @@ -23,7 +23,7 @@ binaryOperation // Decreasing precedence : "*" : "/" // No % : "+" : "-" // No << >> >>> - : "<" : ">" : ">=" : "<=" : "is" : "isnot" : "in" // TODO: Check the precedence for in carefully + : "<" : ">" : ">=" : "<=" : "is" : "isnot" : "in" : "as" // TODO: Check the precedence for in carefully : "==" : "===" // No | & ^ ~ : "&&" @@ -45,6 +45,11 @@ postfixUnaryOperation : "++" : "--" ; +functionCall + : completeFunctionCall + : onlyTypeParameters + : infixFunctionCall + jump : "throw" expression : "return" expression