lib/activefacts/cql/compiler.rb in activefacts-0.8.15 vs lib/activefacts/cql/compiler.rb in activefacts-0.8.16

- old
+ new

@@ -64,9 +64,30 @@ end raise failure_reason unless ok vocabulary end + def compile_import file, aliases + saved_index = @index + saved_block = @block + old_filename = @filename + @filename = file+'.cql' + + File.open(@filename) do |f| + ok = parse_all(f.read, nil, &@block) + end + + rescue => e + ne = StandardError.new("In #{@filename} #{e.message.strip}") + ne.set_backtrace(e.backtrace) + raise ne + ensure + @block = saved_block + @index = saved_index + @filename = old_filename + nil + end + def compile_definition ast ast.compile end def unit? s