Class: BELParser::Language::Semantics::ListFunctionSubject
- Inherits:
-
Object
- Object
- BELParser::Language::Semantics::ListFunctionSubject
- Includes:
- SemanticsFunction
- Defined in:
- lib/bel_parser/language/semantics/list_function_subject.rb
Overview
ListFunctionSubject implements a SemanticsFunction that maps a Parsers::AST::Subject to SemanticsWarning if a list Parsers::AST::Term is used as the Parsers::AST::Subject of a Parsers::AST::Statement.
Class Method Summary collapse
Class Method Details
.map(node, spec, _namespaces, will_match_partial = false) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bel_parser/language/semantics/list_function_subject.rb', line 16 def self.map(node, spec, _namespaces, will_match_partial = false) return nil unless node.is_a?(BELParser::Parsers::AST::Subject) list_func = spec.function(:list) return nil unless list_func return nil unless node.term.function return nil unless node.term.function.identifier func_name = node.term.function.identifier.string_literal sub_func = spec.function(func_name.to_sym) ListFunctionSubjectWarning.new(node, spec) if sub_func == list_func end |