Add first warning to compiler output

This commit is contained in:
2025-06-24 01:48:17 -07:00
parent c29361214a
commit 1deccaf9c8
5 changed files with 152 additions and 13 deletions
+17 -2
View File
@@ -1,4 +1,5 @@
mod encoding;
mod error;
mod labels;
mod peg;
mod preprocess;
@@ -36,8 +37,22 @@ fn main() -> Result<(), Box<dyn Error>> {
}
// Resolve labels to proper ZZT-OOP
for mut board in &mut world.boards {
process_labels(&mut board);
let mut messages = vec![];
for (i, mut board) in world.boards.iter_mut().enumerate() {
let mut result = process_labels(&mut board).unwrap();
for message in result.iter_mut() {
message.location.board = Some(i);
message.location.file_path = Some(world_filename.clone());
}
messages.extend(result);
}
// Print diagnostics
for (i, message) in messages.iter().enumerate() {
if i > 0 {
println!();
}
println!("{}", message.rich_format(&world));
}
// Try to write a modified world file