class MetaParse::FunctionMatcher

Arbitrary predicate, particularly useful for generating final return value from SequentialMatchers. Context is the containing matcher, and in the case of SequentialMatcher includes access to accumulated matches.

Public Instance Methods

match?(scanner, context=nil) click to toggle source

Try to match against scanner using arbitrary predicated specified as Proc or Symbol naming method of Matcher's parser.

# File lib/meta_parse.rb, line 406
def match?(scanner, context=nil)
  case spec
  when Proc
    spec.call(scanner, context)
  when Symbol
    scanner.parser.send spec, scanner, context
  end
end