Function types

This commit is contained in:
2026-06-28 05:45:13 +02:00
parent 3ddb1bc601
commit 76541040c9
6 changed files with 104 additions and 2 deletions
+23 -1
View File
@@ -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 = {