Class: BELParser::Language::Semantics::SemanticValue

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

Overview

AST node for Value is a semantic AST.

Instance Attribute Summary

Attributes inherited from AST::Node

#children, #hash, #type

Instance Method Summary collapse

Methods inherited from AST::Node

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

Constructor Details

#initialize(children = [], **properties) ⇒ SemanticValue

Returns a new instance of SemanticValue.



461
462
463
# File 'lib/bel_parser/language/semantics_ast.rb', line 461

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

Instance Method Details

#match(parse_node, spec) ⇒ Object



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/bel_parser/language/semantics_ast.rb', line 473

def match(parse_node, spec)
  return nil_node_warning(
    parse_node,
    spec,
    BELParser::Parsers::AST::Value) if parse_node.nil?

  if parse_node.type != BELParser::Parsers::AST::Value.ast_type
    return type_warning(
      parse_node,
      spec,
      BELParser::Parsers::AST::Value,
      parse_node)
  end

  value_patterns.map do |pattern|
    pattern.match(parse_node, spec)
  end
end

#terminal?Boolean

Returns:

  • (Boolean)


465
466
467
# File 'lib/bel_parser/language/semantics_ast.rb', line 465

def terminal?
  true
end

#value_patternsObject



469
470
471
# File 'lib/bel_parser/language/semantics_ast.rb', line 469

def value_patterns
  children
end