Class: BELParser::Language::Semantics::SemanticNamespaceOf
- Inherits:
-
SemanticASTNode
- Object
- AST::Node
- SemanticASTNode
- BELParser::Language::Semantics::SemanticNamespaceOf
- Defined in:
- lib/bel_parser/language/semantics_ast.rb
Overview
AST node for NamespaceOf is a semantic AST.
Instance Attribute Summary
Attributes inherited from AST::Node
Instance Method Summary collapse
-
#initialize(namespaces, **properties) ⇒ SemanticNamespaceOf
constructor
A new instance of SemanticNamespaceOf.
- #match(prefix_node, spec) ⇒ Object
- #namespaces ⇒ Object
Methods inherited from SemanticASTNode
Methods inherited from AST::Node
#==, #append, #concat, #dup, #eql?, #inspect, #to_a, #to_ast, #to_sexp, #updated
Constructor Details
#initialize(namespaces, **properties) ⇒ SemanticNamespaceOf
Returns a new instance of SemanticNamespaceOf.
572 573 574 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 572 def initialize(namespaces, **properties) super(:namespace_of, namespaces, properties) end |
Instance Method Details
#match(prefix_node, spec) ⇒ Object
580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 580 def match(prefix_node, spec) unless prefix_node.respond_to?(:namespace) && prefix_node.namespace return invalid_namespace(prefix_node, spec, namespaces) end if namespaces.any? { |i| i == :* || i == input_namespace } success(prefix_node, spec) else invalid_namespace(prefix_node, spec, namespaces) end end |
#namespaces ⇒ Object
576 577 578 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 576 def namespaces children end |