diff --git a/src/main.rs b/src/main.rs index 13b6b44..13ad09e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -70,6 +70,32 @@ fn parse_config(conf: String, pool: &mut Vec) -> Result x, Err(_) => return Err("Could not convert token two from the first string to i32"), }; + loop { + // This line should be empty. + let empty_line = match lines.next() { + None => break, + Some(x) => x, + }; + if !empty_line.is_empty() { + return Err("This line should be empty !"); + } + let a = match lines.next() { + None => return Err("This line should be config !"), + Some(raw) => raw, + }; + if a.is_empty() { + return Err("The config line should be empty !"); + } + let b = match lines.next() { + None => return Err("This line should be instruction !"), + Some(raw) => raw, + }; + if b.is_empty() { + return Err("The instruction line should be empty !"); + } + println!("{}", a); + println!("{}", b); + } Ok(world::World { x, y }) }