Sha256: eb5890a690bd4c0202b6e5997284e80871825038fdcfcba476c316ebe193c561

Contents?: true

Size: 1.14 KB

Versions: 17

Compression:

Stored size: 1.14 KB

Contents

require_relative 'metamodel'
require_relative 'language'
require_relative '../../common/version'

require 'rgen/environment'
require 'rgen/fragment/fragmented_model'

require 'rtext/default_loader'

require_relative '../../common/ext/rgen'
require_relative '../../common/exit_helper'
require_relative '../../bake/toolchain/colorizing_formatter'

module Bake

  class BakeryLoader

    attr_reader :model

    def initialize
      @env = RGen::Environment.new
      @model = RGen::Fragment::FragmentedModel.new(:env => @env)
    end

    def load(filename)

      sumErrors = 0

      if not File.exists?filename
        Bake.formatter.printError("Error: #{filename} does not exist")
        ExitHelper.exit(1)
      end

      loader = RText::DefaultLoader.new(
        Bake::BakeryLanguage,
        @model,
        :file_provider => proc { [filename] },
        :cache => @DumpFileCache)
      loader.load()

      f = @model.fragments[0]

      f.data[:problems].each do |p|
        Bake.formatter.printError(p.message, p.file, p.line)
      end

      if f.data[:problems].length > 0
        ExitHelper.exit(1)
      end

      return @env

    end


  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bake-toolkit-2.71.0 lib/bakery/model/loader.rb
bake-toolkit-2.70.1 lib/bakery/model/loader.rb
bake-toolkit-2.70.0 lib/bakery/model/loader.rb
bake-toolkit-2.69.0 lib/bakery/model/loader.rb
bake-toolkit-2.68.1 lib/bakery/model/loader.rb
bake-toolkit-2.68.0 lib/bakery/model/loader.rb
bake-toolkit-2.67.0 lib/bakery/model/loader.rb
bake-toolkit-2.66.0 lib/bakery/model/loader.rb
bake-toolkit-2.65.2 lib/bakery/model/loader.rb
bake-toolkit-2.65.1 lib/bakery/model/loader.rb
bake-toolkit-2.65.0 lib/bakery/model/loader.rb
bake-toolkit-2.64.4 lib/bakery/model/loader.rb
bake-toolkit-2.64.3 lib/bakery/model/loader.rb
bake-toolkit-2.64.2 lib/bakery/model/loader.rb
bake-toolkit-2.64.1 lib/bakery/model/loader.rb
bake-toolkit-2.64.0 lib/bakery/model/loader.rb
bake-toolkit-2.63.2 lib/bakery/model/loader.rb