Attribute grammar
This commit is contained in:
+12
-1
@@ -19,7 +19,18 @@ var_decl = { type_expr ~ mutable? ~ identifier }
|
|||||||
|
|
||||||
// ================= TOP LEVEL =================
|
// ================= TOP LEVEL =================
|
||||||
|
|
||||||
top_level = _{ import | function_decl | struct_decl }
|
attribute_list = { sharp ~ "[" ~ attribute ~ ("," ~ attribute)* ~ "]" }
|
||||||
|
|
||||||
|
attribute = { static_path ~ attribute_args? }
|
||||||
|
|
||||||
|
attribute_args = { "(" ~ (attr_expr ~ ("," ~ attr_expr)*)? ~ ")" }
|
||||||
|
|
||||||
|
attr_expr = {
|
||||||
|
(identifier ~ "=" ~ primary)
|
||||||
|
| primary
|
||||||
|
}
|
||||||
|
|
||||||
|
top_level = _{ attribute_list* ~ (import | function_decl | struct_decl) }
|
||||||
|
|
||||||
import = { sharp ~ "include" ~ "<" ~ static_path ~ ">" }
|
import = { sharp ~ "include" ~ "<" ~ static_path ~ ">" }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user