Updated grammar and AST
This commit is contained in:
+7
-10
@@ -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) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user