Exemple #1
0
 bool match(const eterm<Alloc>& pattern, varbind<Alloc>* binding) const
     throw (err_unbound_variable) {
     if (is_any()) return true;
     const eterm<Alloc>* value = binding ? binding->find(c_str()) : NULL;
     if (value)
         return value->match(pattern, binding);
     if (binding != NULL) {
         // Bind the variable
         eterm<Alloc> et;
         binding->bind(name(), pattern.subst(et, binding) ? et : pattern);
     }
     return true; 
 }
Exemple #2
0
 bool match(const eterm<Alloc>& pattern, varbind<Alloc>* binding) const
     throw (err_unbound_variable)
 {
     if (is_any()) return true;
     if (!binding) return false;
     const eterm<Alloc>* value = binding->find(name());
     if (value)
         return check_type(value->type()) ? value->match(pattern, binding) : false;
     if (!check_type(pattern.type()))
         return false;
     // Bind the variable
     eterm<Alloc> et;
     binding->bind(name(), pattern.subst(et, binding) ? et : pattern);
     return true; 
 }