Enum grammar
This commit is contained in:
+11
-1
@@ -37,7 +37,17 @@ class_decl = {
|
||||
|
||||
// ================= TOP LEVEL =================
|
||||
|
||||
top_level = { (attributes ~ (import | function_decl | struct_decl | class_decl | mod_package)) | mod_attribute }
|
||||
enum_named = { identifier }
|
||||
enum_tuple = { identifier ~ tuple_type }
|
||||
enum_struct = { identifier ~ "{" ~ field_list ~ "}" }
|
||||
|
||||
enum_field = _{ enum_tuple | enum_struct | enum_named }
|
||||
|
||||
enum_fields = _{ enum_field ~ ("," ~ enum_field)* ~ ","? }
|
||||
|
||||
enum_decl = { export? ~ "enum" ~ identifier ~ "{" ~ enum_fields ~ "}" }
|
||||
|
||||
top_level = { (attributes ~ (import | function_decl | struct_decl | enum_decl | class_decl | mod_package)) | mod_attribute }
|
||||
|
||||
attribute = {
|
||||
"#" ~ "[" ~ meta ~ "]"
|
||||
|
||||
Reference in New Issue
Block a user