mers rewrite is starting to be usable

This commit is contained in:
Mark
2023-08-14 17:17:08 +02:00
parent e549b1a5be
commit 2a7cb08596
50 changed files with 1411 additions and 407 deletions

View File

@@ -0,0 +1 @@

View File

@@ -1,9 +1,6 @@
use std::sync::Arc;
use crate::{
info::Info,
program::{self, parsed::CompInfo},
};
use crate::program;
pub mod errors;
pub mod statements;
@@ -96,7 +93,7 @@ impl Source {
/// Useful for debugging the parser.
pub fn section_begin(&mut self, section: String) -> Arc<String> {
#[cfg(debug_assertions)]
println!("Section begin: {}", &section);
println!("[mers:parse] Section begin: {}", &section);
let arc = Arc::new(section);
self.sections.push(SectionMarker {
section: Arc::clone(&arc),
@@ -141,7 +138,7 @@ impl SectionMarker {
if Arc::strong_count(&self.section) == 1 {
self.end = Some(end);
#[cfg(debug_assertions)]
println!("Section end : {}", &self.section);
println!("[mers:parse] Section end : {}", &self.section);
}
}
}

View File

@@ -2,7 +2,7 @@ use std::sync::Arc;
use super::Source;
use crate::{
data::{self, Data},
data::Data,
program::{self, parsed::MersStatement},
};
@@ -142,12 +142,6 @@ pub fn parse_no_chain(
},
})
}
"loop" => {
src.section_begin("loop".to_string());
Box::new(program::parsed::r#loop::Loop {
inner: parse(src)?.expect("err: EOF instead of inner statement after loop"),
})
}
"switch" => {
src.section_begin("loop".to_string());
todo!()