41 lines
702 B
Rust
41 lines
702 B
Rust
|
use crate::params::Params;
|
||
|
use crate::ast::{
|
||
|
Quantifier,
|
||
|
BaseType,
|
||
|
GlobalBlock,
|
||
|
Block,
|
||
|
Literal,
|
||
|
Declaration,
|
||
|
Variable,
|
||
|
BinaryOperator,
|
||
|
};
|
||
|
|
||
|
pub struct AstBuilder {
|
||
|
params: Params,
|
||
|
ast: GlobalBlock,
|
||
|
}
|
||
|
|
||
|
impl AstBuilder {
|
||
|
pub fn from(params: Params) -> Self {
|
||
|
Self {
|
||
|
params,
|
||
|
ast: GlobalBlock::default(),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub fn generate(&self) {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl ToString for AstBuilder {
|
||
|
fn to_string(&self) -> String {
|
||
|
let mut s = format!("// Generated by {} v{}\n",
|
||
|
env!("CARGO_PKG_NAME"),
|
||
|
env!("CARGO_PKG_VERSION"),
|
||
|
);
|
||
|
|
||
|
s.push_str(&self.ast.to_string());
|
||
|
s
|
||
|
}
|
||
|
}
|