Sha256: aede7cfd4e1c1c6e898d8b79d44e6df4aa4410caddd65c0df925168d467168e2
Contents?: true
Size: 702 Bytes
Versions: 5
Compression:
Stored size: 702 Bytes
Contents
require 'readline' require 'rubylisp/environment' require 'rubylisp/parser' module RubyLisp module REPL module_function def start env = RubyLisp::Environment.new(namespace: 'user').stdlib.repl while buf = Readline.readline("#{env.namespace}> ", true) begin input = buf.nil? ? '' : buf.strip puts input.empty? ? '' : RubyLisp::Parser.parse(input, env) rescue => e # If an error happens, print it like Ruby would and continue accepting # REPL input. puts e.backtrace .join("\n\t") .sub("\n\t", ": #{e}#{e.class ? " (#{e.class})" : ''}\n\t") end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rbl-0.0.5 | lib/rubylisp/repl.rb |
rbl-0.0.4 | lib/rubylisp/repl.rb |
rbl-0.0.3 | lib/rubylisp/repl.rb |
rbl-0.0.2 | lib/rubylisp/repl.rb |
rbl-0.0.1 | lib/rubylisp/repl.rb |