Class: BELParser::Language::Syntax::InvalidFunction

Inherits:
Object
  • Object
show all
Includes:
SyntaxFunction
Defined in:
lib/bel_parser/language/syntax/invalid_function.rb

Overview

InvalidFunction represents a syntax error with invalid function name according to a BEL specification.

Class Method Summary collapse

Class Method Details

.map(func_node, spec, _namespaces) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/bel_parser/language/syntax/invalid_function.rb', line 13

def self.map(func_node, spec, _namespaces)
  return nil unless func_node.is_a?(BELParser::Parsers::AST::Function)

  function_name = func_node.identifier.string_literal
  unless spec.function(function_name.to_sym)
    InvalidFunctionSyntaxError.new(func_node, spec, function_name)
  end
end