Function types
This commit is contained in:
@@ -111,12 +111,34 @@ ref_type = {
|
||||
mutable? ~ lifetime? ~ "&"
|
||||
}
|
||||
|
||||
fn_kind_fn = { "fn" }
|
||||
fn_kind_unsafe = { "unsafe" ~ "fn" }
|
||||
fn_kind_closure = { "Fn" }
|
||||
fn_kind_once = { "FnOnce" }
|
||||
fn_kind_mut = { "FnMut" }
|
||||
|
||||
fn_kind = _{
|
||||
fn_kind_fn
|
||||
| fn_kind_unsafe
|
||||
| fn_kind_closure
|
||||
| fn_kind_once
|
||||
| fn_kind_mut
|
||||
}
|
||||
|
||||
fn_type = {
|
||||
fn_kind ~ "(" ~ (type_expr ~ ("," ~ type_expr)*)? ~ ")"
|
||||
}
|
||||
|
||||
dyn_type = {
|
||||
"dyn" ~ type_expr
|
||||
}
|
||||
|
||||
void_type = {
|
||||
"void"
|
||||
}
|
||||
|
||||
type_expr = {
|
||||
(path_type | tuple_type | dyn_type) ~ (unsafe_ref_type | ref_type)*
|
||||
(void_type | path_type | tuple_type | dyn_type) ~ (unsafe_ref_type | ref_type | fn_type)*
|
||||
}
|
||||
|
||||
lifetime = {
|
||||
|
||||
Reference in New Issue
Block a user