diff --git a/demo/demo.rpy b/demo/demo.rpy index 5a94c16..dbe8e1d 100644 --- a/demo/demo.rpy +++ b/demo/demo.rpy @@ -1,2 +1,3 @@ "Bob sat on the bench." -"Bob" "Good morning!" \ No newline at end of file +"Bob" "Good morning!" +eat "potato" \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 252e2dd..9c7dcf5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,7 +33,10 @@ pub enum Command { Say { name: Option, text: String, - } + }, + Eat { + food: String, + }, } use Command::*; @@ -124,6 +127,9 @@ pub fn parse_file(file_path: &str) -> Vec { name: Some(name.to_owned()), text: text.to_owned(), }, + [Keyword(keyword), Str(food)] if keyword.eq("eat") => Eat { + food: food.to_owned(), + }, _ => panic!("Unknown command {}", describe_line(&line)), }); }