Sha256: 3979e9ba2f2086d447ce3ba32597a981e13fac6fa910f5b29ca9ab11f103461d

Contents?: true

Size: 1.17 KB

Versions: 42

Compression:

Stored size: 1.17 KB

Contents

require 'bakery/model/metamodel'
require 'bakery/model/language'
require 'common/version'

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

require 'rtext/default_loader'

require 'common/exit_helper'
require '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

42 entries across 42 versions & 1 rubygems

Version Path
bake-toolkit-2.20.4 lib/bakery/model/loader.rb
bake-toolkit-2.20.3 lib/bakery/model/loader.rb
bake-toolkit-2.20.2 lib/bakery/model/loader.rb
bake-toolkit-2.20.1 lib/bakery/model/loader.rb
bake-toolkit-2.19.2 lib/bakery/model/loader.rb
bake-toolkit-2.19.1 lib/bakery/model/loader.rb
bake-toolkit-2.19.0 lib/bakery/model/loader.rb
bake-toolkit-2.18.0 lib/bakery/model/loader.rb
bake-toolkit-2.17.4 lib/bakery/model/loader.rb
bake-toolkit-2.17.3 lib/bakery/model/loader.rb
bake-toolkit-2.17.2 lib/bakery/model/loader.rb
bake-toolkit-2.17.1 lib/bakery/model/loader.rb
bake-toolkit-2.16.1 lib/bakery/model/loader.rb
bake-toolkit-2.15.0 lib/bakery/model/loader.rb
bake-toolkit-2.14.0 lib/bakery/model/loader.rb
bake-toolkit-2.13.1 lib/bakery/model/loader.rb
bake-toolkit-2.13.0 lib/bakery/model/loader.rb
bake-toolkit-2.12.2 lib/bakery/model/loader.rb
bake-toolkit-2.12.1 lib/bakery/model/loader.rb
bake-toolkit-2.12.0 lib/bakery/model/loader.rb