Class: Brainfuck::Lexer

Inherits:
Parslet::Parser
  • Object
show all
Defined in:
lib/brainfuck/lexer.rb

Constant Summary collapse

INSTRUCTIONS =
%w{> < + - [ ] . ,}

Class Method Summary collapse

Class Method Details

.clean(code) ⇒ Object



7
8
9
# File 'lib/brainfuck/lexer.rb', line 7

def clean code
  code.chars.select {|c| INSTRUCTIONS.include? c }.join
end