Sha256: a3f7d256cea5db814a27cef8eb0f5db809ccd76afee9b5a32919c48af387309b
Contents?: true
Size: 1.25 KB
Versions: 11
Compression:
Stored size: 1.25 KB
Contents
require 'bel_parser/parsers/ast/node' module BELParser module Language module Syntax # InvalidRelationship represents a syntax error with invalid # relationship according to a BEL specification. class InvalidRelationship include SyntaxFunction private_class_method :new 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 end # InvalidRelationshipSyntaxError indicates a relationship was invalid. class InvalidRelationshipSyntaxError < SyntaxError # Gets the relationship literal that was invalid according to a # BEL specification. attr_reader :relationship def initialize(stmt_node, spec, relationship) super(stmt_node, spec) @relationship = relationship end def msg %(Invalid relationship "#{relationship}".) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems