Metalang99 1.13.3
Full-blown preprocessor metaprogramming
|
Identifiers: [a-zA-Z0-9_]+
.
More...
Go to the source code of this file.
Macros | |
#define | ML99_detectIdent(prefix, ident) ML99_call(ML99_detectIdent, prefix, ident) |
Tells whether ident belongs to a set of identifiers defined by prefix . More... | |
#define | ML99_identEq(prefix, x, y) ML99_call(ML99_identEq, prefix, x, y) |
Compares two identifiers x and y for equality. More... | |
#define | ML99_charEq(x, y) ML99_call(ML99_charEq, x, y) |
Compares two characters x and y for equality. More... | |
#define | ML99_isLowercase(x) ML99_call(ML99_isLowercase, x) |
Tells whether the identifier x is a lowercase letter. | |
#define | ML99_isUppercase(x) ML99_call(ML99_isUppercase, x) |
Tells whether the identifier x is an uppercase letter. | |
#define | ML99_isDigit(x) ML99_call(ML99_isDigit, x) |
Tells whether the identifier x is a digit. | |
#define | ML99_isChar(x) ML99_call(ML99_isChar, x) |
Tells whether the identifier x is a character. | |
#define | ML99_charLit(x) ML99_call(ML99_charLit, x) |
Converts the Metalang99 character x to a C character literal. More... | |
#define | ML99_LOWERCASE_CHARS(...) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z |
Expands to all comma-separated lowercase letters. More... | |
#define | ML99_UPPERCASE_CHARS(...) A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z |
The same as ML99_LOWERCASE_CHARS but for uppercase characters. | |
#define | ML99_DIGITS(...) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 |
The same as ML99_LOWERCASE_CHARS but for digits. | |
#define | ML99_DETECT_IDENT(prefix, ident) ML99_PRIV_IS_TUPLE_FAST(ML99_PRIV_CAT(prefix, ident)) |
#define | ML99_IDENT_EQ(prefix, x, y) ML99_DETECT_IDENT(ML99_PRIV_CAT3(prefix, x, _), y) |
#define | ML99_CHAR_EQ(x, y) |
#define | ML99_IS_LOWERCASE(x) ML99_IDENT_EQ(ML99_LOWERCASE_DETECTOR, x, x) |
#define | ML99_IS_UPPERCASE(x) ML99_IDENT_EQ(ML99_UPPERCASE_DETECTOR, x, x) |
#define | ML99_IS_DIGIT(x) ML99_IDENT_EQ(ML99_DIGIT_DETECTOR, x, x) |
#define | ML99_IS_CHAR(x) |
#define | ML99_CHAR_LIT(x) ML99_PRIV_CAT(ML99_PRIV_CHAR_LIT_, x) |
Identifiers: [a-zA-Z0-9_]+
.
An identifier is a sequence of characters. A character is one of:
0123456789
),abcdefghijklmnopqrstuvwxyz
),ABCDEFGHIJKLMNOPQRSTUVWXYZ
),_
).For example, here are identifiers: _ak39A
, 192_iAjP_2
, r9
. But these are not identifiers: ~18nA
, o78*
, 3i#^hdd
.
#define ML99_CHAR_EQ | ( | x, | |
y | |||
) |
#define ML99_charEq | ( | x, | |
y | |||
) | ML99_call(ML99_charEq, x, y) |
Compares two characters x
and y
for equality.
x
and y
can be any identifiers, though this function evaluates to true only for characters.
#define ML99_charLit | ( | x | ) | ML99_call(ML99_charLit, x) |
Converts the Metalang99 character x
to a C character literal.
q
from ‘'q’`. #define ML99_detectIdent | ( | prefix, | |
ident | |||
) | ML99_call(ML99_detectIdent, prefix, ident) |
Tells whether ident
belongs to a set of identifiers defined by prefix
.
If ML99_cat(prefix, ident)
exists, it must be an object-like macro which expands to ()
. If so, ML99_detectIdent(prefix, ident)
will expand to truth, otherwise (ML99_cat(prefix, ident)
does not exist), ML99_detectIdent(prefix, ident)
will expand to falsehood.
ML99_UNDERSCORE_DETECTOR
detects the underscore character (_
).#define ML99_identEq | ( | prefix, | |
x, | |||
y | |||
) | ML99_call(ML99_identEq, prefix, x, y) |
Compares two identifiers x
and y
for equality.
This macro is a shortcut to ML99_detectIdent(ML99_cat3(prefix, x, v(_)), y)
.
ML99_C_KEYWORD_DETECTOR
detects all the C11 keywords.ML99_LOWERCASE_DETECTOR
detects lowercase letters (abcdefghijklmnopqrstuvwxyz
).ML99_UPPERCASE_DETECTOR
detects uppercase letters (ABCDEFGHIJKLMNOPQRSTUVWXYZ
).ML99_DIGIT_DETECTOR
detects digits (0123456789
).#define ML99_IS_CHAR | ( | x | ) |
#define ML99_LOWERCASE_CHARS | ( | ... | ) | a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z |
Expands to all comma-separated lowercase letters.
This macro consumes all arguments.