From a2c4b71c149f0ad5d39b57c94bff2cbbe1ccceef Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Thu, 16 Nov 2023 12:56:22 -0700 Subject: [PATCH] Ast: derive builders --- Cargo.toml | 1 + src/ast.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 8ba95fe..2cdc178 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,4 +7,5 @@ edition = "2021" [dependencies] clap = { version = "4.4.8", features = ["derive"]} +derive_builder = "0.12.0" toml = "0.8.8" diff --git a/src/ast.rs b/src/ast.rs index 6907591..fd4f39a 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -41,6 +41,7 @@ impl ToString for BaseType { } } +#[derive(Builder)] pub struct Block { statements: Vec, } @@ -88,6 +89,7 @@ impl Expr for Literal { } } +#[derive(Builder)] pub struct Declaration { variable: Variable, assn: T, @@ -114,6 +116,7 @@ impl AstNode for Declaration {} impl Statement for Declaration {} +#[derive(Clone, Builder)] pub struct Variable { type_: BaseType, quantifer: Quantifier,