Class: BELParser::Language::Semantics::NonCausalNestedStatement

Inherits:
Object
  • Object
show all
Includes:
SemanticsFunction
Defined in:
lib/bel_parser/language/semantics/non_causal_nested_statement.rb

Overview

NonCausalNestedStatement implements a SemanticsFunction that maps a nested Parsers::AST::Statement to SemanticsWarning if the relationship is non-causal.

Class Method Summary collapse

Class Method Details

.map(node, spec, _namespaces, will_match_partial = false) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/bel_parser/language/semantics/non_causal_nested_statement.rb', line 14

def self.map(node, spec, _namespaces, will_match_partial = false)
  return nil unless node.is_a?(BELParser::Parsers::AST::Statement)
  return nil unless node.object? && node.object.statement?

  rel = node.relationship.string_literal.to_sym
  unless spec.causal_relationships.include?(rel)
    NonCausalNestedStatementWarning.new(node, spec, rel)
  end
end