Parse: Replace polymorphic functor objects with lambdas and llvm::function_ref.

No change in functionality.