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