import errors ;

# Given a property name, return the corresponding feature name
rule get-feature ( property )
{
    return [ SUBST $(property:G) ^<(.*)> $1 ] ;
}

rule is-valid ( property )
{
    import feature ;
    if ! $(property:G)
    {
        return ;
    }
    else
    {
        local f = [ get-feature $(property) ] ;
        local value = $(property:G=) ;
        
        if [ features.is-valid $(f) ] && 
          ( free in [ features.attributes $(f) ]
            || $(value) in [ features.values $(f) ] )
            
        {
            return true ;
        }
        else
        {
            return ;
        }
    }
}
