From d834ff595d39920cb7ab0f6afe268fc340993b69 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 14 Jul 2026 07:19:43 +0200 Subject: [PATCH] Added more struct rules #117 --- crates/parser/src/grammar.pest | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/parser/src/grammar.pest b/crates/parser/src/grammar.pest index 391ef69..f6aa8c1 100644 --- a/crates/parser/src/grammar.pest +++ b/crates/parser/src/grammar.pest @@ -287,6 +287,14 @@ struct_decl = { visibility? ~ "struct" ~ identifier ~ generics_decl? ~ "{" ~ field_list ~ "}" } +tuple_struct_decl = { + visibility? ~ "struct" ~ identifier ~ generics_decl? ~ tuple_type ~ ";" +} + +empty_struct_decl = { + visibility? ~ "struct" ~ identifier ~ generics_decl? ~ ";" +} + // ====================================================== // ENUMS // ====================================================== @@ -399,7 +407,7 @@ type_alias = { "type" ~ identifier ~ generics_decl? ~ "=" ~ type_expr ~ ";" } top_level = { mod_attribute - | (attributes ~ (include_global | include_local | include_use_global | import | impl_for_decl | impl_decl | trait_decl | struct_decl | enum_decl | class_decl | declare_module | function_decl | const_decl | static_decl | type_alias)) + | (attributes ~ (include_global | include_local | include_use_global | import | impl_for_decl | impl_decl | trait_decl | struct_decl | tuple_struct_decl | empty_struct_decl | enum_decl | class_decl | declare_module | function_decl | const_decl | static_decl | type_alias)) } // ======================================================