Sha256: 96b41eb4f7a328255448a53383d47c2824569b573db37a49cb54041f7914cb10
Contents?: true
Size: 898 Bytes
Versions: 2
Compression:
Stored size: 898 Bytes
Contents
module Qlang module Exec class Compiler def initialize(args) @args = args end def parse! parse rescue Exception => e raise e if @options[:trace] || e.is_a?(SystemExit) print "#{e.class}: " unless e.class == RuntimeError puts "#{e.message}" puts " Use --trace for backtrace." exit 1 ensure exit 0 end private def parse raise '#{@args[0]} is unsupported option' unless @args[0] == '-q' filename = @args[1] file = open_file(filename) string = read_file(file) print(Kconv.tosjis(Qlang.compile(string)), '\n') file.close end private def open_file(filename, flag = 'r') return if filename.nil? File.open(filename, flag) end private def read_file(file) file.read end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
qlang-0.0.14 | lib/qlang/exec.rb |
qlang-0.0.1 | lib/qlang/exec.rb |