Class: BELParser::Language::Semantics::SemanticFunction

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

Overview

AST node for Function 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(children = [], **properties) ⇒ SemanticFunction

Returns a new instance of SemanticFunction.



354
355
356
# File 'lib/bel_parser/language/semantics_ast.rb', line 354

def initialize(children = [], **properties)
  super(:function, children, properties)
end

Instance Method Details

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



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/bel_parser/language/semantics_ast.rb', line 358

def match(parse_node, spec, will_match_partial = false)
  return nil_node_warning(
    parse_node,
    spec,
    BELParser::Parsers::AST::Function) if parse_node.nil?

  if parse_node.type == type
    success(parse_node, spec)
  else
    type_warning(
      parse_node,
      spec,
      BELParser::Parsers::AST::Function,
      parse_node)
  end
end