parse token setup line
This commit is contained in:
parent
a50ec5d79b
commit
5c9aeabd03
15
src/main.rs
15
src/main.rs
@ -91,8 +91,21 @@ fn parse_config(conf: String, pool: &mut Vec<robot::Robot>) -> Result<world::Wor
|
|||||||
Some(raw) => raw,
|
Some(raw) => raw,
|
||||||
};
|
};
|
||||||
if raw_inst.is_empty() {
|
if raw_inst.is_empty() {
|
||||||
return Err("Thi line should not be empty !");
|
return Err("This line should not be empty !");
|
||||||
}
|
}
|
||||||
|
let mut setup = raw_setup.split_whitespace();
|
||||||
|
let pos_x = match setup.next() {
|
||||||
|
None => return Err("Could not read the first token of the setup line !"),
|
||||||
|
Some(raw) => raw,
|
||||||
|
};
|
||||||
|
let pos_y = match setup.next() {
|
||||||
|
None => return Err("Could not read the second token of the setup line !"),
|
||||||
|
Some(raw) => raw,
|
||||||
|
};
|
||||||
|
let orientation = match setup.next() {
|
||||||
|
None => return Err("Could not read the third token of the setup line !"),
|
||||||
|
Some(raw) => raw,
|
||||||
|
};
|
||||||
println!("{}", raw_setup);
|
println!("{}", raw_setup);
|
||||||
println!("{}", raw_inst);
|
println!("{}", raw_inst);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user