Function types and literals
This commit is contained in:
@@ -26,7 +26,9 @@ tupleLiteral
|
||||
;
|
||||
|
||||
functionLiteral
|
||||
: "{" (parameter | SimpleName)* "=>" expression "}"
|
||||
: "{" SimpleName "=>" expression "}"
|
||||
: "{" functionTypeContents "=>" expression "}"
|
||||
: "{" "(" parameter{","} ")" "=>" expression "}"
|
||||
;
|
||||
|
||||
constructorInvocation
|
||||
|
||||
+15
-3
@@ -15,15 +15,27 @@ type
|
||||
;
|
||||
|
||||
userType
|
||||
: name ("<" type{","} ">")?
|
||||
: name ("<" (projectionSpecifier type){","} ">")?
|
||||
;
|
||||
|
||||
projectionSpecifier
|
||||
: "in"
|
||||
: "out"
|
||||
: empty
|
||||
;
|
||||
|
||||
functionType
|
||||
: "{" type{","} "=>" type "}"
|
||||
: "{" functionTypeContents "}"
|
||||
;
|
||||
|
||||
functionTypeContents
|
||||
: "(" (parameter | type){","} ")" ":" type
|
||||
;
|
||||
|
||||
tupleType
|
||||
: "(" type"{","} ")"
|
||||
: "(" type{","} ")"
|
||||
;
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user