source: trunk/third/perl/regexp.h @ 14545

Revision 14545, 3.7 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14544, which included commits to RCS files with non-trunk default branches.
Line 
1/*    regexp.h
2 */
3
4/*
5 * Definitions etc. for regexp(3) routines.
6 *
7 * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
8 * not the System V one.
9 */
10
11
12struct regnode {
13    U8  flags;
14    U8  type;
15    U16 next_off;
16};
17
18typedef struct regnode regnode;
19
20struct reg_substr_data;
21
22typedef struct regexp {
23        I32 *startp;
24        I32 *endp;
25        regnode *regstclass;
26        struct reg_substr_data *substrs;
27        char *precomp;          /* pre-compilation regular expression */
28        struct reg_data *data;  /* Additional data. */
29        char *subbeg;           /* saved or original string
30                                   so \digit works forever. */
31        I32 sublen;             /* Length of string pointed by subbeg */
32        I32 refcnt;
33        I32 minlen;             /* mininum possible length of $& */
34        I32 prelen;             /* length of precomp */
35        U32 nparens;            /* number of parentheses */
36        U32 lastparen;          /* last paren matched */
37        U32 reganch;            /* Internal use only +
38                                   Tainted information used by regexec? */
39        regnode program[1];     /* Unwarranted chumminess with compiler. */
40} regexp;
41
42#define ROPT_ANCH               (ROPT_ANCH_BOL|ROPT_ANCH_MBOL|ROPT_ANCH_GPOS|ROPT_ANCH_SBOL)
43#define ROPT_ANCH_SINGLE        (ROPT_ANCH_SBOL|ROPT_ANCH_GPOS)
44#define ROPT_ANCH_BOL           0x00001
45#define ROPT_ANCH_MBOL          0x00002
46#define ROPT_ANCH_SBOL          0x00004
47#define ROPT_ANCH_GPOS          0x00008
48#define ROPT_SKIP               0x00010
49#define ROPT_IMPLICIT           0x00020 /* Converted .* to ^.* */
50#define ROPT_NOSCAN             0x00040 /* Check-string always at start. */
51#define ROPT_GPOS_SEEN          0x00080
52#define ROPT_CHECK_ALL          0x00100
53#define ROPT_LOOKBEHIND_SEEN    0x00200
54#define ROPT_EVAL_SEEN          0x00400
55
56/* 0xf800 of reganch is used by PMf_COMPILETIME */
57
58#define ROPT_UTF8               0x10000
59#define ROPT_NAUGHTY            0x20000 /* how exponential is this pattern? */
60#define ROPT_COPY_DONE          0x40000 /* subbeg is a copy of the string */
61#define ROPT_TAINTED_SEEN       0x80000
62
63#define RE_USE_INTUIT_NOML      0x0100000 /* Best to intuit before matching */
64#define RE_USE_INTUIT_ML        0x0200000
65#define REINT_AUTORITATIVE_NOML 0x0400000 /* Can trust a positive answer */
66#define REINT_AUTORITATIVE_ML   0x0800000
67#define REINT_ONCE_NOML         0x1000000 /* Intuit can succed once only. */
68#define REINT_ONCE_ML           0x2000000
69#define RE_INTUIT_ONECHAR       0x4000000
70#define RE_INTUIT_TAIL          0x8000000
71
72#define RE_USE_INTUIT           (RE_USE_INTUIT_NOML|RE_USE_INTUIT_ML)
73#define REINT_AUTORITATIVE      (REINT_AUTORITATIVE_NOML|REINT_AUTORITATIVE_ML)
74#define REINT_ONCE              (REINT_ONCE_NOML|REINT_ONCE_ML)
75
76#define RX_MATCH_TAINTED(prog)  ((prog)->reganch & ROPT_TAINTED_SEEN)
77#define RX_MATCH_TAINTED_on(prog) ((prog)->reganch |= ROPT_TAINTED_SEEN)
78#define RX_MATCH_TAINTED_off(prog) ((prog)->reganch &= ~ROPT_TAINTED_SEEN)
79#define RX_MATCH_TAINTED_set(prog, t) ((t) \
80                                       ? RX_MATCH_TAINTED_on(prog) \
81                                       : RX_MATCH_TAINTED_off(prog))
82
83#define RX_MATCH_COPIED(prog)           ((prog)->reganch & ROPT_COPY_DONE)
84#define RX_MATCH_COPIED_on(prog)        ((prog)->reganch |= ROPT_COPY_DONE)
85#define RX_MATCH_COPIED_off(prog)       ((prog)->reganch &= ~ROPT_COPY_DONE)
86#define RX_MATCH_COPIED_set(prog,t)     ((t) \
87                                         ? RX_MATCH_COPIED_on(prog) \
88                                         : RX_MATCH_COPIED_off(prog))
89
90#define REXEC_COPY_STR  0x01            /* Need to copy the string. */
91#define REXEC_CHECKED   0x02            /* check_substr already checked. */
92#define REXEC_SCREAM    0x04            /* use scream table. */
93#define REXEC_IGNOREPOS 0x08            /* \G matches at start. */
94#define REXEC_NOT_FIRST 0x10            /* This is another iteration of //g. */
95#define REXEC_ML        0x20            /* $* was set. */
96
97#define ReREFCNT_inc(re) ((void)(re && re->refcnt++), re)
98#define ReREFCNT_dec(re) CALLREGFREE(aTHX_ re)
99
100#define FBMcf_TAIL_DOLLAR       1
101#define FBMcf_TAIL_DOLLARM      2
102#define FBMcf_TAIL_Z            4
103#define FBMcf_TAIL_z            8
104#define FBMcf_TAIL              (FBMcf_TAIL_DOLLAR|FBMcf_TAIL_DOLLARM|FBMcf_TAIL_Z|FBMcf_TAIL_z)
105
106#define FBMrf_MULTILINE 1
107
108struct re_scream_pos_data_s;
Note: See TracBrowser for help on using the repository browser.