Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/smanonr..../lib64/perl5/CORE
File: regexp.h
/* regexp.h
[0] Fix | Delete
*
[1] Fix | Delete
* Copyright (C) 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2003,
[2] Fix | Delete
* 2005, 2006, 2007, 2008 by Larry Wall and others
[3] Fix | Delete
*
[4] Fix | Delete
* You may distribute under the terms of either the GNU General Public
[5] Fix | Delete
* License or the Artistic License, as specified in the README file.
[6] Fix | Delete
*
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
/*
[10] Fix | Delete
* Definitions etc. for regexp(3) routines.
[11] Fix | Delete
*
[12] Fix | Delete
* Caveat: this is V8 regexp(3) [actually, a reimplementation thereof],
[13] Fix | Delete
* not the System V one.
[14] Fix | Delete
*/
[15] Fix | Delete
#ifndef PLUGGABLE_RE_EXTENSION
[16] Fix | Delete
/* we don't want to include this stuff if we are inside of
[17] Fix | Delete
an external regex engine based on the core one - like re 'debug'*/
[18] Fix | Delete
[19] Fix | Delete
#include "utf8.h"
[20] Fix | Delete
[21] Fix | Delete
struct regnode {
[22] Fix | Delete
U8 flags;
[23] Fix | Delete
U8 type;
[24] Fix | Delete
U16 next_off;
[25] Fix | Delete
};
[26] Fix | Delete
[27] Fix | Delete
typedef struct regnode regnode;
[28] Fix | Delete
[29] Fix | Delete
struct reg_substr_data;
[30] Fix | Delete
[31] Fix | Delete
struct reg_data;
[32] Fix | Delete
[33] Fix | Delete
struct regexp_engine;
[34] Fix | Delete
struct regexp;
[35] Fix | Delete
[36] Fix | Delete
struct reg_substr_datum {
[37] Fix | Delete
SSize_t min_offset; /* min pos (in chars) that substr must appear */
[38] Fix | Delete
SSize_t max_offset /* max pos (in chars) that substr must appear */;
[39] Fix | Delete
SV *substr; /* non-utf8 variant */
[40] Fix | Delete
SV *utf8_substr; /* utf8 variant */
[41] Fix | Delete
SSize_t end_shift; /* how many fixed chars must end the string */
[42] Fix | Delete
};
[43] Fix | Delete
struct reg_substr_data {
[44] Fix | Delete
U8 check_ix; /* index into data[] of check substr */
[45] Fix | Delete
struct reg_substr_datum data[3]; /* Actual array */
[46] Fix | Delete
};
[47] Fix | Delete
[48] Fix | Delete
#ifdef PERL_ANY_COW
[49] Fix | Delete
#define SV_SAVED_COPY SV *saved_copy; /* If non-NULL, SV which is COW from original */
[50] Fix | Delete
#else
[51] Fix | Delete
#define SV_SAVED_COPY
[52] Fix | Delete
#endif
[53] Fix | Delete
[54] Fix | Delete
/* offsets within a string of a particular /(.)/ capture */
[55] Fix | Delete
[56] Fix | Delete
typedef struct regexp_paren_pair {
[57] Fix | Delete
SSize_t start;
[58] Fix | Delete
SSize_t end;
[59] Fix | Delete
/* 'start_tmp' records a new opening position before the matching end
[60] Fix | Delete
* has been found, so that the old start and end values are still
[61] Fix | Delete
* valid, e.g.
[62] Fix | Delete
* "abc" =~ /(.(?{print "[$1]"}))+/
[63] Fix | Delete
*outputs [][a][b]
[64] Fix | Delete
* This field is not part of the API. */
[65] Fix | Delete
SSize_t start_tmp;
[66] Fix | Delete
} regexp_paren_pair;
[67] Fix | Delete
[68] Fix | Delete
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_UTF8_C)
[69] Fix | Delete
#define _invlist_union(a, b, output) _invlist_union_maybe_complement_2nd(a, b, FALSE, output)
[70] Fix | Delete
#define _invlist_intersection(a, b, output) _invlist_intersection_maybe_complement_2nd(a, b, FALSE, output)
[71] Fix | Delete
[72] Fix | Delete
/* Subtracting b from a leaves in a everything that was there that isn't in b,
[73] Fix | Delete
* that is the intersection of a with b's complement */
[74] Fix | Delete
#define _invlist_subtract(a, b, output) _invlist_intersection_maybe_complement_2nd(a, b, TRUE, output)
[75] Fix | Delete
#endif
[76] Fix | Delete
[77] Fix | Delete
/* record the position of a (?{...}) within a pattern */
[78] Fix | Delete
[79] Fix | Delete
struct reg_code_block {
[80] Fix | Delete
STRLEN start;
[81] Fix | Delete
STRLEN end;
[82] Fix | Delete
OP *block;
[83] Fix | Delete
REGEXP *src_regex;
[84] Fix | Delete
};
[85] Fix | Delete
[86] Fix | Delete
/* array of reg_code_block's plus header info */
[87] Fix | Delete
[88] Fix | Delete
struct reg_code_blocks {
[89] Fix | Delete
int refcnt; /* we may be pointed to from a regex and from the savestack */
[90] Fix | Delete
int count; /* how many code blocks */
[91] Fix | Delete
struct reg_code_block *cb; /* array of reg_code_block's */
[92] Fix | Delete
};
[93] Fix | Delete
[94] Fix | Delete
[95] Fix | Delete
/*
[96] Fix | Delete
The regexp/REGEXP struct, see L<perlreapi> for further documentation
[97] Fix | Delete
on the individual fields. The struct is ordered so that the most
[98] Fix | Delete
commonly used fields are placed at the start.
[99] Fix | Delete
[100] Fix | Delete
Any patch that adds items to this struct will need to include
[101] Fix | Delete
changes to F<sv.c> (C<Perl_re_dup()>) and F<regcomp.c>
[102] Fix | Delete
(C<pregfree()>). This involves freeing or cloning items in the
[103] Fix | Delete
regexp's data array based on the data item's type.
[104] Fix | Delete
*/
[105] Fix | Delete
[106] Fix | Delete
#define _REGEXP_COMMON \
[107] Fix | Delete
/* what engine created this regexp? */ \
[108] Fix | Delete
const struct regexp_engine* engine; \
[109] Fix | Delete
REGEXP *mother_re; /* what re is this a lightweight copy of? */ \
[110] Fix | Delete
HV *paren_names; /* Optional hash of paren names */ \
[111] Fix | Delete
/*--------------------------------------------------------*/ \
[112] Fix | Delete
/* Information about the match that the perl core uses to */ \
[113] Fix | Delete
/* manage things */ \
[114] Fix | Delete
U32 extflags; /* Flags used both externally and internally */ \
[115] Fix | Delete
SSize_t minlen; /* mininum possible number of chars in string to match */\
[116] Fix | Delete
SSize_t minlenret; /* mininum possible number of chars in $& */ \
[117] Fix | Delete
STRLEN gofs; /* chars left of pos that we search from */ \
[118] Fix | Delete
/* substring data about strings that must appear in the */ \
[119] Fix | Delete
/* final match, used for optimisations */ \
[120] Fix | Delete
struct reg_substr_data *substrs; \
[121] Fix | Delete
U32 nparens; /* number of capture buffers */ \
[122] Fix | Delete
/* private engine specific data */ \
[123] Fix | Delete
U32 intflags; /* Engine Specific Internal flags */ \
[124] Fix | Delete
void *pprivate; /* Data private to the regex engine which */ \
[125] Fix | Delete
/* created this object. */ \
[126] Fix | Delete
/*--------------------------------------------------------*/ \
[127] Fix | Delete
/* Data about the last/current match. These are modified */ \
[128] Fix | Delete
/* during matching */ \
[129] Fix | Delete
U32 lastparen; /* last open paren matched */ \
[130] Fix | Delete
U32 lastcloseparen; /* last close paren matched */ \
[131] Fix | Delete
/* Array of offsets for (@-) and (@+) */ \
[132] Fix | Delete
regexp_paren_pair *offs; \
[133] Fix | Delete
char **recurse_locinput; /* used to detect infinite recursion, XXX: move to internal */ \
[134] Fix | Delete
/*--------------------------------------------------------*/ \
[135] Fix | Delete
/* saved or original string so \digit works forever. */ \
[136] Fix | Delete
char *subbeg; \
[137] Fix | Delete
SV_SAVED_COPY /* If non-NULL, SV which is COW from original */\
[138] Fix | Delete
SSize_t sublen; /* Length of string pointed by subbeg */ \
[139] Fix | Delete
SSize_t suboffset; /* byte offset of subbeg from logical start of str */ \
[140] Fix | Delete
SSize_t subcoffset; /* suboffset equiv, but in chars (for @-/@+) */ \
[141] Fix | Delete
/* Information about the match that isn't often used */ \
[142] Fix | Delete
SSize_t maxlen; /* mininum possible number of chars in string to match */\
[143] Fix | Delete
/*--------------------------------------------------------*/ \
[144] Fix | Delete
/* offset from wrapped to the start of precomp */ \
[145] Fix | Delete
PERL_BITFIELD32 pre_prefix:4; \
[146] Fix | Delete
/* original flags used to compile the pattern, may differ */ \
[147] Fix | Delete
/* from extflags in various ways */ \
[148] Fix | Delete
PERL_BITFIELD32 compflags:9; \
[149] Fix | Delete
/*--------------------------------------------------------*/ \
[150] Fix | Delete
CV *qr_anoncv /* the anon sub wrapped round qr/(?{..})/ */
[151] Fix | Delete
[152] Fix | Delete
typedef struct regexp {
[153] Fix | Delete
_XPV_HEAD;
[154] Fix | Delete
_REGEXP_COMMON;
[155] Fix | Delete
} regexp;
[156] Fix | Delete
[157] Fix | Delete
#define RXp_PAREN_NAMES(rx) ((rx)->paren_names)
[158] Fix | Delete
[159] Fix | Delete
/* used for high speed searches */
[160] Fix | Delete
typedef struct re_scream_pos_data_s
[161] Fix | Delete
{
[162] Fix | Delete
char **scream_olds; /* match pos */
[163] Fix | Delete
SSize_t *scream_pos; /* Internal iterator of scream. */
[164] Fix | Delete
} re_scream_pos_data;
[165] Fix | Delete
[166] Fix | Delete
/* regexp_engine structure. This is the dispatch table for regexes.
[167] Fix | Delete
* Any regex engine implementation must be able to build one of these.
[168] Fix | Delete
*/
[169] Fix | Delete
typedef struct regexp_engine {
[170] Fix | Delete
REGEXP* (*comp) (pTHX_ SV * const pattern, U32 flags);
[171] Fix | Delete
I32 (*exec) (pTHX_ REGEXP * const rx, char* stringarg, char* strend,
[172] Fix | Delete
char* strbeg, SSize_t minend, SV* sv,
[173] Fix | Delete
void* data, U32 flags);
[174] Fix | Delete
char* (*intuit) (pTHX_
[175] Fix | Delete
REGEXP * const rx,
[176] Fix | Delete
SV *sv,
[177] Fix | Delete
const char * const strbeg,
[178] Fix | Delete
char *strpos,
[179] Fix | Delete
char *strend,
[180] Fix | Delete
const U32 flags,
[181] Fix | Delete
re_scream_pos_data *data);
[182] Fix | Delete
SV* (*checkstr) (pTHX_ REGEXP * const rx);
[183] Fix | Delete
void (*rxfree) (pTHX_ REGEXP * const rx);
[184] Fix | Delete
void (*numbered_buff_FETCH) (pTHX_ REGEXP * const rx, const I32 paren,
[185] Fix | Delete
SV * const sv);
[186] Fix | Delete
void (*numbered_buff_STORE) (pTHX_ REGEXP * const rx, const I32 paren,
[187] Fix | Delete
SV const * const value);
[188] Fix | Delete
I32 (*numbered_buff_LENGTH) (pTHX_ REGEXP * const rx, const SV * const sv,
[189] Fix | Delete
const I32 paren);
[190] Fix | Delete
SV* (*named_buff) (pTHX_ REGEXP * const rx, SV * const key,
[191] Fix | Delete
SV * const value, const U32 flags);
[192] Fix | Delete
SV* (*named_buff_iter) (pTHX_ REGEXP * const rx, const SV * const lastkey,
[193] Fix | Delete
const U32 flags);
[194] Fix | Delete
SV* (*qr_package)(pTHX_ REGEXP * const rx);
[195] Fix | Delete
#ifdef USE_ITHREADS
[196] Fix | Delete
void* (*dupe) (pTHX_ REGEXP * const rx, CLONE_PARAMS *param);
[197] Fix | Delete
#endif
[198] Fix | Delete
REGEXP* (*op_comp) (pTHX_ SV ** const patternp, int pat_count,
[199] Fix | Delete
OP *expr, const struct regexp_engine* eng,
[200] Fix | Delete
REGEXP *old_re,
[201] Fix | Delete
bool *is_bare_re, U32 orig_rx_flags, U32 pm_flags);
[202] Fix | Delete
} regexp_engine;
[203] Fix | Delete
[204] Fix | Delete
/*
[205] Fix | Delete
These are passed to the numbered capture variable callbacks as the
[206] Fix | Delete
paren name. >= 1 is reserved for actual numbered captures, i.e. $1,
[207] Fix | Delete
$2 etc.
[208] Fix | Delete
*/
[209] Fix | Delete
#define RX_BUFF_IDX_CARET_PREMATCH -5 /* ${^PREMATCH} */
[210] Fix | Delete
#define RX_BUFF_IDX_CARET_POSTMATCH -4 /* ${^POSTMATCH} */
[211] Fix | Delete
#define RX_BUFF_IDX_CARET_FULLMATCH -3 /* ${^MATCH} */
[212] Fix | Delete
#define RX_BUFF_IDX_PREMATCH -2 /* $` */
[213] Fix | Delete
#define RX_BUFF_IDX_POSTMATCH -1 /* $' */
[214] Fix | Delete
#define RX_BUFF_IDX_FULLMATCH 0 /* $& */
[215] Fix | Delete
[216] Fix | Delete
/*
[217] Fix | Delete
Flags that are passed to the named_buff and named_buff_iter
[218] Fix | Delete
callbacks above. Those routines are called from universal.c via the
[219] Fix | Delete
Tie::Hash::NamedCapture interface for %+ and %- and the re::
[220] Fix | Delete
functions in the same file.
[221] Fix | Delete
*/
[222] Fix | Delete
[223] Fix | Delete
/* The Tie::Hash::NamedCapture operation this is part of, if any */
[224] Fix | Delete
#define RXapif_FETCH 0x0001
[225] Fix | Delete
#define RXapif_STORE 0x0002
[226] Fix | Delete
#define RXapif_DELETE 0x0004
[227] Fix | Delete
#define RXapif_CLEAR 0x0008
[228] Fix | Delete
#define RXapif_EXISTS 0x0010
[229] Fix | Delete
#define RXapif_SCALAR 0x0020
[230] Fix | Delete
#define RXapif_FIRSTKEY 0x0040
[231] Fix | Delete
#define RXapif_NEXTKEY 0x0080
[232] Fix | Delete
[233] Fix | Delete
/* Whether %+ or %- is being operated on */
[234] Fix | Delete
#define RXapif_ONE 0x0100 /* %+ */
[235] Fix | Delete
#define RXapif_ALL 0x0200 /* %- */
[236] Fix | Delete
[237] Fix | Delete
/* Whether this is being called from a re:: function */
[238] Fix | Delete
#define RXapif_REGNAME 0x0400
[239] Fix | Delete
#define RXapif_REGNAMES 0x0800
[240] Fix | Delete
#define RXapif_REGNAMES_COUNT 0x1000
[241] Fix | Delete
[242] Fix | Delete
/*
[243] Fix | Delete
=head1 REGEXP Functions
[244] Fix | Delete
[245] Fix | Delete
=for apidoc Am|REGEXP *|SvRX|SV *sv
[246] Fix | Delete
[247] Fix | Delete
Convenience macro to get the REGEXP from a SV. This is approximately
[248] Fix | Delete
equivalent to the following snippet:
[249] Fix | Delete
[250] Fix | Delete
if (SvMAGICAL(sv))
[251] Fix | Delete
mg_get(sv);
[252] Fix | Delete
if (SvROK(sv))
[253] Fix | Delete
sv = MUTABLE_SV(SvRV(sv));
[254] Fix | Delete
if (SvTYPE(sv) == SVt_REGEXP)
[255] Fix | Delete
return (REGEXP*) sv;
[256] Fix | Delete
[257] Fix | Delete
C<NULL> will be returned if a REGEXP* is not found.
[258] Fix | Delete
[259] Fix | Delete
=for apidoc Am|bool|SvRXOK|SV* sv
[260] Fix | Delete
[261] Fix | Delete
Returns a boolean indicating whether the SV (or the one it references)
[262] Fix | Delete
is a REGEXP.
[263] Fix | Delete
[264] Fix | Delete
If you want to do something with the REGEXP* later use SvRX instead
[265] Fix | Delete
and check for NULL.
[266] Fix | Delete
[267] Fix | Delete
=cut
[268] Fix | Delete
*/
[269] Fix | Delete
[270] Fix | Delete
#define SvRX(sv) (Perl_get_re_arg(aTHX_ sv))
[271] Fix | Delete
#define SvRXOK(sv) cBOOL(Perl_get_re_arg(aTHX_ sv))
[272] Fix | Delete
[273] Fix | Delete
[274] Fix | Delete
/* Flags stored in regexp->extflags
[275] Fix | Delete
* These are used by code external to the regexp engine
[276] Fix | Delete
*
[277] Fix | Delete
* Note that the flags whose names start with RXf_PMf_ are defined in
[278] Fix | Delete
* op_reg_common.h, being copied from the parallel flags of op_pmflags
[279] Fix | Delete
*
[280] Fix | Delete
* NOTE: if you modify any RXf flags you should run regen.pl or
[281] Fix | Delete
* regen/regcomp.pl so that regnodes.h is updated with the changes.
[282] Fix | Delete
*
[283] Fix | Delete
*/
[284] Fix | Delete
[285] Fix | Delete
#include "op_reg_common.h"
[286] Fix | Delete
[287] Fix | Delete
#define RXf_PMf_STD_PMMOD (RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_FOLD|RXf_PMf_EXTENDED|RXf_PMf_EXTENDED_MORE|RXf_PMf_NOCAPTURE)
[288] Fix | Delete
[289] Fix | Delete
#define CASE_STD_PMMOD_FLAGS_PARSE_SET(pmfl, x_count) \
[290] Fix | Delete
case IGNORE_PAT_MOD: *(pmfl) |= RXf_PMf_FOLD; break; \
[291] Fix | Delete
case MULTILINE_PAT_MOD: *(pmfl) |= RXf_PMf_MULTILINE; break; \
[292] Fix | Delete
case SINGLE_PAT_MOD: *(pmfl) |= RXf_PMf_SINGLELINE; break; \
[293] Fix | Delete
case XTENDED_PAT_MOD: if (x_count == 0) { \
[294] Fix | Delete
*(pmfl) |= RXf_PMf_EXTENDED; \
[295] Fix | Delete
*(pmfl) &= ~RXf_PMf_EXTENDED_MORE; \
[296] Fix | Delete
} \
[297] Fix | Delete
else { \
[298] Fix | Delete
*(pmfl) |= RXf_PMf_EXTENDED \
[299] Fix | Delete
|RXf_PMf_EXTENDED_MORE; \
[300] Fix | Delete
} \
[301] Fix | Delete
(x_count)++; break; \
[302] Fix | Delete
case NOCAPTURE_PAT_MOD: *(pmfl) |= RXf_PMf_NOCAPTURE; break;
[303] Fix | Delete
[304] Fix | Delete
/* Note, includes charset ones, assumes 0 is the default for them */
[305] Fix | Delete
#define STD_PMMOD_FLAGS_CLEAR(pmfl) \
[306] Fix | Delete
*(pmfl) &= ~(RXf_PMf_FOLD|RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_EXTENDED|RXf_PMf_EXTENDED_MORE|RXf_PMf_CHARSET|RXf_PMf_NOCAPTURE)
[307] Fix | Delete
[308] Fix | Delete
/* chars and strings used as regex pattern modifiers
[309] Fix | Delete
* Singular is a 'c'har, plural is a "string"
[310] Fix | Delete
*
[311] Fix | Delete
* NOTE, KEEPCOPY was originally 'k', but was changed to 'p' for preserve
[312] Fix | Delete
* for compatibility reasons with Regexp::Common which highjacked (?k:...)
[313] Fix | Delete
* for its own uses. So 'k' is out as well.
[314] Fix | Delete
*/
[315] Fix | Delete
#define DEFAULT_PAT_MOD '^' /* Short for all the default modifiers */
[316] Fix | Delete
#define EXEC_PAT_MOD 'e'
[317] Fix | Delete
#define KEEPCOPY_PAT_MOD 'p'
[318] Fix | Delete
#define NOCAPTURE_PAT_MOD 'n'
[319] Fix | Delete
#define ONCE_PAT_MOD 'o'
[320] Fix | Delete
#define GLOBAL_PAT_MOD 'g'
[321] Fix | Delete
#define CONTINUE_PAT_MOD 'c'
[322] Fix | Delete
#define MULTILINE_PAT_MOD 'm'
[323] Fix | Delete
#define SINGLE_PAT_MOD 's'
[324] Fix | Delete
#define IGNORE_PAT_MOD 'i'
[325] Fix | Delete
#define XTENDED_PAT_MOD 'x'
[326] Fix | Delete
#define NONDESTRUCT_PAT_MOD 'r'
[327] Fix | Delete
#define LOCALE_PAT_MOD 'l'
[328] Fix | Delete
#define UNICODE_PAT_MOD 'u'
[329] Fix | Delete
#define DEPENDS_PAT_MOD 'd'
[330] Fix | Delete
#define ASCII_RESTRICT_PAT_MOD 'a'
[331] Fix | Delete
[332] Fix | Delete
#define ONCE_PAT_MODS "o"
[333] Fix | Delete
#define KEEPCOPY_PAT_MODS "p"
[334] Fix | Delete
#define NOCAPTURE_PAT_MODS "n"
[335] Fix | Delete
#define EXEC_PAT_MODS "e"
[336] Fix | Delete
#define LOOP_PAT_MODS "gc"
[337] Fix | Delete
#define NONDESTRUCT_PAT_MODS "r"
[338] Fix | Delete
#define LOCALE_PAT_MODS "l"
[339] Fix | Delete
#define UNICODE_PAT_MODS "u"
[340] Fix | Delete
#define DEPENDS_PAT_MODS "d"
[341] Fix | Delete
#define ASCII_RESTRICT_PAT_MODS "a"
[342] Fix | Delete
#define ASCII_MORE_RESTRICT_PAT_MODS "aa"
[343] Fix | Delete
[344] Fix | Delete
/* This string is expected by regcomp.c to be ordered so that the first
[345] Fix | Delete
* character is the flag in bit RXf_PMf_STD_PMMOD_SHIFT of extflags; the next
[346] Fix | Delete
* character is bit +1, etc. */
[347] Fix | Delete
#define STD_PAT_MODS "msixxn"
[348] Fix | Delete
[349] Fix | Delete
#define CHARSET_PAT_MODS ASCII_RESTRICT_PAT_MODS DEPENDS_PAT_MODS LOCALE_PAT_MODS UNICODE_PAT_MODS
[350] Fix | Delete
[351] Fix | Delete
/* This string is expected by XS_re_regexp_pattern() in universal.c to be ordered
[352] Fix | Delete
* so that the first character is the flag in bit RXf_PMf_STD_PMMOD_SHIFT of
[353] Fix | Delete
* extflags; the next character is in bit +1, etc. */
[354] Fix | Delete
#define INT_PAT_MODS STD_PAT_MODS KEEPCOPY_PAT_MODS
[355] Fix | Delete
[356] Fix | Delete
#define EXT_PAT_MODS ONCE_PAT_MODS KEEPCOPY_PAT_MODS NOCAPTURE_PAT_MODS
[357] Fix | Delete
#define QR_PAT_MODS STD_PAT_MODS EXT_PAT_MODS CHARSET_PAT_MODS
[358] Fix | Delete
#define M_PAT_MODS QR_PAT_MODS LOOP_PAT_MODS
[359] Fix | Delete
#define S_PAT_MODS M_PAT_MODS EXEC_PAT_MODS NONDESTRUCT_PAT_MODS
[360] Fix | Delete
[361] Fix | Delete
/*
[362] Fix | Delete
* NOTE: if you modify any RXf flags you should run regen.pl or
[363] Fix | Delete
* regen/regcomp.pl so that regnodes.h is updated with the changes.
[364] Fix | Delete
*
[365] Fix | Delete
*/
[366] Fix | Delete
[367] Fix | Delete
/*
[368] Fix | Delete
Set in Perl_pmruntime for a split. Will be used by regex engines to
[369] Fix | Delete
check whether they should set RXf_SKIPWHITE
[370] Fix | Delete
*/
[371] Fix | Delete
#define RXf_SPLIT RXf_PMf_SPLIT
[372] Fix | Delete
[373] Fix | Delete
/* Currently the regex flags occupy a single 32-bit word. Not all bits are
[374] Fix | Delete
* currently used. The lower bits are shared with their corresponding PMf flag
[375] Fix | Delete
* bits, up to but not including _RXf_PMf_SHIFT_NEXT. The unused bits
[376] Fix | Delete
* immediately follow; finally the used RXf-only (unshared) bits, so that the
[377] Fix | Delete
* highest bit in the word is used. This gathers all the unused bits as a pool
[378] Fix | Delete
* in the middle, like so: 11111111111111110000001111111111
[379] Fix | Delete
* where the '1's represent used bits, and the '0's unused. This design allows
[380] Fix | Delete
* us to allocate off one end of the pool if we need to add a shared bit, and
[381] Fix | Delete
* off the other end if we need a non-shared bit, without disturbing the other
[382] Fix | Delete
* bits. This maximizes the likelihood of being able to change things without
[383] Fix | Delete
* breaking binary compatibility.
[384] Fix | Delete
*
[385] Fix | Delete
* To add shared bits, do so in op_reg_common.h. This should change
[386] Fix | Delete
* _RXf_PMf_SHIFT_NEXT so that things won't compile. Then come to regexp.h and
[387] Fix | Delete
* op.h and adjust the constant adders in the definitions of RXf_BASE_SHIFT and
[388] Fix | Delete
* Pmf_BASE_SHIFT down by the number of shared bits you added. That's it.
[389] Fix | Delete
* Things should be binary compatible. But if either of these gets to having
[390] Fix | Delete
* to subtract rather than add, leave at 0 and instead adjust all the entries
[391] Fix | Delete
* that are in terms of it. But if the first one of those is already
[392] Fix | Delete
* RXf_BASE_SHIFT+0, there are no bits left, and a redesign is in order.
[393] Fix | Delete
*
[394] Fix | Delete
* To remove unshared bits, just delete its entry. If you're where breaking
[395] Fix | Delete
* binary compatibility is ok to do, you might want to adjust things to move
[396] Fix | Delete
* the newly opened space so that it gets absorbed into the common pool.
[397] Fix | Delete
*
[398] Fix | Delete
* To add unshared bits, first use up any gaps in the middle. Otherwise,
[399] Fix | Delete
* allocate off the low end until you get to RXf_BASE_SHIFT+0. If that isn't
[400] Fix | Delete
* enough, move RXf_BASE_SHIFT down (if possible) and add the new bit at the
[401] Fix | Delete
* other end instead; this preserves binary compatibility.
[402] Fix | Delete
*
[403] Fix | Delete
* For the regexp bits, PL_reg_extflags_name[] in regnodes.h has a comment
[404] Fix | Delete
* giving which bits are used/unused */
[405] Fix | Delete
[406] Fix | Delete
#define RXf_BASE_SHIFT (_RXf_PMf_SHIFT_NEXT + 2)
[407] Fix | Delete
[408] Fix | Delete
/* What we have seen */
[409] Fix | Delete
#define RXf_NO_INPLACE_SUBST (1U<<(RXf_BASE_SHIFT+2))
[410] Fix | Delete
#define RXf_EVAL_SEEN (1U<<(RXf_BASE_SHIFT+3))
[411] Fix | Delete
[412] Fix | Delete
/* Special */
[413] Fix | Delete
#define RXf_UNBOUNDED_QUANTIFIER_SEEN (1U<<(RXf_BASE_SHIFT+4))
[414] Fix | Delete
#define RXf_CHECK_ALL (1U<<(RXf_BASE_SHIFT+5))
[415] Fix | Delete
[416] Fix | Delete
/* UTF8 related */
[417] Fix | Delete
#define RXf_MATCH_UTF8 (1U<<(RXf_BASE_SHIFT+6)) /* $1 etc are utf8 */
[418] Fix | Delete
[419] Fix | Delete
/* Intuit related */
[420] Fix | Delete
#define RXf_USE_INTUIT_NOML (1U<<(RXf_BASE_SHIFT+7))
[421] Fix | Delete
#define RXf_USE_INTUIT_ML (1U<<(RXf_BASE_SHIFT+8))
[422] Fix | Delete
#define RXf_INTUIT_TAIL (1U<<(RXf_BASE_SHIFT+9))
[423] Fix | Delete
#define RXf_USE_INTUIT (RXf_USE_INTUIT_NOML|RXf_USE_INTUIT_ML)
[424] Fix | Delete
[425] Fix | Delete
/* Do we have some sort of anchor? */
[426] Fix | Delete
#define RXf_IS_ANCHORED (1U<<(RXf_BASE_SHIFT+10))
[427] Fix | Delete
[428] Fix | Delete
/* Copy and tainted info */
[429] Fix | Delete
#define RXf_COPY_DONE (1U<<(RXf_BASE_SHIFT+11))
[430] Fix | Delete
[431] Fix | Delete
/* post-execution: $1 et al are tainted */
[432] Fix | Delete
#define RXf_TAINTED_SEEN (1U<<(RXf_BASE_SHIFT+12))
[433] Fix | Delete
/* this pattern was tainted during compilation */
[434] Fix | Delete
#define RXf_TAINTED (1U<<(RXf_BASE_SHIFT+13))
[435] Fix | Delete
[436] Fix | Delete
/* Flags indicating special patterns */
[437] Fix | Delete
#define RXf_START_ONLY (1U<<(RXf_BASE_SHIFT+14)) /* Pattern is /^/ */
[438] Fix | Delete
#define RXf_SKIPWHITE (1U<<(RXf_BASE_SHIFT+15)) /* Pattern is for a */
[439] Fix | Delete
/* split " " */
[440] Fix | Delete
#define RXf_WHITE (1U<<(RXf_BASE_SHIFT+16)) /* Pattern is /\s+/ */
[441] Fix | Delete
#define RXf_NULL (1U<<(RXf_BASE_SHIFT+17)) /* Pattern is // */
[442] Fix | Delete
[443] Fix | Delete
/* See comments at the beginning of these defines about adding bits. The
[444] Fix | Delete
* highest bit position should be used, so that if RXf_BASE_SHIFT gets
[445] Fix | Delete
* increased, the #error below will be triggered so that you will be reminded
[446] Fix | Delete
* to adjust things at the other end to keep the bit positions unchanged */
[447] Fix | Delete
#if RXf_BASE_SHIFT+17 > 31
[448] Fix | Delete
# error Too many RXf_PMf bits used. See comments at beginning of these for what to do
[449] Fix | Delete
#endif
[450] Fix | Delete
[451] Fix | Delete
/*
[452] Fix | Delete
* NOTE: if you modify any RXf flags you should run regen.pl or
[453] Fix | Delete
* regen/regcomp.pl so that regnodes.h is updated with the changes.
[454] Fix | Delete
*
[455] Fix | Delete
*/
[456] Fix | Delete
[457] Fix | Delete
#ifdef NO_TAINT_SUPPORT
[458] Fix | Delete
# define RX_ISTAINTED(prog) 0
[459] Fix | Delete
# define RX_TAINT_on(prog) NOOP
[460] Fix | Delete
# define RXp_MATCH_TAINTED(prog) 0
[461] Fix | Delete
# define RX_MATCH_TAINTED(prog) 0
[462] Fix | Delete
# define RXp_MATCH_TAINTED_on(prog) NOOP
[463] Fix | Delete
# define RX_MATCH_TAINTED_on(prog) NOOP
[464] Fix | Delete
# define RX_MATCH_TAINTED_off(prog) NOOP
[465] Fix | Delete
#else
[466] Fix | Delete
# define RX_ISTAINTED(prog) (RX_EXTFLAGS(prog) & RXf_TAINTED)
[467] Fix | Delete
# define RX_TAINT_on(prog) (RX_EXTFLAGS(prog) |= RXf_TAINTED)
[468] Fix | Delete
# define RXp_MATCH_TAINTED(prog) (RXp_EXTFLAGS(prog) & RXf_TAINTED_SEEN)
[469] Fix | Delete
# define RX_MATCH_TAINTED(prog) (RX_EXTFLAGS(prog) & RXf_TAINTED_SEEN)
[470] Fix | Delete
# define RXp_MATCH_TAINTED_on(prog) (RXp_EXTFLAGS(prog) |= RXf_TAINTED_SEEN)
[471] Fix | Delete
# define RX_MATCH_TAINTED_on(prog) (RX_EXTFLAGS(prog) |= RXf_TAINTED_SEEN)
[472] Fix | Delete
# define RX_MATCH_TAINTED_off(prog) (RX_EXTFLAGS(prog) &= ~RXf_TAINTED_SEEN)
[473] Fix | Delete
#endif
[474] Fix | Delete
[475] Fix | Delete
#define RX_HAS_CUTGROUP(prog) ((prog)->intflags & PREGf_CUTGROUP_SEEN)
[476] Fix | Delete
#define RX_MATCH_TAINTED_set(prog, t) ((t) \
[477] Fix | Delete
? RX_MATCH_TAINTED_on(prog) \
[478] Fix | Delete
: RX_MATCH_TAINTED_off(prog))
[479] Fix | Delete
[480] Fix | Delete
#define RXp_MATCH_COPIED(prog) (RXp_EXTFLAGS(prog) & RXf_COPY_DONE)
[481] Fix | Delete
#define RX_MATCH_COPIED(prog) (RX_EXTFLAGS(prog) & RXf_COPY_DONE)
[482] Fix | Delete
#define RXp_MATCH_COPIED_on(prog) (RXp_EXTFLAGS(prog) |= RXf_COPY_DONE)
[483] Fix | Delete
#define RX_MATCH_COPIED_on(prog) (RX_EXTFLAGS(prog) |= RXf_COPY_DONE)
[484] Fix | Delete
#define RXp_MATCH_COPIED_off(prog) (RXp_EXTFLAGS(prog) &= ~RXf_COPY_DONE)
[485] Fix | Delete
#define RX_MATCH_COPIED_off(prog) (RX_EXTFLAGS(prog) &= ~RXf_COPY_DONE)
[486] Fix | Delete
#define RX_MATCH_COPIED_set(prog,t) ((t) \
[487] Fix | Delete
? RX_MATCH_COPIED_on(prog) \
[488] Fix | Delete
: RX_MATCH_COPIED_off(prog))
[489] Fix | Delete
[490] Fix | Delete
#define RXp_EXTFLAGS(rx) ((rx)->extflags)
[491] Fix | Delete
#define RXp_COMPFLAGS(rx) ((rx)->compflags)
[492] Fix | Delete
[493] Fix | Delete
/* For source compatibility. We used to store these explicitly. */
[494] Fix | Delete
#define RX_PRECOMP(prog) (RX_WRAPPED(prog) + ReANY(prog)->pre_prefix)
[495] Fix | Delete
#define RX_PRECOMP_const(prog) (RX_WRAPPED_const(prog) + ReANY(prog)->pre_prefix)
[496] Fix | Delete
/* FIXME? Are we hardcoding too much here and constraining plugin extension
[497] Fix | Delete
writers? Specifically, the value 1 assumes that the wrapped version always
[498] Fix | Delete
has exactly one character at the end, a ')'. Will that always be true? */
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function