Ast: derive builders
This commit is contained in:
parent
889cff56b3
commit
a2c4b71c14
2 changed files with 4 additions and 0 deletions
|
@ -7,4 +7,5 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.4.8", features = ["derive"]}
|
clap = { version = "4.4.8", features = ["derive"]}
|
||||||
|
derive_builder = "0.12.0"
|
||||||
toml = "0.8.8"
|
toml = "0.8.8"
|
||||||
|
|
|
@ -41,6 +41,7 @@ impl ToString for BaseType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Builder)]
|
||||||
pub struct Block<T: Statement> {
|
pub struct Block<T: Statement> {
|
||||||
statements: Vec<T>,
|
statements: Vec<T>,
|
||||||
}
|
}
|
||||||
|
@ -88,6 +89,7 @@ impl Expr for Literal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Builder)]
|
||||||
pub struct Declaration <T: Expr> {
|
pub struct Declaration <T: Expr> {
|
||||||
variable: Variable,
|
variable: Variable,
|
||||||
assn: T,
|
assn: T,
|
||||||
|
@ -114,6 +116,7 @@ impl<T: Expr> AstNode for Declaration<T> {}
|
||||||
|
|
||||||
impl<T: Expr> Statement for Declaration<T> {}
|
impl<T: Expr> Statement for Declaration<T> {}
|
||||||
|
|
||||||
|
#[derive(Clone, Builder)]
|
||||||
pub struct Variable {
|
pub struct Variable {
|
||||||
type_: BaseType,
|
type_: BaseType,
|
||||||
quantifer: Quantifier,
|
quantifer: Quantifier,
|
||||||
|
|
Loading…
Reference in a new issue