}
case '`':
do_prematch:
- paren = RXf_PREMATCH;
+ paren = RX_BUFF_IDX_PREMATCH;
goto maybegetparen;
case '\'':
do_postmatch:
- paren = RXf_POSTMATCH;
+ paren = RX_BUFF_IDX_POSTMATCH;
goto maybegetparen;
case '&':
do_match:
- paren = RXf_MATCH;
+ paren = RX_BUFF_IDX_FULLMATCH;
goto maybegetparen;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
goto do_match;
case '`': /* ${^PREMATCH} caught below */
do_prematch:
- paren = RXf_PREMATCH;
+ paren = RX_BUFF_IDX_PREMATCH;
goto setparen;
case '\'': /* ${^POSTMATCH} caught below */
do_postmatch:
- paren = RXf_POSTMATCH;
+ paren = RX_BUFF_IDX_POSTMATCH;
goto setparen;
case '&':
do_match:
- paren = RXf_MATCH;
+ paren = RX_BUFF_IDX_FULLMATCH;
goto setparen;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
CALL_FPTR((rx)->engine->numbered_buff_LENGTH)(aTHX_ (rx),(sv),(paren))
#define CALLREG_NAMED_BUFF_FETCH(rx, key, flags) \
- CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), (key), NULL, ((flags) | RXf_HASH_FETCH))
+ CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), (key), NULL, ((flags) | RXapif_FETCH))
#define CALLREG_NAMED_BUFF_STORE(rx, key, value, flags) \
- CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), (key), (value), ((flags) | RXf_HASH_STORE))
+ CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), (key), (value), ((flags) | RXapif_STORE))
#define CALLREG_NAMED_BUFF_DELETE(rx, key, flags) \
- CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx),(key), NULL, ((flags) | RXf_HASH_DELETE))
+ CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx),(key), NULL, ((flags) | RXapif_DELETE))
#define CALLREG_NAMED_BUFF_CLEAR(rx, flags) \
- CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), NULL, NULL, ((flags) | RXf_HASH_CLEAR))
+ CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), NULL, NULL, ((flags) | RXapif_CLEAR))
#define CALLREG_NAMED_BUFF_EXISTS(rx, key, flags) \
- CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), (key), NULL, ((flags) | RXf_HASH_EXISTS))
+ CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), (key), NULL, ((flags) | RXapif_EXISTS))
#define CALLREG_NAMED_BUFF_FIRSTKEY(rx, flags) \
- CALL_FPTR((rx)->engine->named_buff_iter)(aTHX_ (rx), NULL, ((flags) | RXf_HASH_FIRSTKEY))
+ CALL_FPTR((rx)->engine->named_buff_iter)(aTHX_ (rx), NULL, ((flags) | RXapif_FIRSTKEY))
#define CALLREG_NAMED_BUFF_NEXTKEY(rx, lastkey, flags) \
- CALL_FPTR((rx)->engine->named_buff_iter)(aTHX_ (rx), (lastkey), ((flags) | RXf_HASH_NEXTKEY))
+ CALL_FPTR((rx)->engine->named_buff_iter)(aTHX_ (rx), (lastkey), ((flags) | RXapif_NEXTKEY))
#define CALLREG_NAMED_BUFF_SCALAR(rx, flags) \
- CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), NULL, NULL, ((flags) | RXf_HASH_SCALAR))
+ CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), NULL, NULL, ((flags) | RXapif_SCALAR))
#define CALLREG_NAMED_BUFF_COUNT(rx) \
- CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), NULL, NULL, RXf_HASH_REGNAMES_COUNT)
+ CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), NULL, NULL, RXapif_REGNAMES_COUNT)
#define CALLREG_NAMED_BUFF_ALL(rx, flags) \
CALL_FPTR((rx)->engine->named_buff)(aTHX_ (rx), NULL, NULL, flags)
Which L<Tie::Hash> operation is being performed from the Perl level on
C<%+> or C<%+>, if any:
- RXf_HASH_FETCH
- RXf_HASH_STORE
- RXf_HASH_DELETE
- RXf_HASH_CLEAR
- RXf_HASH_EXISTS
- RXf_HASH_SCALAR
- RXf_HASH_FIRSTKEY
- RXf_HASH_NEXTKEY
+ RXapif_FETCH
+ RXapif_STORE
+ RXapif_DELETE
+ RXapif_CLEAR
+ RXapif_EXISTS
+ RXapif_SCALAR
+ RXapif_FIRSTKEY
+ RXapif_NEXTKEY
Whether C<%+> or C<%-> is being operated on, if any.
- RXf_HASH_ONE /* %+ */
- RXf_HASH_ALL /* %- */
+ RXapif_ONE /* %+ */
+ RXapif_ALL /* %- */
Whether this is being called as C<re::regname>, C<re::regnames> or
C<re::regnames_count>, if any. The first two will be combined with
-C<RXf_HASH_ONE> or C<RXf_HASH_ALL>.
+C<RXapif_ONE> or C<RXapif_ALL>.
- RXf_HASH_REGNAME
- RXf_HASH_REGNAMES
- RXf_HASH_REGNAMES_COUNT
+ RXapif_REGNAME
+ RXapif_REGNAMES
+ RXapif_REGNAMES_COUNT
Internally C<%+> and C<%-> are implemented with a real tied interface
via L<Tie::Hash::NamedCapture>. The methods in that package will call
r->extflags |= RXf_WHITE;
else if (r->prelen == 1 && r->precomp[0] == '^')
r->extflags |= RXf_START_ONLY;
-#endif
+#else
if (r->extflags & RXf_SPLIT && r->prelen == 1 && r->precomp[0] == ' ')
/* XXX: this should happen BEFORE we compile */
r->extflags |= (RXf_SKIPWHITE|RXf_WHITE);
else if (fop == PLUS && nop ==SPACE && OP(regnext(first))==END)
r->extflags |= RXf_WHITE;
}
-
+#endif
#ifdef DEBUGGING
if (RExC_paren_names) {
ri->name_list_idx = add_data( pRExC_state, 1, "p" );
{
PERL_UNUSED_ARG(value);
- if (flags & RXf_HASH_FETCH) {
+ if (flags & RXapif_FETCH) {
return reg_named_buff_fetch(rx, key, flags);
- } else if (flags & (RXf_HASH_STORE | RXf_HASH_DELETE | RXf_HASH_CLEAR)) {
+ } else if (flags & (RXapif_STORE | RXapif_DELETE | RXapif_CLEAR)) {
Perl_croak(aTHX_ PL_no_modify);
return NULL;
- } else if (flags & RXf_HASH_EXISTS) {
+ } else if (flags & RXapif_EXISTS) {
return reg_named_buff_exists(rx, key, flags)
? &PL_sv_yes
: &PL_sv_no;
- } else if (flags & RXf_HASH_REGNAMES) {
+ } else if (flags & RXapif_REGNAMES) {
return reg_named_buff_all(rx, flags);
- } else if (flags & (RXf_HASH_SCALAR | RXf_HASH_REGNAMES_COUNT)) {
+ } else if (flags & (RXapif_SCALAR | RXapif_REGNAMES_COUNT)) {
return reg_named_buff_scalar(rx, flags);
} else {
Perl_croak(aTHX_ "panic: Unknown flags %d in named_buff", (int)flags);
{
PERL_UNUSED_ARG(lastkey);
- if (flags & RXf_HASH_FIRSTKEY)
+ if (flags & RXapif_FIRSTKEY)
return reg_named_buff_firstkey(rx, flags);
- else if (flags & RXf_HASH_NEXTKEY)
+ else if (flags & RXapif_NEXTKEY)
return reg_named_buff_nextkey(rx, flags);
else {
Perl_croak(aTHX_ "panic: Unknown flags %d in named_buff_iter", (int)flags);
{
AV *retarray = NULL;
SV *ret;
- if (flags & RXf_HASH_ALL)
+ if (flags & RXapif_ALL)
retarray=newAV();
if (rx && rx->paren_names) {
const U32 flags)
{
if (rx && rx->paren_names) {
- if (flags & RXf_HASH_ALL) {
+ if (flags & RXapif_ALL) {
return hv_exists_ent(rx->paren_names, key, 0);
} else {
SV *sv = CALLREG_NAMED_BUFF_FETCH(rx, key, flags);
{
(void)hv_iterinit(rx->paren_names);
- return CALLREG_NAMED_BUFF_NEXTKEY(rx, NULL, flags & ~RXf_HASH_FIRSTKEY);
+ return CALLREG_NAMED_BUFF_NEXTKEY(rx, NULL, flags & ~RXapif_FIRSTKEY);
}
SV*
break;
}
}
- if (parno || flags & RXf_HASH_ALL) {
+ if (parno || flags & RXapif_ALL) {
STRLEN len;
char *pv = HePV(temphe, len);
return newSVpvn(pv,len);
I32 length;
if (rx && rx->paren_names) {
- if (flags & (RXf_HASH_ALL | RXf_HASH_REGNAMES_COUNT)) {
+ if (flags & (RXapif_ALL | RXapif_REGNAMES_COUNT)) {
return newSViv(HvTOTALKEYS(rx->paren_names));
- } else if (flags & RXf_HASH_ONE) {
- ret = CALLREG_NAMED_BUFF_ALL(rx, (flags | RXf_HASH_REGNAMES));
+ } else if (flags & RXapif_ONE) {
+ ret = CALLREG_NAMED_BUFF_ALL(rx, (flags | RXapif_REGNAMES));
av = (AV*)SvRV(ret);
length = av_len(av);
return newSViv(length + 1);
break;
}
}
- if (parno || flags & RXf_HASH_ALL) {
+ if (parno || flags & RXapif_ALL) {
STRLEN len;
char *pv = HePV(temphe, len);
av_push(av, newSVpvn(pv,len));
return;
}
else
- if (paren == RXf_PREMATCH && rx->offs[0].start != -1) {
+ if (paren == RX_BUFF_IDX_PREMATCH && rx->offs[0].start != -1) {
/* $` */
i = rx->offs[0].start;
s = rx->subbeg;
}
else
- if (paren == RXf_POSTMATCH && rx->offs[0].end != -1) {
+ if (paren == RX_BUFF_IDX_POSTMATCH && rx->offs[0].end != -1) {
/* $' */
s = rx->subbeg + rx->offs[0].end;
i = rx->sublen - rx->offs[0].end;
/* Some of this code was originally in C<Perl_magic_len> in F<mg.c> */
switch (paren) {
/* $` / ${^PREMATCH} */
- case RXf_PREMATCH:
+ case RX_BUFF_IDX_PREMATCH:
if (rx->offs[0].start != -1) {
i = rx->offs[0].start;
if (i > 0) {
}
return 0;
/* $' / ${^POSTMATCH} */
- case RXf_POSTMATCH:
+ case RX_BUFF_IDX_POSTMATCH:
if (rx->offs[0].end != -1) {
i = rx->sublen - rx->offs[0].end;
if (i > 0) {
paren name. >= 1 is reserved for actual numbered captures, i.e. $1,
$2 etc.
*/
-#define RXf_PREMATCH -2 /* $` / ${^PREMATCH} */
-#define RXf_POSTMATCH -1 /* $' / ${^POSTMATCH} */
-#define RXf_MATCH 0 /* $& / ${^MATCH} */
+#define RX_BUFF_IDX_PREMATCH -2 /* $` / ${^PREMATCH} */
+#define RX_BUFF_IDX_POSTMATCH -1 /* $' / ${^POSTMATCH} */
+#define RX_BUFF_IDX_FULLMATCH 0 /* $& / ${^MATCH} */
/*
Flags that are passed to the named_buff and named_buff_iter
*/
/* The Tie::Hash::NamedCapture operation this is part of, if any */
-#define RXf_HASH_FETCH 0x0001
-#define RXf_HASH_STORE 0x0002
-#define RXf_HASH_DELETE 0x0004
-#define RXf_HASH_CLEAR 0x0008
-#define RXf_HASH_EXISTS 0x0010
-#define RXf_HASH_SCALAR 0x0020
-#define RXf_HASH_FIRSTKEY 0x0040
-#define RXf_HASH_NEXTKEY 0x0080
+#define RXapif_FETCH 0x0001
+#define RXapif_STORE 0x0002
+#define RXapif_DELETE 0x0004
+#define RXapif_CLEAR 0x0008
+#define RXapif_EXISTS 0x0010
+#define RXapif_SCALAR 0x0020
+#define RXapif_FIRSTKEY 0x0040
+#define RXapif_NEXTKEY 0x0080
/* Whether %+ or %- is being operated on */
-#define RXf_HASH_ONE 0x0100 /* %+ */
-#define RXf_HASH_ALL 0x0200 /* %- */
+#define RXapif_ONE 0x0100 /* %+ */
+#define RXapif_ALL 0x0200 /* %- */
/* Whether this is being called from a re:: function */
-#define RXf_HASH_REGNAME 0x0400
-#define RXf_HASH_REGNAMES 0x0800
-#define RXf_HASH_REGNAMES_COUNT 0x1000
+#define RXapif_REGNAME 0x0400
+#define RXapif_REGNAMES 0x0800
+#define RXapif_REGNAMES_COUNT 0x1000
/*
=head1 REGEXP Functions
/* UTF8 related */
#define RXf_UTF8 0x00400000
-#define RXf_MATCH_UTF8 0x00800000
+#define RX_BUFF_IDX_FULLMATCH_UTF8 0x00800000
/* Intuit related */
#define RXf_USE_INTUIT_NOML 0x01000000
}} STMT_END
#endif
-#define RX_MATCH_UTF8(prog) ((prog)->extflags & RXf_MATCH_UTF8)
-#define RX_MATCH_UTF8_on(prog) ((prog)->extflags |= RXf_MATCH_UTF8)
-#define RX_MATCH_UTF8_off(prog) ((prog)->extflags &= ~RXf_MATCH_UTF8)
+#define RX_MATCH_UTF8(prog) ((prog)->extflags & RX_BUFF_IDX_FULLMATCH_UTF8)
+#define RX_MATCH_UTF8_on(prog) ((prog)->extflags |= RX_BUFF_IDX_FULLMATCH_UTF8)
+#define RX_MATCH_UTF8_off(prog) ((prog)->extflags &= ~RX_BUFF_IDX_FULLMATCH_UTF8)
#define RX_MATCH_UTF8_set(prog, t) ((t) \
? (RX_MATCH_UTF8_on(prog), (PL_reg_match_utf8 = 1)) \
: (RX_MATCH_UTF8_off(prog), (PL_reg_match_utf8 = 0)))
XSRETURN_UNDEF;
if (items == 2 && SvTRUE(ST(1))) {
- flags = RXf_HASH_ALL;
+ flags = RXapif_ALL;
} else {
- flags = RXf_HASH_ONE;
+ flags = RXapif_ONE;
}
- ret = CALLREG_NAMED_BUFF_FETCH(rx, ST(0), (flags | RXf_HASH_REGNAME));
+ ret = CALLREG_NAMED_BUFF_FETCH(rx, ST(0), (flags | RXapif_REGNAME));
if (ret) {
if (SvROK(ret))
XSRETURN_UNDEF;
if (items == 1 && SvTRUE(ST(0))) {
- flags = RXf_HASH_ALL;
+ flags = RXapif_ALL;
} else {
- flags = RXf_HASH_ONE;
+ flags = RXapif_ONE;
}
SP -= items;
- ret = CALLREG_NAMED_BUFF_ALL(rx, (flags | RXf_HASH_REGNAMES));
+ ret = CALLREG_NAMED_BUFF_ALL(rx, (flags | RXapif_REGNAMES));
SPAGAIN;
if (items != 0)
Perl_croak(aTHX_ "Usage: Tie::Hash::NamedCapture::flags()");
- XPUSHs(sv_2mortal(newSVuv(RXf_HASH_ONE)));
- XPUSHs(sv_2mortal(newSVuv(RXf_HASH_ALL)));
+ XPUSHs(sv_2mortal(newSVuv(RXapif_ONE)));
+ XPUSHs(sv_2mortal(newSVuv(RXapif_ALL)));
PUTBACK;
return;
}