Class: BELParser::Parsers::AST::Argument

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

Overview

AST node representing an argument.

Instance Attribute Summary

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, #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 = {}) ⇒ Argument

New Argument AST node.



512
513
514
# File 'lib/bel_parser/parsers/ast/node.rb', line 512

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

Instance Method Details

#childObject

Get the Parameter or Term child.



527
528
529
# File 'lib/bel_parser/parsers/ast/node.rb', line 527

def child
  children[0]
end

#parameter?Boolean

Does the argument have a Parameter child?

Returns:

  • (Boolean)


517
518
519
# File 'lib/bel_parser/parsers/ast/node.rb', line 517

def parameter?
  children[0].is_a?(Parameter)
end

#term?Boolean

Does the argument have a Term child?

Returns:

  • (Boolean)


522
523
524
# File 'lib/bel_parser/parsers/ast/node.rb', line 522

def term?
  children[0].is_a?(Term)
end