Module: Dhall::Parser::UnionTypeOrLiteralVariantType

Defined in:
lib/dhall/parser.rb

Instance Method Summary collapse

Instance Method Details

#value(label) ⇒ Object



400
401
402
403
404
405
406
407
408
409
410
# File 'lib/dhall/parser.rb', line 400

def value(label)
	rest = capture(:non_empty_union_type_or_literal)&.value
	type = UnionType.new(
		alternatives: { label => capture(:expression)&.value }
	)
	if rest.is_a?(Union)
		rest.with(alternatives: type.merge(rest.alternatives))
	else
		rest ? type.merge(rest) : type
	end
end