Loading...
Searching...
No Matches
either.h
Go to the documentation of this file.
#ifndef ML99_EITHER_H
#define ML99_EITHER_H
#include <metalang99/priv/util.h>
#include <metalang99/bool.h>
#include <metalang99/choice.h>
#include <metalang99/ident.h>
#define ML99_left(x) ML99_call(ML99_left, x)
#define ML99_right(x) ML99_call(ML99_right, x)
#define ML99_isLeft(either) ML99_call(ML99_isLeft, either)
#define ML99_isRight(either) ML99_call(ML99_isRight, either)
#define ML99_eitherEq(cmp, either, other) ML99_call(ML99_eitherEq, cmp, either, other)
#define ML99_unwrapLeft(either) ML99_call(ML99_unwrapLeft, either)
#define ML99_unwrapRight(either) ML99_call(ML99_unwrapRight, either)
#define ML99_LEFT(x) ML99_CHOICE(left, x)
#define ML99_RIGHT(x) ML99_CHOICE(right, x)
#define ML99_IS_LEFT(either) ML99_PRIV_IS_LEFT(either)
#define ML99_IS_RIGHT(either) ML99_NOT(ML99_IS_LEFT(either))
#ifndef DOXYGEN_IGNORE
#define ML99_left_IMPL(x) v(ML99_LEFT(x))
#define ML99_right_IMPL(x) v(ML99_RIGHT(x))
#define ML99_isLeft_IMPL(either) v(ML99_IS_LEFT(either))
#define ML99_isRight_IMPL(either) v(ML99_IS_RIGHT(either))
// ML99_eitherEq_IMPL {
#define ML99_eitherEq_IMPL(cmp, either, other) \
ML99_matchWithArgs_IMPL(either, ML99_PRIV_eitherEq_, cmp, other)
#define ML99_PRIV_eitherEq_left_IMPL(x, cmp, other) \
ML99_matchWithArgs_IMPL(other, ML99_PRIV_eitherEq_left_, cmp, x)
#define ML99_PRIV_eitherEq_right_IMPL(x, cmp, other) \
ML99_matchWithArgs_IMPL(other, ML99_PRIV_eitherEq_right_, cmp, x)
#define ML99_PRIV_eitherEq_left_left_IMPL(y, cmp, x) ML99_appl2_IMPL(cmp, x, y)
#define ML99_PRIV_eitherEq_left_right_IMPL ML99_false_IMPL
#define ML99_PRIV_eitherEq_right_left_IMPL ML99_false_IMPL
#define ML99_PRIV_eitherEq_right_right_IMPL(y, cmp, x) ML99_appl2_IMPL(cmp, x, y)
// } (ML99_eitherEq_IMPL)
#define ML99_unwrapLeft_IMPL(either) ML99_match_IMPL(either, ML99_PRIV_unwrapLeft_)
#define ML99_PRIV_unwrapLeft_left_IMPL(x) v(x)
#define ML99_PRIV_unwrapLeft_right_IMPL(_x) \
ML99_fatal(ML99_unwrapLeft, expected ML99_left but found ML99_right)
#define ML99_unwrapRight_IMPL(either) ML99_match_IMPL(either, ML99_PRIV_unwrapRight_)
#define ML99_PRIV_unwrapRight_left_IMPL(_x) \
ML99_fatal(ML99_unwrapRight, expected ML99_right but found ML99_left)
#define ML99_PRIV_unwrapRight_right_IMPL(x) v(x)
#define ML99_PRIV_IS_LEFT(either) ML99_DETECT_IDENT(ML99_PRIV_IS_LEFT_, ML99_CHOICE_TAG(either))
#define ML99_PRIV_IS_LEFT_left ()
// Arity specifiers {
#define ML99_left_ARITY 1
#define ML99_right_ARITY 1
#define ML99_isLeft_ARITY 1
#define ML99_isRight_ARITY 1
#define ML99_eitherEq_ARITY 3
#define ML99_unwrapLeft_ARITY 1
#define ML99_unwrapRight_ARITY 1
// } (Arity specifiers)
#endif // DOXYGEN_IGNORE
#endif // ML99_EITHER_H
bool.h
Boolean algebra.
choice.h
Choice types: (tag, ...).
ident.h
Identifiers: [a-zA-Z0-9_]+.