~singpolyma/dhall-ruby

ref: e5560786a4ddbde7b6b1fc5e869bb3ef4e8b9126 dhall-ruby/lib/dhall.rb -rw-r--r-- 510 bytes
e5560786Stephen Paul Weber Allow imports to be either binary or source form 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Dhall
	def self.load_raw(source)
		begin
			return from_binary(source) if source.encoding == Encoding::BINARY
		rescue
			# Parsing CBOR failed, so guess this is source text in standard UTF-8
			return load_raw(source.force_encoding("UTF-8"))
		end

		Parser.parse(source.encode("UTF-8")).value
	end
end

require "dhall/ast"
require "dhall/binary"
require "dhall/builtins"
require "dhall/normalize"
require "dhall/parser"
require "dhall/resolve"
require "dhall/typecheck"