Sha256: 25a1edd09af69a58766123d43d190a7a4cad542074e2594d6018512cf1b2bae1
Contents?: true
Size: 993 Bytes
Versions: 1
Compression:
Stored size: 993 Bytes
Contents
# Ruby stlib require 'kconv' require 'matrix' require 'singleton' require 'yaml' $:.unshift(File.dirname(__FILE__)) # Q core require 'qlang/utils/ruby_ext' require 'qlang/lexer' require 'qlang/parser' module Qlang # $meta_info indicate what and how to do. class MetaInfo include Singleton attr_accessor :lang, :opts, :mode LANGS_HASH = YAML.load_file("./lib/qlang/utils/langs.yml")['langs'] def _load # compiles into R as default. lang = :r end def langs_hash LANGS_HASH end def lang_str LANGS_HASH[@lang.to_s] end end $meta_info = MetaInfo.instance class << self def compile(str) lexed = Lexer.execute(str) Kconv.tosjis(Parser.execute(lexed)) end $meta_info.langs_hash.keys.each do |lang_name| define_method("to_#{lang_name}") do |*opts| $meta_info.lang = lang_name.to_sym $meta_info.opts = opts Qlang end end end end # Make alias as Q Q = Qlang
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
qlang-0.0.27182120 | lib/qlang.rb |