Module: Fop::Compiler::Validations
- Defined in:
- lib/fop/compiler.rb
Class Method Summary collapse
Class Method Details
.validate_args(exp_node) ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/fop/compiler.rb', line 83 def self.validate_args(exp_node) op_token = exp_node.operator_token || return op = Instructions::OPERATIONS.fetch(op_token.val) num = exp_node.args&.size || 0 arity = op.arity max_arity = op.max_arity || arity if num < arity or num > max_arity Parser::Error.new(:argument, op_token, "#{op_token.val} expects #{arity}..#{max_arity} arguments; #{num} given") end end |