class MetaParse::AlternativeMatcher

Matcher subclass matching first of alternative submatches.

Public Instance Methods

match?(scanner, context=nil) click to toggle source
# File lib/meta_parse.rb, line 325
def match?(scanner, context=nil)
  spec.each do |alternative|
    result = alternative.match(scanner)
    return result if result
  end
  return nil
end
show() click to toggle source
# File lib/meta_parse.rb, line 333
def show
  "first of: (#{ (spec.map &:show).join ', ' })"
end