generics parsing and AST

This commit is contained in:
2026-05-08 16:48:31 +02:00
parent 630528a843
commit 205e2d9fd3
3 changed files with 41 additions and 13 deletions
+7 -1
View File
@@ -52,6 +52,12 @@ export = { "public" }
mutable = { "mut" }
var = { "var" }
// ======================================================
// GENERICS
// ======================================================
generic = { identifier ~ (":" ~ static_path ~ ("+" ~ static_path)*)? }
generics = { "<" ~ (generic ~ ("," ~ generic)*)? ~ ">" }
// ======================================================
// TYPES
// ======================================================
@@ -168,7 +174,7 @@ mod_package = {
// ======================================================
struct_decl = {
export? ~ "struct" ~ identifier ~ "{" ~ field_list? ~ "}"
export? ~ "struct" ~ identifier ~ generics? ~ "{" ~ field_list? ~ "}"
}
// ======================================================