parser : suppression Result dans la fonction parse_quote
This commit is contained in:
parent
e023211055
commit
7d319335fe
1 changed files with 4 additions and 4 deletions
|
@ -1,9 +1,9 @@
|
||||||
use crate::command::command_builder::CommandBuilder;
|
use crate::command::command_builder::CommandBuilder;
|
||||||
use crate::command::command_sequence::CommandSequence;
|
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() {
|
if characters.is_empty() {
|
||||||
Err(UnmatchedQuoteError)
|
String::default()
|
||||||
} else {
|
} else {
|
||||||
let mut quoted_arg = String::default();
|
let mut quoted_arg = String::default();
|
||||||
let mut current_char = characters.pop().unwrap();
|
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();
|
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)
|
parse_main(characters, current_arg)
|
||||||
*/
|
*/
|
||||||
} else if current_char == '\'' {
|
} 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.append(&mut parse_main(characters, &mut String::default()));
|
||||||
|
|
||||||
argv
|
argv
|
||||||
|
|
Loading…
Reference in a new issue