Method: Musa::GenerativeGrammar::Implementation::Node#or

Defined in:
lib/musa-dsl/generative/generative-grammar.rb

#or(other) ⇒ OrNode Also known as: |

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.

Creates alternation between this node and another.

Generates options where either this node or the other is chosen.

Examples:

a = N('a')
b = N('b')
ab = a.or(b)  # or a | b

Parameters:

  • other (Node)

    alternative node

Returns:

  • (OrNode)

    alternation node



195
196
197
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 195

def or(other)
  OrNode.new(self, other)
end