Sha256: eb251d8eb503be90d285df928d95f3f9559c4b66d6b764dd7de54da1c9efc347
Contents?: true
Size: 1.07 KB
Versions: 14
Compression:
Stored size: 1.07 KB
Contents
# Compile a CQL file into an ActiveFacts vocabulary. # # Copyright (c) 2009 Clifford Heath. Read the LICENSE file. # require 'activefacts/vocabulary' require 'activefacts/cql/parser' require 'activefacts/cql/compiler' module ActiveFacts module Input #:nodoc: # Compile CQL to an ActiveFacts vocabulary. # Invoke as # afgen --<generator> <file>.cql class CQL # Read the specified file def self.readfile(filename) File.open(filename) {|file| read(file, filename) } rescue => e # Augment the exception message, but preserve the backtrace ne = StandardError.new("In #{filename} #{e.message.strip}") ne.set_backtrace(e.backtrace) raise ne end # Read the specified input stream def self.read(file, filename = "stdin") readstring(file.read, filename) end # Read the specified input string def self.readstring(str, filename = "string") compiler = ActiveFacts::CQL::Compiler.new(filename) compiler.compile(str) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems