Skip to content

Commit

Permalink
Add a new regex flag, RXf_RTRIM.
Browse files Browse the repository at this point in the history
  • Loading branch information
nwc10 authored and khwilliamson committed Jun 6, 2021
1 parent f6f1a03 commit 5f9070e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions dump.c
Expand Up @@ -918,6 +918,8 @@ S_pm_description(pTHX_ const PMOP *pm)
sv_catpvs(desc, ",WHITE");
if (RX_EXTFLAGS(regex) & RXf_NULL)
sv_catpvs(desc, ",NULL");
if (RX_EXTFLAGS(regex) & RXf_RTRIM)
sv_catpvs(desc, ",RTRIM");
}

append_flags(desc, pmflags, pmflags_flags_names);
Expand Down Expand Up @@ -1708,6 +1710,7 @@ const struct flag_to_name regexp_extflags_names[] = {
{RXf_SKIPWHITE, "SKIPWHITE,"},
{RXf_WHITE, "WHITE,"},
{RXf_NULL, "NULL,"},
{RXf_RTRIM, "RTRIM,"},
};

/* NOTE: this structure is mostly duplicative of one generated by
Expand Down
1 change: 1 addition & 0 deletions regexp.h
Expand Up @@ -450,6 +450,7 @@ and check for NULL.
/* split " " */
# define RXf_WHITE (1U<<(RXf_BASE_SHIFT+16)) /* Pattern is /\s+/ */
# define RXf_NULL (1U<<(RXf_BASE_SHIFT+17)) /* Pattern is // */
# define RXf_RTRIM (1U<<(RXf_BASE_SHIFT+18)) /* Pattern is /[:space:]\z/u */

/* See comments at the beginning of these defines about adding bits. The
* highest bit position should be used, so that if RXf_BASE_SHIFT gets
Expand Down
4 changes: 2 additions & 2 deletions regnodes.h
Expand Up @@ -1654,7 +1654,7 @@ EXTCONST char * const PL_reg_name[] = {
EXTCONST char * PL_reg_extflags_name[];
#else
EXTCONST char * const PL_reg_extflags_name[] = {
/* Bits in extflags defined: 01111111111111111000111111111111 */
/* Bits in extflags defined: 11111111111111111000111111111111 */
"MULTILINE", /* 0x00000001 */
"SINGLELINE", /* 0x00000002 */
"FOLD", /* 0x00000004 */
Expand Down Expand Up @@ -1686,7 +1686,7 @@ EXTCONST char * const PL_reg_extflags_name[] = {
"SKIPWHITE", /* 0x10000000 */
"WHITE", /* 0x20000000 */
"NULL", /* 0x40000000 */
"UNUSED_BIT_31", /* 0x80000000 */
"RTRIM", /* 0x80000000 */
};
#endif /* DOINIT */

Expand Down

0 comments on commit 5f9070e

Please sign in to comment.