Refactor challenge 36 to match SRP protocol better

This commit is contained in:
2022-10-06 17:05:46 -04:00
parent eae126f4cd
commit a1de52bfd2
4 changed files with 155 additions and 64 deletions

View File

@@ -17,8 +17,7 @@ pub fn parse_key_value(text: &str) -> HashMap<String, String> {
tokens = scan(text, 0, tokens);
for token_chunk in tokens.chunks(4) {
match token_chunk {
[Token::Identifier(key), Token::Equal, Token::Identifier(value), Token::Ampersand]
| [Token::Identifier(key), Token::Equal, Token::Identifier(value), Token::Semicolon]
[Token::Identifier(key), Token::Equal, Token::Identifier(value), Token::Ampersand | Token::Semicolon]
| [Token::Identifier(key), Token::Equal, Token::Identifier(value)] => {
result.insert(key.to_string(), value.to_string());
}