Class: BELParser::Language::Semantics::SemanticHasNamespace

Inherits:
SemanticASTNode show all
Defined in:
lib/bel_parser/language/semantics_ast.rb

Overview

AST node for HasNamespace is a semantic AST.

Instance Attribute Summary

Attributes inherited from AST::Node

#children, #hash, #type

Instance Method Summary collapse

Methods inherited from SemanticASTNode

#terminal?

Methods inherited from AST::Node

#==, #append, #concat, #dup, #eql?, #inspect, #to_a, #to_ast, #to_bel, #to_s, #to_sexp, #updated

Methods included from Parsers

#serialize

Constructor Details

#initialize(**properties) ⇒ SemanticHasNamespace

Returns a new instance of SemanticHasNamespace.



556
557
558
# File 'lib/bel_parser/language/semantics_ast.rb', line 556

def initialize(**properties)
  super(:has_namespace, [], properties)
end

Instance Method Details

#match(prefix, spec, will_match_partial = false) ⇒ Object



560
561
562
563
564
565
566
# File 'lib/bel_parser/language/semantics_ast.rb', line 560

def match(prefix, spec, will_match_partial = false)
  if prefix.respond_to?(:namespace) && prefix.namespace
    success(prefix, spec)
  else
    missing_namespace_warning(prefix, spec)
  end
end