parser : match plus lisible pour parse_backslash
This commit is contained in:
parent
5584f49c87
commit
eaa9622446
1 changed files with 4 additions and 5 deletions
|
@ -17,11 +17,10 @@ fn parse_quote(characters: &mut Vec<char>) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_backslash(characters: &mut Vec<char>) -> Option<char> {
|
fn parse_backslash(characters: &mut Vec<char>) -> Option<char> {
|
||||||
let mut escaped_char: Option<char> = None;
|
let escaped_char = match characters.is_empty() {
|
||||||
|
false => Some(characters.pop().unwrap()),
|
||||||
if !characters.is_empty() {
|
true => None,
|
||||||
escaped_char = Some(characters.pop().unwrap());
|
};
|
||||||
}
|
|
||||||
|
|
||||||
escaped_char
|
escaped_char
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue