Class: Rley::RGN::CompositeNode

Inherits:
ASTNode
  • Object
show all
Defined in:
lib/rley/rgn/composite_node.rb

Overview

Abstract class for a syntax node that is the parent of one or more subnodes.

Direct Known Subclasses

RepetitionNode, SequenceNode

Instance Attribute Summary collapse

Attributes inherited from ASTNode

#annotation

Instance Method Summary collapse

Methods inherited from ASTNode

#accept, #annotation_to_text, #done!

Constructor Details

#initialize(children) ⇒ CompositeNode

Returns a new instance of CompositeNode.

Parameters:

  • children (Array<ASTNode>)

    sequence of children nodes



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

def initialize(children)
  super()
  @subnodes = children
  @constraints = []
end

Instance Attribute Details

#constraintsHash

Returns:

  • (Hash)


14
15
16
# File 'lib/rley/rgn/composite_node.rb', line 14

def constraints
  @constraints
end

#subnodesArray<ASTNode> (readonly)

Returns:



11
12
13
# File 'lib/rley/rgn/composite_node.rb', line 11

def subnodes
  @subnodes
end

Instance Method Details

#sizeObject



23
24
25
# File 'lib/rley/rgn/composite_node.rb', line 23

def size
  subnodes.size
end