Updated grammar and AST

This commit is contained in:
2026-05-05 14:30:24 +02:00
parent 1d00667b18
commit ce7dc2b9ba
3 changed files with 19 additions and 57 deletions
+7 -10
View File
@@ -20,19 +20,16 @@ var_decl = { type_expr ~ mutable? ~ identifier }
// ================= TOP LEVEL =================
attribute = {
"#" ~ "[" ~ (structured_style | list_style | pair_attr | simple_style) ~ "]"
"#" ~ "[" ~ meta ~ "]"
}
// Simple: #[test]
simple_style = { static_path }
meta = {
static_path ~ ("=" ~ primary | "(" ~ meta_list? ~ ")")?
}
// #[derive(PartialEq, PartialOrd)]
list_style = { static_path ~ "(" ~ identifier ~ ("," ~ identifier)* ~ ","? ~ ")" }
// #[link(name = "readline")]
structured_style = { static_path ~ "(" ~ pair_attr ~ ("," ~ pair_attr)* ~ ","? ~ ")" }
pair_attr = { identifier ~ "=" ~ primary }
meta_list = {
meta ~ ("," ~ meta)* ~ ","?
}
top_level = { attribute* ~ (import | function_decl | struct_decl) }