Class: BELParser::Language::Semantics::NestedStatementWithoutObject

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

Overview

NestedStatementWithoutObject implements a SemanticsFunction that maps a nested Parsers::AST::Statement to SemanticsWarning if the nested statement does not have an object.

Class Method Summary collapse

Class Method Details

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



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

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

  nested = node.object.child

  unless nested.object?
    NestedStatementWithoutObjectWarning.new(node, spec)
  end
end