Class: Rley::RGN::SequenceNode

Inherits:
CompositeNode show all
Defined in:
lib/rley/rgn/sequence_node.rb

Overview

A syntax node for a sequence of AST nodes

Instance Attribute Summary

Attributes inherited from CompositeNode

#constraints, #subnodes

Attributes inherited from ASTNode

#annotation

Instance Method Summary collapse

Methods inherited from CompositeNode

#initialize, #size

Methods inherited from ASTNode

#annotation_to_text, #done!, #initialize

Constructor Details

This class inherits a constructor from Rley::RGN::CompositeNode

Instance Method Details

#accept(visitor) ⇒ Object

Part of the 'visitee' role in Visitor design pattern.

Parameters:



25
26
27
# File 'lib/rley/rgn/sequence_node.rb', line 25

def accept(visitor)
  visitor.visit_sequence_node(self)
end

#nameObject



9
10
11
12
13
14
15
16
# File 'lib/rley/rgn/sequence_node.rb', line 9

def name
  result = +''
  subnodes.each do |sn|
    result << "_#{sn.name}"
  end

  "seq#{result}"
end

#to_textObject



18
19
20
21
# File 'lib/rley/rgn/sequence_node.rb', line 18

def to_text
  arr = subnodes.map(&:to_text)
  arr.join(' ')
end