Skip to content

Commit 47f5936

Browse files
committed
regcomp.c: Add synonym for macro complement
OPERAND and OPERATOR are here complements of each other. It's better to refer to the thing you are manipulating instead of {! the thing you aren't}.
1 parent e1d962e commit 47f5936

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

regcomp.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -13537,7 +13537,8 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
1353713537
* a stack. Each entry on the stack is a single character representing one
1353813538
* of the operators; or else a pointer to an operand inversion list. */
1353913539

13540-
#define IS_OPERAND(a) (! SvIOK(a))
13540+
#define IS_OPERATOR(a) SvIOK(a)
13541+
#define IS_OPERAND(a) (! IS_OPERATOR(a))
1354113542

1354213543
/* The stack is kept in Łukasiewicz order. (That's pronounced similar
1354313544
* to luke-a-shave-itch (or -itz), but people who didn't want to bother
@@ -13710,12 +13711,12 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
1371013711
* better be a '!', otherwise the entry below the top
1371113712
* operand should be an operator */
1371213713
if ( ! (top_ptr = av_fetch(stack, top_index, FALSE))
13713-
|| (! IS_OPERAND(*top_ptr) && SvUV(*top_ptr) != '!')
13714+
|| (IS_OPERATOR(*top_ptr) && SvUV(*top_ptr) != '!')
1371413715
|| top_index - fence < 1
1371513716
|| ! (stacked_ptr = av_fetch(stack,
1371613717
top_index - 1,
1371713718
FALSE))
13718-
|| IS_OPERAND(*stacked_ptr))
13719+
|| ! IS_OPERATOR(*stacked_ptr))
1371913720
{
1372013721
RExC_parse++;
1372113722
vFAIL("Unexpected '(' with no preceding operator");
@@ -13964,7 +13965,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
1396413965
* be an operator */
1396513966
top_ptr = av_fetch(stack, top_index, FALSE);
1396613967
assert(top_ptr);
13967-
if (! IS_OPERAND(*top_ptr)) {
13968+
if (IS_OPERATOR(*top_ptr)) {
1396813969

1396913970
/* The only permissible operator at the top of the stack is
1397013971
* '!', which is applied immediately to this operand. */
@@ -14109,6 +14110,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
1410914110
Set_Node_Length(node, RExC_parse - oregcomp_parse + 1); /* MJD */
1411014111
return node;
1411114112
}
14113+
#undef IS_OPERATOR
1411214114
#undef IS_OPERAND
1411314115

1411414116
STATIC void

0 commit comments

Comments
 (0)