Method: Orenono::Brain#run

Defined in:
lib/brain.rb

#runObject

rubocop:disable CyclomaticComplexity, MethodLength



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/brain.rb', line 22

def run
  loop do
    token = @tokens[@code_cursol]
    case token
    when @config.increment
      increment
      @code_cursol += 1
    when @config.decrement
      decrement
      @code_cursol += 1
    when @config.start_loop
      start_loop
    when @config.end_loop
      end_loop
    when @config.next_cursol
      next_cursol
      @code_cursol += 1
    when @config.previous_cursol
      previous_cursol
      @code_cursol += 1
    when @config.display
      display
      @code_cursol += 1
    when @config.read
      read
      @code_cursol += 1
    end
    break if @code_cursol >= @tokens.size
  end
end