Replace the token filter by a filter mapper

This commit is contained in:
Clément Renault
2020-09-22 10:24:31 +02:00
parent d21c80b865
commit e5adfaade0
2 changed files with 4 additions and 4 deletions

View File

@ -16,6 +16,6 @@ pub fn simple_tokenizer(text: &str) -> impl Iterator<Item=(TokenType, &str)> {
})
}
pub fn only_words((t, _): &(TokenType, &str)) -> bool {
*t == TokenType::Word
pub fn only_token((t, w): (TokenType, &str)) -> Option<&str> {
if t == TokenType::Word { Some(w) } else { None }
}