Implemented logic for loops and if statements

This commit is contained in:
2025-03-16 14:28:49 -04:00
parent 548ea363e3
commit 182182cacb
24 changed files with 811 additions and 299 deletions

View File

@@ -318,6 +318,7 @@ impl JobTab {
}
}
#[derive(Debug)]
pub struct JobBldr {
table_id: Option<usize>,
pgid: Option<Pid>,
@@ -373,6 +374,25 @@ impl JobBldr {
}
}
/// A wrapper around Vec<JobBldr> with some job-specific methods
pub struct JobStack(Vec<JobBldr>);
impl JobStack {
pub fn new() -> Self {
Self(vec![])
}
pub fn new_job(&mut self) {
self.0.push(JobBldr::new())
}
pub fn curr_job_mut(&mut self) -> Option<&mut JobBldr> {
self.0.last_mut()
}
pub fn finalize_job(&mut self) -> Option<Job> {
let job = self.0.pop().map(|bldr| bldr.build());
job
}
}
#[derive(Debug,Clone)]
pub struct Job {
table_id: Option<usize>,