Lumiera  0.pre.03
»edit your freedom«
common/advice/binding.cpp File Reference

Go to the source code of this file.

Description

Implementation of a binding record to represent a match between two patterns.

This is used for the Advice System, to record existing connections between advice providers and consumers. But as such, Binding is a generic mechanism and looks like it could be of wider use within the Lumiera application. This is the reason why Binding got a separate implementation cpp file.

Definition in file common/advice/binding.cpp.

#include "common/advice/binding.hpp"
#include "lib/symbol.hpp"
#include "lib/util.hpp"
#include <boost/functional/hash.hpp>
#include <boost/lexical_cast.hpp>
#include <regex>

Functions

uint detectArity (smatch const &match)
 detect the arity of an predicate, as matched by findPredicate. More...
 
regex findPredicate ("\*"+matchSym+"("+matchArg+")?\*,?")
 sym(arg), groups: [symbol, parenthesis, argument symbol]
 
 LUMIERA_ERROR_DEFINE (BINDING_PATTERN_SYNTAX, "Unable to parse the given binding pattern definition")
 
bool operator== (Binding const &b1, Binding const &b2)
 bindings are considered equivalent if, after normalisation, their respective definitions are identical. More...
 

Variables

const string matchArg = "\\(\\s*"+matchSym+"?\\s*\\)"
 
const string matchSym = "(\\w+(?:[\\.\\-]\\w+)*)"
 

Namespaces

 lumiera
 Lumiera public interface.
 

Function Documentation

◆ operator==()

bool lumiera::advice::operator== ( Binding const &  b1,
Binding const &  b2 
)

bindings are considered equivalent if, after normalisation, their respective definitions are identical.

Note
for bindings without variable arguments, equivalence and matching always yield the same results. Contrary to this, two bindings with some variable arguments could match, without being defined identically. For example pred(X) matches pred(u) or any other binding of the form pred(<constant_value>) ////TICKET #615 not yet implemented

Definition at line 173 of file common/advice/binding.cpp.