lib/lrama/command.rb in lrama-0.5.4 vs lib/lrama/command.rb in lrama-0.5.5

- old
+ new

@@ -3,11 +3,10 @@ module Lrama class Command def initialize(argv) @argv = argv - @version = nil @skeleton = "bison/yacc.c" @header = false @header_file = nil @report = [] @report_file = nil @@ -21,19 +20,15 @@ end def run parse_option - if @version - puts Lrama::VERSION - exit 0 - end - Report::Duration.enable if @trace_opts[:time] warning = Lrama::Warning.new grammar = Lrama::Parser.new(@y.read).parse + @y.close if @y != STDIN states = Lrama::States.new(grammar, warning, trace_state: (@trace_opts[:automaton] || @trace_opts[:closure])) states.compute context = Lrama::Context.new(states) if @report_file @@ -110,10 +105,10 @@ def parse_option opt = OptionParser.new # opt.on('-h') {|v| p v } - opt.on('-V', '--version') {|v| @version = true } + opt.on('-V', '--version') {|v| puts "lrama #{Lrama::VERSION}"; exit 0 } # Tuning the Parser opt.on('-S', '--skeleton=FILE') {|v| @skeleton = v } opt.on('-t') { } # Do nothing