// @name commands // @return Vec // @brief Extract commands by semicolon and newline // @param tcl: &str pub fn commands(tcl: &str) -> Vec { let mut commands: Vec = vec![]; let mut quote: bool = false; let mut new_command: String = String::new(); for character in tcl.chars() { if quote { new_command.push(character); if character == '"' { quote = false; } } else { match character { '\n' | ';' => { commands.push(new_command.clone()); new_command = String::new(); } '"' => { new_command.push(character); quote = true; } _ => new_command.push(character), } } } commands.push(new_command); return commands; } // @name words // @return Vec // @brief Split command into words. // @param command: &str pub fn words(command: &str) -> Vec { vec![] }