Class: Musa::GenerativeGrammar::Implementation::NextNode
- Defined in:
- lib/musa-dsl/generative/generative-grammar.rb
Instance Method Summary collapse
- #_options(parent: nil, &condition) ⇒ Object
-
#initialize(node, after) ⇒ NextNode
constructor
A new instance of NextNode.
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 (parent: nil, &condition) parent ||= [] r = [] @node.(parent: parent, &condition).each do |node_option| @after.(parent: parent + node_option, &condition).each do |after_option| r << node_option + after_option unless after_option.empty? end end r end |