parser : guarde contre un unwrap interdit dans parse_quote
This commit is contained in:
parent
cf1d6ff998
commit
ed6aa02ce4
1 changed files with 7 additions and 4 deletions
|
@ -3,12 +3,15 @@ use crate::command::command_sequence::CommandSequence;
|
||||||
|
|
||||||
fn parse_quote(characters: &mut Vec<char>) -> String {
|
fn parse_quote(characters: &mut Vec<char>) -> String {
|
||||||
let mut quoted = String::default();
|
let mut quoted = String::default();
|
||||||
|
|
||||||
|
if !characters.is_empty() {
|
||||||
let mut current_char = characters.pop().unwrap();
|
let mut current_char = characters.pop().unwrap();
|
||||||
|
|
||||||
while !characters.is_empty() && current_char != '\'' {
|
while !characters.is_empty() && current_char != '\'' {
|
||||||
quoted.push(current_char);
|
quoted.push(current_char);
|
||||||
current_char = characters.pop().unwrap();
|
current_char = characters.pop().unwrap();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
quoted
|
quoted
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue