Ast: derive builders
This commit is contained in:
parent
889cff56b3
commit
a2c4b71c14
|
@ -7,4 +7,5 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
clap = { version = "4.4.8", features = ["derive"]}
|
||||
derive_builder = "0.12.0"
|
||||
toml = "0.8.8"
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue