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