Class: Musa::GenerativeGrammar::Implementation::NextNode Private

Inherits:
Node
  • Object
show all
Defined in:
lib/musa-dsl/generative/generative-grammar.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Node representing sequence of two nodes.

Generates options with node followed by after. Created by Musa::GenerativeGrammar::Implementation::Node#next or + operator.

Instance Method Summary collapse

Constructor Details

#initialize(node, after) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • node (Node)

    first node in sequence

  • after (Node)

    node to follow



635
636
637
638
639
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 635

def initialize(node, after)
  @node = node
  @after = after
  super()
end

Instance Method Details

#_options(parent: nil, &condition) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



642
643
644
645
646
647
648
649
650
651
652
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 642

def _options(parent: nil, &condition)
  parent ||= []

  r = []
  @node._options(parent: parent, &condition).each do |node_option|
    @after._options(parent: parent + node_option, &condition).each do |after_option|
      r << node_option + after_option unless after_option.empty?
    end
  end
  r
end