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_bel, #to_s, #to_sexp, #updated

Methods included from Parsers

#serialize

Constructor Details

#initialize(**properties) ⇒ SemanticHasEncoding

Returns a new instance of SemanticHasEncoding.



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

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

Instance Method Details

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



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

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