Sha256: 7b838c724ae85d66241f5f227e710cc1fe7e3fde6db883b0bd651691c629e737
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
module Lrama class Command def run(argv) options = OptionParser.new.parse(argv) Report::Duration.enable if options.trace_opts[:time] warning = Lrama::Warning.new text = options.y.read options.y.close if options.y != STDIN grammar = Lrama::Parser.new(text).parse states = Lrama::States.new(grammar, warning, trace_state: (options.trace_opts[:automaton] || options.trace_opts[:closure])) states.compute context = Lrama::Context.new(states) if options.report_file reporter = Lrama::StatesReporter.new(states) File.open(options.report_file, "w+") do |f| reporter.report(f, **options.report_opts) end end File.open(options.outfile, "w+") do |f| Lrama::Output.new( out: f, output_file_path: options.outfile, template_name: options.skeleton, grammar_file_path: options.grammar_file, header_file_path: options.header_file, context: context, grammar: grammar, error_recovery: options.error_recovery, ).render end if warning.has_error? exit 1 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lrama-0.5.7 | lib/lrama/command.rb |