class Frepl::Main
Public Class Methods
new()
click to toggle source
# File lib/frepl.rb, line 27 def initialize Frepl.compiler = 'gfortran' Frepl.debug = false reset! end
run()
click to toggle source
# File lib/frepl.rb, line 22 def run new.run end
Public Instance Methods
run()
click to toggle source
# File lib/frepl.rb, line 33 def run loop do begin while buf = Readline.readline(prompt, true) @lines << buf process_line(buf) end rescue Interrupt @classifier.interrupt puts "^C\n" rescue SystemExit, SignalException raise rescue Exception => e puts "Exception!: #{e}" puts e.backtrace raise end end end
run_file(file)
click to toggle source
# File lib/frepl.rb, line 53 def run_file(file) file.each do |line| @lines << line process_line(line) end reset! end
Private Instance Methods
process_line(line)
click to toggle source
# File lib/frepl.rb, line 67 def process_line(line) exit(0) if line.chomp == 'q' Frepl.log("classifying: #{line}") line_obj = @classifier.classify(line) @file.add(line_obj) unless line_obj.nil? || line_obj.incomplete? end
prompt()
click to toggle source
# File lib/frepl.rb, line 63 def prompt '> ' + (' ' * @classifier.indentation_level) end
reset!()
click to toggle source
# File lib/frepl.rb, line 74 def reset! @classifier = Classifier.new @file = FortranFile.new @lines = [] end