This implements a function for retrieving the return type of terms, that is, both the domain to which the expression evaluates to as well as whether it’s an empty, unit, or general set with multiple values.
66 lines
1.3 KiB
C++
66 lines
1.3 KiB
C++
#ifndef __ANTHEM__UTILS_H
|
|
#define __ANTHEM__UTILS_H
|
|
|
|
namespace anthem
|
|
{
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Utils
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
constexpr const auto HeadVariablePrefix = "V";
|
|
constexpr const auto BodyVariablePrefix = "X";
|
|
constexpr const auto UserVariablePrefix = "U";
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
enum class Tristate
|
|
{
|
|
True,
|
|
False,
|
|
Unknown,
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
enum class OperationResult
|
|
{
|
|
Unchanged,
|
|
Changed,
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
enum class Domain
|
|
{
|
|
Noninteger,
|
|
Integer,
|
|
Unknown,
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
enum class SetSize
|
|
{
|
|
Empty,
|
|
Unit,
|
|
Multi,
|
|
Unknown,
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
struct Type
|
|
{
|
|
Domain domain{Domain::Unknown};
|
|
SetSize setSize{SetSize::Unknown};
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}
|
|
|
|
#endif
|