class BELParser::Parsers::AST::Term

AST node representing a term.

Attributes

function_semantics[R]

Get the term's function semantics.

Public Class Methods

new(children = [], properties = {}) click to toggle source

New Term AST node.

@see Node#initialize Node class for basic properties

Calls superclass method BELParser::Parsers::AST::Node::new
# File lib/bel_parser/parsers/ast/node.rb, line 869
def initialize(children = [], properties = {})
  super(Term.ast_type, children, properties)
end

Public Instance Methods

arguments() click to toggle source

Get the term's arguments.

# File lib/bel_parser/parsers/ast/node.rb, line 879
def arguments
  children[1..-1]
end
function() click to toggle source

Get the term's function.

# File lib/bel_parser/parsers/ast/node.rb, line 874
def function
  children[0]
end
function_semantics=(function_semantics) click to toggle source

Sets the term's function semantics.

# File lib/bel_parser/parsers/ast/node.rb, line 887
def function_semantics=(function_semantics)
  if !function_semantics.nil? &&
     !function_semantics.is_a?(BELParser::Language::Signature)
    raise(
      ArgumentError,
      'function_semantics: expected nil or Signature')
  end
  assign_properties(function_semantics: function_semantics)
end