Class: FExpr::Main

Inherits:
Object
  • Object
show all
Defined in:
lib/fexpr/main.rb

Instance Method Summary collapse

Instance Method Details

#main(argv) ⇒ Object



5
6
7
# File 'lib/fexpr/main.rb', line 5

def main(argv)
  puts real_main argv
end

#real_main(argv) ⇒ Object

Void -> Float



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fexpr/main.rb', line 10

def real_main(argv)

  # maybe help
  print_help and return 0 if argv.empty?
  
  # maybe testing
  run_test and return if argv[0] == '-test'
  if argv[0][0..0] == '-'
    @opt_trace = true
    argv.shift
  end
  
  # cleanse the arguments
  args = argv.map {|arg| arg.gsub /,/,''}
  
  # run
  evaluator = Evaluator.new args
  evaluator.eval
end