Sha256: 28288ce5452677fa574214cec97fc697967eea3480818e5a2f6332027443dd02

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

MRuby::Gem::Specification.new 'mruby-compiler' do |spec|
  spec.license = 'MIT'
  spec.author  = 'mruby developers'
  spec.summary = 'mruby compiler library'

  objs = %w[codegen y.tab].map do |name|
    src = "#{dir}/core/#{name}.c"
    if build.cxx_exception_enabled?
      build.compile_as_cxx(src)
    else
      objfile(src.pathmap("#{build_dir}/core/%n"))
    end
  end
  build.libmruby_core_objs << objs

  lex_def = "#{dir}/core/lex.def"

  # Parser
  file "#{dir}/core/y.tab.c" => ["#{dir}/core/parse.y", lex_def] do |t|
    yacc.run t.name, t.prerequisites.first
    replace_line_directive(t.name)
  end

  # Lexical analyzer
  file lex_def => "#{dir}/core/keywords" do |t|
    gperf.run t.name, t.prerequisites.first
    replace_line_directive(t.name)
  end

  def replace_line_directive(path)
    content = File.read(path).gsub(%r{
      ^\#line\s+\d+\s+"\K.*$ |                  # #line directive
      ^/\*\s+Command-line:.*\s\K\S+(?=\s+\*/$)  # header comment in lex.def
    }x, &:relative_path)
    File.write(path, content)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
script_core-0.3.2 ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/mrbgem.rake
script_core-0.3.0 ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/mrbgem.rake