From 1f7db7ff1a70692072f2abf041a80cbe35a4c7cc Mon Sep 17 00:00:00 2001 From: Selimaj Dev Date: Tue, 5 May 2026 18:30:23 +0200 Subject: [PATCH] Class AST --- parser/src/ast.rs | 6 ++++++ parser/src/grammar.pest | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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 ~ "]"