|
|
|
@ -140,6 +140,11 @@ fn parse_file(file_path: PathBuf) -> Vec<Command> {
|
|
|
|
|
let token_lines = tokenize_file(file_path);
|
|
|
|
|
let mut commands = Vec::new();
|
|
|
|
|
for line in token_lines {
|
|
|
|
|
macro_rules! unknown {
|
|
|
|
|
() => {
|
|
|
|
|
panic!("Unknown command {}", describe_line(&line))
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
commands.push(match line.as_slice() {
|
|
|
|
|
[Str(text)] => Say {
|
|
|
|
|
name: None,
|
|
|
|
@ -153,10 +158,10 @@ fn parse_file(file_path: PathBuf) -> Vec<Command> {
|
|
|
|
|
food: food.to_owned(),
|
|
|
|
|
politely: match tail {
|
|
|
|
|
[Boolean(politely)] => *politely,
|
|
|
|
|
_ => false,
|
|
|
|
|
_ => unknown!(),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
_ => panic!("Unknown command {}", describe_line(&line)),
|
|
|
|
|
_ => unknown!(),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
commands
|
|
|
|
|