module DhallishGrammar::AddSubExpression2

Public Instance Methods

to_node() click to toggle source
# 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