allowed chars array

This commit is contained in:
nora 2021-04-24 15:40:37 +02:00
parent 2ae00160fc
commit 3d565765d8

View file

@ -17,9 +17,10 @@ enum Statement {
Loop(Vec<Statement>),
}
const ALLOWED_CHARS: [char; 8] = ['>', '<', '+', '-', '.', ',', '[', ']'];
fn minify(code: &str) -> String {
let allowed: Vec<char> = vec!['>', '<', '+', '-', '.', ',', '[', ']'];
code.chars().filter(|c| allowed.contains(c)).collect()
code.chars().filter(|c| ALLOWED_CHARS.contains(c)).collect()
}
fn parse(chars: Vec<char>) -> Vec<Statement> {