class BELParser::Language::Syntax::InvalidRelationship

InvalidRelationship represents a syntax error with invalid relationship according to a BEL specification.

Public Class Methods

map(stmt_node, spec, _namespaces) click to toggle source
# File lib/bel_parser/language/syntax/invalid_relationship.rb, line 13
def self.map(stmt_node, spec, _namespaces)
  return nil unless stmt_node.is_a?(BELParser::Parsers::AST::Statement)
  return nil unless stmt_node.relationship?

  rel_name = stmt_node.relationship.string_literal
  return nil if rel_name.nil?

  unless spec.relationship(rel_name.to_sym)
    InvalidRelationshipSyntaxError.new(stmt_node, spec, rel_name)
  end
end