gogotanaka/Hilbert

View on GitHub
bin/hilbert

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby

require 'hilbert'

# Hilbert command line
require 'hilbert/exec'

# Hilbert interpreter
require 'hilbert/iq'

# TODO: There are vanch of todo ..
case ARGV.first
when '-i'
  if ARGV[1] == '-zfc'
    Hilbert::Iq.execute('postulate zfc_analysis')
    print %|Hi guys, your postulating zfc_analysis is success. :) \n\n|
  else
    print %|Hi guys,thank you for using Hilbert.\nYou need to execute "postulate zfc_analysis" if you wanna do real analysis.\n\n|
  end

  loop do
    print 'Enjoy! -> '
    begin
      input = $stdin.gets
      output = Hilbert::Iq.execute(input)
      $stdout.puts output
    rescue => e
      break unless input
      puts e
    end
  end
when '-v'
  puts Hilbert::VERSION
when '-r', '-rb', '-py'
  exec = Hilbert::Exec::Compiler.new(ARGV)
  exec.output!
end