9#include <metalang99/priv/util.h>
18#define ML99_left(x) ML99_call(ML99_left, x)
23#define ML99_right(x) ML99_call(ML99_right, x)
40#define ML99_isLeft(either) ML99_call(ML99_isLeft, either)
57#define ML99_isRight(either) ML99_call(ML99_isRight, either)
78#define ML99_eitherEq(cmp, either, other) ML99_call(ML99_eitherEq, cmp, either, other)
95#define ML99_unwrapLeft(either) ML99_call(ML99_unwrapLeft, either)
112#define ML99_unwrapRight(either) ML99_call(ML99_unwrapRight, either)
114#define ML99_LEFT(x) ML99_CHOICE(left, x)
115#define ML99_RIGHT(x) ML99_CHOICE(right, x)
116#define ML99_IS_LEFT(either) ML99_PRIV_IS_LEFT(either)
117#define ML99_IS_RIGHT(either) ML99_NOT(ML99_IS_LEFT(either))
119#ifndef DOXYGEN_IGNORE
121#define ML99_left_IMPL(x) v(ML99_LEFT(x))
122#define ML99_right_IMPL(x) v(ML99_RIGHT(x))
124#define ML99_isLeft_IMPL(either) v(ML99_IS_LEFT(either))
125#define ML99_isRight_IMPL(either) v(ML99_IS_RIGHT(either))
129#define ML99_eitherEq_IMPL(cmp, either, other) \
130 ML99_matchWithArgs_IMPL(either, ML99_PRIV_eitherEq_, cmp, other)
132#define ML99_PRIV_eitherEq_left_IMPL(x, cmp, other) \
133 ML99_matchWithArgs_IMPL(other, ML99_PRIV_eitherEq_left_, cmp, x)
134#define ML99_PRIV_eitherEq_right_IMPL(x, cmp, other) \
135 ML99_matchWithArgs_IMPL(other, ML99_PRIV_eitherEq_right_, cmp, x)
137#define ML99_PRIV_eitherEq_left_left_IMPL(y, cmp, x) ML99_appl2_IMPL(cmp, x, y)
138#define ML99_PRIV_eitherEq_left_right_IMPL ML99_false_IMPL
140#define ML99_PRIV_eitherEq_right_left_IMPL ML99_false_IMPL
141#define ML99_PRIV_eitherEq_right_right_IMPL(y, cmp, x) ML99_appl2_IMPL(cmp, x, y)
144#define ML99_unwrapLeft_IMPL(either) ML99_match_IMPL(either, ML99_PRIV_unwrapLeft_)
145#define ML99_PRIV_unwrapLeft_left_IMPL(x) v(x)
146#define ML99_PRIV_unwrapLeft_right_IMPL(_x) \
147 ML99_fatal(ML99_unwrapLeft, expected ML99_left but found ML99_right)
149#define ML99_unwrapRight_IMPL(either) ML99_match_IMPL(either, ML99_PRIV_unwrapRight_)
150#define ML99_PRIV_unwrapRight_left_IMPL(_x) \
151 ML99_fatal(ML99_unwrapRight, expected ML99_right but found ML99_left)
152#define ML99_PRIV_unwrapRight_right_IMPL(x) v(x)
154#define ML99_PRIV_IS_LEFT(either) ML99_DETECT_IDENT(ML99_PRIV_IS_LEFT_, ML99_CHOICE_TAG(either))
155#define ML99_PRIV_IS_LEFT_left ()
159#define ML99_left_ARITY 1
160#define ML99_right_ARITY 1
161#define ML99_isLeft_ARITY 1
162#define ML99_isRight_ARITY 1
163#define ML99_eitherEq_ARITY 3
164#define ML99_unwrapLeft_ARITY 1
165#define ML99_unwrapRight_ARITY 1
Choice types: (tag, ...).
Identifiers: [a-zA-Z0-9_]+.