Generic lifetimes

This commit is contained in:
2026-05-08 20:08:03 +02:00
parent 0bf32b16cd
commit 020dd3b76b
5 changed files with 46 additions and 21 deletions
+11 -2
View File
@@ -55,7 +55,7 @@ var = { "var" }
// ======================================================
// GENERICS
// ======================================================
generic = { identifier ~ (":" ~ static_path ~ ("+" ~ static_path)*)? }
generic = { lifetime | (identifier ~ (":" ~ type_expr_param ~ ("+" ~ type_expr_param)*)?) }
generics = { "<" ~ (generic ~ ("," ~ generic)*)? ~ ">" }
// ======================================================
@@ -67,7 +67,7 @@ tuple_type = {
}
path_type = {
static_path ~ ("<" ~ (type_expr ~ ("," ~ type_expr)*)? ~ ">")?
static_path ~ ("<" ~ (type_expr_param ~ ("," ~ type_expr_param)*)? ~ ">")?
}
ref_type = {
@@ -78,6 +78,15 @@ type_expr = {
(path_type | tuple_type) ~ ref_type*
}
lifetime = {
"'" ~ identifier
}
type_expr_param = {
type_expr
| lifetime
}
// ======================================================
// LITERALS
// ======================================================