diff --git a/parser/src/ast.rs b/parser/src/ast.rs index fb72ea9..0c8ba21 100644 --- a/parser/src/ast.rs +++ b/parser/src/ast.rs @@ -74,6 +74,12 @@ pub enum TopLevelKind { return_type: TypeExpr, body: Block, }, + ClassDecl { + export: bool, + name: String, + fields: Vec, + constructor: (ParamList, Block), + }, } #[derive(Debug, Clone, Serialize)] diff --git a/parser/src/grammar.pest b/parser/src/grammar.pest index d86c135..86d0f36 100644 --- a/parser/src/grammar.pest +++ b/parser/src/grammar.pest @@ -34,7 +34,7 @@ class_decl = { // ================= TOP LEVEL ================= -top_level = { (attributes ~ (import | function_decl | struct_decl)) | mod_attribute | class_decl } +top_level = { (attributes ~ (import | function_decl | struct_decl | class_decl)) | mod_attribute } attribute = { "#" ~ "[" ~ meta ~ "]"