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

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

Instance Method Summary collapse

Methods inherited from Node

#[], #limit, #next, #options, #or, #repeat, #size, #to_serie

Constructor Details

#initialize(node, after) ⇒ NextNode

Returns a new instance of NextNode.



235
236
237
238
239
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 235

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

Instance Method Details

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



241
242
243
244
245
246
247
248
249
250
251
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 241

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