Ast: derive builders

This commit is contained in:
Akemi Izuko 2023-11-16 12:56:22 -07:00
parent 889cff56b3
commit a2c4b71c14
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC
2 changed files with 4 additions and 0 deletions

View file

@ -7,4 +7,5 @@ edition = "2021"
[dependencies]
clap = { version = "4.4.8", features = ["derive"]}
derive_builder = "0.12.0"
toml = "0.8.8"

View file

@ -41,6 +41,7 @@ impl ToString for BaseType {
}
}
#[derive(Builder)]
pub struct Block<T: Statement> {
statements: Vec<T>,
}
@ -88,6 +89,7 @@ impl Expr for Literal {
}
}
#[derive(Builder)]
pub struct Declaration <T: Expr> {
variable: Variable,
assn: T,
@ -114,6 +116,7 @@ impl<T: Expr> AstNode for Declaration<T> {}
impl<T: Expr> Statement for Declaration<T> {}
#[derive(Clone, Builder)]
pub struct Variable {
type_: BaseType,
quantifer: Quantifier,