Class: Lucio::Repl

Inherits:
Object
  • Object
show all
Defined in:
bin/repl.rb

Class Method Summary collapse

Class Method Details

.runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'bin/repl.rb', line 11

def self.run
exit = false

puts <<lisp
# lucio interactive console
-------------------------
# type a lucio expression and press ENTER
# type .q and press ENTER to exit

lisp
while !exit
  print 'lucio: '
  command = (gets).chomp
  exit = (command == QUIT)
  unless exit
begin
  print '=> '
  p Lucio.eval(command)
rescue Exception => msg
  puts "Error: #{msg}"
end
puts ''
  end
end

puts '# bye!'
end