class Temple::Mixins::GrammarDSL::Or

Public Class Methods

new(grammar, *children) click to toggle source
Calls superclass method Temple::Mixins::GrammarDSL::Rule::new
# File lib/temple/mixins/grammar_dsl.rb, line 29
def initialize(grammar, *children)
  super(grammar)
  @children = children.map {|rule| @grammar.Rule(rule) }
end

Public Instance Methods

<<(rule) click to toggle source
# File lib/temple/mixins/grammar_dsl.rb, line 34
def <<(rule)
  @children << @grammar.Rule(rule)
  self
end
Also aliased as: |
after_copy(source) click to toggle source
# File lib/temple/mixins/grammar_dsl.rb, line 46
def after_copy(source)
  @children = @children.map {|child| child.copy_to(@grammar) }
end
match(exp, unmatched) click to toggle source
# File lib/temple/mixins/grammar_dsl.rb, line 41
def match(exp, unmatched)
  tmp = []
  @children.any? {|rule| rule.match(exp, tmp) } || (unmatched.concat(tmp) && false)
end
|(rule)
Alias for: <<