parser : suppression Result dans la fonction parse_quote

This commit is contained in:
Ahurac 2024-04-15 11:13:30 +02:00
parent e023211055
commit 7d319335fe

View file

@ -1,9 +1,9 @@
use crate::command::command_builder::CommandBuilder;
use crate::command::command_sequence::CommandSequence;
fn parse_quote(characters: &mut Vec<char>) -> Result<String, UnmatchedQuoteError> {
fn parse_quote(characters: &mut Vec<char>) -> String {
if characters.is_empty() {
Err(UnmatchedQuoteError)
String::default()
} else {
let mut quoted_arg = String::default();
let mut current_char = characters.pop().unwrap();
@ -13,7 +13,7 @@ fn parse_quote(characters: &mut Vec<char>) -> Result<String, UnmatchedQuoteError
current_char = characters.pop().unwrap();
}
Ok(quoted_arg)
quoted_arg
}
}
@ -38,7 +38,7 @@ fn parse_main(characters: &mut Vec<char>, current_arg: &mut String) -> Vec<Strin
parse_main(characters, current_arg)
*/
} else if current_char == '\'' {
let mut argv = vec![parse_quote(characters).unwrap()];
let mut argv = vec![parse_quote(characters)];
argv.append(&mut parse_main(characters, &mut String::default()));
argv