Class: BELParser::Language::Semantics::SemanticHasEncoding

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

Overview

AST node for HasEncoding 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_sexp, #updated

Constructor Details

#initialize(**properties) ⇒ SemanticHasEncoding

Returns a new instance of SemanticHasEncoding.



595
596
597
# File 'lib/bel_parser/language/semantics_ast.rb', line 595

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

Instance Method Details

#match(value_node, spec) ⇒ Object



599
600
601
602
603
604
605
# File 'lib/bel_parser/language/semantics_ast.rb', line 599

def match(value_node, spec)
  if value_node.respond_to?(:encoding) && value_node.encoding
    success(value_node, spec)
  else
    missing_encoding_warning(value_node, spec)
  end
end