Work on closures.
This commit is contained in:
parent
bae90b8b80
commit
6652b9fc63
@ -586,4 +586,24 @@ ExpressionList:
|
|||||||
children:
|
children:
|
||||||
- expressions:
|
- expressions:
|
||||||
rule: Expression
|
rule: Expression
|
||||||
vec: true
|
vec: true
|
||||||
|
|
||||||
|
# Closure
|
||||||
|
Closure:
|
||||||
|
children:
|
||||||
|
- closure_parameters:
|
||||||
|
build:
|
||||||
|
or_else_default: true
|
||||||
|
- statements:
|
||||||
|
rule: Statement
|
||||||
|
vec: true
|
||||||
|
ClosureParameters:
|
||||||
|
children:
|
||||||
|
- parameters:
|
||||||
|
rule: ClosureParameters
|
||||||
|
vec: true
|
||||||
|
ClosureParameter:
|
||||||
|
children:
|
||||||
|
- identifier
|
||||||
|
- type_use:
|
||||||
|
optional: true
|
||||||
|
@ -789,13 +789,9 @@ ExpressionList = {
|
|||||||
// Closure
|
// Closure
|
||||||
|
|
||||||
Closure = {
|
Closure = {
|
||||||
( Cons | Mut )?
|
"{"
|
||||||
~ Move?
|
|
||||||
~ ClosureCaptures?
|
|
||||||
~ "{"
|
|
||||||
~ ( ClosureParameters? ~ "->" )?
|
~ ( ClosureParameters? ~ "->" )?
|
||||||
~ Statement*
|
~ Statement*
|
||||||
~ Expression?
|
|
||||||
~ "}"
|
~ "}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,19 +805,6 @@ ClosureParameter = {
|
|||||||
~ ( ":" ~ TypeUse )?
|
~ ( ":" ~ TypeUse )?
|
||||||
}
|
}
|
||||||
|
|
||||||
ClosureCaptures = {
|
|
||||||
"|"
|
|
||||||
~ ClosureCapture
|
|
||||||
~ ( "," ~ ClosureCapture )*
|
|
||||||
~ "|"
|
|
||||||
}
|
|
||||||
|
|
||||||
ClosureCapture = {
|
|
||||||
Borrow*
|
|
||||||
~ Mut?
|
|
||||||
~ Identifier
|
|
||||||
}
|
|
||||||
|
|
||||||
// Literals
|
// Literals
|
||||||
|
|
||||||
Literal = {
|
Literal = {
|
||||||
|
Loading…
Reference in New Issue
Block a user