Class: BELParser::Parsers::AST::Term

Inherits:
Node show all
Defined in:
lib/bel_parser/parsers/ast/node.rb

Overview

AST node representing a term.

Instance Attribute Summary collapse

Attributes inherited from Node

#character_range, #complete, #line_number

Attributes inherited from AST::Node

#children, #hash, #type

Instance Method Summary collapse

Methods inherited from Node

#add_syntax_error, #append, #child, #children?, #complete?, #concat, #first_child, #fourth_child, #freeze, #incomplete?, #num_children, #range_end, #range_start, #second_child, #syntax_errors, #third_child, #traverse, #updated

Methods inherited from AST::Node

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

Constructor Details

#initialize(children = [], properties = {}) ⇒ Term

New Term AST node.



840
841
842
# File 'lib/bel_parser/parsers/ast/node.rb', line 840

def initialize(children = [], properties = {})
  super(Term.ast_type, children, properties)
end

Instance Attribute Details

#function_semanticsObject

Get the term’s function semantics.



855
856
857
# File 'lib/bel_parser/parsers/ast/node.rb', line 855

def function_semantics
  @function_semantics
end

Instance Method Details

#argumentsObject

Get the term’s arguments.



850
851
852
# File 'lib/bel_parser/parsers/ast/node.rb', line 850

def arguments
  children[1..-1]
end

#functionObject

Get the term’s function.



845
846
847
# File 'lib/bel_parser/parsers/ast/node.rb', line 845

def function
  children[0]
end