Class: Crisp::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/crisp/shell.rb

Instance Method Summary collapse

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/crisp/shell.rb', line 5

def run
  runtime = Runtime.new
  buffer = ''

  while (line = Readline.readline(buffer.empty? ? ">> " : "?> ", true))
    begin
      buffer << line
      ast = Parser.new.parse(buffer)
      puts "=> " + runtime.run(ast).to_s
      buffer = ''
    rescue Crisp::SyntaxError => e
      # noop
    end
  end
end