Class: BELParser::Language::Syntax::InvalidRelationship

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

Overview

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

Class Method Summary collapse

Class Method Details

.map(stmt_node, spec, _namespaces) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# 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)

  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