Type postix gen

This commit is contained in:
2026-05-04 17:36:39 +02:00
parent 0192844d27
commit d263f1a41f
4 changed files with 33 additions and 13 deletions
+8 -3
View File
@@ -11,11 +11,16 @@ pub struct ParamList(pub Vec<VarDecl>);
#[derive(Debug, Clone, Serialize)]
pub struct Block(pub Vec<Statement>);
#[derive(Debug, Clone, Serialize)]
pub enum TypePostfix {
Ref,
}
#[derive(Debug, Clone, Serialize)]
pub enum TypeExpr {
Path(StaticPath),
PathParams(StaticPath, Vec<TypeExpr>),
Tuple(Vec<TypeExpr>),
Path(StaticPath, Vec<TypePostfix>),
PathParams(StaticPath, Vec<TypeExpr>, Vec<TypePostfix>),
Tuple(Vec<TypeExpr>, Vec<TypePostfix>),
}
#[derive(Debug, Clone, Serialize)]
+2 -1
View File
@@ -75,7 +75,8 @@ while_stmt = {
// ================= EXPRESSIONS =================
tuple_type = { "(" ~ (type_expr ~ ("," ~ type_expr)*)? ~ ")" }
path_type = { static_path ~ ("<" ~ (type_expr ~ ("," ~ type_expr)*)? ~ ">")? }
type_expr = { path_type | tuple_type }
ref_type = { "*" }
type_expr = { (path_type | tuple_type) ~ ref_type* }
primary = {
integer