Module: DhallishGrammar::AddSubExpression2

Defined in:
lib/DhallishGrammar.rb

Instance Method Summary collapse

Instance Method Details

#to_nodeObject



3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
# File 'lib/DhallishGrammar.rb', line 3850

def to_node()
	tail.elements.reduce(exp.to_node()) { |tree, node|
		exp = node.exp.to_node()
		if node.op.text_value == "+"
			Dhallish::Ast::BinaryArithOpNode.new(Dhallish::Types::Numbers, tree, exp, "+") { |x, y| x + y }
		else
			Dhallish::Ast::BinaryArithOpNode.new([Dhallish::Types::Double, Dhallish::Types::Integer], tree, exp, "-") { |x, y| x - y }
		end
	}
end