5 * Definitions etc. for regexp(3) routines.
7 * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof],
8 * not the System V one.
18 typedef struct regnode regnode;
26 typedef struct regexp {
31 I32 minlen; /* mininum possible length of $& */
32 I32 prelen; /* length of precomp */
33 U32 nparens; /* number of parentheses */
34 U32 lastparen; /* last paren matched */
35 char *precomp; /* pre-compilation regular expression */
36 char *subbase; /* saved string so \digit works forever */
37 char *subbeg; /* same, but not responsible for allocation */
38 char *subend; /* end of subbase */
39 U16 naughty; /* how exponential is this pattern? */
40 U16 reganch; /* Internal use only +
41 Tainted information used by regexec? */
42 SV *anchored_substr; /* Substring at fixed position wrt start. */
43 I32 anchored_offset; /* Position of it. */
44 SV *float_substr; /* Substring at variable position wrt start. */
45 I32 float_min_offset; /* Minimal position of it. */
46 I32 float_max_offset; /* Maximal position of it. */
47 SV *check_substr; /* Substring to check before matching. */
48 I32 check_offset_min; /* Offset of the above. */
49 I32 check_offset_max; /* Offset of the above. */
50 struct reg_data *data; /* Additional data. */
51 regnode program[1]; /* Unwarranted chumminess with compiler. */
54 #define ROPT_ANCH (ROPT_ANCH_BOL|ROPT_ANCH_MBOL|ROPT_ANCH_GPOS)
55 #define ROPT_ANCH_SINGLE (ROPT_ANCH_BOL|ROPT_ANCH_GPOS)
56 #define ROPT_ANCH_BOL 1
57 #define ROPT_ANCH_MBOL 2
58 #define ROPT_ANCH_GPOS 4
60 #define ROPT_IMPLICIT 0x10 /* Converted .* to ^.* */
61 #define ROPT_NOSCAN 0x20 /* Check-string always at start. */
62 #define ROPT_GPOS_SEEN 0x40
63 #define ROPT_CHECK_ALL 0x80
64 #define ROPT_LOOKBEHIND_SEEN 0x100
66 #define ROPT_TAINTED_SEEN 0x8000
68 #define RX_MATCH_TAINTED(prog) ((prog)->reganch & ROPT_TAINTED_SEEN)
69 #define RX_MATCH_TAINTED_SET(prog, t) ((t) \
70 ? ((prog)->reganch |= ROPT_TAINTED_SEEN) \
71 : ((prog)->reganch &= ~ROPT_TAINTED_SEEN))
73 #define REXEC_COPY_STR 1 /* Need to copy the string. */
74 #define REXEC_CHECKED 2 /* check_substr already checked. */
76 #define ReREFCNT_inc(re) ((re && re->refcnt++), re)
77 #define ReREFCNT_dec(re) pregfree(re)