mirror of
https://github.com/Noratrieb/brainfuck.git
synced 2026-01-14 13:35:00 +01:00
allowed chars array
This commit is contained in:
parent
2ae00160fc
commit
3d565765d8
1 changed files with 3 additions and 2 deletions
|
|
@ -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> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue