module Dhall::Parser::Expression

Public Instance Methods

arrow() click to toggle source
# File lib/dhall/parser.rb, line 57
def arrow
        Forall.of_arguments(
                capture(:operator_expression).value,
                body: capture(:expression).value
        )
end
assert() click to toggle source
# File lib/dhall/parser.rb, line 91
def assert
        Assertion.new(type: capture(:expression).value)
end
forall() click to toggle source
# File lib/dhall/parser.rb, line 49
def forall
        Forall.new(
                var:  capture(:nonreserved_label).value,
                type: captures(:expression)[0].value,
                body: captures(:expression)[1].value
        )
end
if() click to toggle source
# File lib/dhall/parser.rb, line 64
def if
        If.new(
                predicate: captures(:expression)[0].value,
                then:      captures(:expression)[1].value,
                else:      captures(:expression)[2].value
        )
end
lambda() click to toggle source
# File lib/dhall/parser.rb, line 41
def lambda
        Function.new(
                var:  capture(:nonreserved_label).value,
                type: captures(:expression)[0].value,
                body: captures(:expression)[1].value
        )
end
let_binding() click to toggle source
# File lib/dhall/parser.rb, line 33
def let_binding
        captures(:let_binding).reverse.reduce(
                capture(:expression).value
        ) do |inside, let|
                LetIn.new(let: let.value, body: inside)
        end
end
list() click to toggle source
# File lib/dhall/parser.rb, line 80
def list
        EmptyList.new(type: capture(:application_expression).value)
end
merge() click to toggle source
# File lib/dhall/parser.rb, line 72
def merge
        Merge.new(
                record: captures(:import_expression)[0].value,
                input:  captures(:import_expression)[1].value,
                type:   capture(:application_expression)&.value
        )
end
tomap() click to toggle source
# File lib/dhall/parser.rb, line 84
def tomap
        ToMap.new(
                record: capture(:import_expression).value,
                type:   capture(:application_expression).value
        )
end
value() click to toggle source
Calls superclass method
# File lib/dhall/parser.rb, line 23
def value
        return list if string =~ /\A\[\s*\]/

        key =
                [:let_binding, :lambda, :forall, :arrow, :if, :merge, :tomap, :assert]
                .find { |k| captures.key?(k) }

        key ? public_send(key) : super
end